Skip to content

Add AP mode support to ESP32::WiFi #117

@yuuu

Description

@yuuu

Summary

Add AP (Access Point) mode support to the ESP32::WiFi class in picoruby-esp32, so that PicoRuby code on R2P2-ESP32 can start a Wi-Fi access point in addition to the existing station mode.

Background

On the RP2040 / Pico W side, an equivalent change is being introduced for CYW43:

That PR adds the following Ruby APIs:

  • CYW43.enable_ap_mode(ssid, password, auth = CYW43::Auth::WPA2_AES_PSK) -> bool
  • CYW43.disable_ap_mode() -> bool

We want ESP32::WiFi to expose a comparable AP mode API so that AP mode is available across both RP2040 and ESP32 targets.

Proposed API

Modeled after picoruby/picoruby#400, on the ESP32::WiFi class:

  • ESP32::WiFi.enable_ap_mode(ssid, password, auth = <ESP32 default WPA2>) -> bool
  • ESP32::WiFi.disable_ap_mode() -> bool

The exact constant name(s) for the auth mode should match existing ESP32::WiFi conventions.

Approach

  • Reference the design and API shape of Add minimal CYW43 AP mode API picoruby#400.
  • Implement the AP-mode bindings on top of ESP-IDF's Wi-Fi APIs (esp_wifi_set_mode(WIFI_MODE_AP) etc.).
  • Keep the first step minimal: bringing up / tearing down the AP. Higher-level concerns (DHCP server tuning, IP configuration helpers, etc.) can be follow-ups.
  • Add a minimal example and note current limitations, mirroring the structure of PR #400.

Example (target usage)

ESP32::WiFi.enable_ap_mode("R2P2-AP", "12345678")
puts "AP started"

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions