Skip to content

Commit f352214

Browse files
committed
Add support for XIAO ESP32S3
1 parent 1bb4161 commit f352214

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

platformio.ini

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,29 @@
77
;
88
; Please visit documentation for the other options and examples
99
; https://docs.platformio.org/page/projectconf.html
10+
[common_env_data]
11+
build_flags =
12+
-D BUILD_ENV_NAME=$PIOENV
13+
-D BUILD_PLATFORM=$PIOPLATFORM
14+
-D BUILD_TIME=$UNIX_TIME
15+
-D CORE_DEBUG_LEVEL=3
1016

11-
[env:espwroom32]
17+
[env:generic_espwroom32]
1218
platform = espressif32
1319
board = nodemcu-32s
1420
framework = arduino
1521
upload_port = COM4
16-
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
22+
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
1723
monitor_speed = 115200
18-
build_flags = -DCORE_DEBUG_LEVEL=3
24+
build_flags =
25+
${common_env_data.build_flags}
26+
27+
[env:xiao_esp32s3]
28+
platform = espressif32
29+
board = seeed_xiao_esp32s3
30+
framework = arduino
31+
upload_port = /dev/cu.usbmodem2101
32+
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
33+
monitor_speed = 115200
34+
build_flags =
35+
${common_env_data.build_flags}

src/config.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
#ifndef OPENESPRESSOPROFILER_CONFIG_H
22
#define OPENESPRESSOPROFILER_CONFIG_H
33

4+
#include <Arduino.h>
5+
6+
#ifndef BUILD_ENV_NAME
7+
#error "Add -D BUILD_ENV_NAME=$PIOENV to platformio.ini build_flags"
8+
#else
9+
#define generic_espwroom32 101
10+
#define xiao_esp32s3 102
11+
#endif
12+
13+
#if BUILD_ENV_NAME==generic_espwroom32
414
#define LED_PIN 2
15+
#define INVERT_LED false
516
#define PRESSURE_PIN 32
617

18+
#elif BUILD_ENV_NAME==xiao_esp32s3
19+
#define LED_PIN LED_BUILTIN
20+
#define INVERT_LED true
21+
#define PRESSURE_PIN A1
22+
23+
#else
24+
#error "BUILD_ENV_NAME NOT RECOGNIZED"
25+
#endif
26+
27+
728
#define R1_OHMS 10000
829
#define R2_OHMS 15000
930

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void loop() {
143143
Serial.println("ping");
144144
lastPoll = now;
145145

146-
digitalWrite(LED_PIN, deviceConnected);
146+
digitalWrite(LED_PIN, INVERT_LED ^ deviceConnected);
147147

148148
if (PRESSURE != nullptr) {
149149
int16_t pressure = readPressure();

0 commit comments

Comments
 (0)