2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Config/Config.h
- Committer:
- shimniok
- Date:
- 2019-01-01
- Revision:
- 36:3095e00eef37
- Parent:
- Config.h@ 9:fc3575d2cbbf
File content as of revision 36:3095e00eef37:
#ifndef __CONFIG_H #define __CONFIG_H #include "mbed.h" #define MAXSTR 30 #define MAXTBL 30 union Value { double d; int i; }; typedef struct { char key[MAXSTR]; char format; Value value; } ConfigEntry; class Config { public: enum{INT, DOUBLE} format; Config(); int load(char *filename); int assign(char *key, char *value); void add(char *key, char format); void attach(Callback<void(char *)>, char *key, char format); int get(char *key, double *value); int get(char *key, int *value); template<typename T> T retrieve(char *key); private: static const int MAXBUF=128; char buf[MAXBUF]; ConfigEntry table[MAXTBL]; int itable; int lookup(char *key); }; #endif