Seeed Tracker X1 Support (#10834)
* Seeed Tracker X1 Support * silence CPPCheck * fix macro order regression and adapt stm32hal for new radiolib * STM32 is a radiolib upstream fix ( https://github.com/jgromes/RadioLib/issues/1825 ) * fix STM32 regression * Seeed Tracker X1 Support * silence CPPCheck * fix macro order regression and adapt stm32hal for new radiolib * STM32 is a radiolib upstream fix ( https://github.com/jgromes/RadioLib/issues/1825 ) * fix STM32 regression * address copilot OCD * Split behavior only when the two LEDs are on distinct pins. * bring naming in line with the other seeed devices * update env name to fit convention too * guarantee evaluation order * Guard sensor readings against null values, make sensor use less power
This commit is contained in:
co-authored by
GitHub
parent
3becaf2d95
commit
7509c1a6dd
@@ -0,0 +1,33 @@
|
||||
[env:seeed_mesh_tracker_X1]
|
||||
custom_meshtastic_support_level = 1
|
||||
custom_meshtastic_images = seeed-mesh-tracker-x1.svg
|
||||
custom_meshtastic_tags = Seeed
|
||||
custom_meshtastic_hw_model = 128
|
||||
custom_meshtastic_hw_model_slug = MESH_TRACKER_X1
|
||||
custom_meshtastic_architecture = nrf52840
|
||||
custom_meshtastic_display_name = Seeed SenseCAP Mesh-Tracker-X1
|
||||
custom_meshtastic_actively_supported = true
|
||||
|
||||
extends = nrf52840_base
|
||||
board = mesh-tracker-x1
|
||||
board_level = pr
|
||||
build_flags = ${nrf52840_base.build_flags}
|
||||
-Ivariants/nrf52840/seeed_mesh_tracker_X1
|
||||
-Isrc/platform/nrf52/softdevice
|
||||
-Isrc/platform/nrf52/softdevice/nrf52
|
||||
-DMESH_TRACKER_X1
|
||||
-DCONFIG_NFCT_PINS_AS_GPIOS=1
|
||||
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL=1
|
||||
-DMESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
|
||||
-DMESHTASTIC_EXCLUDE_SCREEN=1
|
||||
-DMESHTASTIC_EXCLUDE_DETECTIONSENSOR=1
|
||||
-DMESHTASTIC_EXCLUDE_WIFI=1
|
||||
board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld
|
||||
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/seeed_mesh_tracker_X1>
|
||||
lib_deps =
|
||||
${nrf52840_base.lib_deps}
|
||||
adafruit/Adafruit DRV2605 Library@1.2.4
|
||||
|
||||
debug_tool = jlink
|
||||
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
||||
upload_protocol = nrfutil
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "RadioLib.h"
|
||||
#include "nrf.h"
|
||||
|
||||
static const uint32_t lr2021_rfswitch_dio_pins[] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||
|
||||
static const Module::RfSwitchMode_t lr2021_rfswitch_table[] = {
|
||||
{LR2021::MODE_STBY, {}}, {LR2021::MODE_RX, {}}, {LR2021::MODE_TX, {}},
|
||||
{LR2021::MODE_RX_HF, {}}, {LR2021::MODE_TX_HF, {}}, END_OF_MODE_TABLE,
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
#include "DebugConfiguration.h"
|
||||
#include "nrf.h"
|
||||
#include "wiring_constants.h"
|
||||
#include "wiring_digital.h"
|
||||
|
||||
const uint32_t g_ADigitalPinMap[] = {
|
||||
// P0
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
|
||||
// P1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
|
||||
|
||||
void initVariant()
|
||||
{
|
||||
pinMode(PIN_3V3_EN, OUTPUT);
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
|
||||
pinMode(PIN_BAT_ADC_EN, OUTPUT);
|
||||
digitalWrite(PIN_BAT_ADC_EN, HIGH);
|
||||
|
||||
pinMode(PIN_LED1, OUTPUT);
|
||||
digitalWrite(PIN_LED1, LOW);
|
||||
|
||||
pinMode(PIN_LED2, OUTPUT);
|
||||
digitalWrite(PIN_LED2, LOW);
|
||||
|
||||
pinMode(PIN_LED3, OUTPUT);
|
||||
digitalWrite(PIN_LED3, LOW);
|
||||
|
||||
pinMode(PIN_DRV_EN, OUTPUT);
|
||||
digitalWrite(PIN_DRV_EN, LOW);
|
||||
|
||||
pinMode(PIN_RTC_EN, OUTPUT);
|
||||
digitalWrite(PIN_RTC_EN, LOW);
|
||||
|
||||
pinMode(PIN_GPS_EN, OUTPUT);
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
|
||||
pinMode(GPS_VRTC_EN, OUTPUT);
|
||||
digitalWrite(GPS_VRTC_EN, HIGH);
|
||||
|
||||
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||
digitalWrite(PIN_GPS_RESET, LOW);
|
||||
|
||||
pinMode(GPS_SLEEP_INT, OUTPUT);
|
||||
digitalWrite(GPS_SLEEP_INT, HIGH);
|
||||
|
||||
pinMode(GPS_RTC_INT, OUTPUT);
|
||||
digitalWrite(GPS_RTC_INT, LOW);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This library 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 Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_MESH_TRACKER_X1_
|
||||
#define _VARIANT_MESH_TRACKER_X1_
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (64000000ul)
|
||||
|
||||
#define USE_LFXO // Board uses 32khz crystal for LF
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (48)
|
||||
#define NUM_DIGITAL_PINS (48)
|
||||
#define NUM_ANALOG_INPUTS (6)
|
||||
#define NUM_ANALOG_OUTPUTS (0)
|
||||
|
||||
// Use the native nrf52 usb power detection
|
||||
#define NRF_APM
|
||||
|
||||
// PIN_3V3_EN use in deep sleep , as power pin.
|
||||
#define PIN_3V3_EN (32 + 7) // P1.7, Power to Sensors
|
||||
#define PIN_BAT_ADC_EN (32 + 6) // P1.6, Power to battery ADC
|
||||
#define PIN_RTC_EN (0 + 9) // P0.9, Power to RTC
|
||||
|
||||
#define PIN_LED1 (0 + 3) // P0.3, red led
|
||||
#define PIN_LED2 (0 + 24) // P0.24, green led
|
||||
#define PIN_LED3 (0 + 28) // P0.28, blue led
|
||||
#define LED_POWER PIN_LED2
|
||||
#define LED_RED PIN_LED1
|
||||
#define LED_BLUE -1 // Actually green
|
||||
#define LED_STATE_ON 1 // State when LED is lit
|
||||
#define LED_POWER_CRITICAL LED_RED // red LED doubles as the low-battery/critical indicator
|
||||
|
||||
// ARCH_NRF52 auto define HAS_BUTTON 1
|
||||
#define HAS_BUTTON 1
|
||||
#define BUTTON_PIN (0 + 6) // P0.06
|
||||
#define BUTTON_ACTIVE_LOW false
|
||||
#define BUTTON_ACTIVE_PULLUP false
|
||||
#define BUTTON_SENSE_TYPE 0x5 // enable input pull-down
|
||||
|
||||
/**************** Sensor *******************/
|
||||
|
||||
#define HAS_WIRE 1
|
||||
#define WIRE_INTERFACES_COUNT 1 // have 1 I2C interface, Wire
|
||||
|
||||
#define PIN_WIRE_SDA (32 + 15) // P1.15
|
||||
#define PIN_WIRE_SCL (32 + 14) // P1.14
|
||||
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
|
||||
|
||||
#define HAS_DRV2605 1 // haptic driver
|
||||
#define DRV2605_USE_LRA
|
||||
#define PIN_DRV_EN (32 + 5) // P1.05, Power to haptic driver
|
||||
|
||||
#define HAS_SPA06 1
|
||||
|
||||
/*
|
||||
* Serial interfaces
|
||||
*/
|
||||
#define PIN_SERIAL1_RX (0 + 14) // P0.14
|
||||
#define PIN_SERIAL1_TX (0 + 13) // P0.13
|
||||
|
||||
#define PIN_SERIAL2_RX (0 + 17) // P0.17
|
||||
#define PIN_SERIAL2_TX (0 + 16) // P0.16
|
||||
|
||||
#define SPI_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_SPI_MISO (32 + 8) // P1.08
|
||||
#define PIN_SPI_MOSI (32 + 9) // P1.09
|
||||
#define PIN_SPI_SCK (0 + 11) // P0.11
|
||||
#define PIN_SPI_NSS (0 + 12) // P0.12
|
||||
|
||||
#define LORA_RESET (32 + 10) // P1.10 // RST
|
||||
#define LORA_DIO1 (32 + 1) // P1.01 // IRQ
|
||||
#define LORA_DIO2 (0 + 7) // P0.07 // BUSY
|
||||
#define LORA_SCK PIN_SPI_SCK
|
||||
#define LORA_MISO PIN_SPI_MISO
|
||||
#define LORA_MOSI PIN_SPI_MOSI
|
||||
#define LORA_CS PIN_SPI_NSS
|
||||
|
||||
// supported modules list
|
||||
#define USE_LR2021
|
||||
#define IRQ_DIO_NUM 8
|
||||
|
||||
#define LR2021_IRQ_PIN LORA_DIO1
|
||||
#define LR2021_NRESET_PIN LORA_RESET
|
||||
#define LR2021_BUSY_PIN LORA_DIO2
|
||||
#define LR2021_SPI_NSS_PIN LORA_CS
|
||||
#define LR2021_SPI_SCK_PIN LORA_SCK
|
||||
#define LR2021_SPI_MOSI_PIN LORA_MOSI
|
||||
#define LR2021_SPI_MISO_PIN LORA_MISO
|
||||
|
||||
#define LR2021_DIO3_TCXO_VOLTAGE 1.6
|
||||
// #define LR2021_DIO_AS_RF_SWITCH
|
||||
|
||||
// GPS
|
||||
#define HAS_GPS 1
|
||||
#define GNSS_AIROHA
|
||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||
|
||||
#define GPS_BAUDRATE 115200
|
||||
#define GPS_PROBETRIES 8
|
||||
|
||||
#define PIN_GPS_EN (32 + 11) // P1.11
|
||||
#define GPS_EN_ACTIVE HIGH
|
||||
|
||||
#define PIN_GPS_RESET (0 + 8) // P0.8
|
||||
#define GPS_RESET_MODE HIGH
|
||||
|
||||
#define GPS_VRTC_EN (32 + 13) // P1.13, always high
|
||||
#define GPS_SLEEP_INT (0 + 30) // P0.30, always high
|
||||
#define GPS_RTC_INT (0 + 29) // P0.29, normal is LOW, wake by HIGH
|
||||
|
||||
#define BATTERY_PIN 2 // P0.02/AIN0, BAT_ADC
|
||||
#define BATTERY_IMMUTABLE
|
||||
#define ADC_MULTIPLIER (2.0F)
|
||||
// P0.04/AIN2 is VCC_ADC, P0.05/AIN3 is CHARGER_DET, P1.03 is CHARGE_STA, P1.04 is CHARGE_DONE
|
||||
|
||||
#define EXT_CHRG_DETECT (32 + 3) // P1.03
|
||||
#define EXT_CHRG_DETECT_VALUE LOW
|
||||
// #define EXT_IS_CHRGD (32 + 4) // P1.04
|
||||
// #define EXT_IS_CHRGD_VALUE LOW
|
||||
#define EXT_PWR_DETECT (0 + 5) // P0.05
|
||||
|
||||
#define ADC_RESOLUTION 14
|
||||
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||
|
||||
#undef AREF_VOLTAGE
|
||||
#define AREF_VOLTAGE 3.0
|
||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||
|
||||
#define OCV_ARRAY 4290, 4118, 4002, 3889, 3798, 3728, 3677, 3643, 3594, 3500, 3100
|
||||
|
||||
// Buzzer
|
||||
#define PIN_BUZZER (0 + 25) // P0.25, pwm output
|
||||
|
||||
#define HAS_SCREEN 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif // _VARIANT_MESH_TRACKER_X1_
|
||||
Reference in New Issue
Block a user