Revision 1426
Fixes #622.
encoders.h is not included in dragonfly_lib.h and encoders_init() is called within dragonfly_init().
trunk/code/projects/test/test_encoders.c | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* @file encoders unit test |
3 | 3 |
*/ |
4 |
#include "serial.h" |
|
5 |
#include "time.h" |
|
6 |
#include "dio.h" |
|
7 |
#include "encoders.h" |
|
4 |
#include <dragonfly_lib.h> |
|
8 | 5 |
|
9 | 6 |
/** |
10 | 7 |
* @brief Test encoders by outputting values to usb |
... | ... | |
18 | 15 |
|
19 | 16 |
int testencoders(void) |
20 | 17 |
{ |
21 |
usb_init(); |
|
22 |
encoders_init(); |
|
23 | 18 |
int encoder_left,encoder_right; |
24 | 19 |
int x_left, x_right; |
25 | 20 |
int v_left, v_right; |
trunk/code/projects/libdragonfly/dragonfly_lib.c | ||
---|---|---|
60 | 60 |
* Initializes the components specified by config. |
61 | 61 |
* |
62 | 62 |
* @see analog_init, usb_init, xbee_init, buzzer_init, |
63 |
* bom_init, orb_init, motors_init, lcd_init |
|
63 |
* bom_init, orb_init, motors_init, lcd_init, encoders_init
|
|
64 | 64 |
**/ |
65 | 65 |
|
66 | 66 |
void flash_red(void); |
... | ... | |
112 | 112 |
else |
113 | 113 |
bom_init(bom_read); |
114 | 114 |
} |
115 |
|
|
116 |
if (config & ENCODERS) |
|
117 |
{ |
|
118 |
encoders_init(); |
|
119 |
} |
|
120 |
|
|
115 | 121 |
// delay a bit for stability |
116 | 122 |
_delay_ms(1); |
117 | 123 |
} |
trunk/code/projects/libdragonfly/dragonfly_lib.h | ||
---|---|---|
64 | 64 |
#define RANGE 0x0100 |
65 | 65 |
/** @brief Initialize the BOM **/ |
66 | 66 |
#define BOM 0x0200 |
67 |
/** @brief Initilize encoders **/ |
|
68 |
#define ENCODERS 0x400 |
|
67 | 69 |
/** @brief Initialize everything **/ |
68 |
#define ALL_ON 0x03FF
|
|
70 |
#define ALL_ON 0x07FF
|
|
69 | 71 |
|
70 | 72 |
/** @brief Initialize the board **/ |
71 | 73 |
void dragonfly_init(int config); |
... | ... | |
94 | 96 |
#include <buzzer.h> |
95 | 97 |
#include <rangefinder.h> |
96 | 98 |
#include <bom.h> |
99 |
#include <encoders.h> |
|
97 | 100 |
#include <move.h> |
98 | 101 |
#include <reset.h> |
99 | 102 |
#include <math.h> |
Also available in: Unified diff