mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
For boards such as Waveshare's ESP32-P4-WIFI6-POE-ETH: WiFi through the board's ESP32-C6 on SDIO (esp-hosted), Ethernet on the P4's RMII MAC with an IP101. Not tested on a device: no P4 board was at hand. - platformio.ini: env esp32p4 (esp32-p4_r3, chip v3.01+) and esp32p4es (esp32-p4, the esp32p4_es libraries, chips before v2.0). An image runs on one of the two only, so each has its own release files, chip models "p4" and "p4es". Both keep the OTA slot: at level 2 they leave about 128 KB of it. - Ethernet clock mode: stored as eth_clock_id_t in the ESP32's numbering and translated by name, like the PHY id. The P4's eth_clock_mode_t is the IDF's emac_rmii_clock_mode_t, whose 0 is a deprecated default; only clock in (GPIO 50) translates there. - P4 Ethernet defaults: the Waveshare wiring (IP101 as TLK110, address 1, MDC 31, MDIO 52, reset 51), board type 8. The ESP32's put MDIO on an SDIO pin. - Settings take pins up to GPIO 54, the P4's last, instead of 48. - Radio defaults: SPI 32/33/27, CSN 46 (the framework's Waveshare variant), TX 2, RX 3. - Web UI: a Waveshare ESP32-P4-ETH preset, the P4's clock mode, pin lists up to GPIO 54 without the pins the C6 link, Ethernet, USB and UART0 use. - CI builds and releases both, with their ELFs; bootloader at 0x2000. - ADR 0003: amended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
#include <unity.h>
|
|
// As on the ESP32-P4, which has the RMII MAC too but takes the IDF's clock
|
|
// enum.
|
|
#define CONFIG_ETH_USE_ESP32_EMAC 1
|
|
#define CONFIG_IDF_TARGET_ESP32P4 1
|
|
#include "EthPhy.h"
|
|
|
|
void setUp() {}
|
|
void tearDown() {}
|
|
|
|
static void test_builds_with_ethernet() {
|
|
TEST_ASSERT_EQUAL(1, HAS_ETHERNET);
|
|
}
|
|
static void test_ip101_is_the_tlk110_id() {
|
|
// Waveshare's ESP32-P4-ETH boards have an IP101, which Arduino drives as
|
|
// the TLK110; the web UI's preset stores 1.
|
|
eth_phy_type_t type = ETH_PHY_MAX;
|
|
TEST_ASSERT_TRUE(ethPhyType(1, type));
|
|
TEST_ASSERT_EQUAL(ETH_PHY_TLK110, type);
|
|
}
|
|
static void test_clock_in_is_ext_in() {
|
|
// A cast would give the IDF's deprecated EMAC_CLK_DEFAULT.
|
|
eth_clock_mode_t mode = EMAC_CLK_DEFAULT;
|
|
TEST_ASSERT_TRUE(ethClockMode(static_cast<uint8_t>(eth_clock_id_t::GPIO0_IN), mode));
|
|
TEST_ASSERT_EQUAL(EMAC_CLK_EXT_IN, mode);
|
|
}
|
|
static void test_rejects_clock_out() {
|
|
// ETH.begin() keeps the clock on GPIO 50, which only takes a clock in.
|
|
eth_clock_mode_t mode;
|
|
TEST_ASSERT_FALSE(ethClockMode(1, mode));
|
|
TEST_ASSERT_FALSE(ethClockMode(2, mode));
|
|
TEST_ASSERT_FALSE(ethClockMode(3, mode));
|
|
TEST_ASSERT_FALSE(ethClockMode(4, mode));
|
|
}
|
|
static void test_clock_pin_is_50() {
|
|
TEST_ASSERT_EQUAL_INT8(50, ethClockPin(0));
|
|
TEST_ASSERT_EQUAL_INT8(-1, ethClockPin(1));
|
|
TEST_ASSERT_EQUAL_INT8(-1, ethClockPin(3));
|
|
}
|
|
|
|
int main(int, char **) {
|
|
UNITY_BEGIN();
|
|
RUN_TEST(test_builds_with_ethernet);
|
|
RUN_TEST(test_ip101_is_the_tlk110_id);
|
|
RUN_TEST(test_clock_in_is_ext_in);
|
|
RUN_TEST(test_rejects_clock_out);
|
|
RUN_TEST(test_clock_pin_is_50);
|
|
return UNITY_END();
|
|
}
|