82 lines
1.6 KiB
C++
82 lines
1.6 KiB
C++
/*
|
|
* Config.h
|
|
*
|
|
* Created on: 04.03.2014
|
|
* Author: wn
|
|
*/
|
|
|
|
#ifndef CONFIG_H_
|
|
#define CONFIG_H_
|
|
|
|
#include "cmd.h"
|
|
|
|
|
|
class ConfigInvalidateCmd : public Cmd {
|
|
public:
|
|
virtual String getCmdName() { return "CFGINV"; }
|
|
virtual String getHelp() { return "Invalidate the stored configuration"; }
|
|
virtual String exec(String params);
|
|
};
|
|
|
|
|
|
typedef union {
|
|
float f;
|
|
uint8_t e[sizeof(float)];
|
|
} u_float;
|
|
|
|
typedef union {
|
|
unsigned int i;
|
|
uint8_t e[sizeof(unsigned int)];
|
|
} u_uint;
|
|
|
|
typedef union {
|
|
unsigned long l;
|
|
uint8_t e[sizeof(unsigned long)];
|
|
} u_ulong;
|
|
|
|
typedef union {
|
|
bool b;
|
|
uint8_t e[sizeof(bool)];
|
|
} u_bool;
|
|
|
|
typedef union {
|
|
unsigned char c;
|
|
uint8_t e[sizeof(unsigned char)];
|
|
} u_uchar;
|
|
|
|
|
|
namespace Config {
|
|
const unsigned int MAGIC_TOKEN = 0xDEADBEEF;
|
|
|
|
const int MAGIC = 0; // 4
|
|
const int THERMOMETER_ALPHA = 4; // 4
|
|
const int THERMOMETER_PERIOD = 8; // 8
|
|
const int THERMOMETER_CAL[4] = {12, 16, 20, 24}; // 4 x 4
|
|
const int THERMOMETER_DEBUG = 28; // 1
|
|
const int THERMOMETER_INFO = 29; // 1
|
|
const int METERBUSCLIENT_ADDRESS = 30; // 1
|
|
const int METERBUSCLIENT_DEBUG = 31; // 1
|
|
const int METERBUSCLIENT_INFO = 32; // 1
|
|
|
|
|
|
|
|
bool getBool(int pos);
|
|
void setBool(int pos, bool value);
|
|
float getFloat(int pos);
|
|
void setFloat(int pos, float value);
|
|
unsigned int getUInt(int pos);
|
|
void setUInt(int pos, unsigned int value);
|
|
unsigned long getULong(int pos);
|
|
void setULong(int pos, unsigned long value);
|
|
unsigned char getUChar(int pos);
|
|
void setUChar(int pos, unsigned char value);
|
|
|
|
void initialize();
|
|
|
|
bool isInitialized();
|
|
|
|
void setMagic();
|
|
}
|
|
|
|
#endif /* CONFIG_H_ */
|