Files
MeshCore-Solo/variants/wio-tracker-l1/variant.h
Jakub 5bfebc6559 feat(bot): Actions commands, multi-trigger, and user GPIO pins
- Auto-Reply Bot gains Actions (!buzz/!gps/!advert) behind a new per-target
  toggle nested under Commands (bot_actions_dm/ch/room); off by default.
- Bot Trigger fields accept comma-separated multiple phrases, matching any
  one fires the reply.
- New user-assignable GPIO feature (Wio Tracker L1): !gpio1..!gpio4 bot
  commands plus a Tools > GPIO screen. Each pin cycles Off/Input/Output;
  GPIO1/GPIO2 (P0.02/P0.29, the nRF52840's AIN0/AIN5) also offer a read-only
  Analog mode via direct SAADC access. GPIO3/GPIO4 (P0.09/P0.10) are the
  chip's NFC1/NFC2 pins, repurposed as plain GPIO via a one-time UICR
  NFCPINS bit-clear in initVariant() (adapted from Adafruit's own
  nfc_to_gpio example) -- confirmed working on real hardware.
- Fix: DM/room reply-prefix ("@[nick] ") stripping happened at the wrong
  layer, hiding the "To:" header on DM replies and leaking the raw prefix
  into room messages' list view; a related mismatch had the history
  scrollbar's sizing pass wrap room messages with the sender name still
  attached, disagreeing with the actual rendered text.

Build-verified: WioTrackerL1_companion_solo_dual and
WioTrackerL1Eink_companion_solo_dual both compile and link clean
(sizeof(NodePrefs) confirmed 2720 via real build, not guessed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 20:30:03 +02:00

131 lines
4.3 KiB
C

#ifndef _SEEED_WIO_TRACKER_L1_H_
#define _SEEED_WIO_TRACKER_L1_H_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#define PINS_COUNT (38)
#define NUM_DIGITAL_PINS (38)
#define NUM_ANALOG_INPUTS (8)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED (11)
#define LED_BLUE (-1) // Disable annoying flashing caused by Bluefruit
#define LED_BUILTIN PIN_LED
#define P_LORA_TX_LED PIN_LED
#define LED_STATE_ON 1
// Buttons
#define PIN_BUTTON1 (13) // Menu / User Button
#define PIN_BUTTON2 (25) // Joystick Up
#define PIN_BUTTON3 (26) // Joystick Down
#define PIN_BUTTON4 (27) // Joystick Left
#define PIN_BUTTON5 (28) // Joystick Right
#define PIN_BUTTON6 (29) // Joystick Press
#define PIN_BACK_BTN PIN_BUTTON1
#define JOYSTICK_UP PIN_BUTTON2
#define JOYSTICK_DOWN PIN_BUTTON3
#define JOYSTICK_LEFT PIN_BUTTON4
#define JOYSTICK_RIGHT PIN_BUTTON5
#define JOYSTICK_PRESS PIN_BUTTON6
#define PIN_USER_BTN PIN_BUTTON6
// Buzzer
// #define PIN_BUZZER (12) // Buzzer pin (defined per firmware type)
#define VBAT_ENABLE (30)
// Analog pins
#define PIN_VBAT_READ (16)
#define AREF_VOLTAGE (3.6F)
#define ADC_MULTIPLIER (2.0F)
#define ADC_RESOLUTION (12)
// Serial interfaces
#define PIN_SERIAL1_RX (7)
#define PIN_SERIAL1_TX (6)
// SPI Interfaces
#define SPI_INTERFACES_COUNT (2)
#define PIN_SPI_MISO (9)
#define PIN_SPI_MOSI (10)
#define PIN_SPI_SCK (8)
// Lora Pins
#define P_LORA_SCLK PIN_SPI_SCK
#define P_LORA_MISO PIN_SPI_MISO
#define P_LORA_MOSI PIN_SPI_MOSI
#define P_LORA_DIO_1 (1)
#define P_LORA_RESET (2)
#define P_LORA_BUSY (3)
#define P_LORA_NSS (4)
#define SX126X_RXEN (5)
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_DIO2_AS_RF_SWITCH true
#define SX126X_DIO3_TCXO_VOLTAGE (1.8f)
// Wire Interfaces
#define WIRE_INTERFACES_COUNT (2)
#define PIN_WIRE_SDA (14)
#define PIN_WIRE_SCL (15)
#define PIN_WIRE1_SDA (18)
#define PIN_WIRE1_SCL (17)
#define I2C_NO_RESCAN
#define DISPLAY_ADDRESS 0x3D // SH1106 OLED I2C address
// GPS L76KB
#define GPS_BAUDRATE 9600
#define PIN_GPS_TX PIN_SERIAL1_RX
#define PIN_GPS_RX PIN_SERIAL1_TX
#define PIN_GPS_STANDBY (0)
#define PIN_GPS_EN (PIN_GPS_STANDBY)
// User-assignable GPIO: 4 pins with no board function, exposed for bot
// commands (!gpio1..!gpio4) and the Tools > GPIO screen. Raw nRF52 pin
// addressing via NRF_GPIO_PIN_MAP (NOT Arduino pin numbers -- these aren't in
// g_ADigitalPinMap[], so pinMode()/digitalWrite() would silently hit whatever
// Arduino pin index happens to equal the raw value instead). See
// initVariant()'s ensureNfcPinsAsGpio() for the GPIO3/GPIO4 NFC-pin caveat.
#define PIN_GPIO1 NRF_GPIO_PIN_MAP(0, 2)
#define PIN_GPIO2 NRF_GPIO_PIN_MAP(0, 29)
#define PIN_GPIO3 NRF_GPIO_PIN_MAP(0, 9) // NFC1
#define PIN_GPIO4 NRF_GPIO_PIN_MAP(0, 10) // NFC2
// QSPI Pins
#define PIN_QSPI_SCK (19)
#define PIN_QSPI_CS (20)
#define PIN_QSPI_IO0 (21)
#define PIN_QSPI_IO1 (22)
#define PIN_QSPI_IO2 (23)
#define PIN_QSPI_IO3 (24)
#define EXTERNAL_FLASH_DEVICES P25Q16H
#define EXTERNAL_FLASH_USE_QSPI
// EInk on SPI1
#define PIN_DISPLAY_CS (36)
#define PIN_DISPLAY_BUSY (35)
#define PIN_DISPLAY_DC (34)
#define PIN_DISPLAY_RST (32)
#define PIN_SPI1_MISO (37)
#define PIN_SPI1_MOSI (33)
#define PIN_SPI1_SCK (31)
// GxEPD2 needs that for a panel that is not even used !
extern const int MISO;
extern const int MOSI;
extern const int SCK;
#endif