differential input adc board K64F Compatible hal freescale K64F
Dependents: trms_helloworld AnalogIn_Diff_helloworld
Fork of AnalogIn_Diff by
Revision 6:f39be15f056c, committed 2016-01-07
- Comitter:
- fblanc
- Date:
- Thu Jan 07 08:34:27 2016 +0000
- Parent:
- 5:c24df4d64aa1
- Commit message:
- clean code
Changed in this revision
AnalogIn_Diff.cpp | Show annotated file Show diff for this revision Revisions of this file |
AnalogIn_Diff.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/AnalogIn_Diff.cpp Tue Jan 05 09:47:53 2016 +0000 +++ b/AnalogIn_Diff.cpp Thu Jan 07 08:34:27 2016 +0000 @@ -59,20 +59,15 @@ //ADC_HAL_SetHwAverageMode(adc_addrs[instance], kAdcHwAverageCountOf32); ADC_HAL_SetChnMuxMode(adc_addrs[instance], kAdcChnMuxOfB); /* only B channels are avail */ - INT_SYS_DisableIRQ(ADC0_IRQn); - INT_SYS_DisableIRQ(ADC1_IRQn); + } AnalogIn_Diff::~AnalogIn_Diff() { } -void AnalogIn_Diff::test (int x) -{ - printf("\r\n %i: 0x%08lx\r\n",x,(long)adc_addrs[instance]); -} -#if 1 + int16_t AnalogIn_Diff::read_raws16() // Returns a 16bit signed integer { /* sw trigger (SC1A) */ @@ -81,28 +76,7 @@ return ADC_HAL_GetChnConvValueRAW(adc_addrs[instance], 0); } -#else -int16_t AnalogIn_Diff::read_raws16() // Returns a 16bit signed integer -{ - /* sw trigger (SC1A) */ - - static int started = 0; - - if (!started) - { - started = 1; - ADC_HAL_ConfigChn(adc_addrs[instance], 0, false, true, chnNum); - } - if (started && ADC_HAL_GetChnConvCompletedCmd(adc_addrs[instance], 0)) - { - started = 0; - return ADC_HAL_GetChnConvValueRAW(adc_addrs[instance], 0); - } - return -32768; -} - -#endif float AnalogIn_Diff::read() {
--- a/AnalogIn_Diff.h Tue Jan 05 09:47:53 2016 +0000 +++ b/AnalogIn_Diff.h Thu Jan 07 08:34:27 2016 +0000 @@ -30,7 +30,7 @@ #include "fsl_device_registers.h" #include "fsl_interrupt_manager.h" -#define VERSION_ADC_DIFF "2016_01_04" +#define VERSION_ADC_DIFF "2016_01_07" #define MAX_ADC 2 #if FSL_FEATURE_ADC_HAS_DIFF_MODE @@ -75,7 +75,6 @@ */ AnalogIn_Diff(int adc_ch); -void test (int x); /** Destroy an AnalogIn_Diff */