first use of libmbus
This commit is contained in:
@ -5,38 +5,21 @@
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define MBUSFRAMEFIELD_LABELLENGTH 16
|
||||
typedef struct {
|
||||
uint8_t start1;
|
||||
uint8_t length1;
|
||||
uint8_t length2;
|
||||
uint8_t start2;
|
||||
uint8_t l;
|
||||
uint8_t c;
|
||||
uint8_t a;
|
||||
uint8_t ci;
|
||||
uint8_t *userdata;
|
||||
uint8_t chksum;
|
||||
uint8_t stop;
|
||||
} t_longframe;
|
||||
char label[MBUSFRAMEFIELD_LABELLENGTH];
|
||||
uint8_t index;
|
||||
} t_mbusFrameField;
|
||||
|
||||
typedef enum {
|
||||
MBCR_SUCCESS = 0,
|
||||
MBCR_ERROR_TIMEOUT,
|
||||
MBCR_ERROR_LOOP_FAILURE,
|
||||
MBCR_ERROR_TX_REG_UNACCESSIBLE,
|
||||
MBCR_ERROR_OUT_OF_MEMORY__FRAME,
|
||||
MBCR_ERROR_OUT_OF_MEMORY__USERDATA,
|
||||
MBCR_ERROR_STATE_ENGINE__START1,
|
||||
MBCR_ERROR_STATE_ENGINE__LENGTH1,
|
||||
MBCR_ERROR_STATE_ENGINE__LENGTH2,
|
||||
MBCR_ERROR_STATE_ENGINE__START2,
|
||||
MBCR_ERROR_STATE_ENGINE__INVALID_CHKSUM,
|
||||
MBCR_ERROR_STATE_ENGINE__STOP,
|
||||
MBCR_ERROR_STATE_ENGINE__ILLEGAL_STATE,
|
||||
MBCR_ERROR_STATE_ENGINE__UNKNOWN
|
||||
} t_mbusCommResult;
|
||||
#define MBUSDEVICE_NAMELENGTH 16
|
||||
#define MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS 4
|
||||
typedef struct {
|
||||
char deviceName[MBUSDEVICE_NAMELENGTH];
|
||||
uint8_t address;
|
||||
t_mbusFrameField consideredField[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
||||
} t_mbusDevice;
|
||||
|
||||
void mbusCommRequest(uint8_t cmd, uint8_t addr);
|
||||
void mbusCommRequest(t_mbusDevice *mbusDevice);
|
||||
void mbusCommTxCpltCallback(UART_HandleTypeDef *huart);
|
||||
void mbusCommRxCpltCallback(UART_HandleTypeDef *huart);
|
||||
|
||||
|
Reference in New Issue
Block a user