Skip to content

Commit fb0041c

Browse files
authored
Merge branch 'master' into feature/network_refactoring
2 parents 7e893e9 + e92b4ca commit fb0041c

File tree

6 files changed

+361
-0
lines changed

6 files changed

+361
-0
lines changed

boards.txt

+154
Original file line numberDiff line numberDiff line change
@@ -36001,3 +36001,157 @@ Geekble_ESP32C3.menu.EraseFlash.all=Enabled
3600136001
Geekble_ESP32C3.menu.EraseFlash.all.upload.erase_cmd=-e
3600236002

3600336003
##############################################################
36004+
36005+
waveshare_esp32s3_touch_lcd_128.name=Waveshare ESP32S3 Touch LCD 128
36006+
waveshare_esp32s3_touch_lcd_128.vid.0=0x1a86
36007+
waveshare_esp32s3_touch_lcd_128.pid.0=0x55d3
36008+
36009+
waveshare_esp32s3_touch_lcd_128.upload.tool=esptool_py
36010+
waveshare_esp32s3_touch_lcd_128.upload.tool.default=esptool_py
36011+
waveshare_esp32s3_touch_lcd_128.upload.tool.network=esp_ota
36012+
waveshare_esp32s3_touch_lcd_128.upload.maximum_size=16777216
36013+
waveshare_esp32s3_touch_lcd_128.upload.maximum_data_size=327680
36014+
waveshare_esp32s3_touch_lcd_128.upload.wait_for_upload_port=false
36015+
waveshare_esp32s3_touch_lcd_128.upload.speed=460800
36016+
waveshare_esp32s3_touch_lcd_128.upload.flags=
36017+
waveshare_esp32s3_touch_lcd_128.upload.extra_flags=
36018+
36019+
waveshare_esp32s3_touch_lcd_128.bootloader.tool=esptool_py
36020+
waveshare_esp32s3_touch_lcd_128.bootloader.tool.default=esptool_py
36021+
36022+
waveshare_esp32s3_touch_lcd_128.serial.disableDTR=true
36023+
waveshare_esp32s3_touch_lcd_128.serial.disableRTS=true
36024+
36025+
waveshare_esp32s3_touch_lcd_128.build.tarch=xtensa
36026+
waveshare_esp32s3_touch_lcd_128.build.bootloader_addr=0x0
36027+
waveshare_esp32s3_touch_lcd_128.build.mcu=esp32s3
36028+
waveshare_esp32s3_touch_lcd_128.build.core=esp32
36029+
waveshare_esp32s3_touch_lcd_128.build.target=esp32s3
36030+
waveshare_esp32s3_touch_lcd_128.build.variant=waveshare_esp32s3_touch_lcd_128
36031+
waveshare_esp32s3_touch_lcd_128.build.board=WAVESHARE_ESP32S3_TOUCH_LCD_128
36032+
36033+
waveshare_esp32s3_touch_lcd_128.build.usb_mode=1
36034+
waveshare_esp32s3_touch_lcd_128.build.cdc_on_boot=1
36035+
waveshare_esp32s3_touch_lcd_128.build.msc_on_boot=0
36036+
waveshare_esp32s3_touch_lcd_128.build.dfu_on_boot=0
36037+
36038+
waveshare_esp32s3_touch_lcd_128.build.f_cpu=240000000L
36039+
waveshare_esp32s3_touch_lcd_128.build.flash_size=16MB
36040+
waveshare_esp32s3_touch_lcd_128.build.flash_freq=80m
36041+
waveshare_esp32s3_touch_lcd_128.build.flash_mode=dio
36042+
waveshare_esp32s3_touch_lcd_128.build.boot=dio
36043+
waveshare_esp32s3_touch_lcd_128.build.partitions=default
36044+
36045+
waveshare_esp32s3_touch_lcd_128.menu.PSRAM.disabled=Disabled
36046+
waveshare_esp32s3_touch_lcd_128.menu.PSRAM.disabled.build.defines=
36047+
waveshare_esp32s3_touch_lcd_128.menu.PSRAM.enabled=Enabled
36048+
waveshare_esp32s3_touch_lcd_128.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
36049+
waveshare_esp32s3_touch_lcd_128.menu.PSRAM.enabled.build.psram_type=qspi
36050+
36051+
waveshare_esp32s3_touch_lcd_128.menu.LoopCore.1=Core 1
36052+
waveshare_esp32s3_touch_lcd_128.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
36053+
waveshare_esp32s3_touch_lcd_128.menu.LoopCore.0=Core 0
36054+
waveshare_esp32s3_touch_lcd_128.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0
36055+
36056+
waveshare_esp32s3_touch_lcd_128.menu.EventsCore.1=Core 1
36057+
waveshare_esp32s3_touch_lcd_128.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
36058+
waveshare_esp32s3_touch_lcd_128.menu.EventsCore.0=Core 0
36059+
waveshare_esp32s3_touch_lcd_128.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0
36060+
36061+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
36062+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.default.build.partitions=default
36063+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
36064+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
36065+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
36066+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.minimal.build.partitions=minimal
36067+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
36068+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.no_ota.build.partitions=no_ota
36069+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
36070+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
36071+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
36072+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
36073+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
36074+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
36075+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
36076+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
36077+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
36078+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
36079+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
36080+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.huge_app.build.partitions=huge_app
36081+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
36082+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
36083+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
36084+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
36085+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
36086+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.fatflash.build.partitions=ffat
36087+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
36088+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
36089+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
36090+
waveshare_esp32s3_touch_lcd_128.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
36091+
36092+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.240=240MHz (WiFi/BT)
36093+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.240.build.f_cpu=240000000L
36094+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.160=160MHz (WiFi/BT)
36095+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.160.build.f_cpu=160000000L
36096+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.80=80MHz (WiFi/BT)
36097+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.80.build.f_cpu=80000000L
36098+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.40=40MHz (40MHz XTAL)
36099+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.40.build.f_cpu=40000000L
36100+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.26=26MHz (26MHz XTAL)
36101+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.26.build.f_cpu=26000000L
36102+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.20=20MHz (40MHz XTAL)
36103+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.20.build.f_cpu=20000000L
36104+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.13=13MHz (26MHz XTAL)
36105+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.13.build.f_cpu=13000000L
36106+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.10=10MHz (40MHz XTAL)
36107+
waveshare_esp32s3_touch_lcd_128.menu.CPUFreq.10.build.f_cpu=10000000L
36108+
36109+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.qio=QIO
36110+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.qio.build.flash_mode=dio
36111+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.qio.build.boot=qio
36112+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.dio=DIO
36113+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.dio.build.flash_mode=dio
36114+
waveshare_esp32s3_touch_lcd_128.menu.FlashMode.dio.build.boot=dio
36115+
36116+
waveshare_esp32s3_touch_lcd_128.menu.FlashFreq.80=80MHz
36117+
waveshare_esp32s3_touch_lcd_128.menu.FlashFreq.80.build.flash_freq=80m
36118+
waveshare_esp32s3_touch_lcd_128.menu.FlashFreq.40=40MHz
36119+
waveshare_esp32s3_touch_lcd_128.menu.FlashFreq.40.build.flash_freq=40m
36120+
36121+
waveshare_esp32s3_touch_lcd_128.menu.FlashSize.16M=16MB (128Mb)
36122+
waveshare_esp32s3_touch_lcd_128.menu.FlashSize.16M.build.flash_size=16MB
36123+
36124+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.921600=921600
36125+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.921600.upload.speed=921600
36126+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.115200=115200
36127+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.115200.upload.speed=115200
36128+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.256000.windows=256000
36129+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.256000.upload.speed=256000
36130+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.230400.windows.upload.speed=256000
36131+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.230400=230400
36132+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.230400.upload.speed=230400
36133+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.460800.linux=460800
36134+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.460800.macosx=460800
36135+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.460800.upload.speed=460800
36136+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.512000.windows=512000
36137+
waveshare_esp32s3_touch_lcd_128.menu.UploadSpeed.512000.upload.speed=512000
36138+
36139+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.none=None
36140+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.none.build.code_debug=0
36141+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.error=Error
36142+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.error.build.code_debug=1
36143+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.warn=Warn
36144+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.warn.build.code_debug=2
36145+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.info=Info
36146+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.info.build.code_debug=3
36147+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.debug=Debug
36148+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.debug.build.code_debug=4
36149+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.verbose=Verbose
36150+
waveshare_esp32s3_touch_lcd_128.menu.DebugLevel.verbose.build.code_debug=5
36151+
36152+
waveshare_esp32s3_touch_lcd_128.menu.EraseFlash.none=Disabled
36153+
waveshare_esp32s3_touch_lcd_128.menu.EraseFlash.none.upload.erase_cmd=
36154+
waveshare_esp32s3_touch_lcd_128.menu.EraseFlash.all=Enabled
36155+
waveshare_esp32s3_touch_lcd_128.menu.EraseFlash.all.upload.erase_cmd=-e
36156+
36157+
##############################################################

