spi
This commit is contained in:
parent
5d86d6c2bd
commit
d6d758d53f
@ -49,12 +49,6 @@
|
|||||||
|
|
||||||
|
|
||||||
void SPI_Init() {
|
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);
|
pinMode(AD7190_SLAVE_ID, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String ConfigInvalidateCmd::exec(String params) {
|
String ConfigInvalidateCmd::exec(String params) {
|
||||||
Config::setUInt(Config::MAGIC, 0);
|
Config::setUInt(Config::MAGIC, 0);
|
||||||
return "done";
|
return "done";
|
||||||
|
1
Config.h
1
Config.h
@ -19,7 +19,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
float f;
|
float f;
|
||||||
uint8_t e[sizeof(float)];
|
uint8_t e[sizeof(float)];
|
||||||
|
@ -4,22 +4,29 @@
|
|||||||
#include "uptime.h"
|
#include "uptime.h"
|
||||||
#include "thermometer.h"
|
#include "thermometer.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "spi.h"
|
||||||
|
|
||||||
|
|
||||||
|
// #define ENABLE_CONFIGURATION_INVALID_CMD 1
|
||||||
|
|
||||||
|
|
||||||
static CmdServer cmdServer(&Serial);
|
static CmdServer cmdServer(&Serial);
|
||||||
static ConfigInvalidateCmd configInvalidateCmd;
|
#ifdef ENABLE_CONFIGURATION_INVALID_CMD
|
||||||
|
static ConfigInvalidateCmd configInvalidateCmd;
|
||||||
|
#endif
|
||||||
static Uptime uptime;
|
static Uptime uptime;
|
||||||
static Thermometer thermometer;
|
static Thermometer thermometer;
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
spiInit();
|
||||||
|
|
||||||
cmdServer.begin();
|
cmdServer.begin();
|
||||||
|
#ifdef ENABLE_CONFIGURATION_INVALID_CMD
|
||||||
configInvalidateCmd.registerYourself(&cmdServer);
|
configInvalidateCmd.registerYourself(&cmdServer);
|
||||||
|
#endif
|
||||||
uptime.begin(&cmdServer);
|
uptime.begin(&cmdServer);
|
||||||
thermometer.begin(&cmdServer);
|
thermometer.begin(&cmdServer);
|
||||||
|
|
||||||
delay(5000);
|
|
||||||
Serial.println("Start");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
18
spi.cpp
Normal file
18
spi.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* spi.cpp
|
||||||
|
*
|
||||||
|
* Created on: 05.03.2014
|
||||||
|
* Author: wn
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void spiInit() {
|
||||||
|
SPI.begin();
|
||||||
|
|
||||||
|
SPI.setBitOrder(MSBFIRST);
|
||||||
|
SPI.setClockDivider(SPI_CLOCK_DIV64);
|
||||||
|
SPI.setDataMode(SPI_MODE3);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user