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.

62 lines
1.8 KiB

  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 > 31
  20. # error "Maximum value of BACKLIGHT_LEVELS is 31"
  21. #endif
  22. #ifndef BREATHING_PERIOD
  23. # define BREATHING_PERIOD 6
  24. #endif
  25. typedef union {
  26. uint8_t raw;
  27. struct {
  28. bool enable : 1;
  29. bool breathing : 1;
  30. uint8_t reserved : 1; // Reserved for possible future backlight modes
  31. uint8_t level : 5;
  32. };
  33. } backlight_config_t;
  34. void backlight_init(void);
  35. void backlight_increase(void);
  36. void backlight_decrease(void);
  37. void backlight_toggle(void);
  38. void backlight_enable(void);
  39. void backlight_disable(void);
  40. bool is_backlight_enabled(void);
  41. void backlight_step(void);
  42. void backlight_set(uint8_t level);
  43. void backlight_level(uint8_t level);
  44. uint8_t get_backlight_level(void);
  45. #ifdef BACKLIGHT_BREATHING
  46. void backlight_toggle_breathing(void);
  47. void backlight_enable_breathing(void);
  48. void backlight_disable_breathing(void);
  49. bool is_backlight_breathing(void);
  50. void breathing_enable(void);
  51. void breathing_disable(void);
  52. #endif