1、控制看门狗设备中,命令控制字可取如下宏定义值:
#define RT_DEVICE_CTRL_WDT_GET_TIMEOUT (1) /* 获取溢出时间 */
#define RT_DEVICE_CTRL_WDT_SET_TIMEOUT (2) /* 设置溢出时间 */
#define RT_DEVICE_CTRL_WDT_GET_TIMELEFT (3) /* 获取剩余时间 */
#define RT_DEVICE_CTRL_WDT_KEEPALIVE (4) /* 喂狗 */
#define RT_DEVICE_CTRL_WDT_START (5) /* 启动看门狗 */
#define RT_DEVICE_CTRL_WDT_STOP (6) /* 停止看门狗 */
2、看门狗设备框架源码添加到工程中在RT-Thread Settings的设备驱动程序中,选择WDT进行开启;对应宏定义在rtconfig.h为:#define RT_USING_WDT
3、SDIO设备框架注册出来的sd设备,设备名是什么?
sdx,例如:#define SD_DEVICE_NAME "sd0"
4、对接Touch框架时,如要返回触摸点的信息,需要对接到哪个接口上
应用层调用如下接口读取触摸点信息:
rt_size_t rt_device_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size);
//读取一个触摸点
rt_device_read(touch_dev, 0, read_data, 1) == 1
//读取五个触摸点
rt_device_read(touch_dev, 0, read_data, 5) == 5
驱动层函数如下,在设备register时进行接口函数对接:device->read = rt_touch_read;
static rt_size_t rt_touch_read(rt_device_t dev, rt_off_t pos, void *buf, rt_size_t len)
{
rt_touch_t touch;
rt_size_t result = 0;
RT_ASSERT(dev != RT_NULL);
touch = (rt_touch_t)dev;
if (buf == NULL || len == 0)
{
return 0;
}
result = touch->ops->touch_readpoint(touch, buf, len);
return result;
}