Chip_GPIO_GetPinState(LPC_GPIO_PORT, port, bit) -- return FALSE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Chip_GPIO_GetPinState(LPC_GPIO_PORT, port, bit) -- return FALSE

1,411 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mrabbasi61 on Sat Jul 05 21:45:00 MST 2014
Hi,
I'm using Blinky example from LPCOpen for LPC4357.

There is one function to get state of a GPIO Pin, defined as below, but this function always returns false in my tests!
currently I use Board_LED_Set(LEDNumber, false) and Board_LED_Set(LEDNumber, false) in order to turn LED On/Off.
sharing any similar experiences would be appreciated.


/* Returns the current state of a board LED */
bool Board_LED_Test(uint8_t LEDNumber)
{
if (LEDNumber <= 7) {
return (bool) Chip_GPIO_GetPinState(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);
}
return false;
}

Labels (1)
0 Kudos
4 Replies

1,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mrabbasi61 on Sun Jul 13 04:57:16 MST 2014
yes,
actually the second one is TRUE
0 Kudos

1,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by expressouser on Sat Jul 12 04:11:19 MST 2014
Hi,

Did you make a typo error here:

Board_LED_Set(LEDNumber, false) and Board_LED_Set(LEDNumber, false) in order to turn LED On/Off ?

should the 2nd parameter be true if you want to turn on the GPIO?



0 Kudos

1,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mrabbasi61 on Fri Jul 11 11:33:36 MST 2014
hi,

but it is used in the LPCOpen priph_blinky project !!
0 Kudos

1,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Martin84 on Mon Jul 07 03:40:10 MST 2014
I think the GetPinState() function is to read the state of an input - not for the output state.

0 Kudos