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