# SPI
[Core]

The SPI subsystem allows the MAKE Controller to communicate with peripheral devices via SPI. More...

## Functions
int | Spi_Configure (int channel, int bits, int clockDivider, int delayBeforeSPCK, int delayBetweenTransfers)
| Configure the SPI channel.
int | Spi_ReadWriteBlock (int channel, unsigned char *buffer, int count)
| Read/Write a block of data via SPI.

## Detailed Description

The SPI subsystem allows the MAKE Controller to communicate with peripheral devices via SPI.

See EEPROM module for an example use.

## Function Documentation

int Spi_Configure | ( | int | channel,
|  | int | bits,
|  | int | clockDivider,
|  | int | delayBeforeSPCK,
|  | int | delayBetweenTransfers |
| ) |  |  |

Configure the SPI channel.

This function locks the I/O lines associated with the SPI channel so they cannot be used by another device on the same lines.

Parameters:

  | channel | An integer specifying the SPI channel to configure.
  | bits | An integer specifying the number of bits to transfer (8-16).
  | clockDivider | An integer specifying the desired divider from the serial clock (0 - 255).
  | delayBeforeSPCK | An integer specifying the delay, in ms, before the clock starts (0 - 255).
  | delayBetweenTransfers | An integer specifying how long, in ms, to wait between transfers (0 - 255).

Returns:
  0 on success.

Definition at line 104 of file spi.c.

int Spi_ReadWriteBlock | ( | int | channel,
|  | unsigned char * | buffer,
|  | int | count |
| ) |  |  |

Read/Write a block of data via SPI.

Parameters:

  | channel | An integer specifying the device to communicate with.
  | buffer | A pointer to the buffer to read to, or write from.
  | count | An integer specifying the length in bytes of the buffer to read/write.

Returns:
  0 on success.

Definition at line 142 of file spi.c.