Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

BF51x/otSpi.h File Reference

SPI Library for BF51x. More...

#include "otdefs.h"
#include "otPort.h"

Defines

#define SPI_CHIP_SELECT_PORT   PP_H
 Port where is located the SPI chip select.
#define SPI_CHIP_SELECT_BIT   0
 Bit of the port used for the SPI chip select.
#define MAX_SPI_ADDRESS   8
 Maximum number of SPI slaves.

Typedefs

typedef SpiConfig SpiConfig

Enumerations

enum  SpiAddress {
  SA_EEPROM, SA_Y6, SA_Y15, SA_LCD,
  SA_TOUCH, SA_ADC, SA_PGA, SA_DAC,
  SA_OFFBOARD, SA_L6470 = 8, SA_MCP48FVB = 9, SA_DIGPOT = 10,
  SA_MAX7219_A = 1, SA_MAX7219_B = 2, SA_MAX7219_C = 11
}
enum  SpiChannel { SPI_0, SPI_1 }
enum  SpiControls { SPI_DEF = 0, SPI_CPOL = 0x800, SPI_CPHA = 0x400 }

Functions

float SpiChannel (int id, float baud, U16 cpol, U16 cpha)
 Specify a new device configuration.
void SpiCs (bool ena)
 Enable or disable SPI chip select.
void SpiSet (int id)
 Select a device on SPI bus.
U8 SpiPut (U8 value)
 Send/receive one byte to selected device.
void SpiPutW (U16 value)
 Send a word to selected device.
U16 SpiGet16 (U8 val)
 Read a word.
U8 SpiPutN (const U8 *value, U32 num)
 Send n bytes to selected device.
void SpiGetN (U8 dummy, U8 *value, U32 num)
 Receive n bytes from selected device.


Detailed Description

Version:
1.0.0
Author:
Manuele Turini
footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0