Files
Scanning the repository...
Last update 5 years 6 months
by Kate Temkin
Filesfirmwareapollosrcboardsluna | |
---|---|
.. | |
apollo_board.h | |
board.mk | |
debug_spi.c | |
dfu.c | |
fpga.c | |
jtag.c | |
led.c | |
platform_jtag.h | |
selftest.c | |
selftest.h | |
spi.c | |
spi.h | |
tusb_config.h | |
uart.c | |
usb_descriptors.c |
spi.h/* * SPI driver code. * This file is part of LUNA. */ #ifndef __SPI_H__ #define __SPI_H__ #include <stddef.h> #include <stdint.h> #include <stdbool.h> typedef enum { SPI_FPGA_JTAG, SPI_FPGA_DEBUG } spi_target_t; /** * Configures the relevant SPI target's pins to be used for SPI. */ void spi_configure_pinmux(spi_target_t target); /** * Returns the relevant SPI target's pins to being used for GPIO. */ void spi_release_pinmux(spi_target_t target); /** * Configures the provided target to be used as an SPI port via the SERCOM. */ void spi_init(spi_target_t target, bool lsb_first, bool configure_pinmux, uint8_t baud_divider, uint8_t clock_polarity, uint8_t clock_phase); /** * Synchronously send a single byte on the given SPI bus. * Does not manage the SSEL line. */ uint8_t spi_send_byte(spi_target_t port, uint8_t data); /** * Sends a block of data over the SPI bus. * * @param port The port on which to perform the SPI transaction. * @param data_to_send The data to be transferred over the SPI bus. * @param data_received Any data received during the SPI transaction. * @param length The total length of the data to be exchanged, in bytes. */ void spi_send(spi_target_t port, void *data_to_send, void *data_received, size_t length); #endif