Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
1 #pragma once
2 #include <Bela.h> // this class acts on the BelaContext directly
3 #include <vector>
14 {
15 public:
19  struct Pins {
20  unsigned int data;
21  unsigned int clock;
22  unsigned int latch;
23  };
28  ShiftRegister();
37  ShiftRegister(const Pins& pins, unsigned int maxSize);
41  void setup(const Pins& pins, unsigned int maxSize);
48  bool dataSent();
52  void process(BelaContext* context);
56  void process(BelaContext* context, unsigned int n);
66  void setData(const std::vector<bool>& dataBuf);
72  void setData(const bool* dataBuf, unsigned int length);
73 private:
74  Pins pins;
75  typedef enum {
76  kStart,
77  kTransmitting,
78  kStop,
79  kIdle,
80  } State;
82  State state = kStop;
83  unsigned int currentDataFrame = 0;
84  std::vector<bool> data;
85  bool pinModeSet = false;
86 };
void setData(const std::vector< bool > &dataBuf)
Definition: ShiftRegister.cpp:68
Definition: ShiftRegister.cpp:3
unsigned int latch
latch pin
Definition: ShiftRegister.h:22
unsigned int data
data pin
Definition: ShiftRegister.h:20
unsigned int clock
clock pin
Definition: ShiftRegister.h:21
Structure holding audio and sensor settings and pointers to I/O data buffers.
Definition: Bela.h:186
Definition: ShiftRegister.h:19
Main Bela public API.
void setup(const Pins &pins, unsigned int maxSize)
Definition: ShiftRegister.cpp:9
void process(BelaContext *context)
Definition: ShiftRegister.cpp:20
bool dataSent()
Definition: ShiftRegister.cpp:15
A class to drive a shift register using Bela's digital outputs.
Definition: ShiftRegister.h:13