Control Surface main
MIDI Control Surface library for Arduino
ShiftRegisterOutBase.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
7
8#include "ExtendedInputOutput.hpp"
11
13
25template <uint16_t N>
27 protected:
39 ShiftRegisterOutBase(pin_t latchPin, BitOrder_t bitOrder);
40
41 public:
46 void pinMode(pin_t pin, PinMode_t mode) override
47 __attribute__((deprecated)) {
48 (void)pin;
49 (void)mode;
50 }
51
55 void pinModeBuffered(pin_t pin, PinMode_t mode) override
56 __attribute__((deprecated)) {
57 (void)pin;
58 (void)mode;
59 }
60
70 void digitalWrite(pin_t pin, PinStatus_t val) override;
71
78 void digitalWriteBuffered(pin_t pin, PinStatus_t val) override;
79
90 PinStatus_t digitalRead(pin_t pin) override;
91
96 return digitalRead(pin);
97 }
98
109 analog_t analogRead(pin_t pin) override __attribute__((deprecated)) {
110 return 1023 * digitalRead(pin);
111 }
112
117 __attribute__((deprecated)) {
118 return 1023 * digitalRead(pin);
119 }
120
131 void analogWrite(pin_t pin, analog_t val) override
132 __attribute__((deprecated)) {
133 digitalWrite(pin, val >= 0x80 ? HIGH : LOW);
134 }
135
139 void analogWriteBuffered(pin_t pin, analog_t val) override
140 __attribute__((deprecated)) {
141 digitalWrite(pin, val >= 0x80 ? HIGH : LOW);
142 }
143
147 void updateBufferedInputs() override {} // LCOV_EXCL_LINE
148
155 pin_t red(pin_t id);
156
160 Array<pin_t, N / 3> redPins();
161
168 pin_t green(pin_t id);
169
173 Array<pin_t, N / 3> greenPins();
174
181 pin_t blue(pin_t id);
182
186 Array<pin_t, N / 3> bluePins();
187
188 protected:
191
193 bool dirty = true;
194};
195
197
199
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
constexpr PinStatus_t LOW
uint8_t BitOrder_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:37
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:36
A class for arrays of bits.
Definition: BitArray.hpp:25
A class for serial-in/parallel-out shift registers, like the 74HC595.
analog_t analogReadBuffered(pin_t pin) override __attribute__((deprecated))
The analogRead function is deprecated because a shift is always digital.
void analogWrite(pin_t pin, analog_t val) override __attribute__((deprecated))
The analogWrite function is not deprecated because a shift is always digital.
PinStatus_t digitalReadBuffered(pin_t pin) override
Get the current state of a given output pin.
void updateBufferedInputs() override
Shift registers don't have an input buffer.
void pinMode(pin_t pin, PinMode_t mode) override __attribute__((deprecated))
The pinMode function is not implemented because the mode is OUTPUT by definition.
analog_t analogRead(pin_t pin) override __attribute__((deprecated))
The analogRead function is deprecated because a shift is always digital.
void pinModeBuffered(pin_t pin, PinMode_t mode) override __attribute__((deprecated))
The pinMode function is not implemented because the mode is OUTPUT by definition.
void analogWriteBuffered(pin_t pin, analog_t val) override __attribute__((deprecated))
The analogWrite function is not deprecated because a shift is always digital.
A class for ExtendedIOElements with a fixed size.
void digitalWriteBuffered(pin_t pin, PinStatus_t val)
A buffered ExtIO version of the Arduino function.
PinStatus_t digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
uint16_t analog_t
The type returned from analogRead and similar functions.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36