Statistics
| Revision:

root / trunk / code / lib / include / libdragonfly / eeprom.h @ 1035

History | View | Annotate | Download (1.34 KB)

1
/**
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
 #include <bom.h>
14
 
15
 #define EEPROM_ROBOT_ID_ADDR 0x10
16
 #define EEPROM_BOM_TYPE_ADDR 0x14
17
 
18
 /** @brief store a byte to eeproem
19
  *  @return 0 if success, nonzero on failure
20
  */
21
 int eeprom_put_byte(unsigned int addr, unsigned char byte);
22
 
23
 /** @brief reads a byte from eeprom
24
  *
25
  *  Pass it thge address and a pointer to a byte where the byte at the
26
  *  address will be stored
27
  *
28
  *  @return 0 if successful (byte is set to the eeprom value at addr), 
29
  *  nonzero if there was a problem
30
   */
31
 int eeprom_get_byte(unsigned int addr, unsigned char *byte);
32
 
33
 /** @brief get stored robot ID
34
  *
35
  *  checks that EEPROM has been programed with an ID and returns it
36
  *
37
  *  @return the robot id, if it is stored. If it returns 0xFF it is probably invalid
38
  */
39
 unsigned char get_robotid(void);
40
  
41
   /** @brief get stored robot ID
42
  *
43
  * checks that EEPROM has been programed with an BOM type and returns it
44
  *
45
  *  @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
46
  */
47
 unsigned char get_bom_type(void);
48
 
49
 #endif