Project

General

Profile

Revision 1598

Added by Chris Mar over 14 years ago

implemented wireless init, terminate, register, and unregister

View differences:

wireless.h
92 92
#define CCA_FAILURE UINT8_C(3)
93 93

  
94 94
/**@brief packet handler function pointer type **/
95
#define FNPTR void (*func)(uint8_t* data,uint8_t length)
95
#define FUNC func
96 96

  
97
/**@brief packet handler function pointer type **/
98
#define FNPTR void (*FUNC)(uint8_t* data,uint8_t length,uint8_t source)
99

  
100
// TODO: this max may be too big b/c the packet handler array stores 3*MAX_PACKET_GROUPS bytes 
101
/**@brief maximum number of packet groups, size of handler array **/
102
#define MAX_PACKET_GROUPS UINT8_C(255)
103

  
104
/**@brief init_flag when library has not been initialized **/
105
#define INIT_NO UINT8_C(0)
106

  
107
/**@brief init_flag when library has been initialized **/
108
#define INIT_YES UINT8_C(1)
109

  
97 110
/**@} **/ // end defines group
98 111

  
112
/**
113
 * @struct PacketGroupHandler
114
 * A PacketGroupHandler represents a packet group, and is used to
115
 * register a packet group with the wireless library. It contains
116
 * a function pointer to the packet handler function and the priority
117
 * of the packet group.
118
 **/
119
typedef struct {
120
    
121
    // function pointer of handler for this packet group
122
    FNPTR;
99 123

  
124
    // priority for this packet group
125
    uint8_t priority;
126
    
127
} PacketGroupHandler;
128

  
129

  
100 130
/**@defgroup wl_functions Public API Functions 
101 131
 * @{ **/
102 132
 
......
156 186
/**@brief Function to register new packet handlers (for non-default groups only). **/
157 187
int8_t wl_register_handler(uint8_t group, FNPTR, uint8_t priority);
158 188

  
189
/**@brief Function to unregister existing packet handlers (for non-default groups only). **/
190
int8_t wl_unregister_handler(uint8_t group);
191

  
159 192
/**@} **/ //end functions group
160 193

  
161 194
/**@} **/ //end wireless group

Also available in: Unified diff