18,6 → 18,27 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
|
/* |
* structs 'n union for easy SPI transfer |
*/ |
typedef struct { |
int16_t ampere; |
int32_t mah; |
int16_t volt; |
} __attribute__((packed)) SPI_strom_data_t; |
|
typedef struct { |
uint8_t c[10]; |
uint8_t chk; |
} __attribute__((packed)) SPI_char_buffer_t; |
|
union SPI_buffer_t { |
SPI_strom_data_t data; |
SPI_char_buffer_t buffer; |
}; |
|
volatile union SPI_buffer_t SPI_buffer; |
|
/** |
* SPI interrupt handler |
*/ |
34,6 → 55,11 |
int TransferIsBusy(void); |
|
/** |
* start a new transfer of <data> with length <len> |
* start a new transfer with length <len> |
*/ |
void StartTransfer(unsigned char *, uint16_t); |
void StartTransfer(uint16_t); |
|
/** |
* send next command through spi |
*/ |
void spi_send_next(); |