From d79dc631f1ef719161a7944aa491cbbb7cc335c7 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 10 Feb 2022 20:21:36 -0600 Subject: [PATCH] Fixed RAK11200 configuration and added to build-all (#1192) * Fixed RAK11200 configuration and added to build-all Co-authored-by: Mike Kinney --- .github/workflows/main.yml | 4 ++ bin/build-all.sh | 5 +- bin/check-all.sh | 4 +- variants/rak11200/pins_arduino.h | 46 +++++++++++++++++++ .../platformio.ini | 2 +- .../variant.h | 16 ++++--- 6 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 variants/rak11200/pins_arduino.h rename variants/{WisCore_RAK11200_Board => rak11200}/platformio.ini (50%) rename variants/{WisCore_RAK11200_Board => rak11200}/variant.h (90%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82f946a45..505ffcafb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -121,6 +121,10 @@ jobs: echo "Simulator started, launching python test..." python3 -c 'from meshtastic.test import testSimulator; testSimulator()' + - name: Cat bin/build-all.sh + run: | + cat bin/build-all.sh + - name: Build everything run: bin/build-all.sh diff --git a/bin/build-all.sh b/bin/build-all.sh index dec3bd2f6..ed537f8f4 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -5,7 +5,7 @@ set -e VERSION=`bin/buildinfo.py long` SHORT_VERSION=`bin/buildinfo.py short` -BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1" +BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1" #BOARDS_ESP32=tbeam # FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine @@ -28,7 +28,7 @@ function do_build() { BOARD=$1 isNrf=$3 - echo "Building for $BOARD with $PLATFORMIO_BUILD_FLAGS" + echo "Building for $BOARD ($isNrf) with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$BOARD/firmware.* # The shell vars the build tool expects to find @@ -59,6 +59,7 @@ function do_boards() { declare isNrf=$2 for board in $boards; do # Build universal + echo "about to build $board $isNrf" do_build $board "" "$isNrf" done } diff --git a/bin/check-all.sh b/bin/check-all.sh index d14f9057b..dde1dd3b1 100755 --- a/bin/check-all.sh +++ b/bin/check-all.sh @@ -13,10 +13,10 @@ if [[ $# -gt 0 ]]; then # can override which environment by passing arg BOARDS="$@" else - BOARDS="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 rak4631_5005 rak4631_19003 t-echo" + BOARDS="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 rak4631_5005 rak4631_19003 rak11200 t-echo" fi -#echo "BOARDS:${BOARDS}" +echo "BOARDS:${BOARDS}" CHECK="" for BOARD in $BOARDS; do diff --git a/variants/rak11200/pins_arduino.h b/variants/rak11200/pins_arduino.h new file mode 100644 index 000000000..a85faaa7f --- /dev/null +++ b/variants/rak11200/pins_arduino.h @@ -0,0 +1,46 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 40 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1) +#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1) +#define digitalPinHasPWM(p) (p < 34) + +#define LED_GREEN 12 +#define LED_BLUE 2 + +#define LED_BUILTIN LED_GREEN + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +#define TX1 21 +#define RX1 19 + +#define WB_IO1 14 +#define WB_IO2 27 +#define WB_IO3 26 +#define WB_IO4 23 +#define WB_IO5 13 +#define WB_IO6 22 +#define WB_SW1 34 +#define WB_A0 36 +#define WB_A1 39 +#define WB_CS 32 +#define WB_LED1 12 +#define WB_LED2 2 + +static const uint8_t SDA = 4; +static const uint8_t SCL = 5; + +static const uint8_t SS = 32; +static const uint8_t MOSI = 25; +static const uint8_t MISO = 35; +static const uint8_t SCK = 33; + +#endif /* Pins_Arduino_h */ diff --git a/variants/WisCore_RAK11200_Board/platformio.ini b/variants/rak11200/platformio.ini similarity index 50% rename from variants/WisCore_RAK11200_Board/platformio.ini rename to variants/rak11200/platformio.ini index affb8908c..96e155e21 100644 --- a/variants/WisCore_RAK11200_Board/platformio.ini +++ b/variants/rak11200/platformio.ini @@ -2,4 +2,4 @@ extends = esp32_base board = wiscore_rak11200 build_flags = - ${esp32_base.build_flags} -D RAK_11200 -I variants/WisCore_RAK11200_Board \ No newline at end of file + ${esp32_base.build_flags} -D RAK_11200 -I variants/rak11200 diff --git a/variants/WisCore_RAK11200_Board/variant.h b/variants/rak11200/variant.h similarity index 90% rename from variants/WisCore_RAK11200_Board/variant.h rename to variants/rak11200/variant.h index 7cd5d0892..6886a3ad3 100644 --- a/variants/WisCore_RAK11200_Board/variant.h +++ b/variants/rak11200/variant.h @@ -42,14 +42,16 @@ static const uint8_t SS = 32; static const uint8_t MOSI = 25; static const uint8_t MISO = 35; static const uint8_t SCK = 33; +#endif /* Pins_Arduino_h */ /* -------- Meshtastic pins -------- */ - #define I2C_SDA SDA #define I2C_SCL SCL -#define GPS_RX_PIN RX -#define GPS_RX_PIN TX +#undef GPS_RX_PIN +#define GPS_RX_PIN (RX1) +#undef GPS_TX_PIN +#define GPS_TX_PIN (TX1) #define LED_PIN LED_BLUE @@ -63,18 +65,20 @@ static const uint8_t SCK = 33; #define LORA_DIO2 WB_IO5 // BUSY for SX1262/SX1268 #define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled -// This is a hack for the radio pin run-around with ESP32 variants +#undef RF95_SCK #define RF95_SCK SCK +#undef RF95_MISO #define RF95_MISO MISO +#undef RF95_MOSI #define RF95_MOSI MOSI +#undef RF95_NSS #define RF95_NSS SS #define USE_SX1262 -#define SX126X_CS (RF95_NSS)// NSS for SX126X +#define SX126X_CS (SS)// NSS for SX126X #define SX126X_DIO1 (LORA_DIO1) #define SX126X_BUSY (LORA_DIO2) #define SX126X_RESET (LORA_RESET) #define SX126X_TXEN (-1) #define SX126X_RXEN (WB_IO3) #define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 -#endif /* Pins_Arduino_h */