Class similar to AnalogIn that uses burst mode to run continious background conversions so when the input is read, the last value can immediatly be returned. This slightly modified version allows NC pins.
Dependents: Pinscape_Controller
Fork of FastAnalogIn by
Diff: FastAnalogIn_LPC408X.cpp
- Revision:
- 5:55274430c8df
- Parent:
- 4:cd84739f7640
- Child:
- 7:965a2b0e477f
--- a/FastAnalogIn_LPC408X.cpp Sun Apr 20 16:23:19 2014 +0000 +++ b/FastAnalogIn_LPC408X.cpp Mon Apr 21 07:17:39 2014 +0000 @@ -26,10 +26,9 @@ ADCnumber = (ADCName)pinmap_peripheral(pin, PinMap_ADC); if (ADCnumber == (uint32_t)NC) error("ADC pin mapping failed"); - //printf("ADC_ID=%u\n",ADCnumber); datareg = (uint32_t*) (&LPC_ADC->DR[ADCnumber]); - wait_us(1000); // we need either the debug printf above or a wait before we try to initialize the ADC + wait_us(1000); // wait for a short while before trying to initialize the ADC afer a reset (needed for those global instantiations just before main) // ensure power is turned on LPC_SC->PCONP |= (1 << 12);