summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordalmais2005-05-01 10:37:45 +0000
committerdalmais2005-05-01 10:37:45 +0000
commit28e37e37d7644314ec858b4bc9bc46622bb4567f (patch)
tree69e4092e96b00af8dfe45e9e6fbd417dc971d253
parentb894208ac5d42765e3e37ad04ba074dbfe2dae1b (diff)
version corrigé avec le twi mis en général, 100 balles et 1 mars pour clément,
fusion avec les corrections de tb
-rw-r--r--n/es/src/main.c64
-rw-r--r--n/es/src/tourelle.c2
2 files changed, 39 insertions, 27 deletions
diff --git a/n/es/src/main.c b/n/es/src/main.c
index fc49dc7..ebee300 100644
--- a/n/es/src/main.c
+++ b/n/es/src/main.c
@@ -49,6 +49,15 @@ uint8_t ascenseur;
uint8_t ventouse;
uint8_t pont;
uint8_t nb_valeur_socle = 0;
+uint8_t socle = 1;
+uint8_t pin_socle1 = 0;
+uint8_t pin_socle2 = 0;
+uint8_t valeur_socle1 = 0;
+uint8_t valeur_socle2 = 0;
+uint8_t SEUIL_SOCLE = 100;
+uint8_t tableau_socle[16];
+uint8_t temp = 0;
+uint8_t etat_socle = 0;
int main (void)
{
@@ -77,7 +86,6 @@ int main (void)
sei (); // on met les interruptions
- rs232_putc('I'); // fin de l'initialisation
/// programme principal
@@ -119,7 +127,6 @@ int main (void)
while(!adc_checkf()){}
tableau_sharp[compteur]=adc_read();
- twi_update ((uint8_t *) tableau_sharp,6); // renoie des valeurs sur le I2C
}
}
@@ -136,6 +143,30 @@ int main (void)
PORTB &= ~_BV (1);
}
}
+
+
+ if (socle == 1) // active les fonctions liées au socle.
+ {
+ adc_start (pin_socle1); // pin socle1 sélectionnée
+ while(!adc_checkf()){}
+ valeur_socle1 = adc_read();
+
+ adc_start (pin_socle2); // pin socle2 sélectionnée
+ while(!adc_checkf()){}
+ valeur_socle2 = adc_read();
+
+ nb_valeur_socle++;
+ if(valeur_socle1 > SEUIL_SOCLE || valeur_socle2 > SEUIL_SOCLE) tableau_socle[nb_valeur_socle & 15] = 1;
+ else tableau_socle[nb_valeur_socle & 15] = 0;
+
+
+ for(temp = 0; temp < 16 ;temp++)
+ etat_socle = tableau_socle[temp];
+
+ tableau_sharp[6] = etat_socle >> 3;
+ // twi_update ((uint8_t *) (etat_socle >> 3)); // RASSEMBLER TOUS LES CAPTEURS DANS 1 TWI
+ }
+
switch(asc_message) /* Affiche les messages de retour de
l'ascenceur :
1 ascenseur en haut en attente.
@@ -149,30 +180,13 @@ int main (void)
case 2 : proto_send0('E'); break;
}
-// Stuff a Snayle qui compile pas :-(
-//
-// if (socle) // active les fonctions liées au socle.
-// {
-// adc_start (pin_socle1); // pin socle1 sélectionnée
-// while(!adc_checkf()){}
-// valeur_socle1 = adc_read();
-//
-// adc_start (pin_socle2); // pin socle2 sélectionnée
-// while(!adc_checkf()){}
-// valeur_socle2 = adc_read();
-//
-// nb_valeur_socle++;
-// if(valeur_socle1 > SEUIL_SOCLE || valeur_socle2 > SEUIL_SOCLE) tableau_socle[nb_valeur_socle & 15] = 1;
-// else tableau_socle[nb_valeur_socle & 15] = 0;
-//
-//
-// for(temp = 0; temp < 16 ;temp++)
-// valeur_socle = tableau_socle[temp];
-//
-// twi_update ((uint8_t *) valeur >> 3)
-// }
}
-
+
+ if (socle == 1 && pont == 1) twi_update ((uint8_t *) tableau_sharp,7);
+ if (socle == 1 && pont == 0) twi_update ((uint8_t *) &(tableau_sharp[6]),1);
+ if (socle == 0 && pont == 1) twi_update ((uint8_t *) tableau_sharp,6);
+
+
}
return 0;
}
diff --git a/n/es/src/tourelle.c b/n/es/src/tourelle.c
index d677c6f..80b9610 100644
--- a/n/es/src/tourelle.c
+++ b/n/es/src/tourelle.c
@@ -70,7 +70,6 @@ void tourelle_init (uint16_t prescaler)
SFIOR |= 0x01; // prescaler autorisé
- rs232_putc('T');
crenaux(delay,port_tourelle,pin_tourelle); // on met le capteur à 0°
delay_ms(20L);
@@ -93,7 +92,6 @@ void tourelle_init (uint16_t prescaler)
pont = 1;
ascenseur = 1;
- rs232_putc('F');
switch(prescaler)
{