battery.h 732 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2025 QMK
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <stdint.h>
  5. /**
  6. * \file
  7. *
  8. * \defgroup battery Battery API
  9. *
  10. * \brief API to query battery status.
  11. * \{
  12. */
  13. /**
  14. * \brief Initialize the battery driver.
  15. */
  16. void battery_init(void);
  17. /**
  18. * \brief Perform housekeeping tasks.
  19. */
  20. void battery_task(void);
  21. /**
  22. * \brief Sample battery level.
  23. *
  24. * \return The battery percentage, in the range 0-100.
  25. */
  26. uint8_t battery_get_percent(void);
  27. /**
  28. * \brief user hook called when battery level changed.
  29. *
  30. */
  31. void battery_percent_changed_user(uint8_t level);
  32. /**
  33. * \brief keyboard hook called when battery level changed.
  34. *
  35. */
  36. void battery_percent_changed_kb(uint8_t level);
  37. /** \} */