Revision 945
Integrated new BOM1.5 compatible code. Also put eeprom code for reading ID and BOM type from EEPROM. will need to program each robot's eeprom separately later. This has been tested and verified to work on robots with different BOM types.
eeprom.c | ||
---|---|---|
30 | 30 |
|
31 | 31 |
|
32 | 32 |
unsigned char get_robotid(void) { |
33 |
unsigned char ret;
|
|
33 |
unsigned char c0, c1, c2;
|
|
34 | 34 |
|
35 |
eeprom_get_byte(EEPROM_ROBOT_ID_ADDR, &ret); |
|
35 |
eeprom_get_byte(EEPROM_ROBOT_ID_ADDR, &c0); |
|
36 |
eeprom_get_byte(EEPROM_ROBOT_ID_ADDR+1, &c1); |
|
37 |
eeprom_get_byte(EEPROM_ROBOT_ID_ADDR+2, &c2); |
|
38 |
if(c0 == 'I' && c1 == 'D') |
|
39 |
return c2; |
|
40 |
else |
|
41 |
return 0xFF; |
|
42 |
} |
|
43 |
|
|
44 |
unsigned char get_bom_type(void) { |
|
45 |
unsigned char c0, c1, c2, c3; |
|
36 | 46 |
|
37 |
return ret; |
|
38 |
} |
|
47 |
eeprom_get_byte(EEPROM_BOM_TYPE_ADDR, &c0); |
|
48 |
eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+1, &c1); |
|
49 |
eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+2, &c2); |
|
50 |
eeprom_get_byte(EEPROM_BOM_TYPE_ADDR+3, &c3); |
|
51 |
if(c0 == 'B' && c1 == 'O' && c2 == 'M') |
|
52 |
return c3; |
|
53 |
else |
|
54 |
return 0xFF; |
|
55 |
} |
Also available in: Unified diff