Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
196 | pakoxda | 1 | /*! \file spi.h \brief SPI interface driver. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'spi.h' |
||
5 | // Title : SPI interface driver |
||
6 | // Author : Pascal Stang - Copyright (C) 2000-2002 |
||
7 | // Created : 11/22/2000 |
||
8 | // Revised : 06/06/2002 |
||
9 | // Version : 0.6 |
||
10 | // Target MCU : Atmel AVR series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | // NOTE: This code is currently below version 1.0, and therefore is considered |
||
14 | // to be lacking in some functionality or documentation, or may not be fully |
||
15 | // tested. Nonetheless, you can expect most functions to work. |
||
16 | // |
||
17 | /// \ingroup driver_avr |
||
18 | /// \defgroup spi SPI (Serial Peripheral Interface) Function Library (spi.c) |
||
19 | /// \code #include "spi.h" \endcode |
||
20 | /// \par Overview |
||
21 | /// Provides basic byte and word transmitting and receiving via the AVR |
||
22 | /// SPI interface. Due to the nature of SPI, every SPI communication operation |
||
23 | /// is both a transmit and simultaneous receive. |
||
24 | /// |
||
25 | /// \note Currently, only MASTER mode is supported. |
||
26 | // |
||
27 | // This code is distributed under the GNU Public License |
||
28 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
29 | // |
||
30 | //***************************************************************************** |
||
31 | |||
32 | // function prototypes |
||
33 | |||
34 | |||
35 | extern volatile double XE,YE; |
||
36 | extern volatile signed char nickgrad,rollgrad,nickgradkomp,rollgradkomp; |
||
37 | extern volatile double richtungorgr,richtungorgd,nick,roll; |
||
38 | extern volatile int iXsf,iYsf,iZsf; |
||
39 | extern volatile signed int Xmax, Xmin, Ymax, Ymin, Zmin, Zmax; |
||
40 | extern volatile double XrawCal, YrawCal, ZrawCal; |
||
41 | extern volatile int Xraw, Yraw, Zraw; // save values you get from the ASIC |
||
42 | extern volatile int Xoffset, Yoffset, Zoffset; |
||
43 | extern volatile int azimuthgrad; |
||
44 | extern double XEx,XEy,XEz,YEy,YEz; |
||
45 | int MagnetG; |
||
46 | // SPI interface initializer |
||
47 | void spiInit(void); |
||
48 | |||
49 | // spiSendByte(u08 data) waits until the SPI interface is ready |
||
50 | // and then sends a single byte over the SPI port. This command |
||
51 | // does not receive anything. |
||
52 | void spiSendByte(unsigned char data); |
||
53 | |||
54 | // spiTransferByte(u08 data) waits until the SPI interface is ready |
||
55 | // and then sends a single byte over the SPI port. The function also |
||
56 | // returns the byte that was received during transmission. |
||
57 | unsigned char spiTransferByte(unsigned char data); |
||
58 | |||
59 | // spiTransferWord(u08 data) works just like spiTransferByte but |
||
60 | // operates on a whole word (16-bits of data). |
||
61 | unsigned int spiTransferWord(unsigned int data); |
||
62 | |||
63 | |||
64 | extern int KompassRead(void); |
||
65 | extern void ReadEepromKompassValues(void); |
||
66 |