#pragma once #include #include #define TM1637_FONT_0 (0x3f) #define TM1637_FONT_1 (0x06) #define TM1637_FONT_2 (0x5b) #define TM1637_FONT_3 (0x4f) #define TM1637_FONT_4 (0x66) #define TM1637_FONT_5 (0x6d) #define TM1637_FONT_6 (0x7d) #define TM1637_FONT_7 (0x07) #define TM1637_FONT_8 (0x7f) #define TM1637_FONT_9 (0x6f) #define TM1637_FONT_A (0x77) #define TM1637_FONT_B (0x7c) #define TM1637_FONT_C (0x39) #define TM1637_FONT_D (0x5e) #define TM1637_FONT_E (0x79) #define TM1637_FONT_F (0x71) #define TM1637_COLON (0x80) typedef struct { uint8_t* data; uint32_t length; } TM1637Sequence; /** @brief configure registers for tm1637 */ void tm1637_begin(); /** * @brief configure display brightness * @param brightness display brightness from 0 (dim) to 7 (bright) * @param on whether the display is on */ void tm1637_dispcfg(uint8_t brightness, bool on); /** * @brief send segment data to display * @param segment address segment 0-3 * @param data data to set to segment where LSB=A and MSB-1=G. on segment 1 MSB=colon */ void tm1637_segmentsend(uint8_t segment, uint8_t data); static const uint8_t tm1637_font[16] = { TM1637_FONT_0, TM1637_FONT_1, TM1637_FONT_2, TM1637_FONT_3, TM1637_FONT_4, TM1637_FONT_5, TM1637_FONT_6, TM1637_FONT_7, TM1637_FONT_8, TM1637_FONT_9, TM1637_FONT_A, TM1637_FONT_B, TM1637_FONT_C, TM1637_FONT_D, TM1637_FONT_E, TM1637_FONT_F, };