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 #pragma once
10 
24 #include "board.h"
25 #include "periph/gpio.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 typedef struct {
38  gpio_t clk;
39 
43  gpio_t dio;
45 
49 typedef struct {
54 } tm1637_t;
55 
62 typedef enum {
63  TM1637_PW_1_16 = 0x00,
64  TM1637_PW_2_16 = 0x01,
65  TM1637_PW_4_16 = 0x02,
66  TM1637_PW_10_16 = 0x03,
67  TM1637_PW_11_16 = 0x04,
68  TM1637_PW_12_16 = 0x05,
69  TM1637_PW_13_16 = 0x06,
70  TM1637_PW_14_16 = 0x07
72 
82 int tm1637_init(tm1637_t *dev, const tm1637_params_t *params);
83 
102 int tm1637_write_number(const tm1637_t *dev, int16_t number, tm1637_brightness_t brightness,
103  bool colon, bool leading_zeros);
104 
113 int tm1637_clear(const tm1637_t *dev);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
Low-level GPIO peripheral driver interface definitions.
tm1637_brightness_t
Brightness level enum for the display.
Definition: tm1637.h:62
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:34
gpio_t dio
GPIO for data input/output.
Definition: tm1637.h:43
gpio_t clk
GPIO for clock.
Definition: tm1637.h:38
tm1637 driver descriptor
Definition: tm1637.h:49
const tm1637_params_t * params
Configuration parameters.
Definition: tm1637.h:53