File sr_595.h¶
Go to the documentation of this file
Source Code¶
#pragma once
#ifndef DSY_DEV_SR_595_H
#define DSY_DEV_SR_595_H
#include "daisy_core.h"
#include "per/gpio.h"
namespace daisy
{
const size_t kMaxSr595DaisyChain
= 16;
class ShiftRegister595
{
public:
enum Pins
{
PIN_LATCH,
PIN_CLK,
PIN_DATA,
NUM_PINS,
};
ShiftRegister595() {}
~ShiftRegister595() {}
void Init(Pin *pin_cfg, size_t num_daisy_chained = 1);
void Set(uint8_t idx, bool state);
void Write();
private:
GPIO pin_[NUM_PINS];
uint8_t state_[kMaxSr595DaisyChain];
size_t num_devices_;
};
} // namespace daisy
#endif