Skip to content

Commit e2ac85a

Browse files
tekka007henrikekblad
authored andcommitted
Reshuffle arch files (#974)
1 parent b892aef commit e2ac85a

24 files changed

+114
-44
lines changed

MySensors.h

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,40 @@
4141
#include <Arduino.h>
4242
#endif
4343

44+
// general macros
45+
#if !defined(_BV)
46+
#define _BV(x) (1<<(x)) //!< _BV
47+
#endif
48+
4449
#include "MyConfig.h"
4550
#include "core/MySplashScreen.h"
4651
#include "core/MySensorsCore.h"
4752

48-
// OTA Debug, have to defined before HAL
53+
// OTA Debug, has to be defined before HAL
4954
#if defined(MY_OTA_LOG_SENDER_FEATURE) || defined(MY_OTA_LOG_RECEIVER_FEATURE)
5055
#include "core/MyOTALogging.h"
5156
#endif
5257

5358
// HARDWARE
59+
#include "hal/architecture/MyHw.h"
5460
#if defined(ARDUINO_ARCH_ESP8266)
55-
#include "hal/architecture/MyHwESP8266.cpp"
61+
#include "hal/architecture/ESP8266/MyHwESP8266.cpp"
5662
#elif defined(ARDUINO_ARCH_AVR)
5763
#include "drivers/AVR/DigitalWriteFast/digitalWriteFast.h"
58-
#include "hal/architecture/MyHwAVR.cpp"
64+
#include "hal/architecture/AVR/MyHwAVR.cpp"
5965
#elif defined(ARDUINO_ARCH_SAMD)
6066
#include "drivers/extEEPROM/extEEPROM.cpp"
61-
#include "hal/architecture/MyHwSAMD.cpp"
67+
#include "hal/architecture/SAMD/MyHwSAMD.cpp"
6268
#elif defined(ARDUINO_ARCH_STM32F1)
63-
#include "hal/architecture/MyHwSTM32F1.cpp"
69+
#include "hal/architecture/STM32F1/MyHwSTM32F1.cpp"
6470
#elif defined(ARDUINO_ARCH_NRF5) || defined(ARDUINO_ARCH_NRF52)
6571
#include "drivers/NVM/VirtualPage.cpp"
6672
#include "drivers/NVM/NVRAM.cpp"
67-
#include "hal/architecture/MyHwNRF5.cpp"
73+
#include "hal/architecture/NRF5/MyHwNRF5.cpp"
6874
#elif defined(__arm__) && defined(TEENSYDUINO)
69-
#include "hal/architecture/MyHwTeensy3.cpp"
75+
#include "hal/architecture/Teensy3/MyHwTeensy3.cpp"
7076
#elif defined(__linux__)
71-
#include "hal/architecture/MyHwLinuxGeneric.cpp"
77+
#include "hal/architecture/Linux/MyHwLinuxGeneric.cpp"
7278
#endif
7379

7480
// OTA Debug second part, depends on HAL
@@ -130,7 +136,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
130136

131137
// GATEWAY - TRANSPORT
132138
#if defined(MY_CONTROLLER_IP_ADDRESS) || defined(MY_CONTROLLER_URL_ADDRESS)
133-
#define MY_GATEWAY_CLIENT_MODE
139+
#define MY_GATEWAY_CLIENT_MODE //!< gateway client mode
134140
#endif
135141

136142
#if defined(MY_USE_UDP) && !defined(MY_GATEWAY_CLIENT_MODE)
@@ -248,7 +254,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
248254

249255
// SANITY CHECK
250256
#if defined(MY_REPEATER_FEATURE) || defined(MY_GATEWAY_FEATURE)
251-
#define MY_TRANSPORT_SANITY_CHECK
257+
#define MY_TRANSPORT_SANITY_CHECK //!< enable regular transport sanity checks
252258
#endif
253259

254260
// TRANSPORT INCLUDES
@@ -268,7 +274,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
268274
// RAM ROUTING TABLE
269275
#if defined(MY_RAM_ROUTING_TABLE_FEATURE) && defined(MY_REPEATER_FEATURE)
270276
// activate feature based on architecture
271-
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_NRF5) || defined(__linux__)
277+
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_NRF5) || defined(ARDUINO_ARCH_STM32F1) || defined(TEENSYDUINO) || defined(__linux__)
272278
#define MY_RAM_ROUTING_TABLE_ENABLED
273279
#elif defined(ARDUINO_ARCH_AVR)
274280
#if defined(__avr_atmega1280__) || defined(__avr_atmega1284__) || defined(__avr_atmega2560__)
@@ -306,7 +312,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
306312
#include "drivers/RF24/RF24.cpp"
307313
#include "hal/transport/MyTransportRF24.cpp"
308314
#elif defined(MY_RADIO_NRF5_ESB)
309-
#if !defined(ARDUINO_ARCH_NRF5)
315+
#if !defined(ARDUINO_ARCH_NRF5)
310316
#error No support for nRF5 radio on this platform
311317
#endif
312318
#if defined(MY_NRF5_ESB_ENABLE_ENCRYPTION)
@@ -382,16 +388,20 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
382388

