LPC546XX: Set the pin function to Digital mode

We cannot rely on the default value as a pin could
be use for Analog purposes in which this bit is cleared

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
pull/6734/head
Mahesh Mahadevan 2018-04-24 11:24:23 -05:00
parent b033a6e42e
commit 2670f790ce
1 changed files with 3 additions and 0 deletions

View File

@ -29,6 +29,9 @@ void pin_function(PinName pin, int function)
CLOCK_EnableClock(gpio_clocks[port_number]);
CLOCK_EnableClock(kCLOCK_Iocon);
/* Set the DIGIMODE bit */
IOCON->PIO[port_number][pin_number] |= IOCON_PIO_DIGIMODE_MASK;
reg = IOCON->PIO[port_number][pin_number];
reg = (reg & ~0x7) | (function & 0x7);
IOCON->PIO[port_number][pin_number] = reg;