Subversion Repositories Projects

Rev

Rev 471 | Rev 761 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 471 Rev 507
Line 16... Line 16...
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
Line -... Line 20...
-
 
20
 
-
 
21
/*
-
 
22
 * structs 'n union for easy SPI transfer
-
 
23
 */
-
 
24
typedef struct {
-
 
25
        int16_t ampere;
-
 
26
        int32_t mah;
-
 
27
        int16_t volt;
-
 
28
} __attribute__((packed)) SPI_strom_data_t;
-
 
29
 
-
 
30
typedef struct {
-
 
31
        uint8_t c[10];
-
 
32
        uint8_t chk;
-
 
33
} __attribute__((packed)) SPI_char_buffer_t;
-
 
34
 
-
 
35
union SPI_buffer_t {
-
 
36
  SPI_strom_data_t data;
-
 
37
  SPI_char_buffer_t buffer;
-
 
38
};
-
 
39
 
-
 
40
volatile union SPI_buffer_t SPI_buffer;
20
 
41
 
21
/**
42
/**
22
 * SPI interrupt handler
43
 * SPI interrupt handler
23
 */
44
 */
Line 32... Line 53...
32
 * check if SPI transfer is still busy
53
 * check if SPI transfer is still busy
33
 */
54
 */
34
int TransferIsBusy(void);
55
int TransferIsBusy(void);
Line 35... Line 56...
35
 
56
 
36
/**
57
/**
-
 
58
 * start a new transfer with length <len>
-
 
59
 */
-
 
60
void StartTransfer(uint16_t);
-
 
61
 
-
 
62
/**
37
 * start a new transfer of <data> with length <len>
63
 * send next command through spi
38
 */
64
 */