Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/configs/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096

# OpenThread support
CONFIG_OPENTHREAD_ENABLED=y

# Suppress deprecation warnings for legacy drivers still included in bindings
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, I wonder if we should actually build the bindings with -Werror so that we're aware of those.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I quickly tried, maybe not worth it)

CONFIG_I2C_SUPPRESS_DEPRECATE_WARN=y
CONFIG_TWAI_SUPPRESS_DEPRECATE_WARN=y
CONFIG_TOUCH_SUPPRESS_DEPRECATE_WARN=y
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,29 @@ jobs:
- xtensa-esp32s2-espidf
- xtensa-esp32s3-espidf
idf-version:
# - v4.4.8
# - v5.0.9
# - v5.1.6
# - v5.2.5
- v4.4.8
- v5.0.9
- v5.1.6
- v5.2.5
- v5.3.4
- v5.4.3
- v5.5.3
- v6.0
exclude:
# ESP32-C6/H2 (riscv32imac) not supported before v5.1
- target: riscv32imac-esp-espidf
idf-version: v4.4.8
- target: riscv32imac-esp-espidf
idf-version: v5.0.9
# ESP32-P4 (riscv32imafc) not supported before v5.3
- target: riscv32imafc-esp-espidf
idf-version: v4.4.8
- target: riscv32imafc-esp-espidf
idf-version: v5.0.9
- target: riscv32imafc-esp-espidf
idf-version: v5.1.6
- target: riscv32imafc-esp-espidf
idf-version: v5.2.5
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
Expand Down
81 changes: 73 additions & 8 deletions src/include/esp-idf/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#include "esp_spi_flash.h"
#endif
#endif
#ifdef ESP_IDF_COMP_ESP_PARTITION
#ifdef ESP_IDF_COMP_ESP_PARTITION_ENABLED
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to understand this one

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid. There is likely no ESP_IDF_COMP_ESP_PARTITION. The correct name is ESP_IDF_COMP_ESP_PARTITION_ENABLED

#include "esp_partition.h"
#endif
#else
Expand Down Expand Up @@ -251,7 +251,9 @@

#ifdef ESP_IDF_COMP_VFS_ENABLED
#include "esp_vfs.h"
#if ESP_IDF_VERSION_MAJOR < 6
#include "esp_vfs_cdcacm.h"
#endif
#include "esp_vfs_dev.h"
#include "esp_vfs_semihost.h"
#ifdef SOC_USB_SERIAL_JTAG_SUPPORTED
Expand Down Expand Up @@ -291,9 +293,15 @@
#endif
#endif

#ifdef ESP_IDF_COMP_ESP_USB_CDC_ROM_CONSOLE_ENABLED
#include "esp_vfs_cdcacm.h"
#endif

#ifdef ESP_IDF_COMP_LWIP_ENABLED
#include "lwip/dns.h"
#if ESP_IDF_VERSION_MAJOR < 6
#include "lwip/lwip_napt.h"
#endif
#include "lwip/netdb.h"
#include "lwip/sockets.h"
#if ESP_IDF_VERSION_MAJOR > 4
Expand All @@ -309,9 +317,8 @@
#endif

#ifdef ESP_IDF_COMP_MBEDTLS_ENABLED
#include "mbedtls/build_info.h"
#include "mbedtls/ssl.h"
#if MBEDTLS_VERSION_MAJOR < 4
#if ESP_IDF_VERSION_MAJOR < 6
#include "mbedtls/aes.h"
#include "mbedtls/cipher.h"
#include "mbedtls/entropy.h"
Expand Down Expand Up @@ -423,6 +430,11 @@
#if OLD_DRIVER_COMP_TWAI || defined(ESP_IDF_COMP_ESP_DRIVER_TWAI_ENABLED)
#include "driver/twai.h"
#endif
#if ESP_IDF_VERSION_MAJOR > 5 && defined(ESP_IDF_COMP_ESP_DRIVER_TWAI_ENABLED)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is worth it, maybe not terribly useful if we don't have a driver yet -- but doesn't hurt.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TWAI = CAN. We do have a driver for that? Or do you mean there is a new twai/can driver? I might have forgotten that...

