Line No. | Rev | Author | Line |
---|---|---|---|
1 | 1 | kaklik | //////////////////////////////////////////////////////////////////////////////// |
2 | // |
||
3 | // Modul pro prime ovladani senzoru v opticke mysi. |
||
4 | // (Pouziva SPI jednotku) |
||
5 | // |
||
6 | // |
||
7 | //////////////////////////////////////////////////////////////////////////////// |
||
8 | |||
9 | #define SPI_DATA PIN_B2 // je treba nadefinovat datovy pin, aby se vedelo, ktery pin se ma vypinat pri cteni dat. |
||
10 | |||
11 | // Address |
||
12 | #define PRODUCT_ID 0x00 |
||
13 | #define PRODUCT_ID4 0x01 |
||
14 | #define MOTION_STATUS 0x02 // |
||
15 | #define DELTA_X 0x03 // vycteni os |
||
16 | #define DELTA_Y 0x04 // -//- |
||
17 | #define OPERATION_MODE 0x85 // zapis do ridiciho registru |
||
18 | #define CONFIGURATION 0x06 |
||
19 | |||
20 | void chip_write(command) |
||
21 | { |
||
22 | output_high(PIN_B2); |
||
23 | spi_write(command); |
||
24 | } |
||
25 | |||
26 | signed int8 chip_read(command) |
||
27 | { |
||
28 | output_high(SPI_DATA); |
||
29 | spi_write(command); |
||
30 | output_float(SPI_DATA); |
||
31 | return spi_read(0); |
||
32 | } |
Powered by WebSVN v2.8.3