2011-07-30 14:10:30 +00:00
|
|
|
#ifndef __MESH_H_
|
|
|
|
#define __MESH_H_
|
|
|
|
|
|
|
|
#define MESHBUFSIZE 10
|
|
|
|
#define MESHPKTSIZE 32
|
|
|
|
|
|
|
|
#define M_SENDINT 500
|
|
|
|
#define M_RECVINT 1000
|
|
|
|
#define M_RECVTIM 100
|
|
|
|
|
|
|
|
#define MESH_CHANNEL 85
|
|
|
|
#define MESH_MAC "MESHB"
|
|
|
|
|
|
|
|
#define MO_TYPE(x) (x[0])
|
|
|
|
#define MO_TYPE_set(x,y) (x[0]=y)
|
|
|
|
#define MO_GEN(x) (x[1])
|
|
|
|
#define MO_GEN_set(x,y) (x[1]=y)
|
|
|
|
#define MO_TIME(x) (uint8ptouint32(x+2))
|
|
|
|
#define MO_TIME_set(x,y) (uint32touint8p(y,x+2))
|
2011-07-30 17:06:12 +00:00
|
|
|
#define MO_BODY(x) (x+6)
|
2011-07-30 14:10:30 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t pkt[32];
|
|
|
|
char flags;
|
|
|
|
} MPKT;
|
|
|
|
|
|
|
|
#define MF_FREE (0)
|
|
|
|
#define MF_USED (1<<0)
|
2011-08-01 23:40:44 +00:00
|
|
|
#define MF_LOCK (1<<1)
|
2011-07-30 14:10:30 +00:00
|
|
|
|
|
|
|
extern char meshgen; // Generation
|
|
|
|
extern MPKT meshbuffer[MESHBUFSIZE];
|
|
|
|
|
|
|
|
void initMesh(void);
|
|
|
|
void mesh_cleanup(void);
|
|
|
|
void mesh_recvloop(void);
|
|
|
|
void mesh_sendloop(void);
|
|
|
|
void mesh_systick(void);
|
2011-08-01 23:40:44 +00:00
|
|
|
MPKT * meshGetMessage(uint8_t type);
|
2011-07-30 14:10:30 +00:00
|
|
|
|
|
|
|
#endif
|