COSA
An Object-Oriented Platform for Arduino Programming
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
OutputPin.cpp
Go to the documentation of this file.
1
21
#include "
Cosa/OutputPin.hh
"
22
23
void
24
OutputPin::write
(uint8_t value,
OutputPin
& clk,
Direction
order)
const
25
{
26
uint8_t bits =
CHARBITS
;
27
if
(order ==
MSB_FIRST
) {
28
do
{
29
_write
(value & 0x80);
30
clk.
_toggle
();
31
value <<= 1;
32
clk.
_toggle
();
33
}
while
(--bits);
34
}
35
else
{
36
do
{
37
_write
(value & 0x01);
38
clk.
_toggle
();
39
value >>= 1;
40
clk.
_toggle
();
41
}
while
(--bits);
42
}
43
}
44
45
void
46
OutputPin::write
(uint16_t value, uint8_t bits, uint16_t us)
const
47
{
48
if
(
UNLIKELY
(bits == 0))
return
;
49
synchronized
{
50
do
{
51
_write
(value & 0x01);
52
DELAY
(us);
53
value >>= 1;
54
}
while
(--bits);
55
}
56
}
57
DELAY
#define DELAY(us)
Definition:
Types.h:280
Pin::Direction
Direction
Definition:
Pin.hh:84
OutputPin::write
void write(int value) const
Definition:
OutputPin.hh:236
OutputPin.hh
CHARBITS
#define CHARBITS
Definition:
Types.h:57
OutputPin::_toggle
void _toggle() const
Definition:
OutputPin.hh:153
OutputPin
Definition:
OutputPin.hh:29
OutputPin::_write
void _write(int value) const
Definition:
OutputPin.hh:219
Pin::MSB_FIRST
Definition:
Pin.hh:85
UNLIKELY
#define UNLIKELY(x)
Definition:
Types.h:153
cores
cosa
Cosa
OutputPin.cpp
Generated on Thu Aug 31 2017 17:02:02 for COSA by
1.8.11