Control Surface main
MIDI Control Surface library for Arduino
SPIShiftRegisterOut.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
7
8#include "ShiftRegisterOutBase.hpp"
9
11#include <AH/Arduino-Wrapper.h> // MSBFIRST, SS
12#include <SPI.h>
14
16
30template <uint16_t N, class SPIDriver = decltype(SPI) &>
32 public:
59 SPIShiftRegisterOut(SPIDriver spi, pin_t latchPin = SS,
60 BitOrder_t bitOrder = MSBFIRST);
61
67 void begin() override;
68
72 void updateBufferedOutputs() override;
73
74 private:
75 SPIDriver spi;
76
77 public:
78 SPISettings settings{SPI_MAX_SPEED, this->bitOrder, SPI_MODE0};
79};
80
82
83#include "SPIShiftRegisterOut.ipp"
84
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
uint8_t BitOrder_t
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
Definition: Warnings.hpp:54
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:53
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:52
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
void updateBufferedOutputs() override
Write the state buffer to the physical outputs.
void begin() override
Initialize the shift register.
SPIShiftRegisterOut(SPIDriver spi, pin_t latchPin=SS, BitOrder_t bitOrder=MSBFIRST)
Create a new SPIShiftRegisterOut object with a given bit order, and a given number of outputs.
A class for serial-in/parallel-out shift registers, like the 74HC595.
static constexpr Frequency SPI_MAX_SPEED
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).