Update TTN_OTTA example ,support T-Motion
This commit is contained in:
parent
a7bcd27c26
commit
a8b695cbab
3 changed files with 78 additions and 4 deletions
|
|
@ -1,7 +1,10 @@
|
|||
|
||||
#include "boards.h"
|
||||
|
||||
#ifdef HAS_SDCARD
|
||||
SPIClass SDSPI(HSPI);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAS_DISPLAY
|
||||
#include <U8g2lib.h>
|
||||
|
|
@ -82,17 +85,48 @@ void disablePeripherals()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef STM32L073xx
|
||||
HardwareSerial Serial1(GPS_RX_PIN, GPS_TX_PIN);
|
||||
#ifndef USBCON
|
||||
HardwareSerial DebugSerial(UART_RX_PIN, UART_TX_PIN);
|
||||
#define Serial DebugSerial
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void initBoard()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("initBoard");
|
||||
SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN);
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
|
||||
#ifdef STM32L073xx
|
||||
SPI.setMISO(RADIO_MISO_PIN);
|
||||
SPI.setMOSI(RADIO_MOSI_PIN);
|
||||
SPI.setSCLK(RADIO_SCLK_PIN);
|
||||
SPI.begin();
|
||||
|
||||
#if defined (I2C_SCL) && defined (I2C_SDA)
|
||||
Wire.setSCL(I2C_SCL);
|
||||
Wire.setSDA(I2C_SDA);
|
||||
Wire.begin();
|
||||
#endif
|
||||
|
||||
pinMode(RADIO_SWITCH_PIN, OUTPUT);
|
||||
pinMode(GPS_ENABLE_PIN, OUTPUT);
|
||||
|
||||
digitalWrite(RADIO_SWITCH_PIN, HIGH);
|
||||
digitalWrite(GPS_ENABLE_PIN, HIGH);
|
||||
|
||||
#ifdef HAS_GPS
|
||||
Serial1.begin(GPS_BAUD_RATE);
|
||||
#endif
|
||||
|
||||
#else
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN);
|
||||
#ifdef HAS_GPS
|
||||
Serial1.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if OLED_RST
|
||||
pinMode(OLED_RST, OUTPUT);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,22 @@ static const u1_t PROGMEM APPKEY[16] = {
|
|||
};
|
||||
|
||||
// Pin mapping
|
||||
#ifdef STM32L073xx
|
||||
const lmic_pinmap lmic_pins = {
|
||||
.nss = RADIO_CS_PIN,
|
||||
.nss = RADIO_CS_PIN,
|
||||
.rxtx = RADIO_SWITCH_PIN,
|
||||
.rst = RADIO_RST_PIN,
|
||||
.dio = {RADIO_DIO0_PIN, RADIO_DIO1_PIN, RADIO_DIO2_PIN},
|
||||
.rx_level = HIGH
|
||||
};
|
||||
#else
|
||||
const lmic_pinmap lmic_pins = {
|
||||
.nss = RADIO_CS_PIN,
|
||||
.rxtx = LMIC_UNUSED_PIN,
|
||||
.rst = RADIO_RST_PIN,
|
||||
.rst = RADIO_RST_PIN,
|
||||
.dio = {RADIO_DI0_PIN, RADIO_DIO1_PIN, RADIO_BUSY_PIN}
|
||||
};
|
||||
#endif
|
||||
|
||||
static osjob_t sendjob;
|
||||
static int spreadFactor = DR_SF7;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
// #define LILYGO_T3_V1_0
|
||||
// #define LILYGO_T3_V1_6
|
||||
// #define LILYGO_T3_V2_0
|
||||
// #define LILYGO_T_MOTION_S76G
|
||||
|
||||
// #define LILYGO_T_MOTION_S78G //Not support
|
||||
/*
|
||||
* The default LMIC_Arduino uses the 868MHz configuration,
|
||||
* you need to change the frequency,
|
||||
|
|
@ -138,6 +140,34 @@
|
|||
#define HAS_DISPLAY
|
||||
#define HAS_SDCARD
|
||||
|
||||
#elif defined(LILYGO_T_MOTION_S76G)
|
||||
#define RADIO_SCLK_PIN PB13
|
||||
#define RADIO_MISO_PIN PB14
|
||||
#define RADIO_MOSI_PIN PB15
|
||||
#define RADIO_CS_PIN PB12
|
||||
#define RADIO_RST_PIN PB10
|
||||
|
||||
#define RADIO_DIO0_PIN PB11
|
||||
#define RADIO_DIO1_PIN PC13
|
||||
#define RADIO_DIO2_PIN PB9
|
||||
#define RADIO_DIO3_PIN PB4
|
||||
#define RADIO_DIO4_PIN PB3
|
||||
#define RADIO_DIO5_PIN PA15
|
||||
|
||||
#define RADIO_SWITCH_PIN PA1 //1:Rx, 0:Tx
|
||||
|
||||
#define GPS_RST_PIN PB2
|
||||
#define GPS_RX_PIN PC11
|
||||
#define GPS_TX_PIN PC10
|
||||
#define GPS_ENABLE_PIN PC6
|
||||
#define GPS_BAUD_RATE 115200
|
||||
#define GPS_1PPS_PIN PB5
|
||||
|
||||
#define UART_RX_PIN PA10
|
||||
#define UART_TX_PIN PA9
|
||||
|
||||
#define HAS_GPS
|
||||
|
||||
#else
|
||||
#error "Please select the version you purchased in utilities.h"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue