Files
kmk_firmware/kmk/extensions/__init__.py
Josh Klar 2c4e866024 Initial attempt to merge internal_state with kmk_keyboard. Seems to work on Plank so far
fix formatting

Example of new "Extension"/plugin system, using LED

Cleanup of RGB code

staticmethod to proper, normal methods

Needs cleanup, but: migrate Leader to Extension API

remove useless self reurns

fix an AttributeError with Leader key removal

Checkpoint from the weekend: split as an Extension (not working or done yet)

wip
2020-11-13 23:27:48 -08:00

43 lines
873 B
Python

class InvalidExtensionEnvironment(Exception):
pass
class Extension:
_enabled = True
def enable(self, keyboard):
self._enabled = True
self.on_runtime_enable(self, keyboard)
def disable(self, keyboard):
self._enabled = False
self.on_runtime_disable(self, keyboard)
# The below methods should be implemented by subclasses
def on_runtime_enable(self, keyboard):
pass
def on_runtime_disable(self, keyboard):
pass
def during_bootup(self, keyboard):
pass
def before_matrix_scan(self, keyboard):
'''
Return value will be injected as an extra matrix update
'''
pass
def after_matrix_scan(self, keyboard, matrix_update):
pass
def before_hid_send(self, keyboard):
pass
def after_hid_send(self, keyboard):
pass