-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recore.py
52 lines (43 loc) · 1.8 KB
/
Recore.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
from ConfigSection import ConfigSection
class Recore:
recore: ConfigSection
mcu: ConfigSection
mcu_ar100: ConfigSection
def __init__(self, board):
self.recore = ConfigSection("recore")
self.mcu = ConfigSection("mcu")
self.mcu_ar100 = ConfigSection("mcu ar100")
match board:
case "Recore A7":
self.recore.add_setting("revision", "A7")
self.mcu.add_setting("serial", "/dev/ttyS2")
case "Recore A6":
self.recore.add_setting("revision", "A6")
self.mcu.add_setting("serial", "/dev/ttyS2")
case "Recore A5":
self.recore.add_setting("revision", "A5")
self.mcu.add_setting("serial", "/dev/ttyS4")
self.recore.add_setting("gain_t0", 1)
self.recore.add_setting("gain_t1", 1)
self.recore.add_setting("gain_t2", 1)
self.recore.add_setting("gain_t3", 1)
self.recore.add_setting("pullup_t0", 1)
self.recore.add_setting("pullup_t1", 1)
self.recore.add_setting("pullup_t2", 1)
self.recore.add_setting("pullup_t3", 1)
if board != "Recore A5":
self.recore.add_setting("offset_t0", 0)
self.recore.add_setting("offset_t1", 0)
self.recore.add_setting("offset_t2", 0)
self.recore.add_setting("offset_t3", 0)
self.mcu.add_setting("serial", "/dev/ttyS2")
self.mcu.add_setting("baud", 250000)
self.mcu.add_setting("restart_method", "command")
self.mcu_ar100.add_setting("serial", "/dev/ttyS1")
self.mcu_ar100.add_setting("baud", 1500000)
def get_recore_config(self):
return self.recore
def get_mcu_config(self):
return self.mcu
def get_mcu_ar100_config(self):
return self.mcu_ar100