Update 'CARDPUTER CircuitPython/keyboard.py'
This commit is contained in:
@@ -23,8 +23,11 @@ class Keyboard:
|
|||||||
"0x4":"CTRLD", "0x13":"CTRLS", "0x9":" ", "0x60":"ESC", "0xf":"CTRLO"
|
"0x4":"CTRLD", "0x13":"CTRLS", "0x9":" ", "0x60":"ESC", "0xf":"CTRLO"
|
||||||
}
|
}
|
||||||
|
|
||||||
def scan(self):
|
def scan(self, keycode = None):
|
||||||
code=hex(ord(sys.stdin.read(1)))
|
if not keycode:
|
||||||
|
code=hex(ord(sys.stdin.readline(1)))
|
||||||
|
else:
|
||||||
|
code = keycode
|
||||||
#printing the code can be useful for debugging purposes, to check that the codes have been logged correctly if something unexpected is happening
|
#printing the code can be useful for debugging purposes, to check that the codes have been logged correctly if something unexpected is happening
|
||||||
#print(code)
|
#print(code)
|
||||||
key = None
|
key = None
|
||||||
@@ -39,10 +42,7 @@ class Keyboard:
|
|||||||
elif code in self.special:
|
elif code in self.special:
|
||||||
key = self.special[code]
|
key = self.special[code]
|
||||||
|
|
||||||
if key:
|
return key
|
||||||
return key
|
|
||||||
else:
|
|
||||||
return "UNKNOWN "+code
|
|
||||||
|
|
||||||
def is_alphanumeric(self, key):
|
def is_alphanumeric(self, key):
|
||||||
if key in self.special.values() or key in self.chars.values():
|
if key in self.special.values() or key in self.chars.values():
|
||||||
|
|||||||
Reference in New Issue
Block a user