Skip to content

Commit

Permalink
Added RAK11200 board variant support (meshtastic#1177)
Browse files Browse the repository at this point in the history
* Added RAK11200 board variant support
  • Loading branch information
thebentern authored Feb 2, 2022
1 parent b21b7de commit 365120e
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
39 changes: 39 additions & 0 deletions boards/wiscore_rak11200.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"build": {
"arduino":{
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32",
"variant": "WisCore_RAK11200_Board"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"frameworks": [
"arduino",
"espidf"
],
"name": "WisCore RAK11200 Board",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"protocols": [
"esptool",
"espota",
"ftdi"
],
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.rakwireless.com",
"vendor": "RAKwireless"
}
4 changes: 4 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_DIY_V1

#elif defined(RAK_11200)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_RAK11200

#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)

#ifdef HELTEC_V2_0
Expand Down
5 changes: 5 additions & 0 deletions variants/WisCore_RAK11200_Board/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[env:rak11200]
extends = esp32_base
board = wiscore_rak11200
build_flags =
${esp32_base.build_flags} -D RAK_11200 -I variants/WisCore_RAK11200_Board
80 changes: 80 additions & 0 deletions variants/WisCore_RAK11200_Board/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#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;

/* -------- Meshtastic pins -------- */

#define I2C_SDA SDA
#define I2C_SCL SCL

#define GPS_RX_PIN RX
#define GPS_RX_PIN TX

#define LED_PIN LED_BLUE

#define PIN_VBAT WB_A0

// https://docs.rakwireless.com/Product-Categories/WisBlock/RAK13300/

#define LORA_DIO0 26 // a No connect on the SX1262/SX1268 module
#define LORA_RESET WB_IO4 // RST for SX1276, and for SX1262/SX1268
#define LORA_DIO1 WB_IO6 // IRQ for SX1262/SX1268
#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
#define RF95_SCK SCK
#define RF95_MISO MISO
#define RF95_MOSI MOSI
#define RF95_NSS SS

#define USE_SX1262
#define SX126X_CS (RF95_NSS)// 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 */

0 comments on commit 365120e

Please sign in to comment.