All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches

Driver for the TM1637 4-digit 7-segment display More...

Detailed Description

Driver for the TM1637 4-digit 7-segment display

Files

file  tm1637.h
 Interface definition for the TM1637 4-digit 7-segment display driver.
 
file  tm1637_params.h
 Config for the TM1637 display.
 

Data Structures

struct  tm1637_params_t
 Pin configuration parameters for the tm1637 display. More...
 
struct  tm1637_t
 tm1637 driver descriptor More...
 

Enumerations

enum  tm1637_brightness_t {
  TM1637_PW_1_16 = 0x00 , TM1637_PW_2_16 = 0x01 , TM1637_PW_4_16 = 0x02 , TM1637_PW_10_16 = 0x03 ,
  TM1637_PW_11_16 = 0x04 , TM1637_PW_12_16 = 0x05 , TM1637_PW_13_16 = 0x06 , TM1637_PW_14_16 = 0x07
}
 Brightness level enum for the display. More...
 

Functions

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.
 

Enumeration Type Documentation

◆ tm1637_brightness_t

Brightness level enum for the display.

Note
The brightness must be one of the given values according to the specification. It is expressed as a fraction of the full pulse width. The value has a size of 3 bits.

Definition at line 63 of file tm1637.h.

Function Documentation

◆ tm1637_clear()

int tm1637_clear ( const tm1637_t * dev)

Clear the display.

Parameters
[in]devdevice descriptor of the display
Return values
0on success
-1on error

◆ tm1637_init()

int tm1637_init ( tm1637_t * dev,
const tm1637_params_t * params )

Initializes the tm1637 device.

Parameters
[out]devdevice descriptor of the display
[in]paramsconfiguration parameters
Return values
0on success
-1on error

◆ tm1637_write_number()

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.

Note
The integer can't be bigger than 9999 or smaller than -999 as only 4 digits can be displayed at a time. When leading zeros are enabled, the display is padded with zeros. For negative integers the leading zeros are added between the minus sign and the number.
Parameters
[in]devdevice descriptor of the display
[in]numbernumber to write, in the range of -999 to 9999
[in]brightnessbrightness of the display according to tm1637_brightness_t
[in]colonIf enabled, displays a colon in the middle
[in]leading_zerosIf enabled, displays leading zeros
Return values
0on success
-1on error