Skip to content

Commit

Permalink
Patching s3 board before build to fix rgb_led
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-se committed Sep 3, 2024
1 parent 0967747 commit 7bb2f6c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 6 deletions.
69 changes: 69 additions & 0 deletions patch/arduino/variants/lolin_s3_mini/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define USB_VID 0x303a
#define USB_PID 0x8167

#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 48
#define NUM_ANALOG_INPUTS 18


static const uint8_t LED_BUILTIN = 47;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
#define RGB_BUILTIN LED_BUILTIN+SOC_GPIO_PIN_COUNT
#define RGB_BRIGHTNESS 64

#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
#define digitalPinHasPWM(p) (p < 46)

static const uint8_t TX = 43;
static const uint8_t RX = 44;

static const uint8_t SDA = 35;
static const uint8_t SCL = 36;

static const uint8_t SS = 10;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 13;
static const uint8_t SCK = 12;

static const uint8_t A0 = 1;
static const uint8_t A1 = 2;
static const uint8_t A2 = 3;
static const uint8_t A3 = 4;
static const uint8_t A4 = 5;
static const uint8_t A5 = 6;
static const uint8_t A6 = 7;
static const uint8_t A7 = 8;
static const uint8_t A8 = 9;
static const uint8_t A9 = 10;
static const uint8_t A10 = 11;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
static const uint8_t A13 = 14;
static const uint8_t A14 = 15;
static const uint8_t A15 = 16;
static const uint8_t A16 = 17;
static const uint8_t A17 = 18;

static const uint8_t T1 = 1;
static const uint8_t T2 = 2;
static const uint8_t T3 = 3;
static const uint8_t T4 = 4;
static const uint8_t T5 = 5;
static const uint8_t T6 = 6;
static const uint8_t T7 = 7;
static const uint8_t T8 = 8;
static const uint8_t T9 = 9;
static const uint8_t T10 = 10;
static const uint8_t T11 = 11;
static const uint8_t T12 = 12;
static const uint8_t T13 = 13;
static const uint8_t T14 = 14;

#endif /* Pins_Arduino_h */
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ platform = ${common_env_data.platform32}
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
extra_scripts =
pre:script/patch_arduino.py
${common_env_data.extra_scripts}
build_unflags =
${common_env_data.build_unflags}
Expand Down
6 changes: 0 additions & 6 deletions script/copy_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ def after_build(source, target, env):
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )

if name == "gravity32c3v1-release" :
target = dir + "/bin/firmware32c3v1.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )

if name == "gravity32s2-release" :
target = dir + "/bin/firmware32s2.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
Expand Down
12 changes: 12 additions & 0 deletions script/patch_arduino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Import("env")
import shutil

framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif32")
name = env.get( "PIOENV" )#print(FRAMEWORK_DIR)
dir = env.GetLaunchDir()

if name == "gravity32s3-release" :
source = dir + "/patch/arduino/variants/lolin_s3_mini/pins_arduino.h"
target = framework_dir + "/variants/lolin_s3_mini/pins_arduino.h"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )

0 comments on commit 7bb2f6c

Please sign in to comment.