parent
cfc7c07bb1
commit
907cddeed0
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef __LED_HPP__
|
||||||
|
#define __LED_HPP__
|
||||||
|
|
||||||
|
#include "./../csl/interfaces/pin.hpp"
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class LED
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
LED(Pin<T>& pin) :
|
||||||
|
pin(pin)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void turnOn()
|
||||||
|
{
|
||||||
|
pin.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void turnOff()
|
||||||
|
{
|
||||||
|
pin.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggle()
|
||||||
|
{
|
||||||
|
pin.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Pin<T>& pin;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __LED_HPP__
|
Binary file not shown.
Loading…
Reference in new issue