vt100: include pgmspace.h as we use PROGMEM macro
[aversive.git] / projects / microb2010 / ballboard / main.h
index 36915bd..adfa627 100755 (executable)
@@ -19,6 +19,8 @@
  *
  */
 
+/* was mainboard in 2009 */
+
 #define LED_TOGGLE(port, bit) do {             \
                if (port & _BV(bit))            \
                        port &= ~_BV(bit);      \
 #define LED1_OFF()     cbi(PORTJ, 2)
 #define LED1_TOGGLE()  LED_TOGGLE(PORTJ, 2)
 
-#define LED2_ON()      sbi(PORTL, 7)
-#define LED2_OFF()     cbi(PORTL, 7)
-#define LED2_TOGGLE()  LED_TOGGLE(PORTL, 7)
+#define LED2_ON()      sbi(PORTJ, 3)
+#define LED2_OFF()     cbi(PORTJ, 3)
+#define LED2_TOGGLE()  LED_TOGGLE(PORTJ, 3)
 
-#define LED3_ON()      sbi(PORTJ, 3)
-#define LED3_OFF()     cbi(PORTJ, 3)
-#define LED3_TOGGLE()  LED_TOGGLE(PORTJ, 3)
+#define LED3_ON()      sbi(PORTL, 7)
+#define LED3_OFF()     cbi(PORTL, 7)
+#define LED3_TOGGLE()  LED_TOGGLE(PORTL, 7)
 
 #define LED4_ON()      sbi(PORTL, 6)
 #define LED4_OFF()     cbi(PORTL, 6)
 #define ROLLER_ENCODER    ((void *)0)
 #define FORKTRANS_ENCODER ((void *)1)
 #define FORKROT_ENCODER   ((void *)2)
+#define BEACON_ENCODER    ((void *)3)
 
 #define ROLLER_PWM     ((void *)&gen.pwm1_4A)
 #define FORKTRANS_PWM  ((void *)&gen.pwm2_4B)
 #define FORKROT_PWM    ((void *)&gen.pwm3_1A)
-#define XXX_PWM        ((void *)&gen.pwm4_1B)
+#define BEACON_PWM     ((void *)&gen.pwm4_1B)
 
-#define BALL_PRESENT_SENSOR  2 /* XXX dummy example */
+#define BEACON_POS_SENSOR  2
 
 /** ERROR NUMS */
 #define E_USER_I2C_PROTO       195
 #define E_USER_SENSOR          196
-#define E_USER_BEACON          197
-#define E_USER_SCANNER         198
-#define E_USER_IMGPROCESS      199
+#define E_USER_ST_MACH         197
+#define E_USER_BEACON         198
 
 #define LED_PRIO           170
 #define TIME_PRIO          160
 #define ADC_PRIO           120
 #define CS_PRIO            100
+#define BEACON_PRIO        80
 #define I2C_POLL_PRIO       20
 
 #define CS_PERIOD 5000L
@@ -91,7 +94,7 @@ struct genboard {
        struct pwm_ng servo2;
        struct pwm_ng servo3;
        struct pwm_ng servo4;
-       
+
        /* ax12 interface */
        AX12 ax12;
 
@@ -115,12 +118,14 @@ struct ballboard {
 #define DO_CS        2
 #define DO_BD        4
 #define DO_POWER     8
+#define DO_ERRBLOCKING 16
        uint8_t flags;                /* misc flags */
 
        /* control systems */
         struct cs_block roller;
         struct cs_block forktrans;
         struct cs_block forkrot;
+        struct cs_block beacon;
 
        /* robot status */
        uint8_t our_color;
@@ -132,7 +137,7 @@ extern struct ballboard ballboard;
 /* start the bootloader */
 void bootloader(void);
 
-#define wait_cond_or_timeout(cond, timeout)                   \
+#define WAIT_COND_OR_TIMEOUT(cond, timeout)                   \
 ({                                                            \
         microseconds __us = time_get_us2();                   \
         uint8_t __ret = 1;                                    \