Added compatibility for Adafruit FeatherESP32, generic ESP32 and ATmega2560
This commit is contained in:
parent
2c0ed89da6
commit
ec7936c8b6
47
Config.h
47
Config.h
@ -13,9 +13,13 @@
|
|||||||
#define MCU_2560 0x92
|
#define MCU_2560 0x92
|
||||||
#define MCU_ESP32 0x81
|
#define MCU_ESP32 0x81
|
||||||
|
|
||||||
#define BOARD_RNODE 0x31
|
#define BOARD_RNODE 0x31
|
||||||
#define BOARD_HMBRW 0x32
|
#define BOARD_HMBRW 0x32
|
||||||
#define BOARD_TBEAM 0x33
|
#define BOARD_TBEAM 0x33
|
||||||
|
#define BOARD_HUZZAH32 0x34
|
||||||
|
#define BOARD_GENERIC_ESP32 0x35
|
||||||
|
#define BOARD_LORA32_V2_0 0x36
|
||||||
|
#define BOARD_LORA32_V2_1 0x37
|
||||||
|
|
||||||
#define MODE_HOST 0x11
|
#define MODE_HOST 0x11
|
||||||
#define MODE_TNC 0x12
|
#define MODE_TNC 0x12
|
||||||
@ -53,7 +57,7 @@
|
|||||||
|
|
||||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||||
#define CONFIG_QUEUE_SIZE 6144
|
#define CONFIG_QUEUE_SIZE 6144
|
||||||
#define CONFIG_QUEUE_MAX_LENGTH 250
|
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||||
|
|
||||||
#define EEPROM_SIZE 4096
|
#define EEPROM_SIZE 4096
|
||||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||||
@ -67,25 +71,40 @@
|
|||||||
|
|
||||||
#define BOARD_MODEL BOARD_HMBRW
|
#define BOARD_MODEL BOARD_HMBRW
|
||||||
|
|
||||||
#define CONFIG_UART_BUFFER_SIZE 1024
|
#define CONFIG_UART_BUFFER_SIZE 768
|
||||||
#define CONFIG_QUEUE_SIZE 4096
|
#define CONFIG_QUEUE_SIZE 5120
|
||||||
#define CONFIG_QUEUE_MAX_LENGTH 80
|
#define CONFIG_QUEUE_MAX_LENGTH 24
|
||||||
|
|
||||||
#define EEPROM_SIZE 4096
|
#define EEPROM_SIZE 4096
|
||||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||||
|
|
||||||
#elif MCU_VARIANT == MCU_ESP32
|
#elif MCU_VARIANT == MCU_ESP32
|
||||||
const int pin_cs = 18;
|
|
||||||
const int pin_reset = 23;
|
|
||||||
const int pin_dio = 26;
|
|
||||||
const int pin_led_rx = 2;
|
|
||||||
const int pin_led_tx = 4;
|
|
||||||
|
|
||||||
#define BOARD_MODEL BOARD_TBEAM
|
#if BOARD_MODEL == BOARD_GENERIC_ESP32
|
||||||
|
const int pin_cs = 4;
|
||||||
|
const int pin_reset = 36;
|
||||||
|
const int pin_dio = 39;
|
||||||
|
const int pin_led_rx = 14;
|
||||||
|
const int pin_led_tx = 32;
|
||||||
|
#elif BOARD_MODEL == BOARD_TBEAM
|
||||||
|
const int pin_cs = 18;
|
||||||
|
const int pin_reset = 23;
|
||||||
|
const int pin_dio = 26;
|
||||||
|
const int pin_led_rx = 2;
|
||||||
|
const int pin_led_tx = 4;
|
||||||
|
#elif BOARD_MODEL == BOARD_HUZZAH32
|
||||||
|
const int pin_cs = 4;
|
||||||
|
const int pin_reset = 36;
|
||||||
|
const int pin_dio = 39;
|
||||||
|
const int pin_led_rx = 14;
|
||||||
|
const int pin_led_tx = 32;
|
||||||
|
#else
|
||||||
|
#error An unsupported board was selected. Cannot compile RNode firmware.
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||||
#define CONFIG_QUEUE_SIZE 6144
|
#define CONFIG_QUEUE_SIZE 6144
|
||||||
#define CONFIG_QUEUE_MAX_LENGTH 250
|
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||||
|
|
||||||
#define EEPROM_SIZE 1024
|
#define EEPROM_SIZE 1024
|
||||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||||
|
71
Makefile
71
Makefile
@ -2,29 +2,54 @@ prep:
|
|||||||
arduino-cli core update-index --config-file arduino-cli.yaml
|
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||||
arduino-cli core install unsignedio:avr
|
arduino-cli core install unsignedio:avr
|
||||||
|
|
||||||
|
prep-esp32:
|
||||||
|
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||||
|
arduino-cli core install esp32:esp32
|
||||||
|
|
||||||
|
prep-samd:
|
||||||
|
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||||
|
arduino-cli core install adafruit:samd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
firmware:
|
firmware:
|
||||||
arduino-cli compile --fqbn unsignedio:avr:rnode
|
arduino-cli compile --fqbn unsignedio:avr:rnode
|
||||||
|
|
||||||
release:
|
firmware-tbeam:
|
||||||
arduino-cli compile --fqbn unsignedio:avr:rnode -e
|
arduino-cli compile --fqbn esp32:esp32:t-beam --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\""
|
||||||
cp build/unsignedio.avr.rnode/RNode_Firmware.ino.hex Precompiled/rnode_firmware_latest.hex
|
|
||||||
rm -r build
|
firmware-featheresp32:
|
||||||
|
arduino-cli compile --fqbn esp32:esp32:featheresp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
|
||||||
|
|
||||||
|
firmware-genericesp32:
|
||||||
|
arduino-cli compile --fqbn esp32:esp32:esp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
|
||||||
|
|
||||||
|
firmware-mega2560:
|
||||||
|
arduino-cli compile --fqbn arduino:avr:mega
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode
|
arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode
|
||||||
|
|
||||||
prep-tbeam:
|
|
||||||
arduino-cli core update-index --config-file arduino-cli.yaml
|
|
||||||
arduino-cli core install esp32:esp32
|
|
||||||
|
|
||||||
firmware-tbeam:
|
|
||||||
arduino-cli compile --fqbn esp32:esp32:t-beam
|
|
||||||
|
|
||||||
upload-tbeam:
|
upload-tbeam:
|
||||||
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam
|
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam
|
||||||
|
|
||||||
|
upload-featheresp32:
|
||||||
|
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:featheresp32
|
||||||
|
|
||||||
|
upload-mega2560:
|
||||||
|
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega
|
||||||
|
|
||||||
|
release-all: release-rnode release-tbeam release-featheresp32 release-genericesp32
|
||||||
|
|
||||||
|
release-rnode:
|
||||||
|
arduino-cli compile --fqbn unsignedio:avr:rnode -e
|
||||||
|
cp build/unsignedio.avr.rnode/RNode_Firmware.ino.hex Precompiled/rnode_firmware_latest.hex
|
||||||
|
rm -r build
|
||||||
|
|
||||||
release-tbeam:
|
release-tbeam:
|
||||||
arduino-cli compile --fqbn esp32:esp32:t-beam -e
|
arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\""
|
||||||
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_tbeam.boot_app0
|
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_tbeam.boot_app0
|
||||||
cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bin build/rnode_firmware_latest_tbeam.bin
|
cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bin build/rnode_firmware_latest_tbeam.bin
|
||||||
cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_tbeam.bootloader
|
cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_tbeam.bootloader
|
||||||
@ -32,13 +57,25 @@ release-tbeam:
|
|||||||
zip --junk-paths ./Precompiled/rnode_firmware_latest_tbeam.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_tbeam.boot_app0 build/rnode_firmware_latest_tbeam.bin build/rnode_firmware_latest_tbeam.bootloader build/rnode_firmware_latest_tbeam.partitions
|
zip --junk-paths ./Precompiled/rnode_firmware_latest_tbeam.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_tbeam.boot_app0 build/rnode_firmware_latest_tbeam.bin build/rnode_firmware_latest_tbeam.bootloader build/rnode_firmware_latest_tbeam.partitions
|
||||||
rm -r build
|
rm -r build
|
||||||
|
|
||||||
firmware-mega2560:
|
release-featheresp32:
|
||||||
arduino-cli compile --fqbn arduino:avr:mega
|
arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
|
||||||
|
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_featheresp32.boot_app0
|
||||||
|
cp build/esp32.esp32.featheresp32/RNode_Firmware.ino.bin build/rnode_firmware_latest_featheresp32.bin
|
||||||
|
cp build/esp32.esp32.featheresp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_featheresp32.bootloader
|
||||||
|
cp build/esp32.esp32.featheresp32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_featheresp32.partitions
|
||||||
|
zip --junk-paths ./Precompiled/rnode_firmware_latest_featheresp32.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_featheresp32.boot_app0 build/rnode_firmware_latest_featheresp32.bin build/rnode_firmware_latest_featheresp32.bootloader build/rnode_firmware_latest_featheresp32.partitions
|
||||||
|
rm -r build
|
||||||
|
|
||||||
|
release-genericesp32:
|
||||||
|
arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
|
||||||
|
cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/boot_app0.bin build/rnode_firmware_latest_esp32_generic.boot_app0
|
||||||
|
cp build/esp32.esp32.esp32/RNode_Firmware.ino.bin build/rnode_firmware_latest_esp32_generic.bin
|
||||||
|
cp build/esp32.esp32.esp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_latest_esp32_generic.bootloader
|
||||||
|
cp build/esp32.esp32.esp32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_latest_esp32_generic.partitions
|
||||||
|
zip --junk-paths ./Precompiled/rnode_firmware_latest_esp32_generic.zip ./Precompiled/esptool/esptool.py build/rnode_firmware_latest_esp32_generic.boot_app0 build/rnode_firmware_latest_esp32_generic.bin build/rnode_firmware_latest_esp32_generic.bootloader build/rnode_firmware_latest_esp32_generic.partitions
|
||||||
|
rm -r build
|
||||||
|
|
||||||
release-mega2560:
|
release-mega2560:
|
||||||
arduino-cli compile --fqbn arduino:avr:mega -e
|
arduino-cli compile --fqbn arduino:avr:mega -e
|
||||||
cp build/arduino.avr.mega/RNode_Firmware.ino.hex Precompiled/rnode_firmware_latest_m2560.hex
|
cp build/arduino.avr.mega/RNode_Firmware.ino.hex Precompiled/rnode_firmware_latest_m2560.hex
|
||||||
rm -r build
|
rm -r build
|
||||||
|
|
||||||
upload-mega2560:
|
|
||||||
arduino-cli upload -p /dev/ttyUSB0 --fqbn arduino:avr:mega
|
|
@ -65,8 +65,11 @@ void setup() {
|
|||||||
LoRa.setPins(pin_cs, pin_reset, pin_dio);
|
LoRa.setPins(pin_cs, pin_reset, pin_dio);
|
||||||
|
|
||||||
#if MCU_VARIANT == MCU_ESP32
|
#if MCU_VARIANT == MCU_ESP32
|
||||||
Wire.begin(I2C_SDA, I2C_SCL);
|
#if BOARD_MODEL == BOARD_TBEAM
|
||||||
initPMU();
|
Wire.begin(I2C_SDA, I2C_SCL);
|
||||||
|
initPMU();
|
||||||
|
#endif
|
||||||
|
|
||||||
kiss_indicate_reset();
|
kiss_indicate_reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -645,11 +648,17 @@ void checkModemStatus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void validateStatus() {
|
void validateStatus() {
|
||||||
#if MCU_VARIANT == MCU_1284P || MCU_VARIANT == MCU_2560
|
#if MCU_VARIANT == MCU_1284P
|
||||||
uint8_t boot_flags = OPTIBOOT_MCUSR;
|
uint8_t boot_flags = OPTIBOOT_MCUSR;
|
||||||
uint8_t F_POR = PORF;
|
uint8_t F_POR = PORF;
|
||||||
uint8_t F_BOR = BORF;
|
uint8_t F_BOR = BORF;
|
||||||
uint8_t F_WDR = WDRF;
|
uint8_t F_WDR = WDRF;
|
||||||
|
#elif MCU_VARIANT == MCU_2560
|
||||||
|
uint8_t boot_flags = OPTIBOOT_MCUSR;
|
||||||
|
if (boot_flags == 0x00) boot_flags = 0x03;
|
||||||
|
uint8_t F_POR = PORF;
|
||||||
|
uint8_t F_BOR = BORF;
|
||||||
|
uint8_t F_WDR = WDRF;
|
||||||
#elif MCU_VARIANT == MCU_ESP32
|
#elif MCU_VARIANT == MCU_ESP32
|
||||||
// TODO: Get ESP32 boot flags
|
// TODO: Get ESP32 boot flags
|
||||||
uint8_t boot_flags = 0x02;
|
uint8_t boot_flags = 0x02;
|
||||||
|
20
Utilities.h
20
Utilities.h
@ -36,10 +36,22 @@ uint8_t boot_vector = 0x00;
|
|||||||
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
|
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
|
||||||
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
|
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
|
||||||
#elif MCU_VARIANT == MCU_ESP32
|
#elif MCU_VARIANT == MCU_ESP32
|
||||||
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
#if BOARD_MODEL == BOARD_TBEAM
|
||||||
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||||
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
|
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||||
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
|
||||||
|
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
||||||
|
#elif BOARD_MODEL == BOARD_HUZZAH32
|
||||||
|
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||||
|
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||||
|
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
|
||||||
|
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
|
||||||
|
#elif BOARD_MODEL == BOARD_GENERIC_ESP32
|
||||||
|
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||||
|
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||||
|
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
|
||||||
|
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void hard_reset(void) {
|
void hard_reset(void) {
|
||||||
|
@ -2,3 +2,4 @@ board_manager:
|
|||||||
additional_urls:
|
additional_urls:
|
||||||
- https://unsigned.io/arduino/package_unsignedio_UnsignedBoards_index.json
|
- https://unsigned.io/arduino/package_unsignedio_UnsignedBoards_index.json
|
||||||
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
||||||
|
- https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
|
||||||
|
Loading…
Reference in New Issue
Block a user