Revision 675
asdf
branches/encoders/code/projects/libdragonfly/encoders.c | ||
---|---|---|
1 | 1 |
#include "encoders.h" |
2 | 2 |
#include "spi.h" |
3 | 3 |
#include <dragonfly_lib.h> |
4 |
#include "ring_buffer.h" |
|
4 | 5 |
|
5 |
void encoder_recv(char data); |
|
6 |
|
|
7 | 6 |
unsigned short int left_data_buf; |
8 | 7 |
unsigned short int right_data_buf; |
9 | 8 |
char buf_index; |
... | ... | |
11 | 10 |
unsigned short int left_data; |
12 | 11 |
unsigned short int right_data; |
13 | 12 |
|
13 |
RING_BUFFER_NEW(enc_buffer, 16, short int, spi_send_buff, spi_rec_buff); |
|
14 |
|
|
14 | 15 |
void encoders_init(void){ |
15 | 16 |
spi_init(encoder_recv); |
16 | 17 |
buf_index = 0; |
... | ... | |
70 | 71 |
left_data = MAGNET_FAILURE; |
71 | 72 |
|
72 | 73 |
else right_data = (right_data_buf>>5) & 1023; |
74 |
|
|
75 |
|
|
73 | 76 |
|
74 | 77 |
left_data_buf = 0; |
75 | 78 |
right_data_buf = 0; |
Also available in: Unified diff