summaryrefslogtreecommitdiff
path: root/n/es-2006/src
diff options
context:
space:
mode:
authordufourj2006-05-25 01:04:18 +0000
committerdufourj2006-05-25 01:04:18 +0000
commitecc3c0a1f65123a164ee2afeb755a09afa4097c9 (patch)
tree18dd0f030f554925b22c92d63a90e1d196c17fdf /n/es-2006/src
parent5f876218f85880415e0b87fcb3e222a6c502f694 (diff)
ES :
- gestion des acks pour le barillet.
Diffstat (limited to 'n/es-2006/src')
-rw-r--r--n/es-2006/src/Makefile2
-rw-r--r--n/es-2006/src/ack.h27
-rw-r--r--n/es-2006/src/barillet.c5
-rw-r--r--n/es-2006/src/main.c4
4 files changed, 14 insertions, 24 deletions
diff --git a/n/es-2006/src/Makefile b/n/es-2006/src/Makefile
index 9ae231c..a431de8 100644
--- a/n/es-2006/src/Makefile
+++ b/n/es-2006/src/Makefile
@@ -1,7 +1,7 @@
BASE = ../../avr
PROGS = es
es_SOURCES = main.c sensor_rvb.c sniff_rvb.c timer_1.c barillet.c \
- servo_motor.c sharp.c lcd.c
+ servo_motor.c sharp.c lcd.c ack.c
MODULES = proto uart utils adc twi
CONFIGFILE = avrconfig.h
# atmega8, atmega8535, atmega128...
diff --git a/n/es-2006/src/ack.h b/n/es-2006/src/ack.h
index 98b0dfa..c4bcd12 100644
--- a/n/es-2006/src/ack.h
+++ b/n/es-2006/src/ack.h
@@ -24,42 +24,31 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// }}}
+#include "common.h"
/** Module for telling upper class something important has occured ! */
-/* Do not use, it's only for the main */
-extern uint8_t ack_value;
-
/** List here what you want to tell to the world and put a description.
* You must use a different number for each code and it must be lower than 255
* of course ! */
#define ACK_NOTHING 0 /* Nothing to ack */
#define ACK_CONTACT_FRONT 1 /* Something in the front */
+#define ACK_BARILLET_BALL_FRONT 2 /* A ball has been get from the front
+ */
+#define ACK_BARILLET_BALL_REAR 3 /* Ball in the rear */
// FIXME, inline ? static ?
/** Reset ack status */
-void ack_reset (void)
-{
- ack_value = ACK_NOTHING;
-}
+void ack_reset (void);
/** Init to nothing. */
-void init_ack (void)
-{
- ack_reset ();
-}
+void ack_init (void);
/* Set an ack */
-void ack_set (uint8_t ack_code)
-{
- ack_value = ack_code;
-}
+void ack_set (uint8_t ack_code);
/* Get current ack */
-uint8_t ack_get (void)
-{
- return ack_value;
-}
+uint8_t ack_get (void);
#endif // ack_h
diff --git a/n/es-2006/src/barillet.c b/n/es-2006/src/barillet.c
index a41bed1..98bfd76 100644
--- a/n/es-2006/src/barillet.c
+++ b/n/es-2006/src/barillet.c
@@ -28,6 +28,7 @@
#include "common.h"
#include "io.h"
#include "modules/proto/proto.h"
+#include "ack.h"
/* utilisation de OCR1A pour le moteur barillet
OCR1B pour la turbine 1 => avant
@@ -340,7 +341,7 @@ void sequenceur_barillet()
rotation_barillet ((pos_actuel_ + 8) % 40, AV_EX_ROTATION);
break;
case AV_EX_FIN:
- // XXX ack
+ ack_set (ACK_BARILLET_BALL_FRONT);
etat_en_cours_ = STAND_BY_FULL;
break;
case AR_EX:
@@ -366,7 +367,7 @@ void sequenceur_barillet()
etat_en_cours_ = AR_DEP_FIN;
break;
case AR_DEP_FIN:
- // XXX ack
+ ack_set (ACK_BARILLET_BALL_REAR);
etat_en_cours_ = STAND_BY_ARRET;
break;
diff --git a/n/es-2006/src/main.c b/n/es-2006/src/main.c
index ca3fec1..05dc16b 100644
--- a/n/es-2006/src/main.c
+++ b/n/es-2006/src/main.c
@@ -73,8 +73,6 @@ uint8_t lcd_key_enable, lcd_key_freq;
/* Enable stat for ack */
uint8_t main_ack_freq, main_ack_enable;
-/* For the ack system, look at ack.h */
-uint8_t ack_value;
/** Call when we receive some data from proto (uart) */
void
@@ -282,6 +280,8 @@ main (void)
sharp_init ();
/* LCD init */
lcd_init ();
+ /* Ack init */
+ ack_init ();
/* Enable interrupts */
sei ();