diff --git a/AD7190.cpp b/AD7190.cpp index 3553fb5..0fafc33 100644 --- a/AD7190.cpp +++ b/AD7190.cpp @@ -49,12 +49,6 @@ void SPI_Init() { - SPI.begin(); - // SPI_Init(0, 1000000, 1, 0); - SPI.setBitOrder(MSBFIRST); - SPI.setClockDivider(SPI_CLOCK_DIV64); - SPI.setDataMode(SPI_MODE3); - pinMode(AD7190_SLAVE_ID, OUTPUT); } diff --git a/Config.cpp b/Config.cpp index 6567e17..c0f39ed 100644 --- a/Config.cpp +++ b/Config.cpp @@ -10,6 +10,7 @@ #include "Config.h" + String ConfigInvalidateCmd::exec(String params) { Config::setUInt(Config::MAGIC, 0); return "done"; diff --git a/Config.h b/Config.h index ad6c486..9355e6b 100644 --- a/Config.h +++ b/Config.h @@ -19,7 +19,6 @@ public: }; - typedef union { float f; uint8_t e[sizeof(float)]; diff --git a/ThermometerPro.cpp b/ThermometerPro.cpp index 60f97e5..721a35d 100644 --- a/ThermometerPro.cpp +++ b/ThermometerPro.cpp @@ -4,22 +4,29 @@ #include "uptime.h" #include "thermometer.h" #include "Config.h" +#include "spi.h" + + +// #define ENABLE_CONFIGURATION_INVALID_CMD 1 static CmdServer cmdServer(&Serial); -static ConfigInvalidateCmd configInvalidateCmd; +#ifdef ENABLE_CONFIGURATION_INVALID_CMD + static ConfigInvalidateCmd configInvalidateCmd; +#endif static Uptime uptime; static Thermometer thermometer; void setup() { + spiInit(); + cmdServer.begin(); +#ifdef ENABLE_CONFIGURATION_INVALID_CMD configInvalidateCmd.registerYourself(&cmdServer); +#endif uptime.begin(&cmdServer); thermometer.begin(&cmdServer); - - delay(5000); - Serial.println("Start"); } diff --git a/spi.cpp b/spi.cpp new file mode 100644 index 0000000..d03aa37 --- /dev/null +++ b/spi.cpp @@ -0,0 +1,18 @@ +/* + * spi.cpp + * + * Created on: 05.03.2014 + * Author: wn + */ + +#include + + + +void spiInit() { + SPI.begin(); + + SPI.setBitOrder(MSBFIRST); + SPI.setClockDivider(SPI_CLOCK_DIV64); + SPI.setDataMode(SPI_MODE3); +} diff --git a/spi.h b/spi.h new file mode 100644 index 0000000..0a127d6 --- /dev/null +++ b/spi.h @@ -0,0 +1,15 @@ +/* + * spi.h + * + * Created on: 05.03.2014 + * Author: wn + */ + +#ifndef SPI_H_ +#define SPI_H_ + + +void spiInit(); + + +#endif /* SPI_H_ */