RLT8762D KEYSCAN 模块

发布时间:2024年01月23日

0 Preface/Foreword

0.0 scan mechanism

Keyscan adopts manual scanning mode and the scanning will be completed in one time.?To realize matrix keyboard scanning, first send key message event

to app_task by key interrupt.When a message event is detected by app_task, it will be parsed at app layer and app_task will execute user program. In the meantime, key information will be printed on DebugAnalyser tool.

0.1 示例代码路径

路径:src/sample/io_sample/KEYSCAN/Keyscan/ble_peripheral

1 Data struct

1.1?KeyScan_Data_TypeDef

typedef struct
{
? ? uint32_t length;
? ? struct
? ? {
? ? ? ? uint16_t column: 5; ? /**< keyscan column buffer data ? */
? ? ? ? uint16_t row: 4; ? ? ?/**< keyscan raw buffer data ? ? ?*/
? ? } key[26];
} KeyScan_Data_TypeDef;

2 Source code

2.1?global_data_keyscan_init?

global_data_keyscan_init?

作用:初始化按键变量中的值。?

2.2?board_keyboard_init

/**
? * @brief ?Initialization of pinmux settings and pad settings.
? * @param ?No parameter.
? * @return Void
? */
void board_keyboard_init(void)
{
? ? /* Keypad pad config */
? ? Pad_Config(KEYBOARD_ROW_0, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE,
? ? ? ? ? ? ? ?PAD_OUT_LOW);
? ? Pad_Config(KEYBOARD_ROW_1, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE,
? ? ? ? ? ? ? ?PAD_OUT_LOW);
? ? Pad_Config(KEYBOARD_COLUMN_0, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_NONE, PAD_OUT_ENABLE,
? ? ? ? ? ? ? ?PAD_OUT_LOW);
? ? Pad_Config(KEYBOARD_COLUMN_1, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_NONE, PAD_OUT_ENABLE,
? ? ? ? ? ? ? ?PAD_OUT_LOW);

? ? /* keypad pinmux config */
? ? Pinmux_Config(KEYBOARD_ROW_0, KEY_ROW_0);
? ? Pinmux_Config(KEYBOARD_ROW_1, KEY_ROW_1);
? ? Pinmux_Config(KEYBOARD_COLUMN_0, KEY_COL_0);
? ? Pinmux_Config(KEYBOARD_COLUMN_1, KEY_COL_1);
}

NOTE:PAD初始化,?PINMUX初始化,设置PAD功能。

文章来源:https://blog.csdn.net/yanlaifan/article/details/135770646
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。