Skip to content

Commit c29bf96

Browse files
committed
scripts/mtl_ecspy_to_c.py: Only set data on OUT pins
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
1 parent 57ae8fa commit c29bf96

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/mtl_ecspy_to_c.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def bit_positions_to_hex(positions: list[int]) -> str:
5959
# using #defines for the bit positions
6060
def gpcr_control_bit_positions_to_c(positions: list[int]) -> str:
6161
macros = []
62-
pimmode = ("1" if 6 in positions else "0") + ("1" if 7 in positions else "0")
62+
pimmode = ("1" if 7 in positions else "0") + ("1" if 6 in positions else "0")
6363
macros.append(gpcr_control_pin_mode_to_c_define[pimmode])
6464
if 2 in positions:
6565
macros.append("GPIO_UP")
@@ -84,6 +84,9 @@ def bit_positions_to_macros(positions: list[int]) -> str:
8484
macros_joined = " | ".join(macros)
8585
return macros_joined
8686

87+
def gpcr_is_output(gpdr: dict) -> bool:
88+
return 6 in gpdr['control'] and 7 not in gpdr['control']
89+
8790
# converts a dictionary of gpdr letter group
8891
# data to a list of bit positions
8992
# where the data is set to 1
@@ -95,7 +98,7 @@ def bit_positions_to_macros(positions: list[int]) -> str:
9598
def gpdr_letter_group_data_to_bit_positions(gpdrs: dict) -> list[int]:
9699
bit_positions = []
97100
for number in gpdrs:
98-
if gpdrs[number]['data'] == 1:
101+
if gpdrs[number]['data'] == 1 and gpcr_is_output(gpdrs[number]):
99102
bit_positions.append(number)
100103
return bit_positions
101104

0 commit comments

Comments
 (0)