Hanna
Sourcecode Batteriemanagementsystem
Funktionen
spi_master.c-Dateireferenz

SPI Master driver. This file defines a useful set of functions for the SPI interface on AVR devices. Mehr ...

#include "spi_master.h"
#include "sysclk.h"
Include-Abhängigkeitsdiagramm für spi_master.c:

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 ...
 

Ausführliche Beschreibung

SPI Master driver. This file defines a useful set of functions for the SPI interface on AVR devices.

Autor
Copyright (c) 2010-2015 Atmel Corporation. All rights reserved.

Definiert in Datei spi_master.c.

Dokumentation der Funktionen

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.

Parameter
spiBase address of the SPI instance.
devicePointer to SPI device struct that should be initialised.
flagsSPI configuration flags. Common flags for all implementations are the SPI modes SPI_MODE_0 ... SPI_MODE_3.
baud_rateBaud rate for communication with slave device in Hz.
sel_idBoard specific select id

Definiert in Zeile 175 der Datei spi_master.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

int8_t spi_xmega_set_baud_div ( SPI_t *  spi,
uint32_t  baudrate,
uint32_t  clkper_hz 
)

Calculates the SPI baudrate divider.

Parameter
baudrateThe expected baudrate on the SPI.
clkper_hzSPI module input clock frequency (Peripheral clock, Hz).
spiThe SPI module address
Rückgabe
Status of operation.
Rückgabewerte
>=0Success.
<0Error.

Definiert in Zeile 59 der Datei spi_master.c.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird: