aboutsummaryrefslogtreecommitdiff
path: root/drivers/sensors/adns9800.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sensors/adns9800.h')
-rw-r--r--drivers/sensors/adns9800.h42
1 files changed, 36 insertions, 6 deletions
diff --git a/drivers/sensors/adns9800.h b/drivers/sensors/adns9800.h
index d19ded401..e75a869c0 100644
--- a/drivers/sensors/adns9800.h
+++ b/drivers/sensors/adns9800.h
@@ -18,18 +18,48 @@
18 18
19#include <stdint.h> 19#include <stdint.h>
20 20
21#ifndef ADNS9800_CPI
22# define ADNS9800_CPI 1600
23#endif
24
25#ifndef ADNS9800_CLOCK_SPEED
26# define ADNS9800_CLOCK_SPEED 2000000
27#endif
28
29#ifndef ADNS9800_SPI_LSBFIRST
30# define ADNS9800_SPI_LSBFIRST false
31#endif
32
33#ifndef ADNS9800_SPI_MODE
34# define ADNS9800_SPI_MODE 3
35#endif
36
37#ifndef ADNS9800_SPI_DIVISOR
38# ifdef __AVR__
39# define ADNS9800_SPI_DIVISOR (F_CPU / ADNS9800_CLOCK_SPEED)
40# else
41# define ADNS9800_SPI_DIVISOR 64
42# endif
43#endif
44
45#ifndef ADNS9800_CS_PIN
46# error "No chip select pin defined -- missing ADNS9800_CS_PIN"
47#endif
48
21typedef struct { 49typedef struct {
22 /* 200 - 8200 CPI supported */ 50 /* 200 - 8200 CPI supported */
23 uint16_t cpi; 51 uint16_t cpi;
24} config_adns_t; 52} config_adns9800_t;
25 53
26typedef struct { 54typedef struct {
27 int16_t x; 55 int16_t x;
28 int16_t y; 56 int16_t y;
29} report_adns_t; 57} report_adns9800_t;
30 58
31void adns_init(void); 59void adns9800_init(void);
32config_adns_t adns_get_config(void); 60config_adns9800_t adns9800_get_config(void);
33void adns_set_config(config_adns_t); 61void adns9800_set_config(config_adns9800_t);
62uint16_t adns9800_get_cpi(void);
63void adns9800_set_cpi(uint16_t cpi);
34/* Reads and clears the current delta values on the ADNS sensor */ 64/* Reads and clears the current delta values on the ADNS sensor */
35report_adns_t adns_get_report(void); 65report_adns9800_t adns9800_get_report(void);