Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Classes | Public Types | Public Member Functions | List of all members
Spi Class Reference

Classes

struct  Settings
 

Public Types

enum  Mode { MODE0 = SPI_MODE_0, MODE1 = SPI_MODE_1, MODE2 = SPI_MODE_2, MODE3 = SPI_MODE_3 }
 

Public Member Functions

int setup (const Settings &settings)
 
int transfer (unsigned char *send, unsigned char *receive, size_t numBytes)
 
int setMode (unsigned char mode)
 
int setNumBits (unsigned char numBits)
 
int setSpeed (unsigned long speed)
 
void cleanup ()
 

Detailed Description

Examples:
Communication/Spi/render.cpp.

Member Function Documentation

int Spi::setup ( const Settings settings)

Initialize the device

Returns
0 on success, an error code otherwise.
Examples:
Communication/Spi/render.cpp.
int Spi::transfer ( unsigned char *  send,
unsigned char *  receive,
size_t  numBytes 
)

Perform one SPI transaction.

: Points to the buffer containing the data to be sent : Points to the buffer into which the received bytes will be stored : length of buffers in bytes.

Returns
0 on success, -1 on failure
Examples:
Communication/Spi/render.cpp.
int Spi::setMode ( unsigned char  mode)

Set the device mode.

Parameters
modea set of flags that will be passed to ioctl(... SPI_IOC_xx_MODE ...)
Returns
0 upon success or an error code otherwise.
int Spi::setNumBits ( unsigned char  numBits)

Set the number of bits per word.

Parameters
numBitsthe number of bits. Valid values are 8, 16, 24, 32
Returns
0 upon success or an error code otherwise.
int Spi::setSpeed ( unsigned long  speed)

Set the clock frequency of the SPI bus.

Parameters
speedthe clock frequency.
Returns
0 upon success or an error code otherwise.
void Spi::cleanup ( )

Close the device.


The documentation for this class was generated from the following files: