Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
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

Member Function Documentation

◆ setup()

int Spi::setup ( const Settings & settings)

Initialize the device

Returns
0 on success, an error code otherwise.
Examples
Communication/Spi/render.cpp.

◆ transfer()

int Spi::transfer ( unsigned char * send,
unsigned char * receive,
size_t numBytes )

Perform one SPI transaction.

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

Returns
0 on success, -1 on failure

◆ setMode()

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.

◆ setNumBits()

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.

◆ setSpeed()

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.

◆ cleanup()

void Spi::cleanup ( )

Close the device.


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