Content originally posted in LPCWare by john78727 on Fri Jan 02 10:43:47 MST 2015
void Chip_SWM_FixedPinEnable(CHIP_SWM_PIN_FIXED_T pin, bool enable);
/**
* @briefEnables a Fixed Function Pin in the Switch Matrix
* @parampin: Pin to be enabled
* @returnNothing
*/
STATIC INLINE void Chip_SWM_EnableFixedPin(CHIP_SWM_PIN_FIXED_T pin)
{
LPC_SWM->PINENABLE0 &= ~((1 << (uint32_t) pin) | SWM_PINENABLE0_RESERVED);
}
I was enabling I2C0 in the fixed pin register using this call. When I did so it also enabled all the ADC pins because the SWM_PINENABLE0_RESERVED definition was not correct for the LPC824 chip. I hope someone will fix it here:
/**
* @brief LPC8XX Switch Matrix register block structure
*/
typedef struct {
#if defined(CHIP_LPC82X)
__IO uint32_t PINASSIGN[12];/*!< Pin Assign register array */
__I uint32_t RESERVED0[100];
#else
__IO uint32_t PINASSIGN[9];/*!< Pin Assign register array */
__I uint32_t RESERVED0[103];
#endif
__IO uint32_t PINENABLE0;/*!< Pin Enable register */
} LPC_SWM_T;
#define SWM_PINENABLE0_RESERVED (~0x1ff)
/**
The define should be (~0x1ffffff) for the LPC82x chip :-)
Have A Nice Day,
Regards,
John