root / branches / ir_branch / code / lib / include / libdragonfly / eeprom.h @ 1572
History | View | Annotate | Download (1.63 KB)
1 | 1496 | jsexton | /**
|
---|---|---|---|
2 | * @file eeprom.h
|
||
3 | * @brief handles eeprom storage for persistent data
|
||
4 | *
|
||
5 | * Contains functions and definitions for reading and writing to eeprom
|
||
6 | *
|
||
7 | * @author Colony Project, Brad Neuman
|
||
8 | */
|
||
9 | |||
10 | 888 | justin | #ifndef _EEPROM_H_
|
11 | #define _EEPROM_H_
|
||
12 | |||
13 | 946 | abuchan | #define EEPROM_ROBOT_ID_ADDR 0x10 |
14 | #define EEPROM_BOM_TYPE_ADDR 0x14 |
||
15 | 1572 | abuchan | #define EEPROM_IR_OFFSET_ADDR 0x20 |
16 | 946 | abuchan | |
17 | 1496 | jsexton | /** @brief store a byte to eeproem
|
18 | * @return 0 if success, nonzero on failure
|
||
19 | */
|
||
20 | 888 | justin | int eeprom_put_byte(unsigned int addr, unsigned char byte); |
21 | |||
22 | 1496 | jsexton | /** @brief reads a byte from eeprom
|
23 | *
|
||
24 | * Pass it thge address and a pointer to a byte where the byte at the
|
||
25 | * address will be stored
|
||
26 | *
|
||
27 | * @return 0 if successful (byte is set to the eeprom value at addr),
|
||
28 | * nonzero if there was a problem
|
||
29 | */
|
||
30 | 888 | justin | int eeprom_get_byte(unsigned int addr, unsigned char *byte); |
31 | |||
32 | 1496 | jsexton | /** @brief get stored robot ID
|
33 | *
|
||
34 | * checks that EEPROM has been programed with an ID and returns it
|
||
35 | *
|
||
36 | * @return the robot id, if it is stored. If it returns 0xFF it is probably invalid
|
||
37 | */
|
||
38 | 946 | abuchan | unsigned char get_robotid(void); |
39 | |||
40 | 1496 | jsexton | /** @brief get stored robot ID
|
41 | *
|
||
42 | * checks that EEPROM has been programed with an BOM type and returns it
|
||
43 | *
|
||
44 | * @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
|
||
45 | */
|
||
46 | 946 | abuchan | unsigned char get_bom_type(void); |
47 | 888 | justin | |
48 | 1572 | abuchan | /** @brief get stored robot ID
|
49 | *
|
||
50 | * checks that EEPROM has been programed with an BOM type and returns it
|
||
51 | *
|
||
52 | * @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
|
||
53 | */
|
||
54 | unsigned char get_ir_offset(void); |
||
55 | |||
56 | |||
57 | 888 | justin | #endif |