2020-02-01 16:30:53 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
TTGO T-BEAM Tracker for The Things Network
|
|
|
|
|
|
|
|
Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com>
|
|
|
|
|
|
|
|
This code requires LMIC library by Matthijs Kooijman
|
|
|
|
https://github.com/matthijskooijman/arduino-lmic
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Version
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2020-02-07 22:52:45 +00:00
|
|
|
#define APP_NAME "Meshtastic"
|
2020-02-19 00:18:01 +00:00
|
|
|
|
|
|
|
// If app version is not specified we assume we are not being invoked by the build script
|
2020-02-14 22:00:08 +00:00
|
|
|
#ifndef APP_VERSION
|
2020-02-19 00:18:01 +00:00
|
|
|
#define APP_VERSION "0.0.0" // this def normally comes from build-all.sh
|
2020-02-14 22:00:08 +00:00
|
|
|
#endif
|
2020-02-19 00:18:01 +00:00
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Configuration
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2020-02-14 22:00:08 +00:00
|
|
|
// Select which board is being used. If the outside build environment has sent a choice, just use that
|
|
|
|
#if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32)
|
2020-02-23 16:53:52 +00:00
|
|
|
//#define T_BEAM_V10 // AKA Rev1 (second board released)
|
|
|
|
#define HELTEC_LORA32
|
2020-02-19 00:18:01 +00:00
|
|
|
|
|
|
|
#define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the correct build
|
2020-02-14 22:00:08 +00:00
|
|
|
#endif
|
2020-02-01 16:30:53 +00:00
|
|
|
|
2020-02-04 04:18:36 +00:00
|
|
|
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
2020-02-06 06:13:27 +00:00
|
|
|
// we don't support jtag on the ttgo - access to gpio 12 is a PITA
|
|
|
|
#ifdef HELTEC_LORA32
|
2020-02-07 05:26:40 +00:00
|
|
|
//#define USE_JTAG
|
2020-02-06 06:13:27 +00:00
|
|
|
#endif
|
2020-02-04 04:18:36 +00:00
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
#define DEBUG_PORT Serial // Serial debug port
|
|
|
|
#define SERIAL_BAUD 115200 // Serial debug baud rate
|
2020-02-03 02:33:46 +00:00
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
#define REQUIRE_RADIO true // If true, we will fail to start if the radio is not found
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// DEBUG
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifdef DEBUG_PORT
|
|
|
|
#define DEBUG_MSG(...) DEBUG_PORT.printf( __VA_ARGS__ )
|
|
|
|
#else
|
|
|
|
#define DEBUG_MSG(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// OLED
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define SSD1306_ADDRESS 0x3C
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// GPS
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define GPS_SERIAL_NUM 1
|
|
|
|
#define GPS_BAUDRATE 9600
|
|
|
|
|
2020-02-01 16:59:16 +00:00
|
|
|
#if defined(T_BEAM_V10)
|
2020-02-01 16:30:53 +00:00
|
|
|
#define GPS_RX_PIN 34
|
2020-02-04 04:18:36 +00:00
|
|
|
#ifdef USE_JTAG
|
2020-02-06 16:18:20 +00:00
|
|
|
#define GPS_TX_PIN -1
|
2020-02-04 04:18:36 +00:00
|
|
|
#else
|
2020-02-01 16:30:53 +00:00
|
|
|
#define GPS_TX_PIN 12
|
|
|
|
#endif
|
2020-02-04 04:18:36 +00:00
|
|
|
#endif
|
2020-02-01 16:30:53 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// LoRa SPI
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define SCK_GPIO 5
|
|
|
|
#define MISO_GPIO 19
|
|
|
|
#define MOSI_GPIO 27
|
|
|
|
#define NSS_GPIO 18
|
2020-02-01 22:23:21 +00:00
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
#if defined(T_BEAM_V10)
|
2020-02-04 04:18:36 +00:00
|
|
|
#define HW_VENDOR "TTGO"
|
2020-02-01 22:23:21 +00:00
|
|
|
|
2020-02-09 02:49:15 +00:00
|
|
|
#define BICOLOR_DISPLAY // we have yellow at the top 16 lines
|
|
|
|
|
2020-02-01 22:23:21 +00:00
|
|
|
#define I2C_SDA 21
|
|
|
|
#define I2C_SCL 22
|
|
|
|
|
|
|
|
#define BUTTON_PIN 38
|
|
|
|
|
2020-02-05 23:37:58 +00:00
|
|
|
#ifndef USE_JTAG
|
2020-02-01 16:30:53 +00:00
|
|
|
#define RESET_GPIO 14
|
2020-02-05 23:37:58 +00:00
|
|
|
#endif
|
2020-02-01 16:30:53 +00:00
|
|
|
#define DIO0_GPIO 26
|
|
|
|
#define DIO1_GPIO 33 // Note: not really used on this board
|
|
|
|
#define DIO2_GPIO 32 // Note: not really used on this board
|
2020-02-12 17:13:49 +00:00
|
|
|
|
|
|
|
// Leave undefined to disable our PMU IRQ handler
|
2020-02-01 22:23:21 +00:00
|
|
|
#define PMU_IRQ 35
|
|
|
|
|
|
|
|
#elif defined(HELTEC_LORA32)
|
2020-02-04 04:18:36 +00:00
|
|
|
#define HW_VENDOR "Heltec"
|
|
|
|
|
2020-02-04 15:31:32 +00:00
|
|
|
#ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag
|
2020-02-01 22:23:21 +00:00
|
|
|
#define I2C_SDA 4
|
|
|
|
#define I2C_SCL 15
|
2020-02-04 15:31:32 +00:00
|
|
|
#endif
|
2020-02-01 22:23:21 +00:00
|
|
|
|
|
|
|
#define RESET_OLED 16
|
|
|
|
|
2020-02-02 16:17:45 +00:00
|
|
|
#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost
|
2020-02-01 22:23:21 +00:00
|
|
|
#define LED_PIN 25
|
|
|
|
#define BUTTON_PIN 0
|
|
|
|
|
2020-02-05 23:37:58 +00:00
|
|
|
#ifndef USE_JTAG
|
2020-02-01 22:23:21 +00:00
|
|
|
#define RESET_GPIO 14
|
2020-02-05 23:37:58 +00:00
|
|
|
#endif
|
2020-02-02 03:09:17 +00:00
|
|
|
#define DIO0_GPIO 26
|
|
|
|
#define DIO1_GPIO 35
|
|
|
|
#define DIO2_GPIO 34
|
2020-02-01 22:23:21 +00:00
|
|
|
#endif
|
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// AXP192 (Rev1-specific options)
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// #define AXP192_SLAVE_ADDRESS 0x34 // Now defined in axp20x.h
|
|
|
|
#define GPS_POWER_CTRL_CH 3
|
|
|
|
#define LORA_POWER_CTRL_CH 2
|
2020-02-01 22:23:21 +00:00
|
|
|
|