FastLED 3.10.8
Loading...
Searching...
No Matches
AutoResearchPlatform.h
Go to the documentation of this file.
1// AutoResearchPlatform.h - Platform-specific defaults for AutoResearch example
2//
3// Encapsulates all platform #ifdefs so AutoResearch.ino stays clean.
4
5#pragma once
6
7#include "platforms/is_platform.h"
8
9namespace autoresearch {
10
11// Default TX pin for each platform
12//
13// NOTE: Avoid GPIO0/1/3 on classic ESP32 — GPIO1 is UART0 TX (console output),
14// GPIO3 is UART0 RX, and GPIO0 is a boot-strap pin. Toggling GPIO1 from
15// AutoResearch's GPIO baseline test (testRxChannel) silences the console and
16// causes FastLED #3452 (RPC silence). Use GPIO 18/19 which are general-purpose
17// and don't collide with peripheral fixed-function muxing on the WROOM module.
18constexpr int defaultTxPin() {
19#if defined(FL_IS_STUB)
20 return 1; // Stub: TX and RX same pin — NativeRxDevice monitors TX output directly
21#elif defined(FL_IS_ESP_32S3)
22 return 1; // ESP32-S3: Connect GPIO 1 (TX) to GPIO 2 (RX) with jumper wire
23#elif defined(FL_IS_ESP_32S2)
24 return 1; // ESP32-S2
25#elif defined(FL_IS_ESP_32C6)
26 return 1; // ESP32-C6 (RISC-V)
27#elif defined(FL_IS_ESP_32C3)
28 return 1; // ESP32-C3 (RISC-V)
29#elif defined(FL_IS_ESP_32P4)
30 return 5; // ESP32-P4: Connect GPIO 5 (TX) to GPIO 6 (RX) with jumper wire
31#elif defined(FL_IS_TEENSY_4X)
32 return 1; // Teensy 4.x: any GPIO works for TX
33#elif defined(FL_IS_ESP_32DEV)
34 // ESP32 (classic): GPIO 33 → GPIO 34 jumper. GPIO34 is input-only
35 // (no output driver, no boot-strap role) which makes it an ideal RX
36 // pin, and 33/34 avoid GPIO0/1/3 (boot strap + UART0, see #3452).
37 // The WROOM COM11 bench harness is physically wired 33 → 34
38 // (verified electrically in FastLED#3569 — the previously-documented
39 // 18 → 19 pair was never connected there).
40 return 33;
41#else
42 return 1; // Other variants
43#endif
44}
45
46// Default RX pin for each platform
47//
48// NOTE: See defaultTxPin() above for the classic-ESP32 GPIO0/1/3 caveat — the
49// default RX pin must also avoid those. GPIO 19 is a safe partner for GPIO 18.
50constexpr int defaultRxPin() {
51#if defined(FL_IS_STUB)
52 return 1; // Stub: same pin as TX — internal loopback
53#elif defined(FL_IS_ESP_32S3)
54 return 2; // ESP32-S3: jumper wire from GPIO 1
55#elif defined(FL_IS_ESP_32S2)
56 return 0;
57#elif defined(FL_IS_ESP_32C6)
58 return 0;
59#elif defined(FL_IS_ESP_32C3)
60 return 0;
61#elif defined(FL_IS_ESP_32P4)
62 return 6; // ESP32-P4: jumper wire from GPIO 5
63#elif defined(FL_IS_TEENSY_4X)
64 return 2; // Teensy 4.x: FlexPWM-capable pin, jumper wire from pin 1
65#elif defined(FL_IS_ESP_32DEV)
66 return 34; // ESP32 (classic): input-only pad, jumper wire from GPIO 33.
67#else
68 return 0; // Other variants
69#endif
70}
71
72// Human-readable chip/platform name
73constexpr const char* chipName() {
74#if defined(FL_IS_STUB)
75 return "Stub/Native";
76#elif defined(FL_IS_ESP_32C6)
77 return "ESP32-C6 (RISC-V)";
78#elif defined(FL_IS_ESP_32S3)
79 return "ESP32-S3 (Xtensa)";
80#elif defined(FL_IS_ESP_32C3)
81 return "ESP32-C3 (RISC-V)";
82#elif defined(FL_IS_ESP_32DEV)
83 return "ESP32 (Xtensa)";
84#elif defined(FL_IS_ESP_32P4)
85 return "ESP32-P4 (dual-core RISC-V)";
86#elif defined(FL_IS_TEENSY_4X)
87 return "Teensy 4.x (Cortex-M7)";
88#elif defined(ARDUINO_RASPBERRY_PI_PICO_2W) || defined(ARDUINO_RPIPICO2W)
89 return "Raspberry Pi Pico 2 W (RP2350)";
90#elif defined(FL_IS_RP2350)
91 return "RP2350";
92#else
93 return "Unknown platform";
94#endif
95}
96
97} // namespace autoresearch
constexpr int defaultTxPin()
constexpr int defaultRxPin()
constexpr const char * chipName()