From b7b1ece7831f6f822b0a1a44924d9d9897065341 Mon Sep 17 00:00:00 2001 From: Benedict Date: Thu, 12 Apr 2018 15:35:30 +0200 Subject: pi: eeprom: programm eeporm for 7seg display --- 7seg-hex.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 7seg-hex.py (limited to '7seg-hex.py') 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() -- cgit v1.2.3-70-g09d2