Test RX channel with manual GPIO toggle pattern.
20 {
21
22 FL_WARN(
"[RX TEST] Testing RX channel with manual GPIO toggle on PIN " << pin_tx);
23
24
27
28
29 const int num_toggles = 16;
30 const int toggle_delay_us = 1000;
31 const u32 signal_range_max_ns = 2000000;
32
33
35 rx_config.edge_capacity = buffer_size;
36 rx_config.hz = hz;
37 rx_config.signal_range_min_ns = 100;
38 rx_config.signal_range_max_ns = signal_range_max_ns;
39 rx_config.start_low = true;
40
41 if (!rx_channel->
begin(rx_config)) {
42 FL_ERROR(
"[RX TEST]: Failed to begin RX channel");
44 return false;
45 }
46
48
49
50 for (int i = 0; i < num_toggles; i++) {
53
56 }
57
58
59 u32 timeout_ms = 100;
61
62
64
65
67 FL_ERROR(
"[RX TEST]: RX channel wait failed (result: " <<
static_cast<int>(wait_result) <<
")");
68 FL_ERROR(
"[RX TEST]: RX may not be working - check PIN_RX (" << pin_rx <<
") and RMT peripheral");
69 FL_ERROR(
"[RX TEST]: If using non-RMT TX, ensure physical jumper from PIN " << pin_tx <<
" to PIN " << pin_rx);
70 return false;
71 }
72
73
74 fl::FixedVector<fl::EdgeTime, 4> check_edges;
77 if (edge_count == 0) {
78 FL_ERROR(
"[RX TEST]: wait() succeeded but 0 edges captured - DMA trigger may be misconfigured");
79 FL_ERROR(
"[RX TEST]: Check DMAMUX source number for PIN_RX (" << pin_rx <<
")");
80 return false;
81 }
82
83 FL_WARN(
"[RX TEST] ✓ RX channel captured " << edge_count <<
" edges from " << num_toggles <<
" toggles");
84 FL_WARN(
"[RX TEST] ✓ RX channel is functioning correctly");
85
86 return true;
87}
void resize(fl::size n) FL_NOEXCEPT
bool begin(const RxChannelConfig &config) FL_NOEXCEPT
size_t getRawEdgeTimes(fl::span< EdgeTime > out, size_t offset=0) FL_NOEXCEPT
RxWaitResult wait(u32 timeout_ms) FL_NOEXCEPT
@ Low
Logic low (0V / GND)
@ High
Logic high (3.3V / 5V, platform-dependent)
void pinMode(int pin, PinMode mode)
Set pin mode (input, output, pull-up, pull-down)
void digitalWrite(int pin, PinValue val)
Write digital value to pin.
RxWaitResult
Result codes for RX wait() operations.
@ SUCCESS
Operation completed successfully.
void delayMicroseconds(u32 us)
Delay for a given number of microseconds.
@ Output
Digital output (push-pull)
@ Input
Digital input (high impedance)