Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. class Neopixel
  2. {
  3. public:
  4.     Neopixel(int size);
  5.  
  6.     Neopixel(const Neopixel&) = default;
  7.     Neopixel& operator =(const Neopixel&) = default;
  8.  
  9.     Neopixel(Neopixel&&) = default;
  10.     Neopixel& operator =(Neopixel&&) = default;
  11.  
  12.     virtual ~Neopixel();
  13.  
  14.     void shine_everyone(Color val);
  15.     void rotate_left(std::vector<Color> colors);
  16.     void rotate_right(std::vector<Color> colors);
  17.     void run_n_back(std::vector<Color> colors);
  18.     void darkness(Color color, double bright);
  19.     void brightness(Color color, double bright);
  20.     void every_second(Color color);
  21.  
  22. private:
  23.     enum class Mode
  24.     {
  25.         UP, DOWN
  26.     };
  27.  
  28.     constexpr static uint32_t CODE_0{0x7C00}; // RGB and GRB
  29.     constexpr static uint32_t CODE_1{0x7F80}; //RGB 7F80- for GRB try 0x7FF0[? maybe it's not necessery to change it in dependend on RGB/GRB. Probalby it's enough to change R and G.]
  30.     std::vector<Color> values;
  31.     Mode mode;
  32.     uint16_t LED_data;
  33.     auto create_vec_levels(Color color, double bright);
  34.     void send();
  35.  
  36.     bool get_bit(uint32_t k, uint32_t n) {
  37.         return (k & (1 << (n)));
  38.     }
  39. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement