fix: NV14 uses active-high for keys and trims
This commit is contained in:
committed by
Peter Feerick
parent
d9b953095e
commit
261c0213f3
@@ -60,6 +60,7 @@ class Key:
|
||||
def __init__(self, gpio, pin):
|
||||
self.gpio = gpio
|
||||
self.pin = pin
|
||||
self.active_low = True
|
||||
|
||||
class Trim:
|
||||
|
||||
@@ -67,6 +68,7 @@ class Trim:
|
||||
self.name = name
|
||||
self.dec = dec
|
||||
self.inc = inc
|
||||
self.active_low = True
|
||||
|
||||
def get_trim_switch(hw_defs, tag):
|
||||
|
||||
@@ -74,7 +76,10 @@ def get_trim_switch(hw_defs, tag):
|
||||
pin = f'TRIMS_GPIO_PIN_{tag}'
|
||||
|
||||
if (gpio in hw_defs) and (pin in hw_defs):
|
||||
return Key(hw_defs[gpio], hw_defs[pin])
|
||||
key = Key(hw_defs[gpio], hw_defs[pin])
|
||||
if 'TRIMS_GPIO_ACTIVE_HIGH' in hw_defs:
|
||||
key.active_low = False
|
||||
return key
|
||||
|
||||
return None
|
||||
|
||||
@@ -108,6 +113,8 @@ def parse_keys(hw_defs):
|
||||
key.key = k['key']
|
||||
key.name = name
|
||||
key.label = k['label']
|
||||
if 'KEYS_GPIO_ACTIVE_HIGH' in hw_defs:
|
||||
key.active_low = False
|
||||
keys.append(key)
|
||||
|
||||
return keys
|
||||
|
||||
Reference in New Issue
Block a user