Index: App/Drivers/CPLD.c =================================================================== diff -u -r67c59954ab757ae9d57b3d80f2b3cb8087300be6 -rc91e9da338d92432930d3589a4055ebbb404c6cb --- App/Drivers/CPLD.c (.../CPLD.c) (revision 67c59954ab757ae9d57b3d80f2b3cb8087300be6) +++ App/Drivers/CPLD.c (.../CPLD.c) (revision c91e9da338d92432930d3589a4055ebbb404c6cb) @@ -33,7 +33,7 @@ #define WD_PET_GIO_PORT_PIN 1U #define WD_EXP_GIO_PORT_PIN 2U -// LIN port pin assignments for pins connected to CPLD +// MIBSPI5 port pin assignments for pins connected to CPLD #define GREEN_SPI5_PORT_MASK 0x00000200 // (CLK - re-purposed as output GPIO) #define BLUE_SPI5_PORT_MASK 0x00000400 // (SIMO[0] - re-purposed as output GPIO) #define RED_SPI5_PORT_MASK 0x00000800 // (SOMI[0] - re-purposed as output GPIO) @@ -57,6 +57,33 @@ #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 ) + { + SET_WD_PET(); + } + else + { + CLR_WD_PET(); + } +} +#endif +// ************************** END TEST CODE ****************************** + /************************************************************************* * @brief initCPLD * The initCPLD function initializes the CPLD module.