summaryrefslogtreecommitdiffstats
path: root/led.hpp
blob: 0e674bb142a040f754120c6732f985e11ed67841 (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, color color);
    virtual ~led();

    void pin(gpio *pin);
    gpio * 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 = nullptr;
    color _color;
};

#endif  /* LED_HPP */