-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.py
137 lines (111 loc) · 3.69 KB
/
code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
from pmk import PMK
from pmk.platform.rgbkeypadbase import RGBKeypadBase as Hardware
from keyboard_windows import run_windows
from keyboard_linux import run_linux
from utils import sleep
from generic_kb import MacroBoard
def windows_splash(pmk):
brightness = 255
for i in range(255):
pmk.keys[0].set_led(brightness,0,0)
pmk.keys[1].set_led(brightness,0,0)
pmk.keys[4].set_led(brightness,0,0)
pmk.keys[5].set_led(brightness,0,0)
pmk.keys[2].set_led(0,brightness,0)
pmk.keys[3].set_led(0,brightness,0)
pmk.keys[6].set_led(0,brightness,0)
pmk.keys[7].set_led(0,brightness,0)
pmk.keys[8].set_led(0,0,brightness)
pmk.keys[9].set_led(0,0,brightness)
pmk.keys[12].set_led(0,0,brightness)
pmk.keys[13].set_led(0,0,brightness)
pmk.keys[10].set_led(brightness,brightness,0)
pmk.keys[11].set_led(brightness,brightness,0)
pmk.keys[14].set_led(brightness,brightness,0)
pmk.keys[15].set_led(brightness,brightness,0)
brightness -= 5
print(brightness)
if brightness <= 0:
break
sleep(0.01)
def mac_splash(pmk):
brightness = 255
for i in range(100):
pmk.keys[0].set_led(brightness,0,0)
pmk.keys[1].set_led(brightness,0,0)
pmk.keys[4].set_led(brightness,0,0)
pmk.keys[5].set_led(brightness,0,0)
pmk.keys[2].set_led(0,brightness,0)
pmk.keys[3].set_led(0,brightness,0)
pmk.keys[6].set_led(0,brightness,0)
pmk.keys[7].set_led(0,brightness,0)
pmk.keys[8].set_led(0,0,brightness)
pmk.keys[9].set_led(0,0,brightness)
pmk.keys[12].set_led(0,0,brightness)
pmk.keys[13].set_led(0,0,brightness)
pmk.keys[10].set_led(brightness,brightness,0)
pmk.keys[11].set_led(brightness,brightness,0)
pmk.keys[14].set_led(brightness,brightness,0)
pmk.keys[15].set_led(brightness,brightness,0)
brightness -= 10
if brightness <= 0:
break
sleep(1)
def linux_splash(pmk):
brightness = 255
for i in range(100):
pmk.keys[0].set_led(brightness,0,0)
pmk.keys[3].set_led(brightness,0,0)
pmk.keys[4].set_led(brightness,0,0)
pmk.keys[7].set_led(brightness,0,0)
pmk.keys[2].set_led(0,brightness,0)
pmk.keys[3].set_led(0,brightness,0)
pmk.keys[6].set_led(0,brightness,0)
pmk.keys[7].set_led(0,brightness,0)
pmk.keys[8].set_led(0,0,brightness)
pmk.keys[9].set_led(0,0,brightness)
pmk.keys[12].set_led(0,0,brightness)
pmk.keys[13].set_led(0,0,brightness)
pmk.keys[10].set_led(brightness,brightness,0)
pmk.keys[11].set_led(brightness,brightness,0)
pmk.keys[14].set_led(brightness,brightness,0)
pmk.keys[15].set_led(brightness,brightness,0)
brightness -= 10
if brightness <= 0:
break
sleep(0.01)
hardware = Hardware()
pmk = PMK(hardware)
pmk.keys[0].set_led(255,0,0)
pmk.keys[1].set_led(0,255,0)
pmk.keys[2].set_led(0,0,255)
win = False
mac = False
lin = False
while True:
pmk.update()
if pmk.keys[0].pressed:
print("Loading windows keymaps...")
win = True
windows_splash(pmk)
break
elif pmk.keys[1].pressed:
print("Loading linux keymaps...")
lin = True
linux_splash(pmk)
break
elif pmk.keys[2].pressed:
print("Loading mac keymaps...")
mac = True
mac_splash(pmk)
break
if win:
run_windows(pmk, hardware)
elif lin:
keymap = run_linux(pmk, hardware)
kb = MacroBoard()
kb.assign_keys(keymap)
kb.run(pmk)
# run_linux(pmk, hardware)
elif mac:
pass