You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

rgb.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Copyright 2015 Kai Ryu <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef RGB_H
  15. #define RGB_H
  16. #include <stdint.h>
  17. #include <stdbool.h>
  18. typedef union {
  19. uint8_t raw;
  20. struct {
  21. uint8_t level :7;
  22. bool enable :1;
  23. };
  24. } rgb_config_t;
  25. enum {
  26. RGB_OFF = 0,
  27. RGB_RED,
  28. RGB_YELLOW,
  29. RGB_GREEN,
  30. RGB_CYAN,
  31. RGB_BLUE,
  32. RGB_MAGENTA,
  33. RGB_WHITE,
  34. RGB_FADE,
  35. RGB_RAINBOW,
  36. RGB_LEVELS = RGB_RAINBOW
  37. };
  38. #define EECONFIG_RGB (uint8_t *)7
  39. #define RGB_UNCONFIGURED 0xFF
  40. #define RGB_LED_COUNT 16
  41. void rgb_init(void);
  42. void rgb_toggle(void);
  43. void rgb_on(void);
  44. void rgb_off(void);
  45. void rgb_decrease(void);
  46. void rgb_increase(void);
  47. void rgb_step(void);
  48. void rgb_set_brightness(uint8_t brightness);
  49. void rgb_fading(void);
  50. #endif