Arduino-GPIO
General Purpose Input/Output (GPIO) library for Arduino
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
SRPO.h
Go to the documentation of this file.
1
19
#ifndef SRPO_H
20
#define SRPO_H
21
22
#include "
GPIO.h
"
23
30
template
<u
int
8_t BITORDER, BOARD::pin_t DATA_PIN, BOARD::pin_t CLOCK_PIN>
31
class
SRPO
{
32
public
:
38
SRPO
()
39
{
40
m_data
.
output
();
41
m_clock
.
output
();
42
}
43
49
void
write
(uint8_t value)
50
{
51
if
(BITORDER == LSBFIRST) {
52
uint8_t mask = 1;
53
do
{
54
m_data
= value & mask;
55
m_clock
.
toggle
();
56
mask <<= 1;
57
m_clock
.
toggle
();
58
}
while
(mask);
59
}
60
else
{
61
uint8_t mask = 0x80;
62
do
{
63
m_data
= value & mask;
64
m_clock
.
toggle
();
65
mask >>= 1;
66
m_clock
.
toggle
();
67
}
while
(mask);
68
}
69
}
70
75
void
operator<<
(uint8_t value)
76
{
77
write
(value);
78
}
79
80
protected
:
81
GPIO<DATA_PIN>
m_data
;
82
GPIO<CLOCK_PIN>
m_clock
;
83
};
84
85
#endif
SRPO::write
void write(uint8_t value)
Definition:
SRPO.h:49
SRPO
Definition:
SRPO.h:31
SRPO::operator<<
void operator<<(uint8_t value)
Definition:
SRPO.h:75
GPIO.h
SRPO::SRPO
SRPO()
Definition:
SRPO.h:38
GPIO::toggle
void toggle()
Definition:
GPIO.h:113
GPIO::output
void output()
Definition:
GPIO.h:56
GPIO< DATA_PIN >
SRPO::m_data
GPIO< DATA_PIN > m_data
Definition:
SRPO.h:81
SRPO::m_clock
GPIO< CLOCK_PIN > m_clock
Definition:
SRPO.h:82
src
SRPO.h
Generated on Sat Oct 14 2017 16:03:22 for Arduino-GPIO by
1.8.11