This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
ShiftRegisterOutBase.ipp
Go to the documentation of this file.
4 
6 
7 template <uint8_t N>
9  : latchPin(latchPin), bitOrder(bitOrder) {}
10 
11 template <uint8_t N>
13  buffer.set(pin, val);
14  dirty = true;
15  this->update(); // TODO: should I always update?
16 }
17 
18 template <uint8_t N>
20  return buffer.get(pin);
21 }
22 
23 template <uint8_t N>
25  return this->pin(3 * id + ShiftRegisterOutRGB::greenBit);
26 }
27 
28 template <uint8_t N>
30  return generateIncrementalArray<pin_t, N / 3>(
31  this->pin(ShiftRegisterOutRGB::greenBit), 3);
32 }
33 
34 template <uint8_t N>
36  return this->pin(3 * id + ShiftRegisterOutRGB::redBit);
37 }
38 
39 template <uint8_t N>
41  return generateIncrementalArray<pin_t, N / 3>(
42  this->pin(ShiftRegisterOutRGB::redBit), 3);
43 }
44 
45 template <uint8_t N>
47  return this->pin(3 * id + ShiftRegisterOutRGB::blueBit);
48 }
49 
50 template <uint8_t N>
52  return generateIncrementalArray<pin_t, N / 3>(
53  this->pin(ShiftRegisterOutRGB::blueBit), 3);
54 }
55 
ShiftRegisterOutRGB.hpp
pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Def.hpp:17
ExtendedInputOutput.hpp
generateIncrementalArray
Array< T, N > generateIncrementalArray(U start=0, V increment=1)
Generate an array where the first value is given, and the subsequent values are calculated as the pre...
Definition: ArrayHelpers.hpp:152
Array
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:20
ShiftRegisterOutRGB::blueBit
const static uint8_t blueBit
The position of the blue output pin for 3-color LEDs.
Definition: ShiftRegisterOutRGB.hpp:28
ShiftRegisterOutBase::bluePins
Array< pin_t, N/3 > bluePins()
Get an array containing all pins with blue LEDs.
Definition: ShiftRegisterOutBase.ipp:51
ShiftRegisterOutBase::blue
pin_t blue(pin_t id)
Get the blue output pin of the given LED.
Definition: ShiftRegisterOutBase.ipp:46
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
ShiftRegisterOutRGB::redBit
const static uint8_t redBit
The position of the red output pin for 3-color LEDs.
Definition: ShiftRegisterOutRGB.hpp:18
ShiftRegisterOutBase::greenPins
Array< pin_t, N/3 > greenPins()
Get an array containing all pins with green LEDs.
Definition: ShiftRegisterOutBase.ipp:29
ShiftRegisterOutRGB::greenBit
const static uint8_t greenBit
The position of the green output pin for 3-color LEDs.
Definition: ShiftRegisterOutRGB.hpp:23
ShiftRegisterOutBase.hpp
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
ShiftRegisterOutBase::digitalRead
int digitalRead(pin_t pin) override
Get the current state of a given output pin.
Definition: ShiftRegisterOutBase.ipp:19
ShiftRegisterOutBase::green
pin_t green(pin_t id)
Get the green output pin of the given LED.
Definition: ShiftRegisterOutBase.ipp:24
ShiftRegisterOutBase::digitalWrite
void digitalWrite(pin_t pin, uint8_t val) override
Set the state of a given output pin.
Definition: ShiftRegisterOutBase.ipp:12
ShiftRegisterOutBase::redPins
Array< pin_t, N/3 > redPins()
Get an array containing all pins with red LEDs.
Definition: ShiftRegisterOutBase.ipp:40
ShiftRegisterOutBase::red
pin_t red(pin_t id)
Get the red output pin of the given LED.
Definition: ShiftRegisterOutBase.ipp:35
ShiftRegisterOutBase::ShiftRegisterOutBase
ShiftRegisterOutBase(pin_t latchPin, uint8_t bitOrder)
Create a new ShiftRegisterOutBase object with a given bit order, and a given number of outputs.
Definition: ShiftRegisterOutBase.ipp:8