Hanna
Sourcecode Batteriemanagementsystem |
SPI Master driver. This file defines a useful set of functions for the SPI interface on AVR devices. Mehr ...
gehe zum Quellcode dieser Datei
Funktionen | |
void | spi_deselect_device (SPI_t *spi, struct spi_device *device) |
Deselect given device on the SPI bus. Mehr ... | |
void | spi_master_init (SPI_t *spi) |
Initializes the SPI in master mode. Mehr ... | |
void | spi_master_setup_device (SPI_t *spi, struct spi_device *device, spi_flags_t flags, uint32_t baud_rate, board_spi_select_id_t sel_id) |
Setup a SPI device. Mehr ... | |
status_code_t | spi_read_packet (SPI_t *spi, uint8_t *data, size_t len) |
Receive a sequence of bytes from a SPI device. Mehr ... | |
void | spi_select_device (SPI_t *spi, struct spi_device *device) |
Select given device on the SPI bus. Mehr ... | |
status_code_t | spi_write_packet (SPI_t *spi, const uint8_t *data, size_t len) |
Send a sequence of bytes to a SPI device. Mehr ... | |
int8_t | spi_xmega_set_baud_div (SPI_t *spi, uint32_t baudrate, uint32_t clkper_hz) |
Calculates the SPI baudrate divider. Mehr ... | |
SPI Master driver. This file defines a useful set of functions for the SPI interface on AVR devices.
Definiert in Datei spi_master.c.
void spi_master_setup_device | ( | SPI_t * | spi, |
struct spi_device * | device, | ||
spi_flags_t | flags, | ||
uint32_t | baud_rate, | ||
board_spi_select_id_t | sel_id | ||
) |
Setup a SPI device.
The returned device descriptor structure must be passed to the driver whenever that device should be used as current slave device.
spi | Base address of the SPI instance. |
device | Pointer to SPI device struct that should be initialised. |
flags | SPI configuration flags. Common flags for all implementations are the SPI modes SPI_MODE_0 ... SPI_MODE_3. |
baud_rate | Baud rate for communication with slave device in Hz. |
sel_id | Board specific select id |
Definiert in Zeile 175 der Datei spi_master.c.
int8_t spi_xmega_set_baud_div | ( | SPI_t * | spi, |
uint32_t | baudrate, | ||
uint32_t | clkper_hz | ||
) |
Calculates the SPI baudrate divider.
baudrate | The expected baudrate on the SPI. |
clkper_hz | SPI module input clock frequency (Peripheral clock, Hz). |
spi | The SPI module address |
>=0 | Success. |
<0 | Error. |
Definiert in Zeile 59 der Datei spi_master.c.