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