/* * LED.hpp * * Created: 30.10.2020 22:05:41 * Author: netz */ #ifndef LED_HPP_ #define LED_HPP_ #include "ports/pin.hpp" #include "ports/portc.hpp" template class LedT { //ENUMS public: enum Led_Color { BLACK = 0, RED = 1, GREEN = 2, YELLOW = 3, BLUE = 4, MAGENTA = 5, CYAN = 6, WHITE = 7 }; // Methods private: void Init() { led_r.MakeLow(); led_g.MakeLow(); led_b.MakeLow(); } protected: public: LedT() { this->Init(); } /** * \brief * Set a color in the RGB Led * \param color * * \return void */ void SetColor(Led_Color color) { led_r.Set(color & (1<<0) ? true : false); led_g.Set(color & (1<<1) ? true : false); led_b.Set(color & (1<<2) ? true : false); } // Variables private: led_pin_r led_r; led_pin_g led_g; led_pin_b led_b; }; typedef LedT, blubblib::pin, blubblib::pin > Led; #endif /* LED_HPP_ */