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 Member Functions | List of all members
ShiftRegister Class Reference

A class to drive a shift register using Bela's digital outputs. More...

#include <ShiftRegister.h>

Classes

struct  Pins
 

Public Member Functions

 ShiftRegister ()
 
 ShiftRegister (const Pins &pins, unsigned int maxSize)
 
void setup (const Pins &pins, unsigned int maxSize)
 
bool dataSent ()
 
void process (BelaContext *context)
 
void process (BelaContext *context, unsigned int n)
 
void setData (const std::vector< bool > &dataBuf)
 
void setData (const bool *dataBuf, unsigned int length)
 

Detailed Description

A class to drive a shift register using Bela's digital outputs.

A class to drive a shift register using Bela's digital outputs. This class accesses the BelaContext directly to perform data output. You need to assign it three digital channels at initialisation, to which data will be written at each call to process().

Examples:
Sensors/shift-register-out/render.cpp.

Constructor & Destructor Documentation

ShiftRegister::ShiftRegister ( )

Default constructor. Does nothing. If the object is constructed this way, you have to call setup() to initialise it properly.

ShiftRegister::ShiftRegister ( const Pins pins,
unsigned int  maxSize 
)

Set the Bela digital channels that will be used and the maximum length of the messages to be transmitted.

Parameters
pinsthe data, clock, latch pins to be used.
maxSizethe maximum length of the messages that will be passed to setData().

Member Function Documentation

void ShiftRegister::setup ( const Pins pins,
unsigned int  maxSize 
)
bool ShiftRegister::dataSent ( )

Check whether the last data set with setData() has been fully shifted out.

Returns
true if all data has been shifted out, or false if shifting is still in progress.
Examples:
Sensors/shift-register-out/render.cpp.
void ShiftRegister::process ( BelaContext context)

Shift out data for all the digital frames in context.

Examples:
Sensors/shift-register-out/render.cpp.
void ShiftRegister::process ( BelaContext context,
unsigned int  n 
)

Shift out data for frame n.

void ShiftRegister::setData ( const std::vector< bool > &  dataBuf)

Set new data bits to be shifted out. Data willl be shifted out during the subsequent calls to process(), until dataSent() returns true. If the size of the data passed in is larger than maxSize was, the internal buffer holding a copy of the data will be reallocated, which is not a real-time safe operation.

Parameters
dataBufthe data to be shifted out.
Examples:
Sensors/shift-register-out/render.cpp.
void ShiftRegister::setData ( const bool *  dataBuf,
unsigned int  length 
)

Set new data bits to be shifted out. Data willl be shifted out during the subsequent calls to process(), until dataSent() returns true. If the size of the data passed in is larger than maxSize was, the internal buffer holding a copy of the data will be reallocated, which is not a real-time safe operation.

Parameters
dataBufthe data to be shifted out.
lengththe length of the data.

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