2020-02-17 14:23:15 +01:00
|
|
|
/** library to communicate with a Titan Micro TM1637 IC attached to a 4-digit 7-segment
|
|
|
|
* @file
|
2017-04-03 13:08:49 +02:00
|
|
|
* @author King Kévin <kingkevin@cuvoodoo.info>
|
2020-06-06 14:35:55 +02:00
|
|
|
* @copyright SPDX-License-Identifier: GPL-3.0-or-later
|
2020-02-17 14:23:15 +01:00
|
|
|
* @date 2017-2020
|
2017-04-03 13:08:49 +02:00
|
|
|
* @note peripherals used: GPIO @ref led_tm1637_gpio, timer @ref led_tm1637_timer
|
|
|
|
* @warning all calls are blocking
|
|
|
|
*/
|
|
|
|
#pragma once
|
2020-11-24 15:56:00 +01:00
|
|
|
#error not converted for STM32F4
|
2017-04-03 13:08:49 +02:00
|
|
|
|
|
|
|
/** display brightness levels
|
|
|
|
*/
|
|
|
|
enum led_tm1637_brightness_t {
|
|
|
|
LED_TM1637_1DIV16 = 0,
|
|
|
|
LED_TM1637_2DIV16 = 1,
|
|
|
|
LED_TM1637_4DIV16 = 2,
|
|
|
|
LED_TM1637_10DIV16 = 3,
|
|
|
|
LED_TM1637_11DIV16 = 4,
|
|
|
|
LED_TM1637_12DIV16 = 5,
|
|
|
|
LED_TM1637_13DIV16 = 6,
|
|
|
|
LED_TM1637_14DIV16 = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** setup communication with TM1637 IC
|
2020-09-27 11:56:31 +02:00
|
|
|
* @param[in] updown if the display is upside down
|
2017-04-03 13:08:49 +02:00
|
|
|
*/
|
2020-09-27 11:56:31 +02:00
|
|
|
void led_tm1637_setup(bool updown);
|
2017-04-03 13:08:49 +02:00
|
|
|
/** switch display on
|
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
|
|
|
bool led_tm1637_on(void);
|
|
|
|
/** switch display off
|
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
|
|
|
bool led_tm1637_off(void);
|
|
|
|
/** set display brightness
|
|
|
|
* @param[in] brightness brightness level to set
|
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
|
|
|
bool led_tm1637_brightness(enum led_tm1637_brightness_t brightness);
|
|
|
|
/** display number
|
|
|
|
* @param[in] number number to display (0-9999)
|
2020-02-18 17:28:34 +01:00
|
|
|
* @param[in] zero pad number with zero on the left
|
2017-04-03 13:08:49 +02:00
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
2020-02-18 17:28:34 +01:00
|
|
|
bool led_tm1637_number(uint16_t number, bool zero);
|
2017-04-03 13:08:49 +02:00
|
|
|
/** display time
|
|
|
|
* @param[in] hours hours to display (0-99)
|
|
|
|
* @param[in] minutes minutes to display (0-99)
|
|
|
|
* @note display separator between hours and minutes
|
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
|
|
|
bool led_tm1637_time(uint8_t hours, uint8_t minutes);
|
|
|
|
/** display text
|
|
|
|
* @param[in] text text to display (4 characters)
|
|
|
|
* @note use first bit of each character to enable dot
|
|
|
|
* @return if transmission succeeded
|
|
|
|
*/
|
|
|
|
bool led_tm1637_text(char* text);
|