Skip to content

Commit 7bb2f6c

Browse files
committed
Patching s3 board before build to fix rgb_led
1 parent 0967747 commit 7bb2f6c

File tree

4 files changed

+82
-6
lines changed

4 files changed

+82
-6
lines changed

Diff for: patch/arduino/variants/lolin_s3_mini/pins_arduino.h

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x303a
7+
#define USB_PID 0x8167
8+
9+
#define EXTERNAL_NUM_INTERRUPTS 46
10+
#define NUM_DIGITAL_PINS 48
11+
#define NUM_ANALOG_INPUTS 18
12+
13+
14+
static const uint8_t LED_BUILTIN = 47;
15+
#define BUILTIN_LED LED_BUILTIN // backward compatibility
16+
#define LED_BUILTIN LED_BUILTIN
17+
#define RGB_BUILTIN LED_BUILTIN+SOC_GPIO_PIN_COUNT
18+
#define RGB_BRIGHTNESS 64
19+
20+
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
21+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
22+
#define digitalPinHasPWM(p) (p < 46)
23+
24+
static const uint8_t TX = 43;
25+
static const uint8_t RX = 44;
26+
27+
static const uint8_t SDA = 35;
28+
static const uint8_t SCL = 36;
29+
30+
static const uint8_t SS = 10;
31+
static const uint8_t MOSI = 11;
32+
static const uint8_t MISO = 13;
33+
static const uint8_t SCK = 12;
34+
35+
static const uint8_t A0 = 1;
36+
static const uint8_t A1 = 2;
37+
static const uint8_t A2 = 3;
38+
static const uint8_t A3 = 4;
39+
static const uint8_t A4 = 5;
40+
static const uint8_t A5 = 6;
41+
static const uint8_t A6 = 7;
42+
static const uint8_t A7 = 8;
43+
static const uint8_t A8 = 9;
44+
static const uint8_t A9 = 10;
45+
static const uint8_t A10 = 11;
46+
static const uint8_t A11 = 12;
47+
static const uint8_t A12 = 13;
48+
static const uint8_t A13 = 14;
49+
static const uint8_t A14 = 15;
50+
static const uint8_t A15 = 16;
51+
static const uint8_t A16 = 17;
52+
static const uint8_t A17 = 18;
53+
54+
static const uint8_t T1 = 1;
55+
static const uint8_t T2 = 2;
56+
static const uint8_t T3 = 3;
57+
static const uint8_t T4 = 4;
58+
static const uint8_t T5 = 5;
59+
static const uint8_t T6 = 6;
60+
static const uint8_t T7 = 7;
61+
static const uint8_t T8 = 8;
62+
static const uint8_t T9 = 9;
63+
static const uint8_t T10 = 10;
64+
static const uint8_t T11 = 11;
65+
static const uint8_t T12 = 12;
66+
static const uint8_t T13 = 13;
67+
static const uint8_t T14 = 14;
68+
69+
#endif /* Pins_Arduino_h */

Diff for: platformio.ini

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ platform = ${common_env_data.platform32}
181181
upload_speed = ${common_env_data.upload_speed}
182182
monitor_speed = ${common_env_data.monitor_speed}
183183
extra_scripts =
184+
pre:script/patch_arduino.py
184185
${common_env_data.extra_scripts}
185186
build_unflags =
186187
${common_env_data.build_unflags}

Diff for: script/copy_firmware.py

-6
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ def after_build(source, target, env):
4545
print( "Copy file : " + source + " -> " + target )
4646
shutil.copyfile( source, target )
4747

48-
if name == "gravity32c3v1-release" :
49-
target = dir + "/bin/firmware32c3v1.bin"
50-
source = dir + "/.pio/build/" + name + "/firmware.bin"
51-
print( "Copy file : " + source + " -> " + target )
52-
shutil.copyfile( source, target )
53-
5448
if name == "gravity32s2-release" :
5549
target = dir + "/bin/firmware32s2.bin"
5650
source = dir + "/.pio/build/" + name + "/firmware.bin"

Diff for: script/patch_arduino.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Import("env")
2+
import shutil
3+
4+
framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif32")
5+
name = env.get( "PIOENV" )#print(FRAMEWORK_DIR)
6+
dir = env.GetLaunchDir()
7+
8+
if name == "gravity32s3-release" :
9+
source = dir + "/patch/arduino/variants/lolin_s3_mini/pins_arduino.h"
10+
target = framework_dir + "/variants/lolin_s3_mini/pins_arduino.h"
11+
print( "Copy file : " + source + " -> " + target )
12+
shutil.copyfile( source, target )

0 commit comments

Comments
 (0)