backlight.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Copyright 2013 Mathias Andersson <wraul@dbox.se>
  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. #pragma once
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #ifndef BACKLIGHT_LEVELS
  18. #define BACKLIGHT_LEVELS 3
  19. #elif BACKLIGHT_LEVELS > 15
  20. #error "Maximum value of BACKLIGHT_LEVELS is 15"
  21. #endif
  22. typedef union {
  23. uint8_t raw;
  24. struct {
  25. bool enable :1;
  26. bool breathing :1;
  27. uint8_t level :4;
  28. };
  29. } backlight_config_t;
  30. void backlight_init(void);
  31. void backlight_increase(void);
  32. void backlight_decrease(void);
  33. void backlight_toggle(void);
  34. void backlight_enable(void);
  35. void backlight_disable(void);
  36. bool is_backlight_enabled(void);
  37. void backlight_step(void);
  38. void backlight_set(uint8_t level);
  39. void backlight_level(uint8_t level);
  40. uint8_t get_backlight_level(void);
  41. #ifdef BACKLIGHT_BREATHING
  42. void backlight_toggle_breathing(void);
  43. void backlight_enable_breathing(void);
  44. void backlight_disable_breathing(void);
  45. bool is_backlight_breathing(void);
  46. void breathing_enable(void);
  47. void breathing_disable(void);
  48. #endif