/* ** =================================================================== ** Event : SW_G_OnInterrupt (module Events) ** ** Component : SW_G [ExtInt] ** Description : ** This event is called when an active signal edge/level has ** occurred. ** Parameters : None ** Returns : Nothing ** =================================================================== */ void SW_G_OnInterrupt(void) { #if PL_HAS_KBI if(KEY7_Get()){ KEY_OnInterrupt(KEY_BTN7); } #endif }
static uint8_t APP_GetKeys(uint8_t *keys) { *keys = KEY1_Get() << KEY_BTN1 | KEY2_Get() << KEY_BTN2 | KEY3_Get() << KEY_BTN3 | KEY4_Get() << KEY_BTN4 | KEY5_Get() << KEY_BTN5 | KEY6_Get() << KEY_BTN6 | KEY7_Get() << KEY_BTN7 ; }
/* ** =================================================================== ** Event : SW7_OnInterrupt (module Events) ** ** Component : SW7 [ExtInt] ** Description : ** This event is called when an active signal edge/level has ** occurred. ** Parameters : None ** Returns : Nothing ** =================================================================== */ void SW7_OnInterrupt(void) { /* Write your code here ... */ #if PL_HAS_KBI if (KEY7_Get()) { KEY_OnInterrupt(KEY_BTN7); } #endif }
void KEY_Scan(void) { /*! check handling all keys */ #if PL_CONFIG_HAS_DEBOUNCE KEYDBNC_Process(); #else #if PL_CONFIG_NOF_KEYS >= 1 if (KEY1_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW1_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 2 if (KEY2_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW2_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 3 if (KEY3_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW3_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 4 if (KEY4_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW4_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 5 if (KEY5_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW5_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 6 if (KEY6_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW6_PRESSED); } #endif #if PL_CONFIG_NOF_KEYS >= 7 if (KEY7_Get()) { /* key pressed */ EVNT_SetEvent(EVNT_SW7_PRESSED); } #endif #endif }
/*! * \brief Returns the state of the keys. This directly reflects the value of the port * \return Port bits */ static DBNC_KeySet KEYDBNC_GetKeys(void) { DBNC_KeySet keys = 0; #if PL_CONFIG_NOF_KEYS >= 1 if (KEY1_Get()) { keys |= (1<<0); } #endif #if PL_CONFIG_NOF_KEYS >= 2 if (KEY2_Get()) { keys |= (1<<1); } #endif #if PL_CONFIG_NOF_KEYS >= 3 if (KEY3_Get()) { keys |= (1<<2); } #endif #if PL_CONFIG_NOF_KEYS >= 4 if (KEY4_Get()) { keys |= (1<<3); } #endif #if PL_CONFIG_NOF_KEYS >= 5 if (KEY5_Get()) { keys |= (1<<4); } #endif #if PL_CONFIG_NOF_KEYS >= 6 if (KEY6_Get()) { keys |= (1<<5); } #endif #if PL_CONFIG_NOF_KEYS >= 7 if (KEY7_Get()) { keys |= (1<<6); } #endif return keys; }
/* ** =================================================================== ** Event : SW7_OnInterrupt (module Events) ** ** Component : SW7 [ExtInt] ** Description : ** This event is called when an active signal edge/level has ** occurred. ** Parameters : None ** Returns : Nothing ** =================================================================== */ void SW7_OnInterrupt(void) { if(KEY7_Get()){ KEY_OnInterrupt(KEY_BTN7); } }