mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Merge branch 'master' into unify-tft
This commit is contained in:
commit
66e5cdcba7
13
src/main.cpp
13
src/main.cpp
@ -480,19 +480,6 @@ void setup()
|
|||||||
|
|
||||||
fsInit();
|
fsInit();
|
||||||
|
|
||||||
#if defined(_SEEED_XIAO_NRF52840_SENSE_H_)
|
|
||||||
|
|
||||||
pinMode(CHARGE_LED, INPUT); // sets to detect if charge LED is on or off to see if USB is plugged in
|
|
||||||
|
|
||||||
pinMode(HICHG, OUTPUT);
|
|
||||||
digitalWrite(HICHG, LOW); // 100 mA charging current if set to LOW and 50mA (actually about 20mA) if set to HIGH
|
|
||||||
|
|
||||||
pinMode(BAT_READ, OUTPUT);
|
|
||||||
digitalWrite(BAT_READ, LOW); // This is pin P0_14 = 14 and by pullling low to GND it provices path to read on pin 32 (P0,31)
|
|
||||||
// PIN_VBAT the voltage from divider on XIAO board
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C
|
#if !MESHTASTIC_EXCLUDE_I2C
|
||||||
#if defined(I2C_SDA1) && defined(ARCH_RP2040)
|
#if defined(I2C_SDA1) && defined(ARCH_RP2040)
|
||||||
Wire1.setSDA(I2C_SDA1);
|
Wire1.setSDA(I2C_SDA1);
|
||||||
|
@ -53,3 +53,10 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
// VBAT
|
// VBAT
|
||||||
31, // D32 is P0.10 (VBAT)
|
31, // D32 is P0.10 (VBAT)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
// Set BQ25101 ISET to 100mA instead of 50mA
|
||||||
|
pinMode(HICHG, OUTPUT);
|
||||||
|
digitalWrite(HICHG, LOW);
|
||||||
|
}
|
||||||
|
@ -164,7 +164,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
// -------
|
// -------
|
||||||
// P0_14 = 14 Reads battery voltage from divider on signal board.
|
// P0_14 = 14 Reads battery voltage from divider on signal board.
|
||||||
// PIN_VBAT is reading voltage divider on XIAO and is program pin 32 / or P0.31
|
// PIN_VBAT is reading voltage divider on XIAO and is program pin 32 / or P0.31
|
||||||
#define BAT_READ 14
|
#define ADC_CTRL VBAT_ENABLE
|
||||||
|
#define ADC_CTRL_ENABLED LOW
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
||||||
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
|
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
|
||||||
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
|
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
|
||||||
|
@ -34,9 +34,9 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
11, // D18 is P0.11 (6D_INT1)
|
11, // D18 is P0.11 (6D_INT1)
|
||||||
|
|
||||||
// MIC
|
// MIC
|
||||||
42, // 17,//42, // D19 is P1.10 (MIC_PWR)
|
42, // D19 is P1.10 (MIC_PWR)
|
||||||
32, // 26,//32, // D20 is P1.00 (PDM_CLK)
|
32, // D20 is P1.00 (PDM_CLK)
|
||||||
16, // 25,//16, // D21 is P0.16 (PDM_DATA)
|
16, // D21 is P0.16 (PDM_DATA)
|
||||||
|
|
||||||
// BQ25100
|
// BQ25100
|
||||||
13, // D22 is P0.13 (HICHG)
|
13, // D22 is P0.13 (HICHG)
|
||||||
@ -80,13 +80,17 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
|
|
||||||
void initVariant()
|
void initVariant()
|
||||||
{
|
{
|
||||||
// LED1 & LED2
|
// Set BQ25101 ISET to 100mA instead of 50mA
|
||||||
pinMode(21, OUTPUT);
|
pinMode(HICHG, OUTPUT);
|
||||||
digitalWrite(21, LOW);
|
digitalWrite(HICHG, LOW);
|
||||||
// LED1 & LED2
|
|
||||||
pinMode(22, OUTPUT);
|
|
||||||
digitalWrite(22, LOW);
|
|
||||||
|
|
||||||
pinMode(PIN_WIRE_SDA, INPUT_PULLUP);
|
// LEDs
|
||||||
pinMode(PIN_WIRE_SCL, INPUT_PULLUP);
|
pinMode(PIN_LED1, OUTPUT);
|
||||||
|
ledOff(PIN_LED1);
|
||||||
|
|
||||||
|
pinMode(PIN_LED2, OUTPUT);
|
||||||
|
ledOff(PIN_LED2);
|
||||||
|
|
||||||
|
pinMode(PIN_LED3, OUTPUT);
|
||||||
|
ledOff(PIN_LED3);
|
||||||
}
|
}
|
@ -19,31 +19,12 @@ extern "C" {
|
|||||||
|
|
||||||
#define PINS_COUNT (33)
|
#define PINS_COUNT (33)
|
||||||
#define NUM_DIGITAL_PINS (33)
|
#define NUM_DIGITAL_PINS (33)
|
||||||
#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference
|
#define NUM_ANALOG_INPUTS (8)
|
||||||
#define NUM_ANALOG_OUTPUTS (0)
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
// LEDs
|
|
||||||
|
|
||||||
#define LED_RED 11
|
|
||||||
#define LED_BLUE 12
|
|
||||||
#define LED_GREEN 13
|
|
||||||
|
|
||||||
#define PIN_LED1 LED_GREEN
|
|
||||||
#define PIN_LED2 LED_BLUE
|
|
||||||
#define PIN_LED3 LED_RED
|
|
||||||
|
|
||||||
#define PIN_LED PIN_LED1
|
|
||||||
#define LED_PWR (PINS_COUNT)
|
|
||||||
|
|
||||||
#define LED_BUILTIN PIN_LED
|
|
||||||
|
|
||||||
#define LED_STATE_ON 1 // State when LED is lit
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buttons
|
* Digital Pins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Digital PINs
|
|
||||||
#define D0 (0ul)
|
#define D0 (0ul)
|
||||||
#define D1 (1ul)
|
#define D1 (1ul)
|
||||||
#define D2 (2ul)
|
#define D2 (2ul)
|
||||||
@ -56,15 +37,6 @@ extern "C" {
|
|||||||
#define D9 (9ul)
|
#define D9 (9ul)
|
||||||
#define D10 (10ul)
|
#define D10 (10ul)
|
||||||
|
|
||||||
/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button.
|
|
||||||
There are some technical solutions that can solve this problem,
|
|
||||||
and we are currently exploring and researching them*/
|
|
||||||
|
|
||||||
// #define BUTTON_PIN D0 // This is the Program Button
|
|
||||||
// // #define BUTTON_NEED_PULLUP 1
|
|
||||||
// #define BUTTON_ACTIVE_LOW true
|
|
||||||
// #define BUTTON_ACTIVE_PULLUP false
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Analog pins
|
* Analog pins
|
||||||
*/
|
*/
|
||||||
@ -85,6 +57,38 @@ static const uint8_t A4 = PIN_A4;
|
|||||||
static const uint8_t A5 = PIN_A5;
|
static const uint8_t A5 = PIN_A5;
|
||||||
#define ADC_RESOLUTION 12
|
#define ADC_RESOLUTION 12
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LEDs
|
||||||
|
*/
|
||||||
|
#define LED_STATE_ON (0) // RGB LED is common anode
|
||||||
|
#define LED_RED (11)
|
||||||
|
#define LED_GREEN (13)
|
||||||
|
#define LED_BLUE (12)
|
||||||
|
|
||||||
|
#define PIN_LED1 LED_GREEN // PIN_LED1 is used in src/platform/nrf52/architecture.h to define LED_PIN
|
||||||
|
#define PIN_LED2 LED_BLUE
|
||||||
|
#define PIN_LED3 LED_RED
|
||||||
|
|
||||||
|
#define LED_BUILTIN LED_RED // LED_BUILTIN is used by framework-arduinoadafruitnrf52 to indicate flash writes
|
||||||
|
|
||||||
|
#define LED_PWR LED_RED
|
||||||
|
#define USER_LED LED_BLUE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Buttons
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* D0 is shared with PIN_GPS_STANDBY on the L76K GNSS Module.
|
||||||
|
* There are some technical solutions that can solve this problem, and we are
|
||||||
|
* currently exploring and researching them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// #define BUTTON_PIN D0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serial Interfaces
|
||||||
|
*/
|
||||||
#define PIN_SERIAL2_RX (-1)
|
#define PIN_SERIAL2_RX (-1)
|
||||||
#define PIN_SERIAL2_TX (-1)
|
#define PIN_SERIAL2_TX (-1)
|
||||||
|
|
||||||
@ -102,11 +106,9 @@ static const uint8_t MOSI = PIN_SPI_MOSI;
|
|||||||
static const uint8_t MISO = PIN_SPI_MISO;
|
static const uint8_t MISO = PIN_SPI_MISO;
|
||||||
static const uint8_t SCK = PIN_SPI_SCK;
|
static const uint8_t SCK = PIN_SPI_SCK;
|
||||||
|
|
||||||
// supported modules list
|
|
||||||
#define USE_SX1262
|
#define USE_SX1262
|
||||||
|
|
||||||
// common pinouts for SX126X modules
|
// Pinout for SX126X
|
||||||
|
|
||||||
#define SX126X_CS D4
|
#define SX126X_CS D4
|
||||||
#define SX126X_DIO1 D1
|
#define SX126X_DIO1 D1
|
||||||
#define SX126X_BUSY D3
|
#define SX126X_BUSY D3
|
||||||
@ -121,16 +123,19 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
/*
|
/*
|
||||||
* Wire Interfaces
|
* Wire Interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
|
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
|
||||||
#define WIRE_INTERFACES_COUNT 1 // 2
|
#define WIRE_INTERFACES_COUNT 1 // 2
|
||||||
|
|
||||||
#define PIN_WIRE_SDA (24) // change to use the correct pins if needed
|
// LSM6DS3TR on XIAO nRF52840 Series
|
||||||
#define PIN_WIRE_SCL (25) // change to use the correct pins if needed
|
#define PIN_WIRE_SDA (17)
|
||||||
|
#define PIN_WIRE_SCL (16)
|
||||||
|
|
||||||
static const uint8_t SDA = PIN_WIRE_SDA;
|
static const uint8_t SDA = PIN_WIRE_SDA;
|
||||||
static const uint8_t SCL = PIN_WIRE_SCL;
|
static const uint8_t SCL = PIN_WIRE_SCL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GPS
|
||||||
|
*/
|
||||||
// GPS L76KB
|
// GPS L76KB
|
||||||
#define GPS_L76K
|
#define GPS_L76K
|
||||||
#ifdef GPS_L76K
|
#ifdef GPS_L76K
|
||||||
@ -144,20 +149,18 @@ static const uint8_t SCL = PIN_WIRE_SCL;
|
|||||||
#define PIN_GPS_STANDBY D0
|
#define PIN_GPS_STANDBY D0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Battery
|
/*
|
||||||
|
* Battery
|
||||||
|
*/
|
||||||
|
#define BATTERY_PIN PIN_VBAT // P0.31: VBAT voltage divider
|
||||||
|
#define ADC_MULTIPLIER (3) // ... R17=1M, R18=510k
|
||||||
|
#define ADC_CTRL VBAT_ENABLE // P0.14: VBAT voltage divider
|
||||||
|
#define ADC_CTRL_ENABLED LOW // ... sink
|
||||||
|
#define EXT_CHRG_DETECT (23) // P0.17: Charge LED
|
||||||
|
#define EXT_CHRG_DETECT_VALUE LOW // ... BQ25101 ~CHG indicates charging
|
||||||
|
#define HICHG (22) // P0.13: BQ25101 ISET 100mA instead of 50mA
|
||||||
|
|
||||||
#define BAT_READ \
|
#define BATTERY_SENSE_RESOLUTION_BITS (10)
|
||||||
14 // P0_14 = 14 Reads battery voltage from divider on signal board. (PIN_VBAT is reading voltage divider on XIAO and is
|
|
||||||
// program pin 32 / or P0.31)
|
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
|
||||||
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
|
|
||||||
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
|
|
||||||
|
|
||||||
// The battery sense is hooked to pin A0 (5)
|
|
||||||
#define BATTERY_PIN PIN_VBAT // PIN_A0
|
|
||||||
|
|
||||||
// ratio of voltage divider = 3.0 (R17=1M, R18=510k)
|
|
||||||
#define ADC_MULTIPLIER 3 // 3.0 + a bit for being optimistic
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -53,3 +53,10 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
// VBAT
|
// VBAT
|
||||||
31, // D32 is P0.10 (VBAT)
|
31, // D32 is P0.10 (VBAT)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
// Set BQ25101 ISET to 100mA instead of 50mA
|
||||||
|
pinMode(HICHG, OUTPUT);
|
||||||
|
digitalWrite(HICHG, LOW);
|
||||||
|
}
|
||||||
|
@ -189,9 +189,8 @@ static const uint8_t SCL = PIN_WIRE_SCL;
|
|||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
|
|
||||||
#define BAT_READ \
|
#define ADC_CTRL VBAT_ENABLE // P0.14: VBAT voltage divider
|
||||||
14 // P0_14 = 14 Reads battery voltage from divider on signal board. (PIN_VBAT is reading voltage divider on XIAO and is
|
#define ADC_CTRL_ENABLED LOW // ... sink
|
||||||
// program pin 32 / or P0.31)
|
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
||||||
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
|
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
|
||||||
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
|
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
|
||||||
|
Loading…
Reference in New Issue
Block a user