Reprise de la communication I2C en cas de soucis
This commit is contained in:
parent
f7bebda9d2
commit
542c407861
@ -64,17 +64,16 @@ void i2c_gestion(i2c_inst_t *i2c){
|
||||
|
||||
// Acquitement des erreurs, pas 100% fonctionnel ! TODO !
|
||||
if(i2c->hw->tx_abrt_source !=0){
|
||||
i2c_error_code = i2c->hw->tx_abrt_source;
|
||||
printf("Erreur I2C tx_abrt_source : %#x\n", i2c_error_code);
|
||||
// on efface l'erreur en lisant le registre clr_tx_abrt
|
||||
index_envoi = i2c->hw->clr_tx_abrt;
|
||||
// Seule solution trouvée pour réinitialiser l'I2C.
|
||||
char a;
|
||||
i2c_read_blocking(i2c, adresse_7_bits, &a, 1, false);
|
||||
|
||||
I2C_nb_a_envoyer = 0;
|
||||
index_reception = 0;
|
||||
I2C_nb_a_recevoir = 0;
|
||||
statu_emission = TRANSACTION_TERMINEE;
|
||||
statu_reception = TRANSACTION_TERMINEE;
|
||||
i2c_statu_i2c0 = I2C_STATU_LIBRE;
|
||||
printf("Erreur acquitee\n");
|
||||
}
|
||||
|
||||
while( (index_envoi < I2C_nb_a_envoyer) && (i2c_get_write_available(i2c)) ){
|
||||
|
Loading…
Reference in New Issue
Block a user