PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
spi.h File Reference

Containing defines and functions for basic SPI initialization and handling. More...

#include "../Pins/Pins.h"
#include <SPI.h>

Go to the source code of this file.

Macros

#define SPI_DEFAULT_SETTINGS   SPISettings(8000000, MSBFIRST, SPI_MODE0)
 Default settings for the SPI.
 

Typedefs

typedef enum SpiDevices SpiDevices_t
 Enumeration with all SPI devices.
 

Enumerations

enum  SpiDevices {
  SPI_DEV_NONE , SPI_DEV_TOUCH , SPI_DEV_TFT , SPI_DEV_PS ,
  SPI_DEV_DDS , SPI_DEV_IO_EXP
}
 Enumeration with all SPI devices. More...
 

Functions

void SPI_SelectDevice (SpiDevices_t spiDevice)
 Deselect all SPI devices (pull the CS lines high) and select the given one (pull the CS line low).
 
void SPI_DeselectAll ()
 Deselect all SPI devices (pull the CS lines high).
 
void SPI_Init ()
 Initialize the SPI subsystem as master.
 
uint8_t SPI_SendByte (uint8_t data)
 Transfer a byte of data to the slave.
 
uint8_t SPI_ReadByte ()
 Read a byte of data from the slave by sending a dummy byte (0xFF).
 

Detailed Description

Containing defines and functions for basic SPI initialization and handling.

Date
14.08.2020 19:24:17

Enumeration Type Documentation

◆ SpiDevices

enum SpiDevices

Enumeration with all SPI devices.

Enumerator
SPI_DEV_NONE 

No SPI device.

SPI_DEV_TOUCH 

Touch controller XPT2046.

SPI_DEV_TFT 

TFT controller ILI9341.

SPI_DEV_PS 

Power supply channel DAC MCP4921.

SPI_DEV_DDS 

DDS channel DAC MCP4922.

SPI_DEV_IO_EXP 

IO expander MCP23S08.

Function Documentation

◆ SPI_ReadByte()

uint8_t SPI_ReadByte ( )
inline

Read a byte of data from the slave by sending a dummy byte (0xFF).

Returns
Byte received form the slave.

◆ SPI_SelectDevice()

void SPI_SelectDevice ( SpiDevices_t spiDevice)

Deselect all SPI devices (pull the CS lines high) and select the given one (pull the CS line low).

Parameters
spiDeviceRequested SPI device which CS line is pulled low.

◆ SPI_SendByte()

uint8_t SPI_SendByte ( uint8_t data)
inline

Transfer a byte of data to the slave.

Parameters
dataData byte to transfer via SPI.
Returns
Byte received from the slave.