30 #if PERIODIC_TELEMETRY
38 #if PERIODIC_TELEMETRY
42 uint16_t i2c0_queue_full_cnt = i2c0.errors->queue_full_cnt;
43 uint16_t i2c0_ack_fail_cnt = i2c0.errors->ack_fail_cnt;
44 uint16_t i2c0_miss_start_stop_cnt = i2c0.errors->miss_start_stop_cnt;
45 uint16_t i2c0_arb_lost_cnt = i2c0.errors->arb_lost_cnt;
46 uint16_t i2c0_over_under_cnt = i2c0.errors->over_under_cnt;
47 uint16_t i2c0_pec_recep_cnt = i2c0.errors->pec_recep_cnt;
48 uint16_t i2c0_timeout_tlow_cnt = i2c0.errors->timeout_tlow_cnt;
49 uint16_t i2c0_smbus_alert_cnt = i2c0.errors->smbus_alert_cnt;
50 uint16_t i2c0_unexpected_event_cnt = i2c0.errors->unexpected_event_cnt;
51 uint32_t i2c0_last_unexpected_event = i2c0.errors->last_unexpected_event;
53 pprz_msg_send_I2C_ERRORS(trans, dev, AC_ID,
57 &i2c0_miss_start_stop_cnt,
61 &i2c0_timeout_tlow_cnt,
62 &i2c0_smbus_alert_cnt,
63 &i2c0_unexpected_event_cnt,
64 &i2c0_last_unexpected_event,
82 #if PERIODIC_TELEMETRY
86 uint16_t i2c1_queue_full_cnt = i2c1.errors->queue_full_cnt;
87 uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt;
88 uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt;
89 uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt;
90 uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt;
91 uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt;
92 uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt;
93 uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt;
94 uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt;
95 uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event;
97 pprz_msg_send_I2C_ERRORS(trans, dev, AC_ID,
101 &i2c1_miss_start_stop_cnt,
103 &i2c1_over_under_cnt,
105 &i2c1_timeout_tlow_cnt,
106 &i2c1_smbus_alert_cnt,
107 &i2c1_unexpected_event_cnt,
108 &i2c1_last_unexpected_event,
126 #if PERIODIC_TELEMETRY
130 uint16_t i2c2_queue_full_cnt = i2c2.errors->queue_full_cnt;
131 uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
132 uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
133 uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
134 uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
135 uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
136 uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
137 uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
138 uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
139 uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
141 pprz_msg_send_I2C_ERRORS(trans, dev, AC_ID,
143 &i2c2_queue_full_cnt,
145 &i2c2_miss_start_stop_cnt,
147 &i2c2_over_under_cnt,
149 &i2c2_timeout_tlow_cnt,
150 &i2c2_smbus_alert_cnt,
151 &i2c2_unexpected_event_cnt,
152 &i2c2_last_unexpected_event,
175 #if PERIODIC_TELEMETRY
178 uint16_t i2c3_wd_reset_cnt = i2c3.errors->wd_reset_cnt;
179 uint16_t i2c3_queue_full_cnt = i2c3.errors->queue_full_cnt;
180 uint16_t i2c3_ack_fail_cnt = i2c3.errors->ack_fail_cnt;
181 uint16_t i2c3_miss_start_stop_cnt = i2c3.errors->miss_start_stop_cnt;
182 uint16_t i2c3_arb_lost_cnt = i2c3.errors->arb_lost_cnt;
183 uint16_t i2c3_over_under_cnt = i2c3.errors->over_under_cnt;
184 uint16_t i2c3_pec_recep_cnt = i2c3.errors->pec_recep_cnt;
185 uint16_t i2c3_timeout_tlow_cnt = i2c3.errors->timeout_tlow_cnt;
186 uint16_t i2c3_smbus_alert_cnt = i2c3.errors->smbus_alert_cnt;
187 uint16_t i2c3_unexpected_event_cnt = i2c3.errors->unexpected_event_cnt;
188 uint32_t i2c3_last_unexpected_event = i2c3.errors->last_unexpected_event;
190 pprz_msg_send_I2C_ERRORS(trans, dev, AC_ID,
192 &i2c3_queue_full_cnt,
194 &i2c3_miss_start_stop_cnt,
196 &i2c3_over_under_cnt,
198 &i2c3_timeout_tlow_cnt,
199 &i2c3_smbus_alert_cnt,
200 &i2c3_unexpected_event_cnt,
201 &i2c3_last_unexpected_event,
208 #if PERIODIC_TELEMETRY
212 static uint8_t _i2c_nb_cnt = 0;
213 switch (_i2c_nb_cnt) {
238 if (_i2c_nb_cnt == 4) {
251 #if PERIODIC_TELEMETRY
bool_t i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
Submit a I2C transaction.
Generic transmission transport header.
uint16_t len_r
Number of bytes to read/receive.
Periodic telemetry system header (includes downlink utility and generated code).
transmit and receive transaction
uint8_t trans_extract_idx
void i2c_init(struct i2c_periph *p)
Initialize I2C peripheral.
struct i2c_errors * errors
bool_t i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
uint8_t len_w
Number of bytes to write/transmit.
bool_t i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
struct i2c_transaction * trans[I2C_TRANSACTION_QUEUE_LEN]
#define DefaultPeriodic
Set default periodic telemetry.
I2C transaction structure.
static const struct usb_device_descriptor dev
uint8_t slave_addr
Slave address.
I2C peripheral structure.
transmit only transaction
volatile uint16_t wd_reset_cnt
enum I2CTransactionType type
Transaction type.
bool_t i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.