35 lines
792 B
C
35 lines
792 B
C
#ifndef _MBUSCOMM_H_
|
|
#define _MBUSCOMM_H_
|
|
|
|
#include <main.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
#define MBUSFRAMEFIELD_LABELLENGTH 16
|
|
typedef struct {
|
|
char label[MBUSFRAMEFIELD_LABELLENGTH];
|
|
uint8_t index;
|
|
} t_mbusFrameField;
|
|
|
|
#define MBUSDEVICE_NAMELENGTH 24
|
|
#define MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS 4
|
|
typedef struct {
|
|
char deviceName[MBUSDEVICE_NAMELENGTH];
|
|
uint8_t address;
|
|
t_mbusFrameField consideredField[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
|
uint32_t requests;
|
|
uint32_t failures;
|
|
} t_mbusDevice;
|
|
|
|
|
|
typedef enum {
|
|
MBCRR_TRIGGERED = 0,
|
|
MBCRR_BUSY = 1
|
|
} e_mbusCommRequestResult;
|
|
|
|
e_mbusCommRequestResult mbusCommRequest(t_mbusDevice *mbusDevice);
|
|
void mbusCommTxCpltCallback(UART_HandleTypeDef *huart);
|
|
void mbusCommRxCpltCallback(UART_HandleTypeDef *huart);
|
|
|
|
#endif // _MBUSCOMM_H_
|