2020-11-27 12:29:21 +01:00
|
|
|
#ifndef _CONFIG_H_
|
|
|
|
#define _CONFIG_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <spi.h>
|
2020-11-30 18:29:53 +01:00
|
|
|
#include <assert.h>
|
2020-11-27 12:29:21 +01:00
|
|
|
|
2020-11-30 19:07:26 +01:00
|
|
|
#define CONFIG_MAGIC 0xdead000a
|
2020-11-30 18:29:53 +01:00
|
|
|
#define DEVICE_MAGIC 0xaffe0000
|
2020-11-27 15:54:16 +01:00
|
|
|
|
2020-11-27 12:29:21 +01:00
|
|
|
typedef struct __attribute__((__packed__)) s_configBlock {
|
2020-11-27 15:54:16 +01:00
|
|
|
uint32_t configMagic;
|
2020-11-27 12:29:21 +01:00
|
|
|
char deviceName[16];
|
|
|
|
uint8_t macAddress[6];
|
2020-11-27 13:37:57 +01:00
|
|
|
int32_t frontendThreshold;
|
2020-11-27 13:27:24 +01:00
|
|
|
char brokerName[64];
|
2020-11-27 12:29:21 +01:00
|
|
|
char watchdogTopic[64];
|
|
|
|
char startupTopic[64];
|
|
|
|
char statusTopic[64];
|
|
|
|
char mbusDataTopic[64];
|
2020-11-27 13:27:24 +01:00
|
|
|
char syslogServerName[64];
|
2020-11-27 16:55:09 +01:00
|
|
|
uint8_t numOfDeviceBlocks;
|
|
|
|
uint8_t filler[1];
|
2020-11-27 12:29:21 +01:00
|
|
|
} t_configBlock;
|
|
|
|
|
2020-11-27 16:55:09 +01:00
|
|
|
|
2020-12-17 09:15:01 +01:00
|
|
|
#define MAX_MBUS_DEVICES 16
|
2020-11-27 16:55:09 +01:00
|
|
|
#define MBUSDEVICE_NAMELENGTH 16
|
|
|
|
#define MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS 4
|
|
|
|
|
|
|
|
typedef struct __attribute__((__packed__)) s_deviceBlock {
|
2020-11-30 18:29:53 +01:00
|
|
|
uint32_t deviceMagic;
|
|
|
|
char deviceName[MBUSDEVICE_NAMELENGTH];
|
|
|
|
uint8_t address;
|
|
|
|
int8_t consideredField[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
|
|
|
int32_t period;
|
|
|
|
uint8_t filler[3];
|
2020-11-27 16:55:09 +01:00
|
|
|
} t_deviceBlock;
|
|
|
|
|
2020-11-27 12:29:21 +01:00
|
|
|
void configInit();
|
2020-11-27 13:27:24 +01:00
|
|
|
t_configBlock* getConfig();
|
2020-11-27 12:29:21 +01:00
|
|
|
|
|
|
|
#endif /* _CONFIG_H_ */
|