Loading...
Searching...
No Matches
tm1637.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Nico Behrens <nifrabe@outlook.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#include "board.h"
22#include "periph/gpio.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
31typedef struct {
35 gpio_t clk;
36
40 gpio_t dio;
42
46typedef struct {
51} tm1637_t;
52
59typedef enum {
60 TM1637_PW_1_16 = 0x00,
61 TM1637_PW_2_16 = 0x01,
62 TM1637_PW_4_16 = 0x02,
63 TM1637_PW_10_16 = 0x03,
64 TM1637_PW_11_16 = 0x04,
65 TM1637_PW_12_16 = 0x05,
66 TM1637_PW_13_16 = 0x06,
67 TM1637_PW_14_16 = 0x07
69
79int tm1637_init(tm1637_t *dev, const tm1637_params_t *params);
80
99int tm1637_write_number(const tm1637_t *dev, int16_t number, tm1637_brightness_t brightness,
100 bool colon, bool leading_zeros);
101
110int tm1637_clear(const tm1637_t *dev);
111
112#ifdef __cplusplus
113}
114#endif
115
Low-level GPIO peripheral driver interface definitions.
tm1637_brightness_t
Brightness level enum for the display.
Definition tm1637.h:59
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:31
gpio_t dio
GPIO for data input/output.
Definition tm1637.h:40
gpio_t clk
GPIO for clock.
Definition tm1637.h:35
tm1637 driver descriptor
Definition tm1637.h:46
const tm1637_params_t * params
Configuration parameters.
Definition tm1637.h:50