From 00c33abf479a89afefad1251178d8daf756b29c6 Mon Sep 17 00:00:00 2001 From: Votyn Date: Fri, 1 Dec 2023 21:54:36 +0000 Subject: [PATCH 1/3] Add seeed xiao esp32c3 support --- src/consts.h | 1 + src/defines.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/consts.h b/src/consts.h index 3c09d1d26..e8dac2f1c 100644 --- a/src/consts.h +++ b/src/consts.h @@ -54,6 +54,7 @@ #define BOARD_WRANGLER 14 // Only used by wrangler app #define BOARD_MOCOPI 15 // Used by mocopi/moslime #define BOARD_WEMOSWROOM02 16 +#define BOARD_XIAO_ESP32C3 17 #define BOARD_DEV_RESERVED 250 // Reserved, should not be used in any release firmware #define BAT_EXTERNAL 1 diff --git a/src/defines.h b/src/defines.h index 79f4d94b3..45be719c0 100644 --- a/src/defines.h +++ b/src/defines.h @@ -189,4 +189,21 @@ IMU_DESC_ENTRY(IMU_BMP160, PRIMARY_IMU_ADDRESS_ONE, IMU_ROTATION, PIN_IMU_SCL, P #define PIN_BATTERY_LEVEL A0 #define LED_PIN 16 #define LED_INVERTED true +#elif BOARD == BOARD_XIAO_ESP32C3 + #define PIN_IMU_SDA 6 //D4 + #define PIN_IMU_SCL 7 //D5 + #define PIN_IMU_INT 5 //D3 + #define PIN_IMU_INT_2 10 //D10 + #define LED_PIN 4 //D2 + #define LED_INVERTED false + #define PIN_BATTERY_LEVEL 2 //D0 / A0 + #ifndef BATTERY_SHIELD_RESISTANCE + #define BATTERY_SHIELD_RESISTANCE 0 + #endif + #ifndef BATTERY_SHIELD_R1 + #define BATTERY_SHIELD_R1 100 + #endif + #ifndef BATTERY_SHIELD_R2 + #define BATTERY_SHIELD_R2 100 + #endif #endif From d7f89ae5a6312356afa85615ce316c85125f6a9d Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Wed, 7 Feb 2024 22:41:59 -0500 Subject: [PATCH 2/3] Fix defines spacing --- src/defines.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/defines.h b/src/defines.h index 45be719c0..bc9c5166f 100644 --- a/src/defines.h +++ b/src/defines.h @@ -190,14 +190,14 @@ IMU_DESC_ENTRY(IMU_BMP160, PRIMARY_IMU_ADDRESS_ONE, IMU_ROTATION, PIN_IMU_SCL, P #define LED_PIN 16 #define LED_INVERTED true #elif BOARD == BOARD_XIAO_ESP32C3 - #define PIN_IMU_SDA 6 //D4 - #define PIN_IMU_SCL 7 //D5 - #define PIN_IMU_INT 5 //D3 - #define PIN_IMU_INT_2 10 //D10 - #define LED_PIN 4 //D2 - #define LED_INVERTED false - #define PIN_BATTERY_LEVEL 2 //D0 / A0 - #ifndef BATTERY_SHIELD_RESISTANCE + #define PIN_IMU_SDA 6 //D4 + #define PIN_IMU_SCL 7 //D5 + #define PIN_IMU_INT 5 //D3 + #define PIN_IMU_INT_2 10 //D10 + #define LED_PIN 4 //D2 + #define LED_INVERTED false + #define PIN_BATTERY_LEVEL 2 //D0 / A0 + #ifndef BATTERY_SHIELD_RESISTANCE #define BATTERY_SHIELD_RESISTANCE 0 #endif #ifndef BATTERY_SHIELD_R1 From 099826066fb942245d8ae92da23f879ceb262955 Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Wed, 7 Feb 2024 22:53:31 -0500 Subject: [PATCH 3/3] Add board to platformio-tools.ini --- platformio-tools.ini | 7 +++++++ src/defines.h | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/platformio-tools.ini b/platformio-tools.ini index f3d1bb3d2..9d82ca9b8 100644 --- a/platformio-tools.ini +++ b/platformio-tools.ini @@ -64,3 +64,10 @@ build_flags = ${env.build_flags} -DESP32C3 board = esp32-c3-devkitm-1 + +[env:BOARD_XIAO_ESP32C3] +platform = espressif32 @ 6.1.0 +build_flags = + ${env.build_flags} + -DESP32C3 +board = seeed_xiao_esp32c3 diff --git a/src/defines.h b/src/defines.h index bc9c5166f..79fd227ae 100644 --- a/src/defines.h +++ b/src/defines.h @@ -190,17 +190,17 @@ IMU_DESC_ENTRY(IMU_BMP160, PRIMARY_IMU_ADDRESS_ONE, IMU_ROTATION, PIN_IMU_SCL, P #define LED_PIN 16 #define LED_INVERTED true #elif BOARD == BOARD_XIAO_ESP32C3 - #define PIN_IMU_SDA 6 //D4 - #define PIN_IMU_SCL 7 //D5 - #define PIN_IMU_INT 5 //D3 - #define PIN_IMU_INT_2 10 //D10 - #define LED_PIN 4 //D2 + #define PIN_IMU_SDA 6 // D4 + #define PIN_IMU_SCL 7 // D5 + #define PIN_IMU_INT 5 // D3 + #define PIN_IMU_INT_2 10 // D10 + #define LED_PIN 4 // D2 #define LED_INVERTED false - #define PIN_BATTERY_LEVEL 2 //D0 / A0 + #define PIN_BATTERY_LEVEL 2 // D0 / A0 #ifndef BATTERY_SHIELD_RESISTANCE #define BATTERY_SHIELD_RESISTANCE 0 #endif - #ifndef BATTERY_SHIELD_R1 + #ifndef BATTERY_SHIELD_R1 #define BATTERY_SHIELD_R1 100 #endif #ifndef BATTERY_SHIELD_R2