rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
wifi_radio.h File Reference

The radio under esp_wifi, as wifi_access.c sees it. More...

#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"

Go to the source code of this file.

Functions

void wifi_radio_mac (uint8_t mac[6])
 6 bytes that differ from board to board, for the network name.
esp_err_t wifi_radio_link (void)
 Bring the link to the C6 up, before esp_wifi_init().
bool wifi_radio_failed (void)
 Whether the link has failed since the panel started.

Detailed Description

The radio under esp_wifi, as wifi_access.c sees it.

The ESP32-P4 has no radio: the 7-inch display board from Waveshare carries an ESP32-C6 on SDIO (Secure Digital input/output) slot 1, and the esp_wifi calls reach it through the managed components esp_wifi_remote and esp_hosted. This file brings that link up, reports the C6's firmware version, and turns a failure of the link into a failed start instead of a restart of the panel.

SPDX-License-Identifier: MIT

Function Documentation

◆ wifi_radio_failed()

bool wifi_radio_failed ( void )

Whether the link has failed since the panel started.

Returns
true after esp_hosted reported a failed SDIO link; callable from any task.

◆ wifi_radio_link()

esp_err_t wifi_radio_link ( void )

Bring the link to the C6 up, before esp_wifi_init().

Called from the task that brings the radio up. The first call resets the C6 (EN low for 10ms, then a fixed 1,500ms, CONFIG_ESP_HOSTED_SDIO_RESET_DELAY_MS), starts it as an SDIO card and waits for its start event, polling every 200ms. A C6 that starts as a card and sends no start event is reset again after 50 and after 100 polls; the call returns after about 25s. A C6 that does not start as a card ends the call after the card's start-up, at least 1,500ms. Then esp_hosted's TRANSPORT_UP event is awaited for at most 1,000ms. The C6's firmware version is logged once. Later calls with the link up return at once, with no reset.

Returns
ESP_OK with the link up; ESP_FAIL when the C6 did not answer, when the handlers of esp_hosted's events cannot be registered, and on every call once the link has failed, until the panel restarts. A C6 that did not answer is held in reset.

◆ wifi_radio_mac()

void wifi_radio_mac ( uint8_t mac[6])

6 bytes that differ from board to board, for the network name.

The ESP32-P4's base MAC (media access control) address from eFuse, read for wa_name().

Parameters
macReceives the 6 bytes.