modbus_params.h 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __MODBUS_PARAMS_H
  2. #define __MODBUS_PARAMS_H
  3. #include "mb.h"
  4. #include "mbport.h"
  5. #include "modbus.h"
  6. #include <stdbool.h>
  7. #define MB_PARAM_MAX 1
  8. //
  9. typedef struct {
  10. uint16_t reg;
  11. uint16_t size;
  12. uint8_t *param;
  13. bool f_activity;
  14. mb_delay_action_t (*set_handler)(void);
  15. void (*check_handler)(void);
  16. } mb_param_t;
  17. //
  18. void mb_init_params(void);
  19. // Возвращает размер параметра в регистрах
  20. bool mb_find_param(uint16_t reg, uint16_t *index, uint16_t *size);
  21. //
  22. mb_delay_action_t mb_set_param(uint8_t *buf, uint16_t index);
  23. //
  24. void mb_get_param(uint8_t *buf, uint16_t index);
  25. // -------------------------------------------------------------------------- //
  26. // Проверка параметров //
  27. // -------------------------------------------------------------------------- //
  28. //
  29. void mb_check_dummy(void);
  30. #endif // __MODBUS_PARAMS_H