One Framework 0.1.0
RoboMaster嵌入式框架“一键”解决方案,为你的“创意”服务。
载入中...
搜索中...
未找到
input-dbus.c 文件参考
#include <zephyr/device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/input/input.h>
#include <zephyr/irq.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/time_units.h>
#include <zephyr/sys_clock.h>
input-dbus.c 的引用(Include)关系图:

结构体

struct  dbus_input_channel
 
struct  input_dbus_config
 
struct  input_dbus_data
 

宏定义

#define DT_DRV_COMPAT   dji_dbus
 
#define DBUS_FRAME_LEN   18
 
#define DBUS_TRANSMISSION_TIME_MS   4
 
#define DBUS_INTERFRAME_SPACING_MS   20
 
#define DBUS_CHANNEL_COUNT   28 /* 通道总数:5个摇杆+2个开关+4个鼠标+1个滚轮+16个键盘 */
 
#define RC_CH_VALUE_OFFSET   1024
 
#define REPORT_FILTER   CONFIG_INPUT_DBUS_REPORT_FILTER
 
#define CHANNEL_VALUE_ZERO   CONFIG_INPUT_DBUS_CHANNEL_VALUE_ZERO
 
#define CHANNEL_VALUE_ONE   CONFIG_INPUT_DBUS_CHANNEL_VALUE_ONE
 
#define INPUT_CHANNEL_CHECK(input_channel_id)
 
#define DBUS_INPUT_CHANNEL_INITIALIZER(input_channel_id)
 
#define INPUT_DBUS_INIT(n)
 

函数

 LOG_MODULE_REGISTER (dji_dbus, CONFIG_INPUT_LOG_LEVEL)
 
static void input_dbus_report (const struct device *dev, unsigned int dbus_channel, unsigned int value)
 
static void input_dbus_input_report_thread (const struct device *dev, void *dummy2, void *dummy3)
 
static void dbus_uart_isr (const struct device *uart_dev, void *user_data)
 
static int input_dbus_init (const struct device *dev)
 

变量

const struct uart_config uart_cfg_dbus
 

宏定义说明

◆ CHANNEL_VALUE_ONE

#define CHANNEL_VALUE_ONE   CONFIG_INPUT_DBUS_CHANNEL_VALUE_ONE

◆ CHANNEL_VALUE_ZERO

#define CHANNEL_VALUE_ZERO   CONFIG_INPUT_DBUS_CHANNEL_VALUE_ZERO

◆ DBUS_CHANNEL_COUNT

#define DBUS_CHANNEL_COUNT   28 /* 通道总数:5个摇杆+2个开关+4个鼠标+1个滚轮+16个键盘 */

◆ DBUS_FRAME_LEN

#define DBUS_FRAME_LEN   18

◆ DBUS_INPUT_CHANNEL_INITIALIZER

#define DBUS_INPUT_CHANNEL_INITIALIZER ( input_channel_id)
值:
{ \
.dbus_channel = DT_PROP(input_channel_id, channel), \
.type = DT_PROP(input_channel_id, type), \
.zephyr_code = DT_PROP(input_channel_id, zephyr_code), \
},

◆ DBUS_INTERFRAME_SPACING_MS

#define DBUS_INTERFRAME_SPACING_MS   20

◆ DBUS_TRANSMISSION_TIME_MS

#define DBUS_TRANSMISSION_TIME_MS   4

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   dji_dbus

◆ INPUT_CHANNEL_CHECK

#define INPUT_CHANNEL_CHECK ( input_channel_id)
值:
BUILD_ASSERT(IN_RANGE(DT_PROP(input_channel_id, channel), 0, 26), "无效的通道号"); \
BUILD_ASSERT(DT_PROP(input_channel_id, type) == INPUT_EV_ABS || DT_PROP(input_channel_id, type) == INPUT_EV_KEY || \
DT_PROP(input_channel_id, type) == INPUT_EV_MSC, \
"无效的通道类型");

◆ INPUT_DBUS_INIT

#define INPUT_DBUS_INIT ( n)
值:
\
static const struct dbus_input_channel input_##n[] = {DT_INST_FOREACH_CHILD(n, DBUS_INPUT_CHANNEL_INITIALIZER)}; \
DT_INST_FOREACH_CHILD(n, INPUT_CHANNEL_CHECK) \
\
static struct input_dbus_data dbus_data_##n; \
\
static const struct input_dbus_config dbus_cfg_##n = { \
.channel_info = input_##n, \
.uart_dev = DEVICE_DT_GET(DT_INST_BUS(n)), \
.num_channels = ARRAY_SIZE(input_##n), \
.cb = dbus_uart_isr, \
}; \
\
DEVICE_DT_INST_DEFINE(n, input_dbus_init, NULL, &dbus_data_##n, &dbus_cfg_##n, POST_KERNEL, \
CONFIG_INPUT_INIT_PRIORITY, NULL);
#define DBUS_INPUT_CHANNEL_INITIALIZER(input_channel_id)
定义 input-dbus.c:329
static int input_dbus_init(const struct device *dev)
定义 input-dbus.c:259
static void dbus_uart_isr(const struct device *uart_dev, void *user_data)
定义 input-dbus.c:205
#define INPUT_CHANNEL_CHECK(input_channel_id)
定义 input-dbus.c:323
定义 input-dbus.c:19
定义 input-dbus.c:33
定义 input-dbus.c:52

◆ RC_CH_VALUE_OFFSET

#define RC_CH_VALUE_OFFSET   1024

◆ REPORT_FILTER

#define REPORT_FILTER   CONFIG_INPUT_DBUS_REPORT_FILTER

函数说明

◆ dbus_uart_isr()

static void dbus_uart_isr ( const struct device * uart_dev,
void * user_data )
static

◆ input_dbus_init()

static int input_dbus_init ( const struct device * dev)
static

◆ input_dbus_input_report_thread()

static void input_dbus_input_report_thread ( const struct device * dev,
void * dummy2,
void * dummy3 )
static

◆ input_dbus_report()

static void input_dbus_report ( const struct device * dev,
unsigned int dbus_channel,
unsigned int value )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( dji_dbus ,
CONFIG_INPUT_LOG_LEVEL  )

变量说明

◆ uart_cfg_dbus

const struct uart_config uart_cfg_dbus
初始值:
= {.baudrate = 100000,
.parity = UART_CFG_PARITY_EVEN,
.stop_bits = UART_CFG_STOP_BITS_2,
.data_bits = UART_CFG_DATA_BITS_8,
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE}