A class to drive a shift register using Bela's digital outputs.
More...
#include <ShiftRegister.h>
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.
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
-
pins | the data, clock, latch pins to be used. |
maxSize | the maximum length of the messages that will be passed to setData(). |
void ShiftRegister::setup |
( |
const Pins & |
pins, |
|
|
unsigned int |
maxSize |
|
) |
| |
bool ShiftRegister::dataSent |
( |
| ) |
|
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
-
dataBuf | the 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
-
dataBuf | the data to be shifted out. |
length | the length of the data. |
The documentation for this class was generated from the following files:
- libraries/ShiftRegister/ShiftRegister.h
- libraries/ShiftRegister/ShiftRegister.cpp