COSA
An Object-Oriented Platform for Arduino Programming
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Pin.cpp
Go to the documentation of this file.
1
21
#include "
Cosa/Pin.hh
"
22
#include "
Cosa/OutputPin.hh
"
23
24
uint8_t
25
Pin::read
(
OutputPin
& clk,
Direction
order)
const
26
{
27
uint8_t value = 0;
28
uint8_t bits =
CHARBITS
;
29
if
(order ==
MSB_FIRST
) {
30
do
{
31
value <<= 1;
32
if
(
is_set
()) value |= 0x01;
33
clk.
toggle
();
34
clk.
toggle
();
35
}
while
(--bits);
36
}
37
else
{
38
do
{
39
value >>= 1;
40
if
(
is_set
()) value |= 0x80;
41
clk.
toggle
();
42
clk.
toggle
();
43
}
while
(--bits);
44
}
45
return
(value);
46
}
Pin.hh
Pin::Direction
Direction
Definition:
Pin.hh:84
OutputPin.hh
CHARBITS
#define CHARBITS
Definition:
Types.h:57
Pin::is_set
bool is_set() const
Definition:
Pin.hh:112
OutputPin::toggle
void toggle() const
Definition:
OutputPin.hh:163
OutputPin
Definition:
OutputPin.hh:29
Pin::read
bool read() const
Definition:
Pin.hh:172
Pin::MSB_FIRST
Definition:
Pin.hh:85
cores
cosa
Cosa
Pin.cpp
Generated on Thu Aug 31 2017 17:02:02 for COSA by
1.8.11