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>
|
2022-06-05 14:50:06 +00:00
|
|
|
|
2022-04-27 09:05:08 +00:00
|
|
|
#ifdef RV3028_RTC
|
|
|
|
#include "Melopero_RV3028.h"
|
|
|
|
#endif
|
2022-04-28 06:18:03 +00:00
|
|
|
#ifdef PCF8563_RTC
|
|
|
|
#include "pcf8563.h"
|
|
|
|
#endif
|
2022-04-27 09:05:08 +00:00
|
|
|
|
2020-02-01 16:30:53 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Version
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
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-12-10 03:28:15 +00:00
|
|
|
#error APP_VERSION must be set by the build environment
|
|
|
|
#endif
|
|
|
|
|
2022-03-20 10:53:37 +00:00
|
|
|
// FIXME: This is still needed by the Bluetooth Stack and needs to be replaced by something better. Remnant of the old versioning system.
|
2020-12-10 03:28:15 +00:00
|
|
|
#ifndef HW_VERSION
|
2022-03-20 10:53:37 +00:00
|
|
|
#define HW_VERSION "1.0"
|
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-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
|
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
|
2020-02-01 16:30:53 +00:00
|
|
|
|
2020-05-13 00:57:51 +00:00
|
|
|
/// 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
|
2020-02-01 16:30:53 +00:00
|
|
|
|
2020-05-13 00:57:51 +00:00
|
|
|
/// 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")
|
|
|
|
|
2022-07-31 12:11:47 +00:00
|
|
|
// Nop definition for these attributes that are specific to ESP32
|
|
|
|
#ifndef EXT_RAM_ATTR
|
|
|
|
#define EXT_RAM_ATTR
|
2020-09-28 20:10:27 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef IRAM_ATTR
|
|
|
|
#define IRAM_ATTR
|
2022-01-07 06:57:29 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef RTC_DATA_ATTR
|
|
|
|
#define RTC_DATA_ATTR
|
2020-09-05 00:23:17 +00:00
|
|
|
#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-06-22 07:52:08 +00:00
|
|
|
// #define DISABLE_NTP
|
2022-04-14 02:23:35 +00:00
|
|
|
|
2022-04-14 22:51:48 +00:00
|
|
|
// Disable the welcome screen and allow
|
2022-08-11 19:24:35 +00:00
|
|
|
//#define DISABLE_WELCOME_UNSET
|
2022-04-14 04:59:25 +00:00
|
|
|
|
2020-05-10 19:33:17 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2022-03-28 14:55:58 +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
|
|
|
|
2020-06-14 08:28:23 +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-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
|
|
|
|
2022-03-28 14:55:58 +00:00
|
|
|
// The m5stack I2C Keyboard (also RAK14004)
|
|
|
|
#define CARDKB_ADDR 0x5F
|
|
|
|
|
2022-06-05 14:50:06 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// SENSOR
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define BME_ADDR 0x76
|
|
|
|
#define BME_ADDR_ALTERNATE 0x77
|
|
|
|
#define MCP9808_ADDR 0x18
|
2022-06-11 21:44:56 +00:00
|
|
|
#define INA_ADDR 0x40
|
|
|
|
#define INA_ADDR_ALTERNATE 0x41
|
2022-10-07 11:57:55 +00:00
|
|
|
#define QMC6310_ADDR 0x1C
|
|
|
|
#define QMI8658_ADDR 0x6B
|
2020-05-10 19:33:17 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// GPS
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define GPS_BAUDRATE 9600
|
|
|
|
|
2022-04-02 10:52:50 +00:00
|
|
|
#ifndef GPS_THREAD_INTERVAL
|
|
|
|
#define GPS_THREAD_INTERVAL 100
|
|
|
|
#endif
|
|
|
|
|
2022-07-31 12:11:47 +00:00
|
|
|
/* Step #1: offer chance for variant-specific defines */
|
|
|
|
#include "variant.h"
|
2022-02-02 18:41:07 +00:00
|
|
|
|
2022-07-31 12:11:47 +00:00
|
|
|
/* Step #2: follow with defines common to the architecture;
|
|
|
|
also enable HAS_ option not specifically disabled by variant.h */
|
|
|
|
#include "architecture.h"
|
2020-02-04 04:18:36 +00:00
|
|
|
|
2022-07-31 12:11:47 +00:00
|
|
|
/* Step #3: mop up with disabled values for HAS_ options not handled by the above two */
|
2021-05-11 01:44:41 +00:00
|
|
|
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef HAS_WIFI
|
|
|
|
#define HAS_WIFI 0
|
2021-05-11 01:44:41 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef HAS_SCREEN
|
|
|
|
#define HAS_SCREEN 0
|
2021-05-11 01:44:41 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef HAS_WIRE
|
|
|
|
#define HAS_WIRE 0
|
2020-05-10 19:33:17 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifndef HAS_GPS
|
|
|
|
#define HAS_GPS 0
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_BUTTON
|
|
|
|
#define HAS_BUTTON 0
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_TELEMETRY
|
|
|
|
#define HAS_TELEMETRY 0
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_RADIO
|
|
|
|
#define HAS_RADIO 0
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_RTC
|
|
|
|
#define HAS_RTC 0
|
2020-02-01 22:23:21 +00:00
|
|
|
#endif
|
|
|
|
|
2022-01-19 00:35:42 +00:00
|
|
|
#include "RF95Configuration.h"
|
2022-03-20 10:53:37 +00:00
|
|
|
#include "DebugConfiguration.h"
|
2022-07-31 12:11:47 +00:00
|
|
|
|
|
|
|
#ifndef HW_VENDOR
|
|
|
|
#error HW_VENDOR must be defined
|
|
|
|
#endif
|