blinkenstrip

Documentation: http://frombelow.net/projects/blinkenstrip/
Clone: git clone https://git.frombelow.net/blinkenstrip.git
Log | Files | Refs | README | LICENSE

led.h (2468B)


      1 /*
      2   Copyright © 2021 Gerd Beuster <gerd@frombelow.net>
      3 
      4   Licensed under the Apache License, Version 2.0 (the "License");
      5   you may not use this file except in compliance with the License.
      6   You may obtain a copy of the License at
      7 
      8       http://www.apache.org/licenses/LICENSE-2.0
      9 
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15 */
     16 #ifndef LED_H
     17 #define LED_H
     18 
     19 #include "led_strip.h"
     20 
     21 #define LED_STRIP_RMT_INTR_NUM 19
     22 
     23 uint16_t led_strip_w;
     24 uint16_t led_strip_h;
     25 uint8_t max_brightness;
     26 // How are the LEDs wired, linearly, or in "snake mode", i.e. first
     27 // line left-to-right, second line right-to-left, ...
     28 uint8_t snake;
     29 // Whether the ends of the LED strip are connected to each other
     30 uint8_t wrap_around;
     31 // Number of worms in BLINKENSTRIP_STATE_WORM
     32 uint8_t number_of_worms;
     33 
     34 // Determine which pattern we show.
     35 volatile uint8_t blinkenstrip_state;
     36 // Toggled whenever the user triggered a state change
     37 // via the webserver.
     38 volatile bool blinkenstrip_state_has_changed;
     39 SemaphoreHandle_t blinkenstrip_state_changed_semaphore;
     40 #define BLINKENSTRIP_STATE_UNICOLOR_RAINBOW   0x05
     41 #define BLINKENSTRIP_STATE_RANDOM_ON_OFF      0x06
     42 #define BLINKENSTRIP_STATE_RUNNING_DOT        0x07
     43 #define BLINKENSTRIP_STATE_CELLULAR_AUTOMATON 0x08
     44 #define BLINKENSTRIP_STATE_LINE_BY_LINE       0x09
     45 #define BLINKENSTRIP_STATE_UNICOLOR_RGB       0x0A
     46 #define BLINKENSTRIP_STATE_WORM               0x0B
     47 #define BLINKENSTRIP_STATE_EXPERIMENTAL       0xFF
     48 
     49 // Data structures for LED strip
     50 uint16_t led_strip_length;
     51 struct led_color_t *led_strip_buf_1;
     52 struct led_color_t *led_strip_buf_2;
     53 struct led_strip_t led_strip;
     54 
     55 // Standard colors
     56 struct led_color_t led_color_red;
     57 struct led_color_t led_color_green;
     58 struct led_color_t led_color_blue;
     59 struct led_color_t led_color_yellow;
     60 struct led_color_t led_color_white;
     61 struct led_color_t led_color_black;
     62 
     63 // All channels set by user
     64 struct led_color_t led_color_rgb;
     65 
     66 // Colors for cellular automaton
     67 struct led_color_t cell_on;
     68 struct led_color_t cell_off;
     69 
     70 // This function is run in its won task and runs the LED show.
     71 void led_controller(void *args);
     72 
     73 // Utiltiy function: Get random number in range 0..n-1.
     74 uint32_t get_random_number(uint32_t n);
     75 
     76 #endif