Also, getting as many raw bindings included (even of we don't have type-safe Rust drivers for those) in general IS useful, as then the user could just call the unsafe C bindings to work with the ESP-IDF drivers.

If the drivers are not even included in the bindings, then there is no escape hatch, which is pretty bad.

With that said, I'm not sure I understand this change...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't even know what TWAI is ,-P

More generally talking about adding new header files to the bindings -- I assumed a new header means a new esp-idf driver, so no support on the Rust side (yet). Understood it makes sense to add them.

#include "esp_twai.h"
#include "esp_twai_types.h"
#include "esp_twai_onchip.h"
#endif

// DAC
#if OLD_DRIVER_COMP || defined(ESP_IDF_COMP_ESP_DRIVER_DAC_ENABLED)
Expand Down Expand Up @@ -553,10 +565,13 @@
#include "sdmmc_cmd.h"
#endif

// Sigma-delta
// Sigma-delta / SDM
#if ESP_IDF_VERSION_MAJOR < 6
#include "driver/sigmadelta.h"
#endif
#ifdef ESP_IDF_COMP_ESP_DRIVER_SDM_ENABLED
#include "driver/sdm.h"
#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, probably worth adding


// SPI
#if OLD_DRIVER_COMP || defined(ESP_IDF_COMP_ESP_DRIVER_SPI_ENABLED)
Expand All @@ -576,7 +591,7 @@
#if OLD_DRIVER_COMP || defined(ESP_IDF_COMP_ESP_DRIVER_UART_ENABLED)
#include "driver/uart.h"
#include "driver/uart_select.h"
#if ESP_IDF_VERSION_MAJOR >= 5 && defined(ESP_IDF_COMP_VFS_ENABLED)
#if defined(ESP_IDF_COMP_VFS_ENABLED) && (ESP_IDF_VERSION_MAJOR > 5 || (ESP_IDF_VERSION_MAJOR == 5 && ESP_IDF_VERSION_MINOR >= 3))
#include "driver/uart_vfs.h"
#endif
#endif
Expand All @@ -588,6 +603,58 @@
#endif
#endif

// New drivers (ESP-IDF v6.0+)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and ditto

#if ESP_IDF_VERSION_MAJOR > 5

#ifdef ESP_IDF_COMP_ESP_DRIVER_CAM_ENABLED
#include "esp_cam_ctlr.h"
#include "esp_cam_ctlr_types.h"
#ifdef SOC_MIPI_CSI_SUPPORTED
#include "esp_cam_ctlr_csi.h"
#endif
#endif

#ifdef ESP_IDF_COMP_ESP_DRIVER_ISP_ENABLED
#ifdef SOC_ISP_SUPPORTED
#include "driver/isp.h"
#include "driver/isp_core.h"
#include "driver/isp_types.h"
#include "driver/isp_af.h"
#include "driver/isp_ae.h"
#include "driver/isp_awb.h"
#include "driver/isp_bf.h"
#include "driver/isp_ccm.h"
#include "driver/isp_gamma.h"
#include "driver/isp_hist.h"
#include "driver/isp_sharpen.h"
#endif
#endif

#ifdef ESP_IDF_COMP_ESP_DRIVER_JPEG_ENABLED
#ifdef SOC_JPEG_CODEC_SUPPORTED
#include "driver/jpeg_types.h"
#ifdef SOC_JPEG_DECODE_SUPPORTED
#include "driver/jpeg_decode.h"
#endif
#ifdef SOC_JPEG_ENCODE_SUPPORTED
#include "driver/jpeg_encode.h"
#endif
#endif
#endif

#ifdef ESP_IDF_COMP_ESP_DRIVER_ANA_CMPR_ENABLED
#include "driver/ana_cmpr.h"
#include "driver/ana_cmpr_types.h"
#endif

#ifdef ESP_IDF_COMP_ESP_DRIVER_PARLIO_ENABLED
#include "driver/parlio_types.h"
#include "driver/parlio_tx.h"
#include "driver/parlio_rx.h"
#endif

#endif // ESP_IDF_VERSION_MAJOR > 5

#ifdef ESP_IDF_COMP_ESPCOREDUMP_ENABLED
#ifdef CONFIG_ESP_COREDUMP_ENABLE
#include "esp_core_dump.h"
Expand Down Expand Up @@ -749,10 +816,8 @@
#include "esp_lcd_types.h"
#include "esp_lcd_panel_interface.h"
#include "esp_lcd_panel_io_interface.h"
#if ESP_IDF_VERSION_MAJOR < 6
#if ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4 || (ESP_IDF_VERSION_MAJOR >= 5 && ESP_IDF_VERSION_MINOR <= 2 || SOC_LCD_RGB_SUPPORTED)
#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || (ESP_IDF_VERSION_MAJOR == 5 && ESP_IDF_VERSION_MINOR <= 2) || defined(SOC_LCD_RGB_SUPPORTED)
#include "esp_lcd_panel_rgb.h"
#endif //(ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ((ESP_IDF_VERSION_MAJOR >= 5 && ESP_IDF_VERSION_MINOR <= 2) || SOC_LCD_RGB_SUPPORTED)
#endif
#if ESP_IDF_VERSION_MAJOR > 5 || ESP_IDF_VERSION_MAJOR == 5 && ESP_IDF_VERSION_MINOR >= 3
#include "esp_lcd_panel_dev.h"
Expand Down
Loading