forked from unfrozen/stm8_libs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
lib_tm1638.h
97 lines (78 loc) · 1.93 KB
/
lib_tm1638.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* File name: lib_tm1638.h
* Date first: 06/08/2018
* Date last: 06/23/2018
*
* Description: STM8 Library for TM1638 LED array and keys.
*
* Author: Richard Hodges
*
* Copyright (C) 2018 Richard Hodges. All rights reserved.
* Permission is hereby granted for any use.
* Some code copied from lib_max7219.h
*
******************************************************************************
*
* Initialize array
* in: type
*/
void tm1638_init(char);
#define TM1638_8 1 /* display with 8 keys and 8 LEDs */
#define TM1638_16 2 /* display with 16 keys, no LEDs */
/* NOTE: Support for the 16 key board is a compile time option */
#define TM1638_16_KEYS /* comment out if you don't need 16 key support */
/*
* Write digit/char to unit
* in: digit/char (ASCII). Bit-7 is decimal point
*/
void tm1638_putc(char);
/*
* Write number/ASCII string to unit
* in: string (insert decimal point where desired.)
*/
void tm1638_puts(char *);
/*
* Push display changes to the LEDs (16 key board only).
* LEDs are not updated until this call.
*/
void tm1638_push(void);
/*
* Set cursor position
* in: column (0-7)
*/
void tm1638_curs(char);
/*
* Clear displays
*/
void tm1638_clear(void);
/*
* Set LED status (8 key board only)
* in: LED number (0 to 7), new status (0=off, 1=red)
*/
void tm1638_setled(char, char);
/*
* Set LED intensity
* in: 0 (minimum) to 7 (maximum)
*/
void tm1638_bright(char);
/*
* Set LED blinking
* Alternates between regular and minimum brightness.
* in: Blink rate * 1/100 second or 0 (disable)
*/
void tm1638_blink(char);
/*
* Poll for key press and blinking
* (call every millisecond)
*/
void tm1638_poll(void);
/*
* Get key
* out: key char ("0123456789ABCDEF"), zero if none
* Bit-7 is low for key press, high for release.
*/
char tm1638_getc(void);
/* Set alternate key mappings
* in: key map has 8 or 16 characters for keys
*/
void tm1638_kmap(char *);