Project

General

Profile

Revision 292

Added by Kevin Woo almost 14 years ago

Added majority for the toolbox

View differences:

trunk/toolbox/main.c
176 176
int main(void) {
177 177
    state_t state = wait;
178 178
    // This reads the node addr
179
    uint8_t addr = eeprom_read_byte((void*)EEPROM_ADDR);    
179
    uint8_t addr = read_addr();
180 180
    uint8_t ms_timer=0;
181 181
    uint8_t mbuf[PROGD_PACKET_SIZE];    // For reading messages
182 182
    uint8_t len;
......
201 201
                resp = parse_packet(mbuf, &len, addr);
202 202

  
203 203
                // Turn on the tool
204
                if (resp == TT_ON) {
204
                if (resp == TT_GRANT) {
205 205
                    send_packet(TT_ACK, addr, NULL, 0);
206 206

  
207 207
                    toggle_led(LED_RED, OFF);
trunk/toolbox/jumptable.h
6 6
#define JT_ADDR             0x7FC
7 7
#define JT_PARSE_PACKET     ((void*)((JT_ADDR+0)/2))
8 8
#define JT_SEND_PACKET      ((void*)((JT_ADDR+2)/2))
9
#define JT_READ_ADDR        ((void*)((JT_ADDR+4)/2))
9 10

  
10 11
#define JT_TYPE static __inline__ void
11 12
typedef void (*PF_ARG1)(uint8_t);
12 13

  
13 14
char (*parse_packet)(uint8_t*, uint8_t*,uint8_t) = JT_PARSE_PACKET;
14 15
void (*send_packet)(uint8_t, uint8_t, uint8_t*, uint8_t) = JT_SEND_PACKET;
16
uint8_t (*read_addr)(void) = JT_READ_ADDR;
15 17

  
16 18
#endif

Also available in: Unified diff