| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /*
- * @file NbusCommunicator.h
- * @brief Deklarácia komunikačnej vrstvy: 1) internej 2) externej
- * @date Mar 7, 2025
- * @author Juraj Dudak
- */
- #ifndef SRC_NBUSCOMMUNICATOR_H_
- #define SRC_NBUSCOMMUNICATOR_H_
- #include "inttypes.h"
- #include "dataframe.h"
- #include "nbus_structs.h"
- #include "stm32l4xx_hal.h"
- /* DEFINES BEGIN */
- #define NBUS_MAX_FRAME_SIZE 64
- /* DEFINES END */
- class NbusCommunicator {
- private:
- uint8_t _data_packet_tx[NBUS_MAX_FRAME_SIZE];
- uint8_t _data_packet_comm[NBUS_MAX_FRAME_SIZE];
- uint8_t _data_packet_rx[NBUS_MAX_FRAME_SIZE];
- DataFrame *_packet_tx;
- DataFrame *_packet_rx;
- UART_HandleTypeDef *_uart_nbus;
- UART_HandleTypeDef *_uart_master;
- void _receive();
- public:
- NbusCommunicator(UART_HandleTypeDef*, UART_HandleTypeDef*);
- void transmit(uint8_t *, uint8_t);
- void sendToMaster(DataFrame *master_frame);
- virtual ~NbusCommunicator();
- DataFrame* send(Nbus_pdu *pdu, uint8_t *data, uint8_t data_len);
- };
- #endif /* SRC_NBUSCOMMUNICATOR_H_ */
|