Skip to content

feat(p4): Add method to set the pins for SDIO to WiFi chip #11513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

me-no-dev
Copy link
Member

This pull request introduces enhancements to the SDIO pin configuration mechanism in the WiFiGeneric library, allowing dynamic configuration of pins for external ESP MCU connections. The changes primarily involve adding a new setPins method, refactoring pin initialization logic, and updating associated comments for clarity.

SDIO Pin Configuration Enhancements:

  • Addition of setPins Method: Introduced a static method setPins in WiFiGenericClass to allow dynamic configuration of SDIO pins. This method validates the provided pin values and ensures they are set before WiFi initialization. (libraries/WiFi/src/WiFiGeneric.cpp and libraries/WiFi/src/WiFiGeneric.h, [1] [2]

  • Refactoring Pin Initialization Logic: Replaced hardcoded pin configurations with a new sdio_pin_config_t structure, enabling centralized and flexible management of SDIO pin settings. (libraries/WiFi/src/WiFiGeneric.cpp, libraries/WiFi/src/WiFiGeneric.cppR249-R309)

Code Cleanup and Comments:

  • Updated Comments in wifiHostedInit: Refined comments in the wifiHostedInit function to reflect the use of the new sdio_pin_config structure instead of hardcoded pin configurations. (libraries/WiFi/src/WiFiGeneric.cpp, libraries/WiFi/src/WiFiGeneric.cppL282-R326)

Fixes: #11404

Copy link
Contributor

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello me-no-dev, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 0b3e248

@me-no-dev me-no-dev requested a review from Copilot June 24, 2025 14:54
@me-no-dev me-no-dev added Status: Review needed Issue or PR is awaiting review Area: WiFi Issue related to WiFi labels Jun 24, 2025
@me-no-dev me-no-dev self-assigned this Jun 24, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Enhance SDIO pin flexibility by introducing a dynamic configuration method and centralizing pin setup using a new data structure, replacing hardcoded values.

  • Add setPins method to allow custom SDIO pin assignment before WiFi initialization.
  • Introduce sdio_pin_config_t struct with default initialization and refactor wifiHostedInit to use it.
  • Update inline comments to reflect the new pin configuration approach.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
libraries/WiFi/src/WiFiGeneric.h Declared setPins method under CONFIG_ESP_WIFI_REMOTE_ENABLED.
libraries/WiFi/src/WiFiGeneric.cpp Added sdio_pin_config_t, default pin setup, setPins logic, refactored wifiHostedInit, and updated comments.
Comments suppressed due to low confidence (2)

libraries/WiFi/src/WiFiGeneric.h:87

  • The public method setPins lacks a documentation comment. Consider adding a brief Doxygen-style comment describing each parameter, the return value, and when it should be called to improve clarity for users.
  static bool setPins(int8_t clk, int8_t cmd, int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t rst);

libraries/WiFi/src/WiFiGeneric.cpp:280

  • The new setPins method implements validation and configuration logic but isn't covered by any tests. Adding unit or integration tests would help ensure correct behavior and prevent regressions.
bool WiFiGenericClass::setPins(int8_t clk, int8_t cmd, int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t rst) {

Copy link
Contributor

github-actions bot commented Jun 24, 2025

Test Results

 76 files   76 suites   13m 8s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 0b3e248.

♻️ This comment has been updated with latest results.

Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32P4000.000.00000.000.00
ESP32S3000.000.00000.000.00
ESP32S2000.000.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32000.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/WiFi/examples/FTM/FTM_Initiator------------
libraries/WiFi/examples/FTM/FTM_Responder------------
libraries/WiFi/examples/SimpleWiFiServer------------
libraries/WiFi/examples/WiFiAccessPoint------------
libraries/WiFi/examples/WiFiClient------------
libraries/WiFi/examples/WiFiClientBasic------------
libraries/WiFi/examples/WiFiClientConnect------------
libraries/WiFi/examples/WiFiClientEvents------------
libraries/WiFi/examples/WiFiClientStaticIP------------
libraries/WiFi/examples/WiFiExtender------------
libraries/WiFi/examples/WiFiIPv6------------
libraries/WiFi/examples/WiFiMulti------------
libraries/WiFi/examples/WiFiMultiAdvanced------------
libraries/WiFi/examples/WiFiScan------------
libraries/WiFi/examples/WiFiScanAsync------------
libraries/WiFi/examples/WiFiScanDualAntenna------------
libraries/WiFi/examples/WiFiScanTime------------
libraries/WiFi/examples/WiFiTelnetToSerial------------
libraries/WiFi/examples/WiFiUDPClient------------
libraries/WiFi/examples/WPS------------
libraries/WiFi/examples/WiFiBlueToothSwitch------------
libraries/WiFi/examples/WiFiClientEnterprise------------
libraries/WiFi/examples/WiFiSmartConfig------------

@Westcott1
Copy link

Can't wait to try this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: WiFi Issue related to WiFi Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESP32P4/C6 WiFi init doesn't work SDIO fail
2 participants