Commit c29bf96 1 parent 57ae8fa commit c29bf96 Copy full SHA for c29bf96
File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def bit_positions_to_hex(positions: list[int]) -> str:
59
59
# using #defines for the bit positions
60
60
def gpcr_control_bit_positions_to_c (positions : list [int ]) -> str :
61
61
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" )
63
63
macros .append (gpcr_control_pin_mode_to_c_define [pimmode ])
64
64
if 2 in positions :
65
65
macros .append ("GPIO_UP" )
@@ -84,6 +84,9 @@ def bit_positions_to_macros(positions: list[int]) -> str:
84
84
macros_joined = " | " .join (macros )
85
85
return macros_joined
86
86
87
+ def gpcr_is_output (gpdr : dict ) -> bool :
88
+ return 6 in gpdr ['control' ] and 7 not in gpdr ['control' ]
89
+
87
90
# converts a dictionary of gpdr letter group
88
91
# data to a list of bit positions
89
92
# where the data is set to 1
@@ -95,7 +98,7 @@ def bit_positions_to_macros(positions: list[int]) -> str:
95
98
def gpdr_letter_group_data_to_bit_positions (gpdrs : dict ) -> list [int ]:
96
99
bit_positions = []
97
100
for number in gpdrs :
98
- if gpdrs [number ]['data' ] == 1 :
101
+ if gpdrs [number ]['data' ] == 1 and gpcr_is_output ( gpdrs [ number ]) :
99
102
bit_positions .append (number )
100
103
return bit_positions
101
104
You can’t perform that action at this time.
0 commit comments