aboutsummaryrefslogtreecommitdiff
path: root/7seg-hex.py
blob: 9ee9e69570cabc32733b6f6fe8ebabc6ab8e0ddb (plain)
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
import eeprom_pi as ep


##
## This files writes the EEPORM for the 7-segment display 
##
## Address one shall show a one on the 7-segment display,
## address two a two, etc.

# init board for writing
ep.init_board()

## Mapping of the I/O 0-7 two the 7-segement display:
## I/O 0: A
## I/O 1: B
## I/O 2: C
## I/O 3: D
## I/O 4: E
## I/O 5: F
## I/O 6: G
SEG_A = 0x1
SEG_B = 0x2
SEG_C = 0x4
SEG_D = 0x8
SEG_E = 0x10
SEG_F = 0x20
SEG_G = 0x40

ep.write_data_at(0x0, SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F)
ep.write_data_at(0x1, SEG_B | SEG_C)
ep.write_data_at(0x2, SEG_A | SEG_B | SEG_G | SEG_E | SEG_D)
ep.write_data_at(0x3, SEG_A | SEG_B | SEG_G | SEG_C | SEG_D)
ep.write_data_at(0x4, SEG_F | SEG_G | SEG_B | SEG_C)
ep.write_data_at(0x5, SEG_A | SEG_F | SEG_G | SEG_C | SEG_D)
ep.write_data_at(0x6, SEG_A | SEG_F | SEG_G | SEG_C | SEG_D | SEG_E)
ep.write_data_at(0x7, SEG_A | SEG_B | SEG_C)
ep.write_data_at(0x8, SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G)
ep.write_data_at(0x9, SEG_A | SEG_B | SEG_C | SEG_D | SEG_F | SEG_G)


ep. cleanup()