2021-05-30 08:25:53 -04:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: ShiftOutSlow.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2021-08-16 13:25:37 -04:00
|
|
|
// VERSION: 0.1.1
|
2021-05-30 08:25:53 -04:00
|
|
|
// PURPOSE: Arduino library for shiftOut with build-in delay
|
|
|
|
// DATE: 2021-05-11
|
|
|
|
// URL: https://github.com/RobTillaart/ShiftOutSlow
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
|
2021-08-16 13:25:37 -04:00
|
|
|
#define SHIFTOUTSLOW_LIB_VERSION (F("0.1.1"))
|
2021-05-30 08:25:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
class ShiftOutSlow : public Print
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// bitorder = { LSBFIRST, MSBFIRST };
|
|
|
|
ShiftOutSlow(const uint8_t dataPin, const uint8_t clockPin, const uint8_t bitOrder = LSBFIRST);
|
|
|
|
|
2021-08-16 13:25:37 -04:00
|
|
|
// PRINT INTERFACE
|
|
|
|
virtual size_t write(const uint8_t data) override;
|
|
|
|
virtual size_t write(const uint8_t *buffer, size_t size) override;
|
|
|
|
|
2021-05-30 08:25:53 -04:00
|
|
|
uint8_t lastWritten(void) { return _value; };
|
|
|
|
|
|
|
|
bool setBitOrder(const uint8_t bitOrder);
|
|
|
|
uint8_t getBitOrder(void) { return _bitOrder; };
|
2021-08-16 13:25:37 -04:00
|
|
|
|
|
|
|
// microSeconds = 0..65535
|
|
|
|
void setDelay(uint16_t microSeconds) { _delay = microSeconds; };
|
2021-05-30 08:25:53 -04:00
|
|
|
uint16_t getDelay() { return _delay; };
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t _clockPin = 0 ;
|
|
|
|
uint8_t _dataPin = 0;
|
|
|
|
uint8_t _bitOrder = LSBFIRST;
|
|
|
|
uint16_t _delay = 0;
|
|
|
|
uint8_t _value = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// -- END OF FILE --
|