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 !
|
// Acquitement des erreurs, pas 100% fonctionnel ! TODO !
|
||||||
if(i2c->hw->tx_abrt_source !=0){
|
if(i2c->hw->tx_abrt_source !=0){
|
||||||
i2c_error_code = i2c->hw->tx_abrt_source;
|
// Seule solution trouvée pour réinitialiser l'I2C.
|
||||||
printf("Erreur I2C tx_abrt_source : %#x\n", i2c_error_code);
|
char a;
|
||||||
// on efface l'erreur en lisant le registre clr_tx_abrt
|
i2c_read_blocking(i2c, adresse_7_bits, &a, 1, false);
|
||||||
index_envoi = i2c->hw->clr_tx_abrt;
|
|
||||||
I2C_nb_a_envoyer = 0;
|
I2C_nb_a_envoyer = 0;
|
||||||
index_reception = 0;
|
index_reception = 0;
|
||||||
I2C_nb_a_recevoir = 0;
|
I2C_nb_a_recevoir = 0;
|
||||||
statu_emission = TRANSACTION_TERMINEE;
|
statu_emission = TRANSACTION_TERMINEE;
|
||||||
statu_reception = TRANSACTION_TERMINEE;
|
statu_reception = TRANSACTION_TERMINEE;
|
||||||
i2c_statu_i2c0 = I2C_STATU_LIBRE;
|
i2c_statu_i2c0 = I2C_STATU_LIBRE;
|
||||||
printf("Erreur acquitee\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while( (index_envoi < I2C_nb_a_envoyer) && (i2c_get_write_available(i2c)) ){
|
while( (index_envoi < I2C_nb_a_envoyer) && (i2c_get_write_available(i2c)) ){
|
||||||
|
Loading…
Reference in New Issue
Block a user