Arduino Filters master
Filter library for Arduino
ShiftRegisterOutBase.ipp
Go to the documentation of this file.
4
6
7template <uint16_t N>
9 BitOrder_t bitOrder)
10 : latchPin(latchPin), bitOrder(bitOrder) {}
11
12template <uint16_t N>
14 buffer.set(pin, val);
15 dirty = true;
16 this->updateBufferedOutputs(); // TODO: should I always update?
17}
18
19template <uint16_t N>
21 buffer.set(pin, val);
22 dirty = true;
23}
24
25template <uint16_t N>
27 return buffer.get(pin) ? HIGH : LOW;
28}
29
30template <uint16_t N>
32 return this->pin(3 * id + ShiftRegisterOutRGB::greenBit);
33}
34
35template <uint16_t N>
37 return generateIncrementalArray<pin_t, N / 3>(
38 this->pin(ShiftRegisterOutRGB::greenBit), 3);
39}
40
41template <uint16_t N>
43 return this->pin(3 * id + ShiftRegisterOutRGB::redBit);
44}
45
46template <uint16_t N>
48 return generateIncrementalArray<pin_t, N / 3>(
49 this->pin(ShiftRegisterOutRGB::redBit), 3);
50}
51
52template <uint16_t N>
54 return this->pin(3 * id + ShiftRegisterOutRGB::blueBit);
55}
56
57template <uint16_t N>
59 return generateIncrementalArray<pin_t, N / 3>(
60 this->pin(ShiftRegisterOutRGB::blueBit), 3);
61}
62
constexpr PinStatus_t LOW
uint8_t BitOrder_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Array< pin_t, N/3 > bluePins()
Get an array containing all pins with blue LEDs.
Array< pin_t, N/3 > redPins()
Get an array containing all pins with red LEDs.
pin_t blue(pin_t id)
Get the blue output pin of the given LED.
PinStatus_t digitalRead(pin_t pin) override
Get the current state of a given output pin.
pin_t red(pin_t id)
Get the red output pin of the given LED.
ShiftRegisterOutBase(pin_t latchPin, BitOrder_t bitOrder)
Create a new ShiftRegisterOutBase object with a given bit order, and a given number of outputs.
pin_t green(pin_t id)
Get the green output pin of the given LED.
void digitalWrite(pin_t pin, PinStatus_t val) override
Set the state of a given output pin.
Array< pin_t, N/3 > greenPins()
Get an array containing all pins with green LEDs.
void digitalWriteBuffered(pin_t pin, PinStatus_t val) override
Set the output of a given pin in the software buffer.
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...
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
static const uint8_t redBit
The position of the red output pin for 3-color LEDs.
static const uint8_t blueBit
The position of the blue output pin for 3-color LEDs.
static const uint8_t greenBit
The position of the green output pin for 3-color LEDs.