Revision 1303
Added read_eeprom to test suite and robot code so we can read the robot ID and BOM type from eeprom
test_comm.c | ||
---|---|---|
1 | 1 |
#include "test_comm.h" |
2 | 2 |
#include "global.h" |
3 | 3 |
#include "comm_robot.h" |
4 |
#include <bom.h> |
|
4 | 5 |
|
5 | 6 |
/** Returns whether we have communication **/ |
6 | 7 |
bool test_comm () |
... | ... | |
8 | 9 |
usb_puts("# Testing communications" NL); |
9 | 10 |
|
10 | 11 |
// FIXME implement |
12 |
uint8_t id,bom_type; |
|
13 |
|
|
14 |
bool success = robot_read_eeprom(&id, &bom_type); |
|
11 | 15 |
|
12 |
bool success=true; |
|
13 |
|
|
14 | 16 |
if (success) |
15 |
usb_puts("# Testing communication finished (communication succeeded)" NL); |
|
17 |
{ |
|
18 |
usb_puts("# Testing communication finished (communication succeeded)" NL); |
|
19 |
usb_puts("# Robot ID:"); |
|
20 |
usb_puti(id); |
|
21 |
usb_puts(" BOM type:"); |
|
22 |
switch (bom_type) |
|
23 |
{ |
|
24 |
case BOM10: usb_puts("1.0" NL); break; |
|
25 |
case BOM15: usb_puts("1.5" NL); break; |
|
26 |
case RBOM: usb_puts("RBOM" NL); break; |
|
27 |
default: usb_puti(bom_type); usb_puts("(invalid)" NL); |
|
28 |
} |
|
29 |
} |
|
16 | 30 |
else |
17 | 31 |
usb_puts("# Testing communication finished (communication failed)" NL); |
18 | 32 |
|
Also available in: Unified diff