Skip to content

Commit c793fa2

Browse files
committed
Update esp32-hal-i2c.c
1 parent b8e644e commit c793fa2

File tree

9 files changed

+65
-89
lines changed

9 files changed

+65
-89
lines changed

.github/scripts/install-platformio-esp32.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
4+
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git#feature/idf-v4.0"
45

56
echo "Installing Python Wheel ..."
67
pip install wheel > /dev/null 2>&1
@@ -9,10 +10,10 @@ echo "Installing PlatformIO ..."
910
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
1011

1112
echo "Installing Platform ESP32 ..."
12-
python -m platformio platform install https://github.com/platformio/platform-espressif32.git > /dev/null 2>&1
13+
python -m platformio platform install $PLATFORMIO_ESP32_URL > /dev/null 2>&1
1314

1415
echo "Replacing the framework version ..."
15-
python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif32']['version'] = '*'; del data['packages']['framework-arduinoespressif32']['owner']; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
16+
python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
1617

1718
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
1819
echo "Linking Core..."

.github/scripts/on-push.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ else
7979
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
8080
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
8181
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
82+
8283
# PlatformIO ESP32 Test
83-
OPTIONS="board_build.mcu = esp32s2"
84-
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
85-
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
84+
# OPTIONS="board_build.mcu = esp32s2"
85+
# build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
86+
# build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
87+
88+
python -m platformio ci --board "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.mcu = esp32s2" --project-option="board_build.partitions = huge_app.csv"
8689

8790
#build_pio_sketches "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries"
8891
fi

cores/esp32/esp32-hal-i2c.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,48 @@ uint32_t i2cGetStatus(i2c_t * i2c){
17801780
}
17811781
else return 0;
17821782
}
1783+
#else
1784+
1785+
i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed){
1786+
return NULL;
1787+
}
1788+
void i2cRelease(i2c_t *i2c){
1789+
return;
1790+
}
1791+
i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis){
1792+
return ESP_FAIL;
1793+
}
1794+
i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis, uint32_t *readCount){
1795+
return ESP_FAIL;
1796+
}
1797+
i2c_err_t i2cFlush(i2c_t *i2c){
1798+
return ESP_FAIL;
1799+
}
1800+
i2c_err_t i2cSetFrequency(i2c_t * i2c, uint32_t clk_speed){
1801+
return ESP_FAIL;
1802+
}
1803+
uint32_t i2cGetFrequency(i2c_t * i2c){
1804+
return 0;
1805+
}
1806+
uint32_t i2cGetStatus(i2c_t * i2c){
1807+
return 0;
1808+
}
1809+
1810+
//Functions below should be used only if well understood
1811+
//Might be deprecated and removed in future
1812+
i2c_err_t i2cAttachSCL(i2c_t * i2c, int8_t scl){
1813+
return ESP_FAIL;
1814+
}
1815+
i2c_err_t i2cDetachSCL(i2c_t * i2c, int8_t scl){
1816+
return ESP_FAIL;
1817+
}
1818+
i2c_err_t i2cAttachSDA(i2c_t * i2c, int8_t sda){
1819+
return ESP_FAIL;
1820+
}
1821+
i2c_err_t i2cDetachSDA(i2c_t * i2c, int8_t sda){
1822+
return ESP_FAIL;
1823+
}
1824+
17831825
#endif /* CONFIG_IDF_TARGET_ESP32 */
17841826

