feat(encoder): 添加编码器模块支持
- 在CMakeLists.txt中添加encoder_module.c和encoder_event.c源文件 - 配置设备树pinctrl设置编码器引脚(QDEC_A和QDEC_B) - 在设备树中启用qdec外设并配置相关参数 - 添加atguigu厂商前缀到vendor-prefixes.txt - 创建encoder_event.h事件头文件定义编码器事件结构 - 在prj.conf中启用NRFX_QDEC和PINCTRL_DYNAMIC配置 - 实现encoder_module.c包含完整的编码器驱动逻辑 - 实现encoder_event.c处理编码器事件的发布和记录
This commit is contained in:
22
inc/events/encoder_event.h
Normal file
22
inc/events/encoder_event.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef BLINKY_ENCODER_EVENT_H_
|
||||
#define BLINKY_ENCODER_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct encoder_event {
|
||||
struct app_event_header header;
|
||||
int8_t detents;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(encoder_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_ENCODER_EVENT_H_ */
|
||||
Reference in New Issue
Block a user