firmware/src/configuration.h

289 lines
7.9 KiB
C
Raw Normal View History

/*
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>
#ifdef RV3028_RTC
#include "Melopero_RV3028.h"
#endif
#ifdef PCF8563_RTC
#include "pcf8563.h"
#endif
// -----------------------------------------------------------------------------
// Version
// -----------------------------------------------------------------------------
// 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
#error APP_VERSION must be set by the build environment
#endif
// FIXME: This is still needed by the Bluetooth Stack and needs to be replaced by something better. Remnant of the old versioning system.
#ifndef HW_VERSION
#define HW_VERSION "1.0"
2020-02-14 22:00:08 +00:00
#endif
// -----------------------------------------------------------------------------
// Configuration
// -----------------------------------------------------------------------------
// 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
2020-03-03 16:23:58 +00:00
#define REQUIRE_RADIO true // If true, we will fail to start if the radio is not found
/// Convert a preprocessor name into a quoted string
2020-03-03 16:23:58 +00:00
#define xstr(s) str(s)
#define str(s) #s
/// Convert a preprocessor name into a quoted string and if that string is empty use "unset"
#define optstr(s) (xstr(s)[0] ? xstr(s) : "unset")
2020-09-04 22:03:22 +00:00
#ifdef PORTDUINO
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
2020-09-05 00:23:17 +00:00
#elif defined(NRF52_SERIES) // All of the NRF52 targets are configured using variant.h, so this section shouldn't need to be
2020-09-06 23:09:07 +00:00
// board specific
2020-05-10 19:33:17 +00:00
//
// Standard definitions for NRF52 targets
//
2020-05-10 19:33:17 +00:00
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
2020-03-20 03:15:51 +00:00
2020-05-10 19:33:17 +00:00
// We bind to the GPS using variant.h instead for this platform (Serial1)
2020-05-10 19:33:17 +00:00
#define LED_PIN PIN_LED1 // LED1 on nrf52840-DK
// If the variant filed defines as standard button
#ifdef PIN_BUTTON1
2020-05-10 19:33:17 +00:00
#define BUTTON_PIN PIN_BUTTON1
2020-07-10 21:37:01 +00:00
#endif
#ifdef PIN_BUTTON2
#define BUTTON_PIN_ALT PIN_BUTTON2
#endif
#ifdef PIN_BUTTON_TOUCH
#define BUTTON_PIN_TOUCH PIN_BUTTON_TOUCH
#endif
2020-05-10 19:33:17 +00:00
#else
//
// Standard definitions for ESP32 targets
//
#define HAS_WIFI
2020-05-10 19:33:17 +00:00
#define GPS_SERIAL_NUM 1
2020-03-03 16:23:58 +00:00
#define GPS_RX_PIN 34
#ifdef USE_JTAG
2020-03-03 16:23:58 +00:00
#define GPS_TX_PIN -1
#else
2020-03-03 16:23:58 +00:00
#define GPS_TX_PIN 12
#endif
// -----------------------------------------------------------------------------
// LoRa SPI
// -----------------------------------------------------------------------------
2020-07-10 21:37:01 +00:00
// NRF52 boards will define this in variant.h
#ifndef RF95_SCK
2020-07-10 18:02:29 +00:00
#define RF95_SCK 5
#define RF95_MISO 19
#define RF95_MOSI 27
#define RF95_NSS 18
2020-07-10 21:37:01 +00:00
#endif
2020-02-01 22:23:21 +00:00
2020-05-10 19:33:17 +00:00
#endif
2020-09-05 00:23:17 +00:00
2022-05-18 16:29:26 +00:00
#ifndef TTGO_T_ECHO
#define GPS_UBLOX
#endif
2020-09-05 00:23:17 +00:00
//
// Standard definitions for !ESP32 targets
//
#ifdef NO_ESP32
// Nop definition for these attributes - not used on NRF52
#define EXT_RAM_ATTR
#define IRAM_ATTR
#define RTC_DATA_ATTR
#endif
2020-05-10 19:33:17 +00:00
2022-04-14 02:23:35 +00:00
// -----------------------------------------------------------------------------
// Feature toggles
// -----------------------------------------------------------------------------
2022-04-14 22:51:48 +00:00
// Disable use of the NTP library and related features
2022-04-14 02:23:35 +00:00
//#define DISABLE_NTP
2022-04-14 22:51:48 +00:00
// Disable the welcome screen and allow
//#define DISABLE_WELCOME_UNSET
2022-04-14 04:59:25 +00:00
2020-05-10 19:33:17 +00:00
// -----------------------------------------------------------------------------
// OLED & Input
2020-05-10 19:33:17 +00:00
// -----------------------------------------------------------------------------
#define SSD1306_ADDRESS 0x3C
2020-10-23 10:00:43 +00:00
#define ST7567_ADDRESS 0x3F
2020-05-10 19:33:17 +00:00
// The SH1106 controller is almost, but not quite, the same as SSD1306
// Define this if you know you have that controller or your "SSD1306" misbehaves.
//#define USE_SH1106
2020-05-10 19:33:17 +00:00
// Flip the screen upside down by default as it makes more sense on T-BEAM
// devices. Comment this out to not rotate screen 180 degrees.
2020-10-24 00:16:15 +00:00
#define SCREEN_FLIP_VERTICALLY
2020-05-10 19:33:17 +00:00
2020-10-24 00:16:15 +00:00
// Define if screen should be mirrored left to right
// #define SCREEN_MIRROR
2020-05-10 19:33:17 +00:00
// The m5stack I2C Keyboard (also RAK14004)
#define CARDKB_ADDR 0x5F
// The older M5 Faces I2C Keyboard
#define FACESKB_ADDR 0x88
2020-05-10 19:33:17 +00:00
// -----------------------------------------------------------------------------
// GPS
// -----------------------------------------------------------------------------
#define GPS_BAUDRATE 9600
#ifndef GPS_THREAD_INTERVAL
#define GPS_THREAD_INTERVAL 100
#endif
#if defined(TBEAM_V10)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_TBEAM
2020-02-01 22:23:21 +00:00
#elif defined(TBEAM_V07)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_TBEAM0p7
#elif defined(DIY_V1)
// 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)
2021-05-11 01:44:41 +00:00
#ifdef HELTEC_V2_0
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC_V2_0
#endif
#ifdef HELTEC_V2_1
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC_V2_1
#endif
2021-12-30 21:16:46 +00:00
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
#define HW_VENDOR HardwareModel_HELTEC_V1
#elif defined(TLORA_V1)
#define HW_VENDOR HardwareModel_TLORA_V1
#elif defined(TLORA_V2)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_TLORA_V2
2021-02-03 01:34:50 +00:00
#elif defined(TLORA_V1_3)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-21 03:47:48 +00:00
#define HW_VENDOR HardwareModel_TLORA_V1_1p3
2021-02-03 01:34:50 +00:00
#elif defined(TLORA_V2_1_16)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-19 15:40:41 +00:00
#define HW_VENDOR HardwareModel_TLORA_V2_1_1p6
2020-12-29 15:08:11 +00:00
#elif defined(GENIEBLOCKS)
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_GENIEBLOCKS
2020-12-29 15:08:11 +00:00
#elif defined(PRIVATE_HW)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_PRIVATE_HW
2020-05-10 19:33:17 +00:00
#endif
2020-05-10 19:33:17 +00:00
#ifdef ARDUINO_NRF52840_PCA10056
// This string must exactly match the case used in release file names or the android updater won't work
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_NRF52840DK
// This board uses 0 to be mean LED on
#undef LED_INVERTED
#define LED_INVERTED 1
2020-05-10 19:33:17 +00:00
#elif defined(ARDUINO_NRF52840_PPR)
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_PPR
2020-05-10 19:33:17 +00:00
2021-04-12 05:25:55 +00:00
#elif defined(RAK4630)
#define HW_VENDOR HardwareModel_RAK4631
2021-04-29 01:51:10 +00:00
#elif defined(TTGO_T_ECHO)
#define HW_VENDOR HardwareModel_T_ECHO
#elif defined(NANO_G1)
#define HW_VENDOR HardwareModel_NANO_G1
#elif defined(NORDIC_PCA10059)
#define HW_VENDOR HardwareModel_NRF52840_PCA10059
2022-05-10 09:10:32 +00:00
#elif defined(M5STACK)
#define HW_VENDOR HardwareModel_M5STACK
#elif NRF52_SERIES
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN
#elif PORTDUINO
2021-03-14 02:48:20 +00:00
#define HW_VENDOR HardwareModel_PORTDUINO
2020-09-06 23:09:07 +00:00
2020-02-01 22:23:21 +00:00
#endif
#include "variant.h"
#include "RF95Configuration.h"
#include "DebugConfiguration.h"