Modified:
/trunk/src/drivers/rf.c
/trunk/src/inc/packet.h
/trunk/src/inc/rf.h
=======================================
--- /trunk/src/drivers/rf.c Mon Jan 17 22:12:54 2011
+++ /trunk/src/drivers/rf.c Mon Jan 17 22:48:31 2011
@@ -25,7 +25,7 @@
#endif
-volatile board_coord objects[4];
+volatile board_coord objects[32];
volatile uint32_t position_microtime;
#ifndef SIMULATE
@@ -44,22 +44,6 @@
struct lock rf_lock;
volatile uint8_t robot_id = 0xFF;
-void rf_status_update(uint8_t caught){
-
- extern volatile uint8_t robot_id;
-
- ATOMIC_BEGIN;
-
- tx.type = STATUS;
- tx.address = 0xFF;
- tx.payload.status.id = robot_id;
- tx.payload.status.caught = caught;
-
- rf_send_packet(0xE7, (uint8_t*)(&tx), sizeof(packet_buffer));
-
- ATOMIC_END;
-}
-
int rf_send(char ch){
ATOMIC_BEGIN;
@@ -303,7 +287,7 @@
rx->payload.coords[i] = t;
}
}
- memcpy((char *)objects, rx->payload.coords, sizeof(objects));
+ memcpy((char *)(objects + 4*(rx->seq_no % 8)),
rx->payload.coords, sizeof(objects));
position_microtime = get_time_us();
break;
=======================================
--- /trunk/src/inc/packet.h Mon Jan 17 22:12:54 2011
+++ /trunk/src/inc/packet.h Mon Jan 17 22:48:31 2011
@@ -36,26 +36,15 @@
#ifndef SIMULATE
-typedef struct{
- uint8_t id;
- int16_t value;
-} __attribute__ ((aligned (1))) __attribute__ ((packed)) light_command;
-
-typedef struct{
- uint8_t id;
- uint8_t caught;
-} __attribute__ ((aligned (1))) __attribute__ ((packed)) status_update;
-
typedef struct {
uint8_t type;
- uint8_t address;
+ unsigned board : 2;
+ unsigned seq_no : 6;
union {
uint8_t array[PAYLOAD_SIZE];
board_coord coords[4];
- light_command lights[4];
- status_update status;
} payload;
-} __attribute__ ((packed)) packet_buffer;
+} __attribute__ ((aligned (1))) __attribute__ ((packed)) packet_buffer;
#endif
=======================================
--- /trunk/src/inc/rf.h Mon Apr 19 21:40:36 2010
+++ /trunk/src/inc/rf.h Mon Jan 17 22:48:31 2011
@@ -13,16 +13,12 @@
*/
extern volatile uint32_t position_microtime;
-extern volatile board_coord objects[4];
+extern volatile board_coord objects[32];
#ifndef SIMULATE
extern packet_buffer tx, rx;
-extern volatile uint8_t caught[4];
-
-extern volatile board_coord goal_position; //The target position received
from a goal packet
-
extern volatile char rf_str_buf[PAYLOAD_SIZE+1];
// rf_new_str is set by the rx interrupt handler and
@@ -30,8 +26,6 @@
// processed as desired.
extern volatile uint8_t rf_new_str;
-void rf_status_update(uint8_t status);
-
int rf_send(char ch);
int rf_put(char ch, FILE *f);
int rf_vprintf(const char *fmt, va_list ap);
@@ -54,7 +48,6 @@
*/
uint8_t rf_send_packet(uint8_t address, uint8_t *data, uint8_t len);
-extern volatile uint8_t light_port;
extern volatile uint8_t robot_id;
/**