FastAnalogIn
Fork of FastAnalogIn by
Diff: FastAnalogIn_LPC11UXX.cpp
- Revision:
- 12:46fbc645de4d
- Parent:
- 11:14744c4ac884
--- a/FastAnalogIn_LPC11UXX.cpp Sun Mar 20 20:18:12 2016 +0000 +++ b/FastAnalogIn_LPC11UXX.cpp Mon Mar 21 07:41:52 2016 +0000 @@ -57,8 +57,14 @@ LPC_SYSCON->PDRUNCFG &= ~ (1 << 4); LPC_SYSCON->SYSAHBCLKCTRL |= ((uint32_t)1 << 13); + #ifdef TARGET_LPC11UXX uint32_t pin_number = (uint32_t)pin; __IO uint32_t *reg = (pin_number < 32) ? (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) : (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32)); + #else + uint32_t offset = (uint32_t)pin & 0xff; + __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset); + #endif + // set pin to ADC mode *reg &= ~(1 << 7); // set ADMODE = 0 (analog mode)