uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
Functions | Variables
spi.c File Reference

SPI emulation module. More...

#include <stdbool.h>
#include <stdint.h>
#include <util/delay.h>
#include "gpio.h"
#include "spi.h"
Include dependency graph for spi.c:

Functions

void init_spi_module (const struct spi_config *const config)
 Configures the SPI module. More...
 
uint16_t spi_transceive (const uint16_t output)
 Sends and receives a word (full duplex) More...
 
void spi_select (const bool select)
 Controls the chip select line. More...
 

Variables

static const struct spi_configspi_config
 Internal pointer to the SPI configuration. More...
 

Detailed Description

SPI emulation module.

Function Documentation

◆ init_spi_module()

void init_spi_module ( const struct spi_config config)

Configures the SPI module.

Initializes all specified GPIO ports and the clock line

Parameters
configthe SPI configuration

◆ spi_select()

void spi_select ( bool  select)

Controls the chip select line.

Parameters
selectif true, the line is pulled down

◆ spi_transceive()

uint16_t spi_transceive ( uint16_t  output)

Sends and receives a word (full duplex)

Parameters
outputthe output word
Returns
the received word, if any

Variable Documentation

◆ spi_config

const struct spi_config* spi_config
static

Internal pointer to the SPI configuration.