Arduino Libraries
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
tool
out_pin.hpp
Go to the documentation of this file.
1
// Author: Mario S. Könz <mskoenz@gmx.net>
2
// Date: 04.07.2013 15:35:23 EDT
3
// File: out_pin.hpp
4
5
/* This program is free software. It comes without any warranty, to
6
* the extent permitted by applicable law. You can redistribute it
7
* and/or modify it under the terms of the Do What The Fuck You Want
8
* To Public License, Version 2, as published by Sam Hocevar. See
9
* http://www.wtfpl.net/ or COPYING for more details. */
10
11
#ifndef __OUT_PIN_HEADER
12
#define __OUT_PIN_HEADER
13
14
#include <Arduino.h>
15
16
namespace
tool {
17
template
<u
int
8_t pin>
18
class
out_pin_class
{
19
public
:
20
//------------------- ctors -------------------
21
out_pin_class
(): state_(LOW) {
22
pinMode(pin, OUTPUT);
23
digitalWrite
(pin, state_);
24
}
25
//------------------- ops -------------------
26
operator
bool()
const
{
27
return
state_;
28
}
29
//------------------- assignment -------------------
30
out_pin_class
&
operator=
(
bool
const
& s) {
31
state_ = s;
32
digitalWrite
(pin, state_);
33
return
(*
this
);
34
}
35
//------------------- modes -------------------
36
void
on
() {
37
state_ = HIGH;
38
digitalWrite
(pin, state_);
39
}
40
void
off
() {
41
state_ = LOW;
42
digitalWrite
(pin, state_);
43
}
44
void
flip
() {
45
state_ = !state_;
46
digitalWrite
(pin, state_);
47
}
48
private
:
49
bool
state_;
50
};
51
}
//end namespace tool
52
53
#endif //__OUT_PIN_HEADER
tool::out_pin_class::flip
void flip()
Definition:
out_pin.hpp:44
tool::out_pin_class::on
void on()
Definition:
out_pin.hpp:36
tool::out_pin_class
Definition:
out_pin.hpp:18
tool::out_pin_class::out_pin_class
out_pin_class()
Definition:
out_pin.hpp:21
tool::out_pin_class::operator=
out_pin_class & operator=(bool const &s)
Definition:
out_pin.hpp:30
tool::out_pin_class::off
void off()
Definition:
out_pin.hpp:40
digitalWrite
#define digitalWrite(x, y)
Definition:
fast_io.hpp:59
Generated on Wed Oct 8 2014 19:44:56 for Arduino Libraries by
1.8.6