17851827
/* todo

libraries/WiFi/examples/ETH_LAN8720/.skip.esp32s2

Whitespace-only changes.

libraries/WiFi/examples/ETH_TLK110/.skip.esp32s2

Whitespace-only changes.

libraries/WiFi/examples/WiFiBlueToothSwitch/.skip.esp32s2

Whitespace-only changes.

libraries/WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void setup() {
6060
}
6161

6262
//start UART and the server
63-
Serial2.begin(9600);
63+
Serial1.begin(9600);
6464
server.begin();
6565
server.setNoDelay(true);
6666

@@ -96,7 +96,7 @@ void loop() {
9696
if (serverClients[i] && serverClients[i].connected()){
9797
if(serverClients[i].available()){
9898
//get data from the telnet client and push it to the UART
99-
while(serverClients[i].available()) Serial2.write(serverClients[i].read());
99+
while(serverClients[i].available()) Serial1.write(serverClients[i].read());
100100
}
101101
}
102102
else {
@@ -106,10 +106,10 @@ void loop() {
106106
}
107107
}
108108
//check UART for data
109-
if(Serial2.available()){
110-
size_t len = Serial2.available();
109+
if(Serial1.available()){
110+
size_t len = Serial1.available();
111111
uint8_t sbuf[len];
112-
Serial2.readBytes(sbuf, len);
112+
Serial1.readBytes(sbuf, len);
113113
//push UART data to all connected telnet clients
114114
for(i = 0; i < MAX_SRV_CLIENTS; i++){
115115
if (serverClients[i] && serverClients[i].connected()){

tools/platformio-build-esp32.py

Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, isdir, isfile, join, basename
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -99,7 +99,8 @@
9999
"-u", "newlib_include_heap_impl",
100100
"-u", "newlib_include_syscalls_impl",
101101
"-u", "newlib_include_pthread_impl",
102-
"-u", "__cxa_guard_dummy"
102+
"-u", "__cxa_guard_dummy",
103+
"-Wl,-Map=" + join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))
103104
],
104105

105106
CPPPATH=[
@@ -225,85 +226,13 @@
225226
("IDF_VER", '\\"v4.2-dev-1415-ga2263571b\\"'),
226227
"ESP_PLATFORM",
227228
"ARDUINO_ARCH_ESP32",
229+
"ESP32",
230+
("F_CPU", "$BOARD_F_CPU"),
231+
("ARDUINO", 10805),
228232
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
229233
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', ""))
230234
],
231235

232-
CPPPATH=[
233-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"),
234-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_trace"),
235-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_update"),
236-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "asio"),
237-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bootloader_support"),
238-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bt"),
239-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "coap"),
240-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "console"),
241-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "driver"),
242-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "efuse"),
243-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp-tls"),
244-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp32"),
245-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_adc_cal"),
246-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_event"),
247-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_http_client"),
248-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_http_server"),
249-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_https_ota"),
250-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_https_server"),
251-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_ringbuf"),
252-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "espcoredump"),
253-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ethernet"),
254-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "expat"),
255-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "fatfs"),
256-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "freemodbus"),
257-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "freertos"),
258-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "heap"),
259-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "idf_test"),
260-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "jsmn"),
261-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "json"),
262-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "libsodium"),
263-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "log"),
264-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "lwip"),
265-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mbedtls"),
266-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mdns"),
267-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "micro-ecc"),
268-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mqtt"),
269-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "newlib"),
270-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nghttp"),
271-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nimble"),
272-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nvs_flash"),
273-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "openssl"),
274-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "protobuf-c"),
275-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "protocomm"),
276-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "pthread"),
277-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "sdmmc"),
278-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "smartconfig_ack"),
279-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "soc"),
280-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spi_flash"),
281-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spiffs"),
282-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcp_transport"),
283-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcpip_adapter"),
284-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ulp"),
285-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "unity"),
286-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "vfs"),
287-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "wear_levelling"),
288-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "wifi_provisioning"),
289-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "wpa_supplicant"),
290-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "xtensa-debug-module"),
291-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp-face"),
292-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp32-camera"),
293-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp-face"),
294-
join(FRAMEWORK_DIR, "tools", "sdk", "include", "fb_gfx"),
295-
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
296-
],
297-
298-
LIBPATH=[
299-
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
300-
join(FRAMEWORK_DIR, "tools", "sdk", "ld")
301-
],
302-
303-
LIBS=[
304-
"-lgcc", "-lfreertos", "-lmesh", "-lod", "-lwear_levelling", "-lfb_gfx", "-lesp_adc_cal", "-lc_nano", "-lesp32", "-ldriver", "-lhal", "-ljsmn", "-lsmartconfig", "-lesp_http_server", "-lprotocomm", "-lface_recognition", "-lespnow", "-ltcpip_adapter", "-lface_detection", "-lunity", "-lc", "-llibsodium", "-lesp_http_client", "-lapp_update", "-lnewlib", "-lcxx", "-ltcp_transport", "-lm", "-lefuse", "-lopenssl", "-lwifi_provisioning", "-lespcoredump", "-llog", "-lmbedtls", "-lesp_ringbuf", "-lwps", "-lnet80211", "-lmqtt", "-lesp_https_server", "-lapp_trace", "-lesp_event", "-lesp32-camera", "-lsoc", "-lheap", "-llwip", "-lwpa", "-lrtc", "-lxtensa-debug-module", "-lspi_flash", "-lphy", "-lfr", "-lconsole", "-lcoap", "-lbtdm_app", "-lsdmmc", "-lfd", "-lmicro-ecc", "-ljson", "-lcore", "-lprotobuf-c", "-lethernet", "-lspiffs", "-lnvs_flash", "-lwpa_supplicant", "-lvfs", "-lasio", "-lwpa2", "-lpp", "-lbootloader_support", "-limage_util", "-ldl_lib", "-lulp", "-lnghttp", "-lpthread", "-lfreemodbus", "-lexpat", "-lfatfs", "-lsmartconfig_ack", "-lmdns", "-lcoexist", "-lesp-tls", "-lesp_https_ota", "-lbt", "-lstdc++"
305-
],
306-
307236
LIBSOURCE_DIRS=[
308237
join(FRAMEWORK_DIR, "libraries")
309238
],

tools/platformio-build-esp32s2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, isdir, isfile, join, basename
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -94,7 +94,8 @@
9494
"-u", "newlib_include_heap_impl",
9595
"-u", "newlib_include_syscalls_impl",
9696
"-u", "newlib_include_pthread_impl",
97-
"-u", "__cxa_guard_dummy"
97+
"-u", "__cxa_guard_dummy",
98+
"-Wl,-Map=" + join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))
9899
],
99100

100101
CPPPATH=[

0 commit comments

Comments
 (0)