uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
Data Structures | Functions
spi.h File Reference

SPI emulation module. More...

#include <stdbool.h>
#include <stdint.h>
#include "gpio.h"
Include dependency graph for spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  spi_config
 Configuration structure for the SPI emulation module. More...
 

Functions

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

Detailed Description

SPI emulation module.

Note: At the moment only a single instance is supported! Also, the clock frequency is hard-coded to 500kHz.

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