work on KED structure idea

master
polymurph 4 years ago
parent cfc7c07bb1
commit 907cddeed0

@ -1,11 +1,29 @@
#ifndef __HW_PLATTFORM_HPP__
#define __HW_PLATTFORM_HPP__
//
// csl ressources
//
#include "./../csl/implementations/dummy/dummy_pin.hpp"
//
// drivers
//
#include "./../drivers/LED.hpp"
struct HW_plattform
{
Dummy_Pin pin_0, pin_1;
LED<Dummy_Pin> led_0;
HW_plattform():
pin_0(),
pin_1(),
led_0(pin_0)
{}
};

@ -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__

@ -8,6 +8,9 @@ int main()
HW_plattform hw;
hw.pin_0.set(true);
hw.pin_1.set(true);
hw.led_0.turnOn();
return 1;
}

Binary file not shown.
Loading…
Cancel
Save