Harmonize definition ins core (#628)
This commit is contained in:
committed by
Embedded Innovation
parent
e77f3c06cd
commit
c6ff9122b4
@@ -67,6 +67,15 @@
|
|||||||
#ifndef MY_BAUD_RATE
|
#ifndef MY_BAUD_RATE
|
||||||
#define MY_BAUD_RATE 115200
|
#define MY_BAUD_RATE 115200
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* @def MY_SERIAL_OUTPUT_SIZE
|
||||||
|
* @brief Max. characters for serial output.
|
||||||
|
*/
|
||||||
|
#ifndef MY_SERIAL_OUTPUT_SIZE
|
||||||
|
#define MY_SERIAL_OUTPUT_SIZE (120u)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Disables over-the-air reset of node
|
// Disables over-the-air reset of node
|
||||||
//#define MY_DISABLE_REMOTE_RESET
|
//#define MY_DISABLE_REMOTE_RESET
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ uint16_t hwFreeMem() {
|
|||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||||
#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(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
@@ -233,9 +233,9 @@ void hwDebugPrint(const char *fmt, ... ) {
|
|||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_SERIALDEVICE Serial
|
#define MY_SERIALDEVICE Serial
|
||||||
#define MY_DEBUG_BUFFER_SIZE 300
|
|
||||||
|
|
||||||
#if defined __AVR_ATmega328P__
|
#if defined __AVR_ATmega328P__
|
||||||
#ifndef sleep_bod_disable
|
#ifndef sleep_bod_disable
|
||||||
@@ -73,21 +72,20 @@ do { \
|
|||||||
#define hwReboot() wdt_enable(WDTO_15MS); while (1)
|
#define hwReboot() wdt_enable(WDTO_15MS); while (1)
|
||||||
#define hwMillis() millis()
|
#define hwMillis() millis()
|
||||||
#define hwRandomNumberInit() randomSeed(analogRead(MY_SIGNING_SOFT_RANDOMSEED_PIN))
|
#define hwRandomNumberInit() randomSeed(analogRead(MY_SIGNING_SOFT_RANDOMSEED_PIN))
|
||||||
#define hwReadConfig(__pos) (eeprom_read_byte((uint8_t*)(__pos)))
|
#define hwReadConfig(__pos) eeprom_read_byte((uint8_t*)(__pos))
|
||||||
|
|
||||||
#ifndef eeprom_update_byte
|
#ifndef eeprom_update_byte
|
||||||
#define hwWriteConfig(loc, val) if((uint8_t)(val) != eeprom_read_byte((uint8_t*)(loc))) { eeprom_write_byte((uint8_t*)(loc), (val)); }
|
#define hwWriteConfig(__loc, __val) if((uint8_t)(__val) != eeprom_read_byte((uint8_t*)(__loc))) { eeprom_write_byte((uint8_t*)(__loc), (__val)); }
|
||||||
#else
|
#else
|
||||||
#define hwWriteConfig(__pos, __value) (eeprom_update_byte((uint8_t*)(__pos), (__value)))
|
#define hwWriteConfig(__pos, __val) eeprom_update_byte((uint8_t*)(__pos), (__val))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define hwReadConfigBlock(__buf, __pos, __length) (eeprom_read_block((__buf), (void*)(__pos), (__length)))
|
#define hwReadConfigBlock(__buf, __pos, __length) eeprom_read_block((void*)(__buf), (void*)(__pos), (__length))
|
||||||
#define hwWriteConfigBlock(__buf, __pos, __length) (eeprom_write_block((void*)(__buf), (void*)(__pos), (__length)))
|
#define hwWriteConfigBlock(__buf, __pos, __length) eeprom_write_block((void*)(__buf), (void*)(__pos), (__length))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum period_t
|
enum period_t {
|
||||||
{
|
|
||||||
SLEEP_15MS,
|
SLEEP_15MS,
|
||||||
SLEEP_30MS,
|
SLEEP_30MS,
|
||||||
SLEEP_60MS,
|
SLEEP_60MS,
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ uint16_t hwFreeMem() {
|
|||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||||
#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(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
@@ -144,9 +144,9 @@ void hwDebugPrint(const char *fmt, ... ) {
|
|||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_SERIALDEVICE Serial
|
#define MY_SERIALDEVICE Serial
|
||||||
#define MY_DEBUG_BUFFER_SIZE 300
|
|
||||||
|
|
||||||
#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))
|
||||||
|
|||||||
+4
-4
@@ -160,7 +160,7 @@ uint16_t hwFreeMem() {
|
|||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
if (MY_SERIALDEVICE) {
|
if (MY_SERIALDEVICE) {
|
||||||
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||||
#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, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
@@ -170,9 +170,9 @@ void hwDebugPrint(const char *fmt, ... ) {
|
|||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf(fmtBuffer, 60, fmt, args);
|
vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
fmtBuffer[59] = '\n';
|
fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
|
||||||
fmtBuffer[60] = '\0';
|
fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,15 +52,6 @@ void hwWriteConfig(int adr, uint8_t value);
|
|||||||
uint8_t hwReadConfig(int adr);
|
uint8_t hwReadConfig(int adr);
|
||||||
|
|
||||||
#define MY_SERIALDEVICE SerialUSB
|
#define MY_SERIALDEVICE SerialUSB
|
||||||
#define MY_DEBUG_BUFFER_SIZE 300
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define hwReadConfigBlock(__buf, __adr, __length) ( __length = __length)
|
|
||||||
#define hwWriteConfigBlock(__buf, __adr, __length) ( __length = __length)
|
|
||||||
#define hwWriteConfig(__adr, __value) ( __value = __value)
|
|
||||||
#define hwReadConfig(__adr) (0)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable all interrupts.
|
* Disable all interrupts.
|
||||||
|
|||||||
Reference in New Issue
Block a user