tm1637.h 698 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * SPDX-FileCopyrightText: 2022 Helmut Pozimski <helmut@pozimski.eu>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0-only
  5. */
  6. #include <stdint.h>
  7. #include <stdbool.h>
  8. typedef struct {
  9. uint8_t clk_pin;
  10. uint8_t dio_pin;
  11. bool show_colon;
  12. uint8_t brightness;
  13. } tm1637_config;
  14. static const uint16_t NUMERALS[] = {
  15. 0x3f,
  16. 0x06,
  17. 0x5b,
  18. 0x4f,
  19. 0x66,
  20. 0x6d,
  21. 0x7d,
  22. 0x07,
  23. 0x7f,
  24. 0x6f,
  25. 0x00
  26. };
  27. esp_err_t tm1637_init(tm1637_config *config, uint8_t clk_pint, uint8_t dio_pin, bool show_colon, uint8_t brightness);
  28. void tm1637_set_segment(tm1637_config *config, uint8_t value, uint8_t segment, bool enable_display);