Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
Diff: data.h
- Revision:
- 0:7f26f0680202
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data.h Fri Dec 31 14:01:14 2010 +0000 @@ -0,0 +1,62 @@ +#ifndef DATA_H +#define DATA_H + + +#include <stdint.h> +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef uint8_t BOOL8; +typedef int16_t INT16; +typedef int32_t INT32; +typedef uint16_t BOOL16; +typedef uint8_t UCHAR8; +typedef uint32_t UINT32; +typedef uint32_t BOOL32; + +#include "ROBO_TX_FW.h" //"../PC_programming_RoboTXC_V1-2_11_Dec_2009/PC_Programming_RoboTXC/Demo_Static_Lib_C/Inc/" + +typedef struct +{ UINT16 start; + union //the message format is HL, the native format is LH, receiver routine swaps HL to LH, send routine writes as HL + { UINT16 bytes; + struct + { UINT8 bytesH, bytesL; + }/*anonymous*/; //as_bytes; + };//winavr allows anonymous structs and unions + UINT32 snd, rec; + UINT16 trans, session; + UINT32 cmd, structs, ta_id;//ta_id is normally not considered part of the header but part of the payload, it is repeated for each struct +} header; + + +typedef struct +{ UINT16 chksum; + UCHAR8 etx; +} trailer; + +typedef struct +{ header hdr; + union + { struct { TA_OUTPUT output; trailer trl;} cmd002;//set outputs + struct { TA_CONFIG config; trailer trl;} cmd005;//initialize + struct { trailer trl;} cmd006;//extension request + struct { DISPLAY_MSG disp; trailer trl;} cmd008;//display message + struct { char name[20]; trailer trl;} cmd009;//change name, 20 = DEV_NAME_LEN+1+3padding + struct { TA_INPUT input; trailer trl;} cmd102;//reply to cmd002 + struct { trailer trl;} cmd105;//reply to cmd005 + struct { TA_INFO info; trailer trl;} cmd106;//reply to cmd006 + struct { trailer trl;} cmd108;//reply to cmd008 + struct { trailer trl;} cmd109;//reply to cmd009 + struct { trailer trl;} empty; //empty reply (cmd108,109) + } body; +} message; + +#define SLAVES 8 + +extern struct _conf config[SLAVES]; +extern message msg; +extern unsigned char thisindex; +void store_index(); +#define BYTES(m) ((m->hdr.bytesH<<8)|m->hdr.bytesL) + +#endif