Revision 946
extension of update to eeprom/bom/init. this is just the include files and the library archive.
trunk/code/lib/include/libdragonfly/dragonfly_lib.h | ||
---|---|---|
54 | 54 |
#define ORB 0x04 |
55 | 55 |
/** @brief Initialize the motors **/ |
56 | 56 |
#define MOTORS 0x08 |
57 |
/** @brief Initialize I2C **/ |
|
58 |
#define I2C 0x20 |
|
57 | 59 |
/** @brief Initialize the buzzer **/ |
58 |
#define BUZZER 0x10
|
|
60 |
#define BUZZER 0x40
|
|
59 | 61 |
/** @brief Initialize the LCD screen **/ |
60 |
#define LCD 0x20 |
|
61 |
/** @brief Initialize everything **/ |
|
62 |
#define ALL_ON 0xFF |
|
62 |
#define LCD 0x80 |
|
63 |
/** @brief Initialize the rangefinders **/ |
|
64 |
#define RANGE 0x0100 |
|
65 |
/** @brief Initialize the BOM **/ |
|
66 |
#define BOM 0x0200 |
|
67 |
/** @brief Initialize everything **/ |
|
68 |
#define ALL_ON 0x03FF |
|
63 | 69 |
|
64 |
|
|
65 | 70 |
/** @brief Initialize the board **/ |
66 | 71 |
void dragonfly_init(int config); |
67 | 72 |
|
... | ... | |
87 | 92 |
#include <bom.h> |
88 | 93 |
#include <move.h> |
89 | 94 |
#include <reset.h> |
95 |
#include <math.h> |
|
96 |
#include <eeprom.h> |
|
90 | 97 |
|
91 | 98 |
#endif |
92 | 99 |
|
trunk/code/lib/include/libdragonfly/bom.h | ||
---|---|---|
45 | 45 |
|
46 | 46 |
/** @brief Include all elements in the 16-bit bitfield **/ |
47 | 47 |
#define BOM_ALL 0xFFFF |
48 |
|
|
48 | 49 |
/** @brief Original BOM - No Range, No Individual LED control **/ |
49 |
#define BOM 0 |
|
50 |
#define BOM10 0 |
|
51 |
|
|
50 | 52 |
/** @brief BOM 1.5 - No Range, Individual LED control **/ |
51 | 53 |
#define BOM15 1 |
54 |
|
|
52 | 55 |
/** @brief RBOM - Range, Individual LED control **/ |
53 | 56 |
#define RBOM 2 |
54 |
|
|
57 |
|
|
58 |
|
|
55 | 59 |
/** @brief Initialize the bom according to bom type **/ |
56 | 60 |
void bom_init(char type); |
61 |
|
|
57 | 62 |
/** @brief Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work. **/ |
58 | 63 |
void bom_refresh(int bit_field); |
64 |
|
|
59 | 65 |
/** @brief Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values. **/ |
60 | 66 |
int bom_get(int which); |
67 |
|
|
61 | 68 |
/** @brief Compares all the values in bom_val[] and returns the index to the highest value element. **/ |
62 | 69 |
int bom_get_max(void); |
63 |
/** @brief Turns on the selected bom leds. Only works with BOM_ALL if using the original bom. **/ |
|
64 |
void bom_leds_on(int bit_field); |
|
65 |
/** @brief Turns off the selected bom leds. Only works with BOM_ALL if using the original bom. **/ |
|
66 |
void bom_leds_off(int bit_field); |
|
67 | 70 |
|
68 |
/** @brief (DEPRECATED) Wrapper function. See bom_refresh and bom_get_max **/ |
|
71 |
/** @brief Enables the selected bom leds on a BOM1.5 **/ |
|
72 |
void bom_set_leds(int bit_field); |
|
73 |
|
|
74 |
/** @brief (DEPRECATED) Gets and compares all bom values. Returns the index to the highest value element. **/ |
|
69 | 75 |
int get_max_bom(void); |
70 |
/** @brief (DEPRECATED) Wrapper function. See bom_leds_on. **/ |
|
76 |
|
|
77 |
/** @brief Turns on all BOM leds, or turns on enabled leds on a BOM1.5. **/ |
|
71 | 78 |
void bom_on(void); |
72 |
/** @brief (DEPRECATED) Wrapper function. See bom_leds_off. **/ |
|
79 |
|
|
80 |
/** @brief Turns off all bom leds. **/ |
|
73 | 81 |
void bom_off(void); |
74 | 82 |
|
75 | 83 |
/** @} **/ |
trunk/code/lib/include/libdragonfly/eeprom.h | ||
---|---|---|
10 | 10 |
#ifndef _EEPROM_H_ |
11 | 11 |
#define _EEPROM_H_ |
12 | 12 |
|
13 |
#define EEPROM_ROBOT_ID_ADDR 0x0b
|
|
13 |
#include <bom.h>
|
|
14 | 14 |
|
15 |
#define EEPROM_ROBOT_ID_ADDR 0x10 |
|
16 |
#define EEPROM_BOM_TYPE_ADDR 0x14 |
|
17 |
|
|
15 | 18 |
/** @brief store a byte to eeproem |
16 | 19 |
* @return 0 if success, nonzero on failure |
17 | 20 |
*/ |
... | ... | |
29 | 32 |
|
30 | 33 |
/** @brief get stored robot ID |
31 | 34 |
* |
32 |
* returnes the value of eerpom at EEPROM_ROBOT_ID_ADDR
|
|
35 |
* checks that EEPROM has been programed with an ID and returns it
|
|
33 | 36 |
* |
34 |
* @return the robot id, if it is stored. If it returns 0xff it is probably invalid
|
|
37 |
* @return the robot id, if it is stored. If it returns 0xFF it is probably invalid
|
|
35 | 38 |
*/ |
36 |
unsigned char get_robotid(void); |
|
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); |
|
37 | 48 |
|
38 | 49 |
#endif |
50 |
|
|
39 | 51 |
|
Also available in: Unified diff