library to communicate with a Titan Micro TM1637 IC attached to a 4-digit 7-segment (code)
More...
Go to the source code of this file.
library to communicate with a Titan Micro TM1637 IC attached to a 4-digit 7-segment (code)
- Author
- King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
- Date
- 2017
- Note
- peripherals used: GPIO GPIO used to communication with TM1637 IC, timer timer used to communication with TM1637 IC
-
the protocol is very similar to I2C but incompatible for the following reasons: the capacitance is too large for open-drain type output with weak pull-up resistors (push-pull needs to be used, preventing to get ACKs since no indication of the ACK timing is provided); the devices doesn't use addresses; the STM32 I2C will switch to receiver mode when the first sent byte (the I2C address) has last bit set to 1 (such as for address commands with B7=1 where B7 is transmitted last), preventing to send further bytes (the data byte after the address)
- Warning
- all calls are blocking
bit vs segment: 0bpgfedcba +a+ f b p +g+ e c p +d+
Definition in file led_tm1637.c.
◆ led_tm1637_brightness()
set display brightness
- Parameters
-
[in] | brightness | brightness level to set |
- Returns
- if transmission succeeded
Definition at line 277 of file led_tm1637.c.
◆ led_tm1637_number()
bool led_tm1637_number |
( |
uint16_t |
number | ) |
|
display number
- Parameters
-
[in] | number | number to display (0-9999) |
- Returns
- if transmission succeeded
Definition at line 288 of file led_tm1637.c.
◆ led_tm1637_off()
bool led_tm1637_off |
( |
void |
| ) |
|
switch display off
- Returns
- if transmission succeeded
Definition at line 267 of file led_tm1637.c.
◆ led_tm1637_on()
bool led_tm1637_on |
( |
void |
| ) |
|
switch display on
- Returns
- if transmission succeeded
Definition at line 256 of file led_tm1637.c.
◆ led_tm1637_text()
bool led_tm1637_text |
( |
char * |
text | ) |
|
display text
- Parameters
-
[in] | text | text to display (4 characters) |
- Note
- use first bit of each character to enable dot
- Returns
- if transmission succeeded
Definition at line 310 of file led_tm1637.c.
◆ led_tm1637_time()
bool led_tm1637_time |
( |
uint8_t |
hours, |
|
|
uint8_t |
minutes |
|
) |
| |
display time
- Parameters
-
[in] | hours | hours to display (0-99) |
[in] | minutes | minutes to display (0-99) |
- Note
- display separator between hours and minutes
- Returns
- if transmission succeeded
Definition at line 299 of file led_tm1637.c.
◆ led_tm1637_write()
static bool led_tm1637_write |
( |
const uint8_t * |
data, |
|
|
size_t |
length |
|
) |
| |
|
static |
write data on bus
- Parameters
-
[in] | data | bytes to write |
[in] | length | number of bytes to write |
- Returns
- if write succeeded
- Note
- includes start and stop conditions
Definition at line 201 of file led_tm1637.c.
◆ ascii_7segments
const uint8_t ascii_7segments[] |
|
static |
ASCII characters encoded for the 7 segments digit block.
- Note
- starts with space
Definition at line 68 of file led_tm1637.c.