diff --git a/libs/lpc_open/boards/edu_ciaa_nxp/inc/board.h b/libs/lpc_open/boards/edu_ciaa_nxp/inc/board.h index 8a5b0c99..be89bd85 100644 --- a/libs/lpc_open/boards/edu_ciaa_nxp/inc/board.h +++ b/libs/lpc_open/boards/edu_ciaa_nxp/inc/board.h @@ -108,6 +108,7 @@ extern "C" { bool Board_TEC_GetStatus(uint8_t button); +bool Board_GPIO_GetStatus(uint8_t port_num); void Board_ADC_ReadBegin(ADC_CHANNEL_T channel); bool Board_ADC_ReadWait(); uint16_t Board_ADC_ReadEnd(); diff --git a/libs/lpc_open/boards/edu_ciaa_nxp/src/board.c b/libs/lpc_open/boards/edu_ciaa_nxp/src/board.c index da73ccfc..cb4a2882 100644 --- a/libs/lpc_open/boards/edu_ciaa_nxp/src/board.c +++ b/libs/lpc_open/boards/edu_ciaa_nxp/src/board.c @@ -267,6 +267,17 @@ bool Board_TEC_GetStatus(uint8_t button) } +bool Board_GPIO_GetStatus(uint8_t port_num) +{ + if (port_num >= GPIO_PORTS_SIZE) { + return false; + } + + return Chip_GPIO_GetPinState(LPC_GPIO_PORT, GpioPorts[port_num].port, + GpioPorts[port_num].pin); +} + + void Board_ADC_ReadBegin(ADC_CHANNEL_T channel) { if (channel < ADC_CH0 || channel > ADC_CH3) { @@ -319,4 +330,4 @@ int __stdio_getchar() void __stdio_init() { Board_Debug_Init(); -} \ No newline at end of file +}