-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest_keyboard.py
More file actions
51 lines (39 loc) · 1.59 KB
/
test_keyboard.py
File metadata and controls
51 lines (39 loc) · 1.59 KB
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
"""
Mechanical keyboard example design.
Relies on footprints from external libraries.
In the KiCad Plugin and Content Manager, install the Keyswitch Kicad Library,
also on GitHub here https://github.com/perigoso/keyswitch-kicad-library
The project is set up to reference the third party library as installed by the KiCad
Plugin Manager, it does not need to be in your global library table.
"""
import unittest
from typing_extensions import override
from edg import *
from .util import run_test_board
class Keyboard(SimpleBoardTop):
@override
def contents(self) -> None:
super().contents()
self.usb = self.Block(UsbCReceptacle())
self.reg = self.Block(Ldl1117(3.3 * Volt(tol=0.05)))
self.connect(self.usb.gnd, self.reg.gnd)
self.connect(self.usb.pwr, self.reg.pwr_in)
with self.implicit_connect(
ImplicitConnect(self.reg.pwr_out, [Power]),
ImplicitConnect(self.reg.gnd, [Common]),
) as imp:
self.mcu = imp.Block(Stm32f103_48())
self.connect(self.usb.usb, self.mcu.usb.request())
self.sw = self.Block(SwitchMatrix(nrows=3, ncols=2))
self.connect(self.sw.cols, self.mcu.gpio.request_vector())
self.connect(self.sw.rows, self.mcu.gpio.request_vector())
@override
def refinements(self) -> Refinements:
return super().refinements() + Refinements(
class_refinements=[
(Switch, KailhSocket),
],
)
class KeyboardTestCase(unittest.TestCase):
def test_design(self) -> None:
run_test_board(Keyboard)