31 #if PERIODIC_TELEMETRY
39 #if PERIODIC_TELEMETRY
40 static void send_i2c0_err(
struct transport_tx *
trans,
struct link_device *
dev)
43 uint16_t i2c0_queue_full_cnt = i2c0.errors->queue_full_cnt;
44 uint16_t i2c0_ack_fail_cnt = i2c0.errors->ack_fail_cnt;
45 uint16_t i2c0_miss_start_stop_cnt = i2c0.errors->miss_start_stop_cnt;
46 uint16_t i2c0_arb_lost_cnt = i2c0.errors->arb_lost_cnt;
47 uint16_t i2c0_over_under_cnt = i2c0.errors->over_under_cnt;
48 uint16_t i2c0_pec_recep_cnt = i2c0.errors->pec_recep_cnt;
49 uint16_t i2c0_timeout_tlow_cnt = i2c0.errors->timeout_tlow_cnt;
50 uint16_t i2c0_smbus_alert_cnt = i2c0.errors->smbus_alert_cnt;
51 uint16_t i2c0_unexpected_event_cnt = i2c0.errors->unexpected_event_cnt;
52 uint32_t i2c0_last_unexpected_event = i2c0.errors->last_unexpected_event;
54 pprz_msg_send_I2C_ERRORS(
trans,
dev, AC_ID,
58 &i2c0_miss_start_stop_cnt,
62 &i2c0_timeout_tlow_cnt,
63 &i2c0_smbus_alert_cnt,
64 &i2c0_unexpected_event_cnt,
65 &i2c0_last_unexpected_event,
83 #if PERIODIC_TELEMETRY
84 static void send_i2c1_err(
struct transport_tx *
trans,
struct link_device *
dev)
87 uint16_t i2c1_queue_full_cnt = i2c1.errors->queue_full_cnt;
88 uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt;
89 uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt;
90 uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt;
91 uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt;
92 uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt;
93 uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt;
94 uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt;
95 uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt;
96 uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event;
98 pprz_msg_send_I2C_ERRORS(
trans,
dev, AC_ID,
100 &i2c1_queue_full_cnt,
102 &i2c1_miss_start_stop_cnt,
104 &i2c1_over_under_cnt,
106 &i2c1_timeout_tlow_cnt,
107 &i2c1_smbus_alert_cnt,
108 &i2c1_unexpected_event_cnt,
109 &i2c1_last_unexpected_event,
127 #if PERIODIC_TELEMETRY
128 static void send_i2c2_err(
struct transport_tx *
trans,
struct link_device *
dev)
131 uint16_t i2c2_queue_full_cnt = i2c2.errors->queue_full_cnt;
132 uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
133 uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
134 uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
135 uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
136 uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
137 uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
138 uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
139 uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
140 uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
142 pprz_msg_send_I2C_ERRORS(
trans,
dev, AC_ID,
144 &i2c2_queue_full_cnt,
146 &i2c2_miss_start_stop_cnt,
148 &i2c2_over_under_cnt,
150 &i2c2_timeout_tlow_cnt,
151 &i2c2_smbus_alert_cnt,
152 &i2c2_unexpected_event_cnt,
153 &i2c2_last_unexpected_event,
176 #if PERIODIC_TELEMETRY
177 static void send_i2c3_err(
struct transport_tx *
trans,
struct link_device *
dev)
179 uint16_t i2c3_wd_reset_cnt = i2c3.errors->wd_reset_cnt;
180 uint16_t i2c3_queue_full_cnt = i2c3.errors->queue_full_cnt;
181 uint16_t i2c3_ack_fail_cnt = i2c3.errors->ack_fail_cnt;
182 uint16_t i2c3_miss_start_stop_cnt = i2c3.errors->miss_start_stop_cnt;
183 uint16_t i2c3_arb_lost_cnt = i2c3.errors->arb_lost_cnt;
184 uint16_t i2c3_over_under_cnt = i2c3.errors->over_under_cnt;
185 uint16_t i2c3_pec_recep_cnt = i2c3.errors->pec_recep_cnt;
186 uint16_t i2c3_timeout_tlow_cnt = i2c3.errors->timeout_tlow_cnt;
187 uint16_t i2c3_smbus_alert_cnt = i2c3.errors->smbus_alert_cnt;
188 uint16_t i2c3_unexpected_event_cnt = i2c3.errors->unexpected_event_cnt;
189 uint32_t i2c3_last_unexpected_event = i2c3.errors->last_unexpected_event;
191 pprz_msg_send_I2C_ERRORS(
trans,
dev, AC_ID,
193 &i2c3_queue_full_cnt,
195 &i2c3_miss_start_stop_cnt,
197 &i2c3_over_under_cnt,
199 &i2c3_timeout_tlow_cnt,
200 &i2c3_smbus_alert_cnt,
201 &i2c3_unexpected_event_cnt,
202 &i2c3_last_unexpected_event,
219 #if PERIODIC_TELEMETRY
220 static void send_i2c4_err(
struct transport_tx *
trans,
struct link_device *
dev)
222 uint16_t i2c4_wd_reset_cnt = i2c4.errors->wd_reset_cnt;
223 uint16_t i2c4_queue_full_cnt = i2c4.errors->queue_full_cnt;
224 uint16_t i2c4_ack_fail_cnt = i2c4.errors->ack_fail_cnt;
225 uint16_t i2c4_miss_start_stop_cnt = i2c4.errors->miss_start_stop_cnt;
226 uint16_t i2c4_arb_lost_cnt = i2c4.errors->arb_lost_cnt;
227 uint16_t i2c4_over_under_cnt = i2c4.errors->over_under_cnt;
228 uint16_t i2c4_pec_recep_cnt = i2c4.errors->pec_recep_cnt;
229 uint16_t i2c4_timeout_tlow_cnt = i2c4.errors->timeout_tlow_cnt;
230 uint16_t i2c4_smbus_alert_cnt = i2c4.errors->smbus_alert_cnt;
231 uint16_t i2c4_unexpected_event_cnt = i2c4.errors->unexpected_event_cnt;
232 uint32_t i2c4_last_unexpected_event = i2c4.errors->last_unexpected_event;
234 pprz_msg_send_I2C_ERRORS(
trans,
dev, AC_ID,
236 &i2c4_queue_full_cnt,
238 &i2c4_miss_start_stop_cnt,
240 &i2c4_over_under_cnt,
242 &i2c4_timeout_tlow_cnt,
243 &i2c4_smbus_alert_cnt,
244 &i2c4_unexpected_event_cnt,
245 &i2c4_last_unexpected_event,
253 extern void send_softi2c0_err(
struct transport_tx *
trans,
struct link_device *
dev);
257 extern void send_softi2c1_err(
struct transport_tx *
trans,
struct link_device *
dev);
260 #if PERIODIC_TELEMETRY
262 struct link_device *
dev __attribute__((unused)))
264 static uint8_t _i2c_nb_cnt = 0;
265 switch (_i2c_nb_cnt) {
303 if (_i2c_nb_cnt == 7) {
312 p->trans_insert_idx = 0;
313 p->trans_extract_idx = 0;
317 #if PERIODIC_TELEMETRY
355 #ifndef I2C_BLOCKING_TIMEOUT
356 #define I2C_BLOCKING_TIMEOUT 1.f
373 if (
p->spin)
p->spin(
p);
395 if (
p->spin)
p->spin(
p);
417 if (
p->spin)
p->spin(
p);