Index: App/Drivers/CPLD.c =================================================================== diff -u -r833095dbbe2b21a989b05f48bd7ddc390ad964cb -r29f1ba03faefd982327916590818a260a3e4aa48 --- App/Drivers/CPLD.c (.../CPLD.c) (revision 833095dbbe2b21a989b05f48bd7ddc390ad964cb) +++ App/Drivers/CPLD.c (.../CPLD.c) (revision 29f1ba03faefd982327916590818a260a3e4aa48) @@ -57,32 +57,29 @@ #define CLR_BLUE() {mibspiREG5->PC3 &= ~BLUE_SPI5_PORT_MASK;} #define CLR_RED() {mibspiREG5->PC3 &= ~RED_SPI5_PORT_MASK;} -// ***************************** TEST CODE ****************************** -// TODO - remove later -#if 1 -// for RM46 eval board, user button B uses the MIBSPI1_nCS[4] pin, so need to re-purpose that pin as GPIO to see the button -#define USER_BUTTON_MASK 0x00000010 // (nCS[4] -#define GET_USER_BUTTON() (PIN_SIGNAL_STATE_T)(((mibspiREG1->PC2 & USER_BUTTON_MASK) == 0 ? PIN_SIGNAL_LOW : PIN_SIGNAL_HIGH)) -PIN_SIGNAL_STATE_T getUserButtonState( void ) -{ - PIN_SIGNAL_STATE_T result = GET_USER_BUTTON(); - - return result; -} -// for RM46 eval board, user LED A uses the same GPIO pin that CPLD uses for watchdog pet. Had to disable watchdog pet to use as LED. -void setUserLED( BOOL on ) -{ - if ( on == TRUE ) +#ifdef RM46_EVAL_BOARD_TARGET + // for RM46 eval board, user button B uses the MIBSPI1_nCS[4] pin, so need to re-purpose that pin as GPIO to see the button + #define USER_BUTTON_MASK 0x00000010 // (nCS[4] + #define GET_USER_BUTTON() (PIN_SIGNAL_STATE_T)(((mibspiREG1->PC2 & USER_BUTTON_MASK) == 0 ? PIN_SIGNAL_LOW : PIN_SIGNAL_HIGH)) + PIN_SIGNAL_STATE_T getUserButtonState( void ) { - SET_WD_PET(); + PIN_SIGNAL_STATE_T result = GET_USER_BUTTON(); + + return result; } - else + // for RM46 eval board, user LED A uses the same GPIO pin that CPLD uses for watchdog pet. Had to disable watchdog pet to use as LED. + void setUserLED( BOOL on ) { - CLR_WD_PET(); + if ( on == TRUE ) + { + SET_WD_PET(); + } + else + { + CLR_WD_PET(); + } } -} #endif -// ************************** END TEST CODE ****************************** /************************************************************************* * @brief initCPLD