openLuat / LuatOS

LuatOS -- Powerful embedded Lua Engine for IoT devices, with many components and low memory requirements (16K RAM, 128K Flash)
https://wiki.luatos.com
MIT License
460 stars 100 forks source link

LuatOS - uart库 - 设计文档 #13

Closed wendal closed 4 years ago

wendal commented 4 years ago

RT

wendal commented 4 years ago

https://github.com/openLuat/LuatOS/blob/master/markdown/device/luat_usart.md

wendal commented 4 years ago

意见:

  1. uart.unread --> uart.available 或者 uart.canread, unread不符合语法吧, 有点 revert read/取消读取意思
  2. 异步方法是通过msgbus机制传递的, 并不需要 luat_uart_on 方法
  3. uart.setup 的第一个参数为啥要用字符串呢?? 数值就很清楚 uart.setup(1,...) uart.write(1, str)?
  4. uart.on的回调应该有参数的吧?
chenxuuu commented 4 years ago

@wendal

  1. c#里这个叫BytesToRead,改成类似的?
  2. 说实话我没看到在哪里声明哪个消息由谁来处理
  3. rtt文档里貌似用的是字符串,后面万一有usb串口的话应该也能直接写usb
  4. 回调参数确实应该有,应该是uart id
wendal commented 4 years ago
  1. 可以,简短一些,意义明确就行
  2. 这是我的锅, 事件消息的处理, 我也是写完timer和gpio之后才定型下来,我会再更新msgbus的文档
  3. 嗯, 但我觉得uart.setup就不要返回值吧?