board_common.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "board_common.h"
  2. #include "esp_sleep.h"
  3. /**
  4. * Weak default implementations of iot_board_*() functions.
  5. * Board-specific board.c files override these as needed.
  6. */
  7. __attribute__((weak)) esp_err_t iot_board_init(void) {
  8. return ESP_OK;
  9. }
  10. __attribute__((weak)) esp_err_t iot_board_deinit(void) {
  11. return ESP_OK;
  12. }
  13. __attribute__((weak)) bool iot_board_is_init(void) {
  14. return false;
  15. }
  16. __attribute__((weak)) board_res_handle_t iot_board_get_handle(int id) {
  17. (void)id;
  18. return NULL;
  19. }
  20. __attribute__((weak)) const char *iot_board_get_info(void) {
  21. return "Unknown Board";
  22. }
  23. __attribute__((weak)) void iot_board_init_lvgl_resources(void) {
  24. }
  25. // Default: boards without a power latch enter deep sleep instead of cutting
  26. // power. The Waveshare board overrides this to release its battery latch.
  27. __attribute__((weak)) void board_power_off(void) {
  28. esp_deep_sleep_start();
  29. }
  30. // Default: no battery monitor. Boards with a battery override this.
  31. __attribute__((weak)) bool board_battery_read(int *percent, bool *charging) {
  32. (void)percent;
  33. (void)charging;
  34. return false;
  35. }