summaryrefslogtreecommitdiffstats
path: root/led.hpp
blob: f266d4b2225681da04cab898fcba4063e7647dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* 
 * File:   led.hpp
 * Author: naopross
 *
 * Created on May 5, 2018, 2:33 PM
 */

#ifndef LED_HPP
#define LED_HPP

#include "hal/pin.hpp"

#include <string>

class led {
public:
    enum class color
    {
        RED, GREEN, YELLOW,
    };

    led(gpio_pin *pin, color color);
    virtual ~led();

    void pin(gpio_pin *pin);
    gpio_pin * pin() const ;

    void get_color(color color);
    color set_color() const;

    void set(unsigned s);
    unsigned is_set() const;
    void toggle();

    std::string to_string();

private:
    led() {}

    gpio_pin *_pin = nullptr;
    color _color;
};

#endif  /* LED_HPP */