Line data Source code
1 : #pragma once 2 : 3 : #include <stdint.h> 4 : #include <pthread.h> 5 : 6 : /* 7 : A class to create output of some description or another for RGB LEDs. 8 : 9 : Hopefully something visual, but perhaps just text 10 : */ 11 : 12 : class SIM_RGBLED 13 : { 14 : public: 15 8580 : SIM_RGBLED(const char *_name) : 16 8580 : name{_name} 17 8580 : { } 18 : 19 : void init(); 20 : 21 357960797 : void set_colours(uint8_t _red, uint8_t _green, uint8_t _blue) { 22 357960797 : red = _red; 23 357960797 : green = _green; 24 357960797 : blue = _blue; 25 357960797 : } 26 : 27 : private: 28 : 29 : const char *name; 30 : 31 : uint8_t red; 32 : uint8_t green; 33 : uint8_t blue; 34 : 35 : static constexpr uint8_t height = 50; 36 : static constexpr uint8_t width = height; 37 : 38 : pthread_t thread; 39 : static void *update_thread_start(void *obj); 40 : void update_thread(void); 41 : 42 : uint32_t last_colour; 43 : };