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 ; }
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; }