Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_kys.h
Go to the documentation of this file.
1 #ifndef _BFLB_KYS_H
2 #define _BFLB_KYS_H
3 
4 #include "bflb_core.h"
5 
7  uint8_t col; /* Col of keyboard,max:8 */
8  uint8_t row; /* Row of keyboard,max:8 */
9  uint8_t deglitch_en; /* Disable deglitch function */
10  uint8_t deglitch_cnt; /* Deglitch count */
11  uint8_t idle_duration; /* Idle duration between column scans */
12  uint8_t ghost_en; /* Disable ghost key event detection */
13 };
14 
15 /* keyscan interrupt enable define */
16 #if defined(BL702)
17 #define KEYSCAN_INT_EN (0x1 << 0)
18 #else
19 #define KEYSCAN_INT_EN_DONE (0x1 << 7)
20 #define KEYSCAN_INT_EN_FIFOFULL (0x1 << 8)
21 #define KEYSCAN_INT_EN_FIFOHALF (0x1 << 9)
22 #define KEYSCAN_INT_EN_FIFOQUARTER (0x1 << 10)
23 #define KEYSCAN_INT_EN_FIFO_NONEMPTY (0x1 << 11)
24 #define KEYSCAN_INT_EN_GHOST (0x1 << 12)
25 #endif
26 
27 /* keyscan interrupt clear */
28 #if defined(BL702L)
29 #define KEYSCAN_INT_CLR_DONE (0x1 << 7)
30 #define KEYSCAN_INT_CLR_FIFO (0x1 << 8)
31 #define KEYSCAN_INT_CLR_GHOST (0x1 << 12)
32 #endif
33 
34 #if defined(BL702)
35 /* keyscan keycode status and clear */
36 #define KEYSCAN_STS_KEYCODE0 (0x1 << 0)
37 #define KEYSCAN_STS_KEYCODE1 (0x1 << 1)
38 #define KEYSCAN_STS_KEYCODE2 (0x1 << 2)
39 #define KEYSCAN_STS_KEYCODE3 (0x1 << 3)
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 void bflb_kys_init(struct bflb_device_s *dev, const struct bflb_kys_config_s *config);
47 void bflb_kys_enable(struct bflb_device_s *dev);
48 void bflb_kys_disable(struct bflb_device_s *dev);
49 void bflb_kys_int_enable(struct bflb_device_s *dev, uint32_t flag, bool enable);
50 void bflb_kys_int_clear(struct bflb_device_s *dev, uint32_t flag);
51 uint32_t bflb_kys_get_int_status(struct bflb_device_s *dev);
52 #if defined(BL702L)
53 void bflb_kys_get_fifo_info(struct bflb_device_s *dev, uint8_t *fifo_head, uint8_t *fifo_tail, uint8_t *fifo_valid_cnt);
54 #endif
55 uint8_t bflb_kys_read_keyvalue(struct bflb_device_s *dev, uint8_t index);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif
void bflb_kys_int_clear(struct bflb_device_s *dev, uint32_t flag)
void bflb_kys_enable(struct bflb_device_s *dev)
uint8_t bflb_kys_read_keyvalue(struct bflb_device_s *dev, uint8_t index)
uint32_t bflb_kys_get_int_status(struct bflb_device_s *dev)
uint8_t idle_duration
Definition: bflb_kys.h:11
void bflb_kys_int_enable(struct bflb_device_s *dev, uint32_t flag, bool enable)
uint8_t col
Definition: bflb_kys.h:7
void bflb_kys_init(struct bflb_device_s *dev, const struct bflb_kys_config_s *config)
uint8_t row
Definition: bflb_kys.h:8
uint8_t deglitch_en
Definition: bflb_kys.h:9
void bflb_kys_disable(struct bflb_device_s *dev)
uint8_t deglitch_cnt
Definition: bflb_kys.h:10
uint8_t ghost_en
Definition: bflb_kys.h:12