Skip to content

Commit

Permalink
Add support for XIAO ESP32S3
Browse files Browse the repository at this point in the history
  • Loading branch information
wwong committed Dec 15, 2023
1 parent 1bb4161 commit f352214
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
23 changes: 20 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,29 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[common_env_data]
build_flags =
-D BUILD_ENV_NAME=$PIOENV
-D BUILD_PLATFORM=$PIOPLATFORM
-D BUILD_TIME=$UNIX_TIME
-D CORE_DEBUG_LEVEL=3

[env:espwroom32]
[env:generic_espwroom32]
platform = espressif32
board = nodemcu-32s
framework = arduino
upload_port = COM4
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=3
build_flags =
${common_env_data.build_flags}

[env:xiao_esp32s3]
platform = espressif32
board = seeed_xiao_esp32s3
framework = arduino
upload_port = /dev/cu.usbmodem2101
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
monitor_speed = 115200
build_flags =
${common_env_data.build_flags}
21 changes: 21 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
#ifndef OPENESPRESSOPROFILER_CONFIG_H
#define OPENESPRESSOPROFILER_CONFIG_H

#include <Arduino.h>

#ifndef BUILD_ENV_NAME
#error "Add -D BUILD_ENV_NAME=$PIOENV to platformio.ini build_flags"
#else
#define generic_espwroom32 101
#define xiao_esp32s3 102
#endif

#if BUILD_ENV_NAME==generic_espwroom32
#define LED_PIN 2
#define INVERT_LED false
#define PRESSURE_PIN 32

#elif BUILD_ENV_NAME==xiao_esp32s3
#define LED_PIN LED_BUILTIN
#define INVERT_LED true
#define PRESSURE_PIN A1

#else
#error "BUILD_ENV_NAME NOT RECOGNIZED"
#endif


#define R1_OHMS 10000
#define R2_OHMS 15000

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void loop() {
Serial.println("ping");
lastPoll = now;

digitalWrite(LED_PIN, deviceConnected);
digitalWrite(LED_PIN, INVERT_LED ^ deviceConnected);

if (PRESSURE != nullptr) {
int16_t pressure = readPressure();
Expand Down

0 comments on commit f352214

Please sign in to comment.