2019-07-25 09:32:20 +02:00
import board
Continue to shuffle and burn stuff
- Remove the concept of "mcus". With only one target platform
(CircuitPython), it no longer makes a bunch of sense and has been kept
around for "what if" reasons, complicating our import chains and eating
up RAM for pointless subclasses. If you're a `board`, you derive from
`KeyboardConfig`. If you're a handwire, the user will derive from
`KeyboardConfig`. The end. As part of this, `kmk.hid` was refactored
heavily to emphasize that CircuitPython is our only supported HID stack,
with stubs for future HID implementations (`USB_HID` becomes
`AbstractHID`, probably only usable for testing purposes,
`CircuitPython_USB_HID` becomes `USBHID`, and `BLEHID` is added with an
immediate `NotImplementedError` on instantiation)
- `KeyboardConfig` can now take a HID type at runtime. The NRF52840
boards will happily run in either configuration once CircuitPython
support is in place, and a completely separate `mcu` subclass for each
mode made no sense. This also potentially allows runtime *swaps* of HID
driver down the line, but no code has been added to this effect. The
default, and only functional value, for this is `HIDModes.USB`
- Most consts have been moved to more logical homes - often, the main
or, often only, component that uses them. `DiodeOrientation` moved to
`kmk.matrix`, and anything HID-related moved to `kmk.hid`
2019-07-25 09:58:23 +02:00
from kmk . consts import UnicodeMode
2019-07-25 08:43:00 +02:00
from kmk . handlers . sequences import compile_unicode_string_sequences , send_string
2019-07-17 08:30:14 +02:00
from kmk . keys import KC
2019-07-25 10:30:55 +02:00
from kmk . kmk_keyboard import KMKKeyboard
Continue to shuffle and burn stuff
- Remove the concept of "mcus". With only one target platform
(CircuitPython), it no longer makes a bunch of sense and has been kept
around for "what if" reasons, complicating our import chains and eating
up RAM for pointless subclasses. If you're a `board`, you derive from
`KeyboardConfig`. If you're a handwire, the user will derive from
`KeyboardConfig`. The end. As part of this, `kmk.hid` was refactored
heavily to emphasize that CircuitPython is our only supported HID stack,
with stubs for future HID implementations (`USB_HID` becomes
`AbstractHID`, probably only usable for testing purposes,
`CircuitPython_USB_HID` becomes `USBHID`, and `BLEHID` is added with an
immediate `NotImplementedError` on instantiation)
- `KeyboardConfig` can now take a HID type at runtime. The NRF52840
boards will happily run in either configuration once CircuitPython
support is in place, and a completely separate `mcu` subclass for each
mode made no sense. This also potentially allows runtime *swaps* of HID
driver down the line, but no code has been added to this effect. The
default, and only functional value, for this is `HIDModes.USB`
- Most consts have been moved to more logical homes - often, the main
or, often only, component that uses them. `DiodeOrientation` moved to
`kmk.matrix`, and anything HID-related moved to `kmk.hid`
2019-07-25 09:58:23 +02:00
from kmk . matrix import DiodeOrientation
2019-07-17 08:30:14 +02:00
from kmk . types import AttrDict
2019-07-25 10:30:55 +02:00
keyboard = KMKKeyboard ( )
2019-07-17 08:30:14 +02:00
'''
Converter / handwire :
PB5 : SCL
PB4 : SDA
PE6 : A0
PD7 : A1
PC6 : A2
PD4 : A3
PD0 : A4
PB6 : D2
PB2 : TX
PB3 : RX
PB1 : MI
PF7 : MO
PF6 : SCK
PF5 : A5
Mosfet on B5 to control backlight
'''
2019-07-25 09:32:20 +02:00
keyboard . col_pins = ( board . A4 , board . A2 , board . A3 , board . A1 , board . A0 , board . SDA )
keyboard . row_pins = ( board . D2 , board . TX , board . RX , board . MISO , board . MOSI )
2019-07-17 08:30:14 +02:00
# Kyle is fucking stupid
keyboard . col_pins = tuple ( reversed ( keyboard . col_pins ) )
keyboard . row_pins = tuple ( reversed ( keyboard . row_pins ) )
keyboard . diode_orientation = DiodeOrientation . COLUMNS
# ------------------User level config variables ---------------------------------------
keyboard . unicode_mode = UnicodeMode . LINUX
keyboard . tap_time = 350
keyboard . leader_timeout = 2000
keyboard . debug_enabled = False
emoticons = compile_unicode_string_sequences ( {
# Emoticons, but fancier
' ANGRY_TABLE_FLIP ' : r ' (ノಠ痊ಠ)ノ彡┻━┻ ' ,
' CHEER ' : r ' +。:.゚ヽ(´∀。)ノ゚.:。+゚゚+。:.゚ヽ(*´∀)ノ゚.:。+゚ ' ,
' TABLE_FLIP ' : r ' (╯°□°)╯︵ ┻━┻ ' ,
' WAT ' : r ' ⊙.☉ ' ,
' FF ' : r ' 凸(゚Д゚#) ' ,
' F ' : r ' ( ̄^ ̄)凸 ' ,
' MEH ' : r ' ╮( ̄_ ̄)╭ ' ,
' YAY ' : r ' o(^▽^)o ' ,
} )
# ---------------------- Leader Key Macros --------------------------------------------
keyboard . leader_dictionary = {
' flip ' : emoticons . ANGRY_TABLE_FLIP ,
' cheer ' : emoticons . CHEER ,
' wat ' : emoticons . WAT ,
' ff ' : emoticons . FF ,
' f ' : emoticons . F ,
' meh ' : emoticons . MEH ,
' yay ' : emoticons . YAY ,
}
2019-07-25 07:56:10 +02:00
WPM = send_string ( ' Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Bibendum arcu vitae elementum curabitur vitae nunc sed. Facilisis sed odio morbi quis. ' )
2019-07-17 08:30:14 +02:00
# ---------------------- Keymap ---------------------------------------------------------
keyboard . keymap = [
[
KC . GESC , KC . W , KC . E , KC . R , KC . T , KC . Y , KC . U , KC . I , KC . O , KC . P ,
KC . A , KC . S , KC . D , KC . F , KC . G , KC . H , KC . J , KC . K , KC . L , KC . ESC ,
KC . Z , KC . X , KC . C , KC . V , KC . BSPC , KC . SPC , KC . B , KC . N , KC . M , KC . ENT ,
] ,
]
if __name__ == ' __main__ ' :
keyboard . go ( )