Restructure HAL files (arch) (#820)

This commit is contained in:
Olivier
2017-04-17 20:33:08 +02:00
committed by Henrik Ekblad
parent b4b5eb52e8
commit 26c237adad
16 changed files with 26 additions and 28 deletions
+10 -10
View File
@@ -1,4 +1,4 @@
/* /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -84,17 +84,17 @@
// HARDWARE // HARDWARE
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#include "core/MyHwESP8266.cpp" #include "hal/architecture/MyHwESP8266.cpp"
#elif defined(ARDUINO_ARCH_AVR) #elif defined(ARDUINO_ARCH_AVR)
#include "drivers/AVR/DigitalWriteFast/digitalWriteFast.h" #include "drivers/AVR/DigitalWriteFast/digitalWriteFast.h"
#include "core/MyHwAVR.cpp" #include "hal/architecture/MyHwAVR.cpp"
#elif defined(ARDUINO_ARCH_SAMD) #elif defined(ARDUINO_ARCH_SAMD)
#include "drivers/extEEPROM/extEEPROM.cpp" #include "drivers/extEEPROM/extEEPROM.cpp"
#include "core/MyHwSAMD.cpp" #include "hal/architecture/MyHwSAMD.cpp"
#elif defined(ARDUINO_ARCH_STM32F1) #elif defined(ARDUINO_ARCH_STM32F1)
#include "core/MyHwSTM32F1.cpp" #include "hal/architecture/MyHwSTM32F1.cpp"
#elif defined(__linux__) #elif defined(__linux__)
#include "core/MyHwLinuxGeneric.cpp" #include "hal/architecture/MyHwLinuxGeneric.cpp"
#endif #endif
// LEDS // LEDS
@@ -398,13 +398,13 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
// HW mains // HW mains
#if !defined(MY_CORE_ONLY) #if !defined(MY_CORE_ONLY)
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#include "core/MyMainESP8266.cpp" #include "hal/architecture/MyMainESP8266.cpp"
#elif defined(__linux__) #elif defined(__linux__)
#include "core/MyMainLinux.cpp" #include "hal/architecture/MyMainLinux.cpp"
#elif defined(ARDUINO_ARCH_STM32F1) #elif defined(ARDUINO_ARCH_STM32F1)
#include "core/MyMainSTM32F1.cpp" #include "hal/architecture/MyMainSTM32F1.cpp"
#else #else
#include "core/MyMainDefault.cpp" #include "hal/architecture/MyMainDefault.cpp"
#endif #endif
#endif #endif
+1 -1
View File
@@ -1,4 +1,4 @@
/* /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -31,11 +31,11 @@ bool hwInit(void)
#define INVALID_INTERRUPT_NUM (0xFFu) #define INVALID_INTERRUPT_NUM (0xFFu)
volatile uint8_t _wokeUpByInterrupt = volatile uint8_t _wokeUpByInterrupt =
INVALID_INTERRUPT_NUM; // Interrupt number that woke the mcu. INVALID_INTERRUPT_NUM; // Interrupt number that woke the mcu.
volatile uint8_t _wakeUp1Interrupt = volatile uint8_t _wakeUp1Interrupt =
INVALID_INTERRUPT_NUM; // Interrupt number for wakeUp1-callback. INVALID_INTERRUPT_NUM; // Interrupt number for wakeUp1-callback.
volatile uint8_t _wakeUp2Interrupt = volatile uint8_t _wakeUp2Interrupt =
INVALID_INTERRUPT_NUM; // Interrupt number for wakeUp2-callback. INVALID_INTERRUPT_NUM; // Interrupt number for wakeUp2-callback.
void wakeUp1() void wakeUp1()
{ {
@@ -45,8 +45,7 @@ void wakeUp1()
sleep_disable(); sleep_disable();
detachInterrupt(_wakeUp1Interrupt); detachInterrupt(_wakeUp1Interrupt);
// First interrupt occurred will be reported only // First interrupt occurred will be reported only
if (INVALID_INTERRUPT_NUM == _wokeUpByInterrupt) if (INVALID_INTERRUPT_NUM == _wokeUpByInterrupt) {
{
_wokeUpByInterrupt = _wakeUp1Interrupt; _wokeUpByInterrupt = _wakeUp1Interrupt;
} }
} }
@@ -55,8 +54,7 @@ void wakeUp2()
sleep_disable(); sleep_disable();
detachInterrupt(_wakeUp2Interrupt); detachInterrupt(_wakeUp2Interrupt);
// First interrupt occurred will be reported only // First interrupt occurred will be reported only
if (INVALID_INTERRUPT_NUM == _wokeUpByInterrupt) if (INVALID_INTERRUPT_NUM == _wokeUpByInterrupt) {
{
_wokeUpByInterrupt = _wakeUp2Interrupt; _wokeUpByInterrupt = _wakeUp2Interrupt;
} }
} }
@@ -128,7 +126,7 @@ void hwInternalSleep(unsigned long ms)
ms += 15u; ms += 15u;
while (!interruptWakeUp() && ms >= 16) { while (!interruptWakeUp() && ms >= 16) {
for (uint8_t period = 9u; ;--period) { for (uint8_t period = 9u; ; --period) {
const uint16_t comparatorMS = 1 << (period + 4); const uint16_t comparatorMS = 1 << (period + 4);
if ( ms >= comparatorMS) { if ( ms >= comparatorMS) {
hwPowerDown(period); // 8192ms => 9, 16ms => 0 hwPowerDown(period); // 8192ms => 9, 16ms => 0
@@ -151,7 +149,7 @@ int8_t hwSleep(uint8_t interrupt, uint8_t mode, unsigned long ms)
} }
int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2,
unsigned long ms) unsigned long ms)
{ {
// ATMega328P supports following modes to wake from sleep: LOW, CHANGE, RISING, FALLING // ATMega328P supports following modes to wake from sleep: LOW, CHANGE, RISING, FALLING
// Datasheet states only LOW can be used with INT0/1 to wake from sleep, which is incorrect. // Datasheet states only LOW can be used with INT0/1 to wake from sleep, which is incorrect.
@@ -193,7 +191,7 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mo
} }
// Return what woke the mcu. // Return what woke the mcu.
// Default: no interrupt triggered, timer wake up // Default: no interrupt triggered, timer wake up
int8_t ret = MY_WAKE_UP_BY_TIMER; int8_t ret = MY_WAKE_UP_BY_TIMER;
if (interruptWakeUp()) { if (interruptWakeUp()) {
ret = static_cast<int8_t>(_wokeUpByInterrupt); ret = static_cast<int8_t>(_wokeUpByInterrupt);
@@ -274,7 +272,7 @@ void hwDebugPrint(const char *fmt, ... )
#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;%lu "), snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "),
C_INTERNAL, I_LOG_MESSAGE, hwMillis()); C_INTERNAL, I_LOG_MESSAGE, hwMillis());
MY_SERIALDEVICE.print(fmtBuffer); MY_SERIALDEVICE.print(fmtBuffer);
#else #else
// prepend timestamp // prepend timestamp
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each