Project

General

Profile

Statistics
| Revision:

root / branches / encoders / code / projects / libdragonfly / encoders.h @ 771

History | View | Annotate | Download (863 Bytes)

1
#ifndef __ENCODERS_H__
2
#define __ENCODERS_H__
3

    
4

    
5
#define RIGHT 1
6
#ifndef LEFT
7
        #define LEFT 0
8
#endif
9
#ifndef LEFT
10
        #define LEFT 0
11
#endif
12
#define INVALID 1024
13
#define MAGNET_FAILURE 1025
14

    
15

    
16
//delay_ms argument after a full read is complete
17
#define ENCODER_DELAY 20
18

    
19
#define MIN_V (-100)
20
#define MAX_V 100
21

    
22
//Data invalid flags (hardware failure):
23
#define OCF _BV(4)
24
#define COF _BV(3)
25

    
26
//Data invlalid alarm (May be invalid):
27
#define LIN _BV(2)
28

    
29
#define MagINCn _BV(1)
30
#define MagDECn _BV(0)
31

    
32
#define BUFFER_SIZE 23
33

    
34
void encoders_init(void);
35
int encoder_read(char encoder);
36
char encoder_direction(char encoder);
37

    
38
int encoder_get_dx(char encoder);
39
void encoder_rst_dx(char encoder);
40
int encoder_get_tc(void);
41
void encoder_rst_tc(void);
42

    
43
int encoder_get_v(char encoder);
44

    
45
//waits for the next encoder reading, then returns
46
void encoder_wait( int nReadings );
47

    
48
#endif