aboutsummaryrefslogtreecommitdiff
path: root/7seg-hex.py
diff options
context:
space:
mode:
Diffstat (limited to '7seg-hex.py')
-rw-r--r--7seg-hex.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/7seg-hex.py b/7seg-hex.py
new file mode 100644
index 0000000..9ee9e69
--- /dev/null
+++ b/7seg-hex.py
@@ -0,0 +1,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()