cascade_freemodbus.h 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _CASCADE_FREEMODBUS_H_
  2. #define _CASCADE_FREEMODBUS_H_
  3. #include "stdint.h"
  4. #include "datadef.h"
  5. #include "power.h"
  6. typedef struct {
  7. union {
  8. md_ac_dc_t ac_dc;
  9. md_3_ac_t ac_3;
  10. }data;
  11. }north_data_t;
  12. typedef struct cascade_saddr{
  13. uint8_t addr;
  14. uint16_t channels;
  15. power_ch_new_t ch[POWER_SLAVE_CH_MAX];
  16. }slave_info_t;
  17. typedef union{
  18. slave_info_t info;
  19. north_data_t north;
  20. }cascade_data_cache;
  21. typedef struct {
  22. uint8_t model; // master or slave model
  23. uint8_t saddr; // slave addr
  24. uint32_t baund; //
  25. uint32_t north_reg_max;
  26. uint32_t north_reg_start;
  27. uint32_t cascade_max;
  28. uint32_t cascade_start;
  29. cascade_data_cache *cache;
  30. lock_t lock;
  31. }cascade_freemodbus_t;
  32. void cascade_freemodbus_init(void);
  33. void cascade_freemodbus_reset(uint8_t model,uint8_t saddr,uint32_t baund);
  34. cascade_freemodbus_t * get_cascade_freemodbus(void);
  35. #endif