cores/esp32/esp32-hal-gpio.c

+11
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,16 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
151151
}
152152
}
153153

154+
#ifdef RGB_BUILTIN
155+
uint8_t RGB_BUILTIN_storage = 0;
156+
#endif
157+
154158
extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val)
155159
{
156160
#ifdef RGB_BUILTIN
157161
if(pin == RGB_BUILTIN){
158162
//use RMT to set all channels on/off
163+
RGB_BUILTIN_storage=val;
159164
const uint8_t comm_val = val != 0 ? RGB_BRIGHTNESS : 0;
160165
neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
161166
return;
@@ -170,6 +175,12 @@ extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val)
170175

171176
extern int ARDUINO_ISR_ATTR __digitalRead(uint8_t pin)
172177
{
178+
#ifdef RGB_BUILTIN
179+
if(pin == RGB_BUILTIN){
180+
return RGB_BUILTIN_storage;
181+
}
182+
#endif
183+
173184
if(perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) != NULL){
174185
return gpio_get_level((gpio_num_t)pin);
175186
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/*
2+
3+
This Sketch demonstrates how to use onReceive(callbackFunc) with HardwareSerial
4+
5+
void HardwareSerial::onReceive(OnReceiveCb function, bool onlyOnTimeout = false)
6+
7+
It is possible to register an UART callback function that will be called
8+
every time that UART receives data and an associated interrupt is generated.
9+
10+
In summary, HardwareSerial::onReceive() works like an RX Interrupt callback, that can be adjusted
11+
using HardwareSerial::setRxFIFOFull() and HardwareSerial::setRxTimeout().
12+
13+
OnReceive will be called, while receiving a stream of data, when every 120 bytes are received (default FIFO Full),
14+
which may not help in case that the application needs to get all data at once before processing it.
15+
Therefore, a way to make it work is by detecting the end of a stream transmission. This can be based on a protocol
16+
or based on timeout with the UART line in idle (no data received - this is the case of this example).
17+
18+
In some cases, it is necessary to wait for receiving all the data before processing it and parsing the
19+
UART input. This example demonstrates a way to create a String with all data received from UART0 and
20+
signaling it using a Mutex for another task to process it. This example uses a timeout of 500ms as a way to
21+
know when the reception of data has finished.
22+
23+
The onReceive() callback is called whenever the RX ISR is triggered.
24+
It can occur because of two possible events:
25+
26+
1- UART FIFO FULL: it happens when internal UART FIFO reaches a certain number of bytes.
27+
Its full capacity is 127 bytes. The FIFO Full threshold for the interrupt can be changed
28+
using HardwareSerial::setRxFIFOFull(uint8_t fifoFull).
29+
Default FIFO Full Threshold is set in the UART initialization using HardwareSerial::begin()
30+
This will depend on the baud rate used when begin() is executed.
31+
For a baud rate of 115200 or lower, it it just 1 byte, mimicking original Arduino UART driver.
32+
For a baud rate over 115200 it will be 120 bytes for higher performance.
33+
Anyway, it can be changed by the application at any time.
34+
35+
2- UART RX Timeout: it happens, based on a timeout equivalent to a number of symbols at
36+
the current baud rate. If the UART line is idle for this timeout, it will raise an interrupt.
37+
This time can be changed by HardwareSerial::setRxTimeout(uint8_t rxTimeout)
38+
39+
When any of those two interrupts occur, IDF UART driver will copy FIFO data to its internal
40+
RingBuffer and then Arduino can read such data. At the same time, Arduino Layer will execute
41+
the callback function defined with HardwareSerial::onReceive().
42+
43+
<bool onlyOnTimeout> parameter (default false) can be used by the application to tell Arduino to
44+
only execute the callback when the second event above happens (Rx Timeout). At this time all
45+
received data will be available to be read by the Arduino application. But if the number of
46+
received bytes is higher than the FIFO space, it will generate an error of FIFO overflow.
47+
In order to avoid such problem, the application shall set an appropriate RX buffer size using
48+
HardwareSerial::setRxBufferSize(size_t new_size) before executing begin() for the Serial port.
49+
*/
50+
51+
52+
// this will make UART0 work in any case (using or not USB)
53+
#if ARDUINO_USB_CDC_ON_BOOT
54+
#define UART0 Serial0
55+
#else
56+
#define UART0 Serial
57+
#endif
58+
59+
// global variable to keep the results from onReceive()
60+
String uart_buffer = "";
61+
// a pause of a half second in the UART transmission is considered the end of transmission.
62+
const uint32_t communicationTimeout_ms = 500;
63+
64+
// Create a mutex for the access to uart_buffer
65+
// only one task can read/write it at a certain time
66+
SemaphoreHandle_t uart_buffer_Mutex = NULL;
67+
68+
// UART_RX_IRQ will be executed as soon as data is received by the UART
69+
// This is a callback function executed from a high priority
70+
// task created when onReceive() is used
71+
void UART0_RX_CB() {
72+
// take the mutex, waits forever until loop() finishes its processing
73+
if (xSemaphoreTake(uart_buffer_Mutex, portMAX_DELAY)) {
74+
uint32_t now = millis(); // tracks timeout
75+
while ((millis() - now) < communicationTimeout_ms) {
76+
if (UART0.available()) {
77+
uart_buffer += (char) UART0.read();
78+
now = millis(); // reset the timer
79+
}
80+
}
81+
// releases the mutex for data processing
82+
xSemaphoreGive(uart_buffer_Mutex);
83+
}
84+
}
85+
86+
// setup() and loop() are functions executed by a low priority task
87+
// Therefore, there are 2 tasks running when using onReceive()
88+
void setup() {
89+
UART0.begin(115200);
90+
91+
// creates a mutex object to control access to uart_buffer
92+
uart_buffer_Mutex = xSemaphoreCreateMutex();
93+
if(uart_buffer_Mutex == NULL) {
94+
log_e("Error creating Mutex. Sketch will fail.");
95+
while(true) {
96+
UART0.println("Mutex error (NULL). Program halted.");
97+
delay(2000);
98+
}
99+
}
100+
101+
UART0.onReceive(UART0_RX_CB); // sets the callback function
102+
UART0.println("Send data to UART0 in order to activate the RX callback");
103+
}
104+
105+
uint32_t counter = 0;
106+
void loop() {
107+
if (uart_buffer.length() > 0) {
108+
// signals that the onReceive function shall not change uart_buffer while processing
109+
if (xSemaphoreTake(uart_buffer_Mutex, portMAX_DELAY)) {
110+
// process the received data from UART0 - example, just print it beside a counter
111+
UART0.print("[");
112+
UART0.print(counter++);
113+
UART0.print("] [");
114+
UART0.print(uart_buffer.length());
115+
UART0.print(" bytes] ");
116+
UART0.println(uart_buffer);
117+
uart_buffer = ""; // reset uart_buffer for the next UART reading
118+
// releases the mutex for more data to be received
119+
xSemaphoreGive(uart_buffer_Mutex);
120+
}
121+
}
122+
UART0.println("Sleeping for 1 second...");
123+
delay(1000);
124+
}

libraries/WiFi/src/WiFiGeneric.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,40 @@ int32_t WiFiGenericClass::channel(void)
401401
return primaryChan;
402402
}
403403

404+
/**
405+
* Set the WiFi channel configuration
406+
* @param primary primary channel. Depending on the region, not all channels may be available.
407+
* @param secondary secondary channel (WIFI_SECOND_CHAN_NONE, WIFI_SECOND_CHAN_ABOVE, WIFI_SECOND_CHAN_BELOW)
408+
* @return 0 on success, otherwise error
409+
*/
410+
int WiFiGenericClass::setChannel(uint8_t primary, wifi_second_chan_t secondary)
411+
{
412+
wifi_country_t country;
413+
esp_err_t ret;
414+
415+
ret = esp_wifi_get_country(&country);
416+
if (ret != ESP_OK) {
417+
log_e("Failed to get country info");
418+
return ret;
419+
}
420+
421+
uint8_t min_chan = country.schan;
422+
uint8_t max_chan = min_chan + country.nchan - 1;
423+
424+
if(primary < min_chan || primary > max_chan){
425+
log_e("Invalid primary channel: %d. Valid range is %d-%d for country %s", primary, min_chan, max_chan, country.cc);
426+
return ESP_ERR_INVALID_ARG;
427+
}
428+
429+
ret = esp_wifi_set_channel(primary, secondary);
430+
if (ret != ESP_OK) {
431+
log_e("Failed to set channel");
432+
return ret;
433+
}
434+
435+
return ESP_OK;
436+
}
437+
404438
/**
405439
* store WiFi config in SDK flash area
406440
* @param persistent

libraries/WiFi/src/WiFiGeneric.h

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class WiFiGenericClass
8686
static int waitStatusBits(int bits, uint32_t timeout_ms);
8787

8888
int32_t channel(void);
89+
int setChannel(uint8_t primary, wifi_second_chan_t secondary=WIFI_SECOND_CHAN_NONE);
8990

9091
void persistent(bool persistent);
9192
void enableLongRange(bool enable);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x1A86
7+
#define USB_PID 0x55D3
8+
#define USB_MANUFACTURER "Waveshare"
9+
#define USB_PRODUCT "ESP32-S3 Touch LCD 1.28"
10+
#define USB_SERIAL "" // Empty string for MAC adddress
11+
12+
#define LCD_BACKLIGHT 2
13+
#define LCD_DC 8
14+
#define LCD_RST 14
15+
16+
#define TP_INT 5
17+
#define TP_RST 13
18+
19+
#define IMU_INT1 4
20+
#define IMU_INT2 3
21+
22+
static const uint8_t TX = 43;
23+
static const uint8_t RX = 44;
24+
#define TX1 TX
25+
#define RX1 RX
26+
27+
static const uint8_t SCL = 7;
28+
static const uint8_t SDA = 6;
29+
30+
static const uint8_t SS = 9;
31+
static const uint8_t MOSI = 11;
32+
static const uint8_t MISO = 12;
33+
static const uint8_t SCK = 10;
34+
35+
static const uint8_t A0 = 1; // Connected through voltage divider to battery pin
36+
37+
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)