diff --git a/kmk/boards/nice_nano/crkbd.py b/kmk/boards/nice_nano/crkbd.py index eee09f1..b1bafc3 100644 --- a/kmk/boards/nice_nano/crkbd.py +++ b/kmk/boards/nice_nano/crkbd.py @@ -4,17 +4,25 @@ from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard from kmk.matrix import DiodeOrientation from kmk.matrix import intify_coordinate as ic + class KMKKeyboard(_KMKKeyboard): - col_pins = (board.P0_31, board.P0_29, board.P0_02, board.P1_15, board.P1_13, board.P1_11) + col_pins = ( + board.P0_31, + board.P0_29, + board.P0_02, + board.P1_15, + board.P1_13, + board.P1_11, + ) row_pins = (board.P0_22, board.P0_24, board.P1_00, board.P0_11) diode_orientation = DiodeOrientation.COLUMNS - split_type = 'UART' #TODO add bluetooth support as well + split_type = 'UART' # TODO add bluetooth support as well split_flip = True split_offsets = [6, 6, 6, 6, 6] uart_pin = board.P0_08 rgb_pixel_pin = board.P0_06 - extra_data_pin = board.SDA #TODO This is incorrect. Find better solution + extra_data_pin = board.SDA # TODO This is incorrect. Find better solution coord_mapping = [] coord_mapping.extend(ic(0, x) for x in range(12)) diff --git a/kmk/keys.py b/kmk/keys.py index 3ba4a97..f214317 100644 --- a/kmk/keys.py +++ b/kmk/keys.py @@ -1,5 +1,3 @@ -import gc - import kmk.handlers.layers as layers import kmk.handlers.modtap as modtap import kmk.handlers.stock as handlers @@ -305,9 +303,7 @@ def make_key(code=None, names=tuple(), type=KEY_SIMPLE, **kwargs): # NOQA key = constructor(code=code, **kwargs) - gc.collect() register_key_names(key, names) - gc.collect() return key diff --git a/kmk/kmk_keyboard.py b/kmk/kmk_keyboard.py index e266bd4..b41329e 100644 --- a/kmk/kmk_keyboard.py +++ b/kmk/kmk_keyboard.py @@ -108,22 +108,6 @@ class KMKKeyboard: self.uart_pin, ) - def _print_debug_cycle(self, init=False): - pre_alloc = gc.mem_alloc() - pre_free = gc.mem_free() - - if self.debug_enabled: - if init: - print('KMKInit(release={})'.format(KMK_RELEASE)) - - print(self) - print(self._state) - print( - 'GCStats(pre_alloc={} pre_free={} alloc={} free={})'.format( - pre_alloc, pre_free, gc.mem_alloc(), gc.mem_free() - ) - ) - def _send_hid(self): self._hid_helper_inst.create_report(self._state.keys_pressed).send() self._state.resolve_hid() @@ -223,6 +207,7 @@ class KMKKeyboard: elif hid_type == HIDModes.USB: try: from kmk.hid import USBHID + self.hid_helper = USBHID except ImportError: self.hid_helper = AbstractHID @@ -230,12 +215,12 @@ class KMKKeyboard: elif hid_type == HIDModes.BLE: try: from kmk.ble import BLEHID + self.hid_helper = BLEHID except ImportError: self.hid_helper = AbstractHID print('Bluetooth is unsupported ') - self._hid_helper_inst = self.hid_helper(**kwargs) # Split keyboard Init @@ -293,9 +278,6 @@ class KMKKeyboard: if not isinstance(k, tuple): del self.leader_dictionary[k] - gc.collect() - self._print_debug_cycle(init=True) - while True: state_changed = False @@ -336,6 +318,3 @@ class KMKKeyboard: if self.led and self.led.enabled and self.led.animation_mode: self.led = self.led.animate() - - if state_changed: - self._print_debug_cycle() diff --git a/kmk/matrix.py b/kmk/matrix.py index dd35c62..c23ed9c 100644 --- a/kmk/matrix.py +++ b/kmk/matrix.py @@ -1,5 +1,4 @@ import digitalio -import gc def intify_coordinate(row, col): @@ -37,7 +36,6 @@ class MatrixScanner: len(unique_pins) == self.len_cols + self.len_rows ), 'Cannot use a pin as both a column and row' del unique_pins - gc.collect() self.diode_orientation = diode_orientation