tm1637.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Nico Behrens <nifrabe@outlook.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #ifndef TM1637_H
10 #define TM1637_H
11 
25 #include "board.h"
26 #include "periph/gpio.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 typedef struct {
39  gpio_t clk;
40 
44  gpio_t dio;
46 
50 typedef struct {
55 } tm1637_t;
56 
63 typedef enum {
64  TM1637_PW_1_16 = 0x00,
65  TM1637_PW_2_16 = 0x01,
66  TM1637_PW_4_16 = 0x02,
67  TM1637_PW_10_16 = 0x03,
68  TM1637_PW_11_16 = 0x04,
69  TM1637_PW_12_16 = 0x05,
70  TM1637_PW_13_16 = 0x06,
71  TM1637_PW_14_16 = 0x07
73 
83 int tm1637_init(tm1637_t *dev, const tm1637_params_t *params);
84 
103 int tm1637_write_number(const tm1637_t *dev, int16_t number, tm1637_brightness_t brightness,
104  bool colon, bool leading_zeros);
105 
114 int tm1637_clear(const tm1637_t *dev);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
121 #endif /* TM1637_H */
Low-level GPIO peripheral driver interface definitions.
tm1637_brightness_t
Brightness level enum for the display.
Definition: tm1637.h:63
int tm1637_init(tm1637_t *dev, const tm1637_params_t *params)
Initializes the tm1637 device.
int tm1637_write_number(const tm1637_t *dev, int16_t number, tm1637_brightness_t brightness, bool colon, bool leading_zeros)
Writes an integer to the display.
int tm1637_clear(const tm1637_t *dev)
Clear the display.
Pin configuration parameters for the tm1637 display.
Definition: tm1637.h:35
gpio_t dio
GPIO for data input/output.
Definition: tm1637.h:44
gpio_t clk
GPIO for clock.
Definition: tm1637.h:39
tm1637 driver descriptor
Definition: tm1637.h:50
const tm1637_params_t * params
Configuration parameters.
Definition: tm1637.h:54