AVR library
Functions | Variables
tm1637.c File Reference

TM1637 8-segment LED driver routines. More...

#include <inttypes.h>
#include <util/delay.h>
#include <stdlib.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "i2c.h"

Functions

void tm1637_setbri (uint8_t a)
 Set brightness. Effective on next display update. More...
 
void tm1637_putsn (char *s, uint8_t len)
 Display string. More...
 
void tm1637_puti_lc (int16_t a, uint8_t r, uint8_t w, char c)
 Display int. More...
 

Variables

const uint8_t ascii2seg7[] PROGMEM
 

Detailed Description

TM1637 8-segment LED driver routines.

For this to work, you must use swi2c.c and define #define SWI2C_RAWADR #define SWI2C_REVBITS in swdefs.h since someone at Tian Micro decided it would be a good idea to put bits in reverse than what i2c spec says.

Also note that on the modules I got, the i2c pullups are 10k coupled with some 1nF caps which makes it work at very low i2c speeds only. My recommendation is remove the caps and replace the resistors with 2k.

Author
Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
Note
This file is part of mat-avr-lib

Function Documentation

void tm1637_puti_lc ( int16_t  a,
uint8_t  r,
uint8_t  w,
char  c 
)

Display int.

Parameters
[in]aint
[in]rRadix
[in]wMin width
[in]cPrepending char to achieve min width
void tm1637_putsn ( char *  s,
uint8_t  len 
)

Display string.

Parameters
[in]sString to display
[in]lenString length
void tm1637_setbri ( uint8_t  a)

Set brightness. Effective on next display update.

Parameters
[in]aBrightness (0..7)

Variable Documentation

const uint8_t ascii2seg7 [] PROGMEM
Initial value:
= {
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,
0,0,0,0,0,0,0,
0x77,0x7c,0x39,0x5e,0x79,0x71,0x3d,0x74,0x30,0x1e,0x75,0x38,0x15,0x54,0x3f,0x73,0x67,0x50,0x6d,0x78,0x3e,0x1c,0x2a,0x76,0x6e,0x5b
}