I2C_annexe : Attraper la plante
Ajout du message pour attraper la plante. Suppression des tests des anciennes fonctions I2C
This commit is contained in:
parent
c1e11676c2
commit
4d251b4b74
94
Test_i2c.c
94
Test_i2c.c
@ -291,20 +291,14 @@ int test_i2c_ecriture_pico_annex_nb_2(){
|
||||
|
||||
|
||||
printf("A - Aimant tient pot\n");
|
||||
printf("B - Bras attrape pot\n");
|
||||
printf("C - Aimant lache pot\n");
|
||||
printf("D - Deguisement On\n");
|
||||
printf("E - Deguisement Off\n");
|
||||
printf("F - Ferme porte\n");
|
||||
printf("G - Mi-Ferme porte\n");
|
||||
printf("O - Ouvre porte\n");
|
||||
printf("T - Turbine On\n");
|
||||
printf("U - Turbine Off\n");
|
||||
printf("P - Propulseur On\n");
|
||||
printf("M - Propulseur Off\n");
|
||||
printf("D - Bras lève pot\n");
|
||||
printf("E - Attrape plante - bras 1\n");
|
||||
printf("F - Attrape plante - bras 6\n");
|
||||
printf("S - Score + 1\n");
|
||||
printf("B - Bras deplie\n");
|
||||
printf("N - Bras plie 1\n");
|
||||
|
||||
printf("\nQ - Quitter\n");
|
||||
|
||||
|
||||
int lettre;
|
||||
int continue_test=1;
|
||||
@ -314,6 +308,8 @@ int test_i2c_ecriture_pico_annex_nb_2(){
|
||||
time_i2c[1] = time_us_32();
|
||||
time_i2c[2] = 0;
|
||||
|
||||
i2c_annexe_init();
|
||||
|
||||
multicore_launch_core1(affiche_contacteur);
|
||||
|
||||
|
||||
@ -329,6 +325,14 @@ int test_i2c_ecriture_pico_annex_nb_2(){
|
||||
}
|
||||
printf("=> Lache pot\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
case 'B':
|
||||
for(int i=1; i<7; i++){
|
||||
i2c_annexe_actionneur_pot(i, BRAS_POT_SOL, DOIGT_TIENT);
|
||||
}
|
||||
printf("=> Attrape pot\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'C':
|
||||
@ -338,58 +342,24 @@ int test_i2c_ecriture_pico_annex_nb_2(){
|
||||
printf("=> Tient pot\n");
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
case 'D':
|
||||
i2c_annexe_active_deguisement();
|
||||
printf("=> Active déguisement\n");
|
||||
case 'd':
|
||||
for(int i=1; i<7; i++){
|
||||
i2c_annexe_actionneur_pot(i, BRAS_HAUT, DOIGT_TIENT);
|
||||
}
|
||||
printf("=> Attrape pot\n");
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
case 'e':
|
||||
i2c_annexe_desactive_deguisement();
|
||||
printf("=> Desactive déguisement\n");
|
||||
i2c_annexe_attrape_plante(PLANTE_BRAS_1);
|
||||
printf("=> Attrape plante - bras 1\n");
|
||||
break;
|
||||
|
||||
|
||||
case 'F':
|
||||
case 'f':
|
||||
i2c_annexe_ferme_porte();
|
||||
printf("=> Ferme porte\n");
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
case 'g':
|
||||
i2c_annexe_mi_ferme_porte();
|
||||
printf("=> Ferme porte\n");
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
case 'o':
|
||||
i2c_annexe_ouvre_porte();
|
||||
printf("=> Ouvre porte\n");
|
||||
break;
|
||||
|
||||
case 't':
|
||||
case 'T':
|
||||
i2c_annexe_active_turbine();
|
||||
printf("=> Active turbine\n");
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
case 'U':
|
||||
i2c_annexe_desactive_turbine();
|
||||
printf("=> Arrete turbine\n");
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 'M':
|
||||
i2c_annexe_desactive_propulseur();
|
||||
printf("=> Arrete propulseur\n");
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 'P':
|
||||
i2c_annexe_active_propulseur();
|
||||
printf("=> Active propulseur\n");
|
||||
i2c_annexe_attrape_plante(PLANTE_BRAS_6);
|
||||
printf("=> Attrape plante - bras 6\n");
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
@ -402,18 +372,6 @@ int test_i2c_ecriture_pico_annex_nb_2(){
|
||||
score++;
|
||||
i2c_annexe_envoie_score(score);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
case 'B':
|
||||
i2c_annexe_deplie_bras();
|
||||
printf("=> Deplie bras\n");
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
case 'N':
|
||||
i2c_annexe_plie_bras();
|
||||
printf("=> Plie bras\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("lettre non reconnue: %d %c\n", lettre, lettre);
|
||||
|
15
i2c_annexe.c
15
i2c_annexe.c
@ -18,10 +18,12 @@
|
||||
|
||||
#define ADRESSE_PIC18F4550 0x31
|
||||
#define ADRESSE_PIC18F4550_DEBUT_W 0x00
|
||||
#define ADRESSE_ACTION_PINCE 6
|
||||
#define TAILLE_DONNEES_PIC18F4550_EMISSION 7
|
||||
|
||||
uint8_t donnees_emission[TAILLE_DONNEES_EMISSION];
|
||||
uint8_t donnees_emission_pic18f4550[TAILLE_DONNEES_PIC18F4550_EMISSION];
|
||||
uint8_t donnees_reception_pic18f4550[TAILLE_DONNEES_PIC18F4550_EMISSION];
|
||||
uint8_t donnees_reception[TAILLE_DONNEES_RECEPTION];
|
||||
|
||||
|
||||
@ -77,12 +79,14 @@ void i2c_annexe_gestion(){
|
||||
etat_i2c_annexe = EMISSION_DONNEES_RPi;
|
||||
temps = time_us_32();
|
||||
donnees_a_envoyer_pic=0;
|
||||
donnees_emission_pic18f4550[ADRESSE_ACTION_PINCE]=0;
|
||||
}
|
||||
}else{
|
||||
etat_i2c_annexe = EMISSION_DONNEES_RPi;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,3 +191,14 @@ void i2c_annexe_actionneur_pot(int actionneur, uint8_t pos_bras, uint8_t pos_doi
|
||||
donnees_emission_pic18f4550[actionneur-1] = (pos_bras << 2) | pos_doigt;
|
||||
donnees_a_envoyer_pic=1;
|
||||
}
|
||||
|
||||
void i2c_annexe_attrape_plante(uint8_t action){
|
||||
donnees_emission_pic18f4550[ADRESSE_ACTION_PINCE] = action;
|
||||
donnees_a_envoyer_pic=1;
|
||||
}
|
||||
|
||||
void i2c_annexe_init(void){
|
||||
for(unsigned int actionneur=1; actionneur<= NB_BRAS; actionneur++){
|
||||
i2c_annexe_actionneur_pot(actionneur, BRAS_PLIE, DOIGT_LACHE);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,11 @@
|
||||
#define BRAS_DEPOSE_JARDINIERE 4
|
||||
#define BRAS_HAUT 5
|
||||
|
||||
#define NB_BRAS 6
|
||||
|
||||
#define PLANTE_BRAS_1 '1'
|
||||
#define PLANTE_BRAS_6 '6'
|
||||
|
||||
void i2c_annexe_gestion(void);
|
||||
void i2c_annexe_active_turbine(void);
|
||||
void i2c_annexe_desactive_turbine(void);
|
||||
@ -44,3 +49,5 @@ void i2c_annexe_deplie_bras(void);
|
||||
uint8_t i2c_annexe_get_tension_batterie(void);
|
||||
|
||||
void i2c_annexe_actionneur_pot(int actionneur, uint8_t pos_bras, uint8_t pos_doigt);
|
||||
void i2c_annexe_attrape_plante(uint8_t action);
|
||||
void i2c_annexe_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user