Skip to content

Commit

Permalink
support self.pin during migration (#180)
Browse files Browse the repository at this point in the history
re add the pin member with details for the I2C direct control of the port expanders to allow easier migration.
  • Loading branch information
ChrisDick authored Jul 1, 2024
1 parent e3a09a0 commit 3982416
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions modules/tildagon/pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,44 @@
"6_LS_E": (0, 15),
}

HEXPANSION_I2C = {
"1_LS_A": (0x5A, 0, 1 << 3),
"1_LS_B": (0x5A, 1, 1 << 0),
"1_LS_C": (0x5A, 1, 1 << 1),
"1_LS_D": (0x5A, 1, 1 << 2),
"1_LS_E": (0x5A, 1, 1 << 3),
"2_LS_A": (0x5A, 0, 1 << 0),
"2_LS_B": (0x5A, 0, 1 << 1),
"2_LS_C": (0x59, 1, 1 << 5),
"2_LS_D": (0x59, 1, 1 << 6),
"2_LS_E": (0x59, 1, 1 << 7),
"3_LS_A": (0x59, 0, 1 << 4),
"3_LS_B": (0x59, 0, 1 << 5),
"3_LS_C": (0x59, 0, 1 << 6),
"3_LS_D": (0x59, 0, 1 << 7),
"3_LS_E": (0x59, 1, 1 << 4),
"4_LS_A": (0x58, 1, 1 << 0),
"4_LS_B": (0x58, 1, 1 << 1),
"4_LS_C": (0x58, 1, 1 << 2),
"4_LS_D": (0x58, 1, 1 << 3),
"4_LS_E": (0x58, 0, 1 << 0),
"5_LS_A": (0x58, 0, 1 << 2),
"5_LS_B": (0x58, 0, 1 << 3),
"5_LS_C": (0x58, 0, 1 << 4),
"5_LS_D": (0x58, 0, 1 << 5),
"5_LS_E": (0x58, 1, 1 << 6),
"6_LS_A": (0x58, 0, 1 << 7),
"6_LS_B": (0x58, 1, 1 << 4),
"6_LS_C": (0x58, 1, 1 << 5),
"6_LS_D": (0x58, 1, 1 << 6),
"6_LS_E": (0x58, 1, 1 << 7),
}


class Pin(ePin):
def __init__(self, pin_name, mode=None):
self.name = pin_name
self.pin = HEXPANSION_I2C[pin_name]
super().__init__(HEXPANSION_GPIOS[pin_name], mode)

def __repr__(self):
Expand Down

0 comments on commit 3982416

Please # to comment.