Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
I am still porting the touch aspect of the K350 boosterpack and GRLib
In the MSP432P401R code they have this:
static void touch_delay(){ uint32_t i = 0; uint32_t time = 480000; for(i = 0; i < time; i++) { ; } }
which, because of some other comments I believe is a 4ms delay.
Other than adding some "volatiles" to this code, is there a better way to implement a delay? would delay_cycles() be better? Interrupts still happen during a delay_cycle() chain, right?
Also, because I have to switch between GPIO and ADC, I do the following:
/* Sample the X+ ADC channel to check if there is currently a touch. */ SYSCFG_DL_ADC12_0_init(); gCheckADC0 = false; DL_ADC12_startConversion(ADC12_0_INST); while (false == gCheckADC0) { __WFE(); } aDCTemp = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_0);
which I stole from one of the ADC examples.
I notice that I sometimes get 0 values returned when I do this. Do I need to allow more time between the init and the startConversion?