-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathShiftOutSlow.h
47 lines (32 loc) · 1.03 KB
/
ShiftOutSlow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
//
// FILE: ShiftOutSlow.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.5
// PURPOSE: Arduino library for shiftOut with build-in delay
// DATE: 2021-05-11
// URL: https://github.com/RobTillaart/ShiftOutSlow
#include "Arduino.h"
#define SHIFTOUTSLOW_LIB_VERSION (F("0.1.5"))
class ShiftOutSlow : public Print
{
public:
// bitOrder = { LSBFIRST, MSBFIRST }; defined in Arduino.h
ShiftOutSlow(const uint8_t dataPin, const uint8_t clockPin, const uint8_t bitOrder = LSBFIRST);
// PRINT INTERFACE
virtual size_t write(const uint8_t data) override;
virtual size_t write(const uint8_t *buffer, size_t size) override;
uint8_t lastWritten();
bool setBitOrder(const uint8_t bitOrder = LSBFIRST);
uint8_t getBitOrder();
// microSeconds = 0..65535
void setDelay(uint16_t microSeconds = 0);
uint16_t getDelay();
private:
uint8_t _clockPin = 0;
uint8_t _dataPin = 0;
uint8_t _bitOrder = LSBFIRST;
uint16_t _delay = 0;
uint8_t _value = 0;
};
// -- END OF FILE --