383389
// HW mains
384390
#if !defined(MY_CORE_ONLY)
385-
#if defined(ARDUINO_ARCH_ESP8266)
386-
#include "hal/architecture/MyMainESP8266.cpp"
391+
#if defined(ARDUINO_ARCH_AVR)
392+
#include "hal/architecture/AVR/MyMainAVR.cpp"
393+
#elif defined(ARDUINO_ARCH_SAMD)
394+
#include "hal/architecture/SAMD/MyMainSAMD.cpp"
395+
#elif defined(ARDUINO_ARCH_ESP8266)
396+
#include "hal/architecture/ESP8266/MyMainESP8266.cpp"
397+
#elif defined(ARDUINO_ARCH_NRF5)
398+
#include "hal/architecture/NRF5/MyMainNRF5.cpp"
387399
#elif defined(__linux__)
388-
#include "hal/architecture/MyMainLinux.cpp"
400+
#include "hal/architecture/Linux/MyMainLinux.cpp"
389401
#elif defined(ARDUINO_ARCH_STM32F1)
390-
#include "hal/architecture/MyMainSTM32F1.cpp"
402+
#include "hal/architecture/STM32F1/MyMainSTM32F1.cpp"
391403
#elif defined(TEENSYDUINO)
392-
#include "hal/architecture/MyMainTeensy3.cpp"
393-
#else
394-
#include "hal/architecture/MyMainDefault.cpp"
404+
#include "hal/architecture/Teensy3/MyMainTeensy3.cpp"
395405
#endif
396406
#endif
397407

drivers/NRF5/Radio_ESB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "Radio.h"
2323
#include "Radio_ESB.h"
24-
#include "hal/architecture/MyHwNRF5.h"
24+
#include "hal/architecture/NRF5/MyHwNRF5.h"
2525
#include "drivers/CircularBuffer/CircularBuffer.h"
2626
#include <stdio.h>
2727

drivers/RF24/RF24.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ _SPI;
105105
#include <stdio.h>
106106
#include <string.h>
107107

108-
#if !defined(_BV)
109-
#define _BV(x) (1<<(x)) //!< _BV()
110-
#endif
111-
112108
#if defined(__arm__) || defined(__linux__)
113109
#include <SPI.h>
114110
#else
File renamed without changes.

hal/architecture/MyHwAVR.h renamed to hal/architecture/AVR/MyHwAVR.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* The MySensors Arduino library handles the wireless radio link and protocol
33
* between your home built sensors/actuators and HA controller of choice.
44
* The sensors forms a self healing radio network with optional repeaters. Each
@@ -20,7 +20,6 @@
2020
#ifndef MyHwAVR_h
2121
#define MyHwAVR_h
2222

23-
#include "MyHw.h"
2423
#include <avr/eeprom.h>
2524
#include <avr/pgmspace.h>
2625
#include <avr/sleep.h>

hal/architecture/AVR/MyMainAVR.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* The MySensors Arduino library handles the wireless radio link and protocol
3+
* between your home built sensors/actuators and HA controller of choice.
4+
* The sensors forms a self healing radio network with optional repeaters. Each
5+
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
6+
* network topology allowing messages to be routed to nodes.
7+
*
8+
* Created by Henrik Ekblad <[email protected]>
9+
* Copyright (C) 2013-2017 Sensnology AB
10+
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
11+
*
12+
* Documentation: http://www.mysensors.org
13+
* Support Forum: http://forum.mysensors.org
14+
*
15+
* This program is free software; you can redistribute it and/or
16+
* modify it under the terms of the GNU General Public License
17+
* version 2 as published by the Free Software Foundation.
18+
*/
19+
20+
// Initialize library and handle sketch functions like we want to
21+
22+
int main(void)
23+
{
24+
init();
25+
#if defined(USBCON)
26+
USBDevice.attach();
27+
#endif
28+
_begin(); // Startup MySensors library
29+
for(;;) {
30+
_process(); // Process incoming data
31+
if (loop) {
32+
loop(); // Call sketch loop
33+
}
34+
if (serialEventRun) {
35+
serialEventRun();
36+
}
37+
}
38+
return 0;
39+
}

hal/architecture/MyHwESP8266.h renamed to hal/architecture/ESP8266/MyHwESP8266.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* The MySensors Arduino library handles the wireless radio link and protocol
33
* between your home built sensors/actuators and HA controller of choice.
44
* The sensors forms a self healing radio network with optional repeaters. Each
@@ -19,8 +19,6 @@
1919
#ifndef MyHwESP8266_h
2020
#define MyHwESP8266_h
2121

22-
#include "MyHw.h"
23-
2422
#ifdef __cplusplus
2523
#include <Arduino.h>
2624
#endif

0 commit comments

Comments
 (0)