Skip to content

Commit

Permalink
ESP32C6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacefish committed May 1, 2024
1 parent 8b43c3d commit b70eb62
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/i2cscan/i2cscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ uint8_t portArray[] = {16, 5, 4, 2, 14, 12, 13};
uint8_t portExclude[] = {LED_PIN};
String portMap[] = {"D0", "D1", "D2", "D4", "D5", "D6", "D7"};
// ESP32C3 has not as many ports as the ESP32
#elif defined(ESP32C3)
#elif defined(ESP32C3) || defined(ESP32C6)
uint8_t portArray[] = {2, 3, 4, 5, 6, 7, 8, 9, 10};
uint8_t portExclude[] = {18, 19, 20, 21, LED_PIN};
String portMap[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
Expand Down Expand Up @@ -113,13 +113,13 @@ namespace I2CSCAN

bool hasDevOnBus(uint8_t addr) {
byte error;
#if ESP32C3
#if defined(ESP32C3) || defined(ESP32C6)
int retries = 2;
do {
#endif
Wire.beginTransmission(addr);
error = Wire.endTransmission();
#if ESP32C3
#if defined(ESP32C3) || defined(ESP32C6)
}
while (error != 0 && retries--);
#endif
Expand Down
7 changes: 7 additions & 0 deletions platformio-tools.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ build_flags =
-DESP32C3
board = esp32-c3-devkitm-1

[env:BOARD_ES32C6DEVKITC1]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.04.14/platform-espressif32.zip
build_flags =
${env.build_flags}
-DESP32C6
board = esp32-c6-devkitc-1

[env:BOARD_XIAO_ESP32C3]
platform = espressif32 @ 6.1.0
build_flags =
Expand Down
8 changes: 8 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,11 @@ upload_speed = 921600
; ${env.build_flags}
; -DESP32C3
;board = lolin_c3_mini

; If you want to use a ESP32C6, you can use this (experimental)
;[env:esp32c6]
;platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.04.14/platform-espressif32.zip
;board = esp32-c6-devkitc-1
;build_flags =
; ${env.build_flags}
; -DESP32C6
1 change: 1 addition & 0 deletions src/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#define BOARD_MOCOPI 15 // Used by mocopi/moslime
#define BOARD_WEMOSWROOM02 16
#define BOARD_XIAO_ESP32C3 17
#define BOARD_ES32C6DEVKITC1 18
#define BOARD_DEV_RESERVED 250 // Reserved, should not be used in any release firmware

#define BAT_EXTERNAL 1
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ IMU_DESC_ENTRY(IMU_BMP160, PRIMARY_IMU_ADDRESS_ONE, IMU_ROTATION, PIN_IMU_SCL, P
#define PIN_BATTERY_LEVEL 3
#define LED_PIN 10
#define LED_INVERTED false
#elif BOARD == BOARD_ES32C3DEVKITM1
#elif BOARD == BOARD_ES32C3DEVKITM1 || BOARD == BOARD_ES32C6DEVKITC1
#define PIN_IMU_SDA 5
#define PIN_IMU_SCL 4
#define PIN_IMU_INT 6
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void setup()
Serial.begin(serialBaudRate);
globalTimer = timer_create_default();

#ifdef ESP32C3
#ifdef defined(ESP32C3) || defined(ESP32C6)
// Wait for the Computer to be able to connect.
delay(2000);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/sensors/icm20948sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void ICM20948Sensor::startCalibrationAutoSave()
void ICM20948Sensor::startDMP()
{
#ifdef ESP32
#if ESP32C3
#if defined(ESP32C3) || defined(ESP32C6)
#define ICM20948_ODRGYR 1
#define ICM20948_ODRAXL 1
#else
Expand Down

0 comments on commit b70eb62

Please sign in to comment.