Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
ShiftRegisterOutBase.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
8
10
22template <uint16_t N>
24 protected:
37
38 public:
43 void pinMode(pin_int_t pin, PinMode_t mode) override
44 __attribute__((deprecated)) {
45 (void)pin;
46 (void)mode;
47 }
48
52 void pinModeBuffered(pin_int_t pin, PinMode_t mode) override
53 __attribute__((deprecated)) {
54 (void)pin;
55 (void)mode;
56 }
57
68
76
88
93 return digitalRead(pin);
94 }
95
106 analog_t analogRead(pin_int_t pin) override __attribute__((deprecated)) {
107 return 1023 * digitalRead(pin);
108 }
109
114 __attribute__((deprecated)) {
115 return 1023 * digitalRead(pin);
116 }
117
128 void analogWrite(pin_int_t pin, analog_t val) override
129 __attribute__((deprecated)) {
130 digitalWrite(pin, val >= 0x80 ? HIGH : LOW);
131 }
132
137 __attribute__((deprecated)) {
138 digitalWrite(pin, val >= 0x80 ? HIGH : LOW);
139 }
140
144 void updateBufferedInputs() override {} // LCOV_EXCL_LINE
145
153
157 Array<pin_t, N / 3> redPins();
158
166
171
179
184
185 protected:
188
190 bool dirty = true;
191};
192
194
195#include "ShiftRegisterOutBase.ipp"
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
constexpr PinStatus_t LOW
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
uint8_t BitOrder_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
A class for serial-in/parallel-out shift registers, like the 74HC595.
pin_t blue(pin_int_t id)
Get the blue output pin of the given LED.
void pinMode(pin_int_t pin, PinMode_t mode) override __attribute__((deprecated))
The pinMode function is not implemented because the mode is OUTPUT by definition.
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.
PinStatus_t digitalRead(pin_int_t pin) override
Get the current state of a given output pin.
void digitalWrite(pin_int_t pin, PinStatus_t val) override
Set the state of a given output pin.
void analogWriteBuffered(pin_int_t pin, analog_t val) override __attribute__((deprecated))
The analogWrite function is not deprecated because a shift is always digital.
PinStatus_t digitalReadBuffered(pin_int_t pin) override
Get the current state of a given output pin.
ShiftRegisterOutBase(pin_t latchPin, BitOrder_t bitOrder)
Create a new ShiftRegisterOutBase object with a given bit order, and a given number of outputs.
void pinModeBuffered(pin_int_t pin, PinMode_t mode) override __attribute__((deprecated))
The pinMode function is not implemented because the mode is OUTPUT by definition.
void updateBufferedInputs() override
Shift registers don't have an input buffer.
pin_t green(pin_int_t id)
Get the green output pin of the given LED.
analog_t analogReadBuffered(pin_int_t pin) override __attribute__((deprecated))
The analogRead function is deprecated because a shift is always digital.
Array< pin_t, N/3 > greenPins()
Get an array containing all pins with green LEDs.
void digitalWriteBuffered(pin_int_t pin, PinStatus_t val) override
Set the output of a given pin in the software buffer.
pin_t red(pin_int_t id)
Get the red output pin of the given LED.
void analogWrite(pin_int_t pin, analog_t val) override __attribute__((deprecated))
The analogWrite function is not deprecated because a shift is always digital.
analog_t analogRead(pin_int_t pin) override __attribute__((deprecated))
The analogRead function is deprecated because a shift is always digital.
A class for ExtendedIOElements with a fixed size.
uint16_t analog_t
The type returned from analogRead and similar functions.
uint_fast16_t pin_int_t
Integer type used internally to store the index of (extended) GPIO pins.
An array wrapper for easy copying, comparing, and iterating.
Definition Array.hpp:32
Type for storing pin numbers of Extended Input/Output elements.