luat_hmeta.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef LUAT_HMETA_H
  2. #define LUAT_HMETA_H
  3. // 获取模块的设备类型, 原始需求是区分Air780E和Air600E
  4. int luat_hmeta_model_name(char* buff);
  5. // 获取硬件版本号, 例如A11, A14
  6. int luat_hmeta_hwversion(char* buff);
  7. // 获取芯片组型号, 原始型号, 传入的buff最少要8字节空间
  8. int luat_hmeta_chip(char* buff);
  9. // -------------------------------------------------------
  10. // GPIO 元数据
  11. // -------------------------------------------------------
  12. typedef struct luat_hmeta_gpio_pin
  13. {
  14. uint16_t id; // GPIO编号
  15. // const char* name; // 管脚名称
  16. uint8_t pull_up : 1; // 支持上拉
  17. uint8_t pull_down: 1; // 支持下拉
  18. uint8_t pull_open: 1; // 支持开漏
  19. uint8_t irq_rasing:1; // 支持上升沿中断
  20. uint8_t irq_falling:1; //支持下降沿中断
  21. uint8_t irq_both :1; // 支持双向触发
  22. uint8_t irq_high :1; // 支持高电平触发
  23. uint8_t irq_low :1; // 支持低电平触发
  24. uint8_t volsel; // 电压范围
  25. const char* commet; // 备注信息
  26. }luat_hmeta_gpio_pin_t;
  27. typedef struct luat_hmeta_gpio
  28. {
  29. size_t count; // 总共有多少管脚
  30. const char* comment; // 总体备注
  31. const luat_hmeta_gpio_pin_t pins;
  32. }luat_hmeta_gpio_t;
  33. const luat_hmeta_gpio_t* luat_hmeta_gpio_get(void);
  34. // -------------------------------------------------------
  35. // UART 元数据
  36. // -------------------------------------------------------
  37. typedef struct luat_hmeta_uart_port
  38. {
  39. uint16_t id; // UART编号
  40. uint16_t pins[2]; // 对应的GPIO, 如果有的话
  41. uint16_t baudrates[16]; // 可用的波特率,0会自动跳过
  42. const char* commet; // 备注信息
  43. }luat_hmeta_uart_port_t;
  44. typedef struct luat_hmeta_uart
  45. {
  46. size_t count; // 总共有多少管脚
  47. const char* comment; // 总体备注
  48. const luat_hmeta_uart_port_t ports;
  49. }luat_hmeta_uart_t;
  50. const luat_hmeta_uart_t* luat_hmeta_uart_get(void);
  51. // TODO i2c/spi/pwm/adc的 元数据
  52. #endif