root / trunk / code / projects / test / eeprom.h @ 1120
History | View | Annotate | Download (1 KB)
1 | 858 | dsschult | /**
|
---|---|---|---|
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 | #ifndef _EEPROM_H_
|
||
11 | #define _EEPROM_H_
|
||
12 | |||
13 | #define EEPROM_ROBOT_ID_ADDR 0x0b |
||
14 | |||
15 | /** @brief store a byte to eeproem
|
||
16 | * @return 0 if success, nonzero on failure
|
||
17 | */
|
||
18 | int eeprom_put_byte(unsigned int addr, unsigned char byte); |
||
19 | |||
20 | /** @brief reads a byte from eeprom
|
||
21 | *
|
||
22 | * Pass it thge address and a pointer to a byte where the byte at the
|
||
23 | * address will be stored
|
||
24 | *
|
||
25 | * @return 0 if successful (byte is set to the eeprom value at addr),
|
||
26 | * nonzero if there was a problem
|
||
27 | */
|
||
28 | int eeprom_get_byte(unsigned int addr, unsigned char *byte); |
||
29 | |||
30 | /** @brief get stored robot ID
|
||
31 | *
|
||
32 | * returnes the value of eerpom at EEPROM_ROBOT_ID_ADDR
|
||
33 | *
|
||
34 | * @return the robot id, if it is stored. If it returns 0xff it is probably invalid
|
||
35 | */
|
||
36 | unsigned char get_robotid(void); |
||
37 | |||
38 | #endif
|