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 | Protected Types | Protected Attributes | List of all members
ShiftRegister Class Referenceabstract

A class to drive a shift register using Bela's digital I/O. More...

#include <ShiftRegister.h>

Inheritance diagram for ShiftRegister:
ShiftRegisterIn ShiftRegisterOut

Classes

struct  Pins
 

Public Member Functions

 ShiftRegister ()
 
 ShiftRegister (const Pins &pins, unsigned int maxSize)
 
void setup (const Pins &pins, unsigned int maxSize)
 
bool dataReady ()
 
virtual void process (BelaContext *context, unsigned int n)=0
 

Protected Types

enum  State { kStart, kTransmitting, kStop, kIdle }
 

Protected Attributes

Pins pins
 
State state = kStop
 
std::vector< bool > data
 
bool pinModeSet = false
 
bool notified = true
 

Detailed Description

A class to drive a shift register using Bela's digital I/O.

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

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::dataReady ( )

Check whether the last I/O transmission is completed. After one call has returned true, future calls will return false until a new transmission is completed.

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

Shift I/O data for frame n.

Implemented in ShiftRegisterIn, and ShiftRegisterOut.


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