lpcware

reading current state of a board LED

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mrabbasi61 on Mon Aug 25 15:38:34 MST 2014
Hi,
Sorry for opening new topic for repeated subject,
I'd asked similar question before, but finally I couldn't fix the problem.

I couldn't find out why the following function always return false?!!


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



I am using "periph_blinky" example of LPCOpen v2_10 or V2_11 and I can only blink the LED by using two functions "Board_LED_Set(0, TRUE)" and "Board_LED_Set(0, FALSE)" , I can not use "Board_LED_Toggle(0)" because the above function always return FALSE.
I've tested all possible values for the "modefunc" parameter in fuction "Chip_SCU_PinMuxSet()".

Outcomes