Changed updated name of macro for serial device, to follow generic MY_xx format

This commit is contained in:
Thomas Mørch
2016-01-03 22:59:44 +01:00
parent 9ba4669b52
commit 07f1ba9d04
9 changed files with 34 additions and 34 deletions
@@ -107,22 +107,22 @@ bool gatewayTransportInit() {
while (WiFi.status() != WL_CONNECTED) while (WiFi.status() != WL_CONNECTED)
{ {
delay(500); delay(500);
SERIALDEVICE.print("."); MY_SERIALDEVICE.print(".");
yield(); yield();
} }
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(WiFi.localIP()); MY_SERIALDEVICE.println(WiFi.localIP());
#else #else
#ifdef MY_IP_ADDRESS #ifdef MY_IP_ADDRESS
Ethernet.begin(_ethernetGatewayMAC, _ethernetGatewayIP); Ethernet.begin(_ethernetGatewayMAC, _ethernetGatewayIP);
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(Ethernet.localIP()); MY_SERIALDEVICE.println(Ethernet.localIP());
#else #else
// Get IP address from DHCP // Get IP address from DHCP
Ethernet.begin(_ethernetGatewayMAC); Ethernet.begin(_ethernetGatewayMAC);
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(Ethernet.localIP()); MY_SERIALDEVICE.println(Ethernet.localIP());
#endif /* IP_ADDRESS_DHCP */ #endif /* IP_ADDRESS_DHCP */
// give the Ethernet interface a second to initialize // give the Ethernet interface a second to initialize
// TODO: use HW delay // TODO: use HW delay
@@ -161,21 +161,21 @@ bool gatewayTransportInit() {
while (WiFi.status() != WL_CONNECTED) while (WiFi.status() != WL_CONNECTED)
{ {
delay(500); delay(500);
SERIALDEVICE.print("."); MY_SERIALDEVICE.print(".");
yield(); yield();
} }
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(WiFi.localIP()); MY_SERIALDEVICE.println(WiFi.localIP());
#else #else
#ifdef MY_IP_ADDRESS #ifdef MY_IP_ADDRESS
Ethernet.begin(_clientMAC, _clientIp); Ethernet.begin(_clientMAC, _clientIp);
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(Ethernet.localIP()); MY_SERIALDEVICE.println(Ethernet.localIP());
#else #else
// Get IP address from DHCP // Get IP address from DHCP
Ethernet.begin(_clientMAC); Ethernet.begin(_clientMAC);
SERIALDEVICE.print(F("IP: ")); MY_SERIALDEVICE.print(F("IP: "));
SERIALDEVICE.println(Ethernet.localIP()); MY_SERIALDEVICE.println(Ethernet.localIP());
#endif /* IP_ADDRESS_DHCP */ #endif /* IP_ADDRESS_DHCP */
// give the Ethernet interface a second to initialize // give the Ethernet interface a second to initialize
// TODO: use HW delay // TODO: use HW delay
@@ -31,7 +31,7 @@ MyMessage _serialMsg;
bool gatewayTransportSend(MyMessage &message) { bool gatewayTransportSend(MyMessage &message) {
SERIALDEVICE.print(protocolFormat(message)); MY_SERIALDEVICE.print(protocolFormat(message));
// Serial print is always successful // Serial print is always successful
return true; return true;
} }
@@ -45,9 +45,9 @@ bool gatewayTransportInit() {
bool gatewayTransportAvailable() { bool gatewayTransportAvailable() {
bool available = false; bool available = false;
while (SERIALDEVICE.available()) { while (MY_SERIALDEVICE.available()) {
// get the new byte: // get the new byte:
char inChar = (char) SERIALDEVICE.read(); char inChar = (char) MY_SERIALDEVICE.read();
// if the incoming character is a newline, set a flag // if the incoming character is a newline, set a flag
// so the main loop can do something about it: // so the main loop can do something about it:
if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 && !available) { if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 && !available) {
+1 -1
View File
@@ -36,7 +36,7 @@
#include <Arduino.h> #include <Arduino.h>
#endif #endif
#define SERIALDEVICE Serial #define MY_SERIALDEVICE Serial
#if defined __AVR_ATmega328P__ #if defined __AVR_ATmega328P__
#ifndef sleep_bod_disable #ifndef sleep_bod_disable
#define sleep_bod_disable() \ #define sleep_bod_disable() \
+1 -1
View File
@@ -30,7 +30,7 @@
//#include <SPI.h> //#include <SPI.h>
#endif #endif
#define SERIALDEVICE Serial #define MY_SERIALDEVICE Serial
#define min(a,b) ((a)<(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b))
+6 -6
View File
@@ -99,9 +99,9 @@ void hwWriteConfig(int adr, uint8_t value)
} }
void hwInit() { void hwInit() {
SERIALDEVICE.begin(MY_BAUD_RATE); MY_SERIALDEVICE.begin(MY_BAUD_RATE);
#ifndef MY_GATEWAY_W5100 #ifndef MY_GATEWAY_W5100
while (!SERIALDEVICE) {} while (!MY_SERIALDEVICE) {}
#endif #endif
Wire.begin(); Wire.begin();
} }
@@ -140,12 +140,12 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mo
#ifdef MY_DEBUG #ifdef MY_DEBUG
void hwDebugPrint(const char *fmt, ... ) { void hwDebugPrint(const char *fmt, ... ) {
if (SERIALDEVICE) { if (MY_SERIALDEVICE) {
char fmtBuffer[300]; char fmtBuffer[300];
#ifdef MY_GATEWAY_FEATURE #ifdef MY_GATEWAY_FEATURE
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
snprintf(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE); snprintf(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
SERIALDEVICE.print(fmtBuffer); MY_SERIALDEVICE.print(fmtBuffer);
#endif #endif
va_list args; va_list args;
va_start (args, fmt ); va_start (args, fmt );
@@ -159,8 +159,8 @@ void hwDebugPrint(const char *fmt, ... ) {
vsnprintf(fmtBuffer, 299, fmt, args); vsnprintf(fmtBuffer, 299, fmt, args);
#endif #endif
va_end (args); va_end (args);
SERIALDEVICE.print(fmtBuffer); MY_SERIALDEVICE.print(fmtBuffer);
// SERIALDEVICE.flush(); // MY_SERIALDEVICE.flush();
//Serial.write(freeRam()); //Serial.write(freeRam());
} }
+1 -1
View File
@@ -52,7 +52,7 @@ void hwWriteConfigBlock(void* buf, void* adr, size_t length);
void hwWriteConfig(int adr, uint8_t value); void hwWriteConfig(int adr, uint8_t value);
uint8_t hwReadConfig(int adr); uint8_t hwReadConfig(int adr);
#define SERIALDEVICE SerialUSB #define MY_SERIALDEVICE SerialUSB
/* /*
@@ -63,7 +63,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
#ifdef MY_GATEWAY_FEATURE #ifdef MY_GATEWAY_FEATURE
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE); snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
SERIALDEVICE.print(printBuffer); MY_SERIALDEVICE.print(printBuffer);
#endif #endif
for (int i=0; i<sz; i++) for (int i=0; i<sz; i++)
{ {
@@ -75,12 +75,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
// Truncate message if this is gateway node // Truncate message if this is gateway node
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0'; printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
#endif #endif
SERIALDEVICE.print(str); MY_SERIALDEVICE.print(str);
if (sz > 0) if (sz > 0)
{ {
SERIALDEVICE.print(printBuffer); MY_SERIALDEVICE.print(printBuffer);
} }
SERIALDEVICE.println(""); MY_SERIALDEVICE.println("");
} }
#else #else
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz) #define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
@@ -66,7 +66,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
#ifdef MY_GATEWAY_FEATURE #ifdef MY_GATEWAY_FEATURE
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE); snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
SERIALDEVICE.print(printBuffer); MY_SERIALDEVICE.print(printBuffer);
#endif #endif
for (int i=0; i<sz; i++) for (int i=0; i<sz; i++)
{ {
@@ -78,12 +78,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
// Truncate message if this is gateway node // Truncate message if this is gateway node
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0'; printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
#endif #endif
SERIALDEVICE.print(str); MY_SERIALDEVICE.print(str);
if (sz > 0) if (sz > 0)
{ {
SERIALDEVICE.print(printBuffer); MY_SERIALDEVICE.print(printBuffer);
} }
SERIALDEVICE.println(""); MY_SERIALDEVICE.println("");
} }
#else #else
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz) #define DEBUG_SIGNING_PRINTBUF(str, buf, sz)