MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / _timer_tick

Method _timer_tick

libraries/AP_HAL_ChibiOS/RCInput.cpp:127–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void RCInput::_timer_tick(void)
128{
129 if (!_init) {
130 return;
131 }
132#ifndef HAL_NO_UARTDRIVER
133 const char *rc_protocol = nullptr;
134 RCSource source = last_source;
135#endif
136
137#if AP_RCPROTOCOL_ENABLED
138 AP_RCProtocol &rcprot = AP::RC();
139
140#if HAL_USE_ICU == TRUE
141 if (pulse_input_enabled) {
142 const uint32_t *p;
143 uint32_t n;
144 while ((p = (const uint32_t *)sig_reader.sigbuf.readptr(n)) != nullptr) {
145 rcprot.process_pulse_list(p, n*2, sig_reader.need_swap);
146 sig_reader.sigbuf.advance(n);
147 }
148 }
149#endif
150
151#if HAL_USE_EICU == TRUE
152 if (pulse_input_enabled) {
153 uint32_t width_s0, width_s1;
154 while(sig_reader.read(width_s0, width_s1)) {
155 rcprot.process_pulse(width_s0, width_s1);
156 }
157 }
158#endif
159
160#endif // AP_RCPROTOCOL_ENABLED
161
162#if HAL_WITH_IO_MCU
163 uint32_t now = AP_HAL::millis();
164 const bool have_iocmu_rc = (_rcin_last_iomcu_ms != 0 && now - _rcin_last_iomcu_ms < 400);
165 if (!have_iocmu_rc) {
166 _rcin_last_iomcu_ms = 0;
167 }
168#elif AP_RCPROTOCOL_ENABLED
169 const bool have_iocmu_rc = false;
170#endif
171
172#if AP_RCPROTOCOL_ENABLED
173 if (rcprot.new_input() && !have_iocmu_rc) {
174 WITH_SEMAPHORE(rcin_mutex);
175 _rcin_timestamp_last_signal = AP_HAL::micros();
176 _num_channels = rcprot.num_channels();
177 _num_channels = MIN(_num_channels, RC_INPUT_MAX_CHANNELS);
178 rcprot.read(_rc_values, _num_channels);
179 _rssi = rcprot.get_RSSI();
180 _rx_link_quality = rcprot.get_rx_link_quality();
181#ifndef HAL_NO_UARTDRIVER
182 rc_protocol = rcprot.protocol_name();
183 source = rcprot.using_uart() ? RCSource::RCPROT_BYTES : RCSource::RCPROT_PULSES;
184#endif

Callers 3

_run_timersMethod · 0.45
_rcin_threadMethod · 0.45
_storage_threadMethod · 0.45

Calls 15

MINFunction · 0.85
process_pulse_listMethod · 0.80
protocol_nameMethod · 0.80
using_uartMethod · 0.80
check_rcinputMethod · 0.80
get_rc_protocolMethod · 0.80
millisFunction · 0.70
microsFunction · 0.70
readptrMethod · 0.45
advanceMethod · 0.45
readMethod · 0.45
process_pulseMethod · 0.45

Tested by

no test coverage detected