1.使用接口函数rt_device_t rt_device_create(int type, int attach_size);
2.调用该接口时,系统会从动态堆内存中分配一个设备控制块,大小为 struct rt_device 和 attach_size的和,设备的类型由参数 type 设定。设备被创建后,需要实现它访问硬件的操作方法。

3.把结构体rt_device_t 内的函数指针指向标准库中的外设的函数.

 RTthread IO设备的创建

例如:设备是I2C,device->init = IIC_init;

4.go on...注册,查找.打开.读,写,关闭.注销..等等

相关文章:

  • 2022-12-23
  • 2022-03-03
  • 2021-08-06
  • 2021-11-15
  • 2022-01-10
  • 2021-06-28
  • 2021-07-08
  • 2021-05-22
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2021-08-08
  • 2021-11-17
  • 2022-02-13
  • 2022-12-23
  • 2022-01-22
相关资源
相似解决方案