luat_msgbus.h 541 B

123456789101112131415161718192021222324252627
  1. #ifndef LUAT_MSGBUS
  2. #define LUAT_MSGBUS
  3. #include "luat_base.h"
  4. #define MSG_TIMER 1
  5. #define MSG_GPIO 2
  6. #define MSG_UART_RX 3
  7. #define MSG_UART_TXDONE 4
  8. typedef int (*luat_msg_handler) (lua_State *L, void* ptr);
  9. typedef struct rtos_msg{
  10. luat_msg_handler handler;
  11. void* ptr;
  12. }rtos_msg_t;
  13. // 定义接口方法
  14. void luat_msgbus_init(void);
  15. //void* luat_msgbus_data();
  16. uint32_t luat_msgbus_put(rtos_msg_t* msg, size_t timeout);
  17. uint32_t luat_msgbus_get(rtos_msg_t* msg, size_t timeout);
  18. uint32_t luat_msgbus_freesize(void);
  19. #endif