NbusBridge.h 567 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * NbusBridge.h
  3. *
  4. * Created on: Mar 7, 2025
  5. * Author: juraj
  6. */
  7. #ifndef SRC_NBUSBRIDGE_H_
  8. #define SRC_NBUSBRIDGE_H_
  9. #include "NbusSlave.h"
  10. #define MAX_SLAVES 8
  11. class NbusBridge {
  12. private:
  13. UART_HandleTypeDef *_uartUbus;
  14. uint8_t _data_packet_rx[32];
  15. NbusSlave *_slaves[MAX_SLAVES];
  16. uint8_t _num_slaves;
  17. void transmit(DataFrame *packet);
  18. public:
  19. NbusBridge(UART_HandleTypeDef *uartUbus);
  20. bool addSlave(NbusSlave *slave);
  21. virtual ~NbusBridge();
  22. uint8_t send(DataFrame *);
  23. bool call_echo(uint8_t slave);
  24. };
  25. #endif /* SRC_NBUSBRIDGE_H_ */