Skip to content

Commit 2ce5031

Browse files
committed
Trying to resolve the confilict in boards.txt file
2 parents 19a4729 + 057eac6 commit 2ce5031

30 files changed

+2094
-271
lines changed

boards.txt

Lines changed: 1304 additions & 241 deletions
Large diffs are not rendered by default.

cores/esp32/esp32-hal-ledc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ void analogWrite(uint8_t pin, int value) {
234234
return;
235235
}
236236
ledcAttachPin(pin, channel);
237-
pin_to_channel[pin] = channel;
237+
pin_to_channel[pin] = channel + 1;
238238
ledcWrite(channel, value);
239239
}
240240
}
241241

242242
int8_t analogGetChannel(uint8_t pin) {
243-
return pin_to_channel[pin];
243+
return pin_to_channel[pin] - 1;
244244
}
245245

246246
void analogWriteFrequency(uint32_t freq) {

docs/source/api/adc.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ This function will return analog value in millivolts.
4848
analogReadResolution
4949
^^^^^^^^^^^^^^^^^^^^
5050

51-
This function is used to set the resolution of ``analogRead`` return value. Default is 12 bits (range from 0 to 4096)
52-
for all chips except ESP32S3 where default is 13 bits (range from 0 to 8192).
51+
This function is used to set the resolution of ``analogRead`` return value. Default is 12 bits (range from 0 to 4095)
52+
for all chips except ESP32S3 where default is 13 bits (range from 0 to 8191).
5353
When different resolution is set, the values read will be shifted to match the given resolution.
5454

5555
Range is 1 - 16 .The default value will be used, if this function is not used.
@@ -205,4 +205,4 @@ Here is an example of how to use the ADC.
205205
.. literalinclude:: ../../../libraries/ESP32/examples/AnalogRead/AnalogRead.ino
206206
:language: arduino
207207

208-
Or you can run Arduino example 01.Basics -> AnalogReadSerial.
208+
Or you can run Arduino example 01.Basics -> AnalogReadSerial.

docs/source/tutorials/partition_table.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,21 @@ Here is an example you can use for a custom partition table:
131131
132132
This partition will use about 12MB of the 16MB flash. The offset will be automatically calculated after the first application partition and the units are in K and M.
133133

134-
A alternative is to create the new partition table as a new file in the `tools/partitions <https://github.com/espressif/arduino-esp32/tree/master/tools/partitions>`_ folder and edit the `boards.txt <https://github.com/espressif/arduino-esp32/tree/master/boards.txt>`_ file to add your custom partition table.
134+
An alternative is to create the new partition table as a new file in the `tools/partitions <https://github.com/espressif/arduino-esp32/tree/master/tools/partitions>`_ folder and edit the `boards.txt <https://github.com/espressif/arduino-esp32/tree/master/boards.txt>`_ file to add your custom partition table.
135+
136+
Another alternative is to create the new partition table as a new file, and place it in the `variants <https://github.com/espressif/arduino-esp32/tree/master/variants>`_ folder under your boards folder, and edit the `boards.txt <https://github.com/espressif/arduino-esp32/tree/master/boards.txt>`_ file to add your custom partition table, noting that in order for the compiler to find your custom partition table file you must use the '.build.custom_partitions=' option in the boards.txt file, rather than the standard '.build.partitions=' option. The '.build.variant=' option has the name of the folder holding your custom partition table in the variants folder.
137+
138+
An example of the PartitionScheme listing using the ESP32S3 Dev Module as a reference, would be to have the following:
139+
140+
**Custom Partition - CSV file in /variants/custom_esp32s3/ folder**
141+
142+
.. code-block::
143+
144+
esp32s3.build.variant=custom_esp32s3
145+
--
146+
esp32s3.menu.PartitionScheme.huge_app=Custom Huge APP (3MB No OTA/1MB SPIFFS)
147+
esp32s3.menu.PartitionScheme.huge_app.build.custom_partitions=custom_huge_app
148+
esp32s3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
135149
136150
Examples
137151
--------

libraries/SD/src/SD.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ uint64_t SDFS::totalBytes()
9595
{
9696
FATFS* fsinfo;
9797
DWORD fre_clust;
98-
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
99-
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
98+
char drv[3] = {(char)(48+_pdrv), ':', 0};
99+
if(f_getfree(drv,&fre_clust,&fsinfo)!= 0) return 0;
100+
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
100101
#if _MAX_SS != 512
101102
*(fsinfo->ssize);
102103
#else
@@ -109,7 +110,8 @@ uint64_t SDFS::usedBytes()
109110
{
110111
FATFS* fsinfo;
111112
DWORD fre_clust;
112-
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
113+
char drv[3] = {(char)(48+_pdrv), ':', 0};
114+
if(f_getfree(drv,&fre_clust,&fsinfo)!= 0) return 0;
113115
uint64_t size = ((uint64_t)(fsinfo->csize))*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
114116
#if _MAX_SS != 512
115117
*(fsinfo->ssize);

libraries/SD/src/sd_diskio.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,9 @@ DSTATUS ff_sd_initialize(uint8_t pdrv)
616616

617617
DSTATUS ff_sd_status(uint8_t pdrv)
618618
{
619+
ardu_sdcard_t * card = s_cards[pdrv];
620+
AcquireSPI lock(card);
621+
619622
if(sdTransaction(pdrv, SEND_STATUS, 0, NULL))
620623
{
621624
log_e("Check status failed");

libraries/Update/src/Update.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ class UpdateClass {
190190
uint8_t _ledOn;
191191
};
192192

193+
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)
193194
extern UpdateClass Update;
195+
#endif
194196

195197
#endif

libraries/Update/src/Updater.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,4 +414,6 @@ bool UpdateClass::_chkDataInBlock(const uint8_t *data, size_t len) const {
414414
return false;
415415
}
416416

417+
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE)
417418
UpdateClass Update;
419+
#endif

libraries/WiFi/src/WiFiClient.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ class WiFiClientRxBuffer {
153153
size_t available(){
154154
return _fill - _pos + r_available();
155155
}
156+
157+
void flush(){
158+
if(r_available()){
159+
fillBuffer();
160+
}
161+
_pos = _fill;
162+
}
156163
};
157164

158165
class WiFiClientSocketHandle {
@@ -501,26 +508,7 @@ int WiFiClient::available()
501508
// Though flushing means to send all pending data,
502509
// seems that in Arduino it also means to clear RX
503510
void WiFiClient::flush() {
504-
int res;
505-
size_t a = available(), toRead = 0;
506-
if(!a){
507-
return;//nothing to flush
508-
}
509-
uint8_t * buf = (uint8_t *)malloc(WIFI_CLIENT_FLUSH_BUFFER_SIZE);
510-
if(!buf){
511-
return;//memory error
512-
}
513-
while(a){
514-
toRead = (a>WIFI_CLIENT_FLUSH_BUFFER_SIZE)?WIFI_CLIENT_FLUSH_BUFFER_SIZE:a;
515-
res = recv(fd(), buf, toRead, MSG_DONTWAIT);
516-
if(res < 0) {
517-
log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
518-
stop();
519-
break;
520-
}
521-
a -= res;
522-
}
523-
free(buf);
511+
_rxBuffer->flush();
524512
}
525513

526514
uint8_t WiFiClient::connected()

tools/partitions/large_fat_32MB.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0x480000,
5+
app1, app, ota_1, 0x490000,0x480000,
6+
ffat, data, fat, 0x910000,0x16E0000,
7+
coredump, data, coredump,0x1FF0000,0x10000,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0x480000,
5+
app1, app, ota_1, 0x490000,0x480000,
6+
spiffs, data, spiffs, 0x910000,0x16E0000,
7+
coredump, data, coredump,0x1FF0000,0x10000,

variants/adafruit_matrixportal_esp32s3/pins_arduino.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919

2020
#define LED_BUILTIN 13
2121

22-
#define PIN_NEOPIXEL 33
22+
#define PIN_NEOPIXEL 4
23+
#define NEOPIXEL_PIN 4
2324
#define NEOPIXEL_NUM 1
25+
#define PIN_LIGHTSENSOR A5
26+
27+
#define PIN_BUTTON_UP 6
28+
#define PIN_BUTTON_DOWN 7
2429

2530
static const uint8_t TX = 18;
2631
static const uint8_t RX = 8;
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ESP-IDF Partition Table
2+
# Name, Type, SubType, Offset, Size, Flags
3+
# bootloader.bin,, 0x1000, 32K
4+
# partition table,, 0x8000, 4K
5+
nvs, data, nvs, 0x9000, 20K,
6+
otadata, data, ota, 0xe000, 8K,
7+
ota_0, app, ota_0, 0x10000, 2048K,
8+
ota_1, app, ota_1, 0x210000, 2048K,
9+
uf2, app, factory,0x410000, 256K,
10+
ffat, data, fat, 0x450000, 11968K,
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x239A
7+
#define USB_PID 0x8145
8+
#define USB_MANUFACTURER "Adafruit"
9+
#define USB_PRODUCT "Metro ESP32-S3"
10+
#define USB_SERIAL "" // Empty string for MAC adddress
11+
12+
#define EXTERNAL_NUM_INTERRUPTS 46
13+
#define NUM_DIGITAL_PINS 48
14+
#define NUM_ANALOG_INPUTS 20
15+
16+
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17+
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
18+
#define digitalPinHasPWM(p) (p < 46)
19+
20+
#define LED_BUILTIN 13
21+
22+
#define PIN_NEOPIXEL 45
23+
#define NEOPIXEL_PIN 45
24+
#define NEOPIXEL_NUM 1
25+
26+
#define PIN_BUTTON1 0 // BOOT0 switch
27+
28+
static const uint8_t TX = 40;
29+
static const uint8_t RX = 41;
30+
#define TX1 TX
31+
#define RX1 RX
32+
33+
static const uint8_t SDA = 47;
34+
static const uint8_t SCL = 48;
35+
36+
static const uint8_t SS = 21;
37+
static const uint8_t MOSI = 35;
38+
static const uint8_t SCK = 36;
39+
static const uint8_t MISO = 37;
40+
41+
static const uint8_t A0 = 14;
42+
static const uint8_t A1 = 15;
43+
static const uint8_t A2 = 16;
44+
static const uint8_t A3 = 17;
45+
static const uint8_t A4 = 18;
46+
static const uint8_t A5 = 1;
47+
48+
static const uint8_t A6 = 40;
49+
static const uint8_t A7 = 41;
50+
static const uint8_t A8 = 2;
51+
static const uint8_t A9 = 3;
52+
static const uint8_t A10 = 4;
53+
static const uint8_t A11 = 5;
54+
static const uint8_t A12 = 6;
55+
static const uint8_t A13 = 7;
56+
static const uint8_t A14 = 8;
57+
static const uint8_t A15 = 9;
58+
static const uint8_t A16 = 10;
59+
static const uint8_t A17 = 11;
60+
static const uint8_t A18 = 12;
61+
static const uint8_t A19 = 13;
62+
63+
static const uint8_t T1 = 1;
64+
static const uint8_t T2 = 2;
65+
static const uint8_t T3 = 3;
66+
static const uint8_t T4 = 4;
67+
static const uint8_t T5 = 5;
68+
static const uint8_t T6 = 6;
69+
static const uint8_t T7 = 7;
70+
static const uint8_t T8 = 8;
71+
static const uint8_t T9 = 9;
72+
static const uint8_t T10 = 10;
73+
static const uint8_t T11 = 11;
74+
static const uint8_t T12 = 12;
75+
static const uint8_t T13 = 13;
76+
static const uint8_t T14 = 14;
77+
78+
#endif /* Pins_Arduino_h */
171 KB
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021 Ha Thach (tinyusb.org) for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
26+
#include "esp32-hal-gpio.h"
27+
#include "pins_arduino.h"
28+
29+
extern "C" {
30+
31+
// Initialize variant/board, called before setup()
32+
void initVariant(void) {
33+
// default SD_CS to input pullup
34+
pinMode(SS, INPUT_PULLUP);
35+
}
36+
37+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0xFE0000,
5+
coredump, data,coredump, 0xFF0000, 0x10000,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000,0x200000,
5+
app1, app, ota_1, 0x210000,0x200000,
6+
spiffs, data, spiffs, 0x410000,0xBE0000,
7+
coredump, data, coredump,0xFF0000,0x10000,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0x480000,
5+
app1, app, ota_1, 0x490000,0x480000,
6+
spiffs, data, spiffs, 0x910000,0x6E0000,
7+
coredump, data, coredump,0xFF0000,0x10000,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000,0x7F0000,
5+
app1, app, ota_1, 0x800000,0x7F0000,
6+
coredump, data,coredump, 0xFF0000, 0x10000,

variants/esp32_s3r8n16/pins_arduino.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
#include "soc/soc_caps.h"
6+
7+
#define USB_VID 0x303a
8+
#define USB_PID 0x1001
9+
#define USB_MANUFACTURER "4D Systems Pty Ltd"
10+
#define USB_PRODUCT "4D Systems gen4-ESP32 16MB Modules (ESP32-S3R8n16)"
11+
//#define USB_CLASS 2
12+
13+
#define EXTERNAL_NUM_INTERRUPTS 46
14+
#define NUM_DIGITAL_PINS 48
15+
#define NUM_ANALOG_INPUTS 20
16+
17+
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
18+
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
19+
#define digitalPinHasPWM(p) (p < 46)
20+
21+
static const uint8_t TX = 43;
22+
static const uint8_t RX = 44;
23+
24+
static const uint8_t SDA = 17;
25+
static const uint8_t SCL = 18;
26+
27+
static const uint8_t SS = -1; // Modified elsewhere
28+
static const uint8_t MOSI = -1; // Modified elsewhere
29+
static const uint8_t MISO = -1; // Modified elsewhere
30+
static const uint8_t SCK = -1; // Modified elsewhere
31+
32+
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)