1 /* 2 * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GD32F4XX_KEY_INPUT_H_ 17 #define GD32F4XX_KEY_INPUT_H_ 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #define MAX_KEY_NUM (KEY_LIMIT + 1) 23 typedef enum { 24 KEY_WAKEUP = 0, 25 KEY_TAMPER, 26 KEY_USER, 27 KEY_LIMIT = KEY_USER, 28 } KEY_TYPE; 29 30 typedef struct { 31 KEY_TYPE keyType[MAX_KEY_NUM]; 32 int isPressed[MAX_KEY_NUM]; 33 } AllKeyCond; 34 35 extern int32_t Gd32f450KeyInputInit(void); 36 extern int32_t Gd32f450KeyInputRelease(void); 37 extern AllKeyCond *Gd32f450ALLKeyInputRead(void); 38 extern int Gd32f450SingleKeyInputRead(KEY_TYPE keyId); 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif