forked from BerkeleyHCI/PolymorphicBlocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_AA_battery.py
36 lines (26 loc) · 1.18 KB
/
test_AA_battery.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
import unittest
from edg import *
from electronics_lib.Batteries import AABattery
from electronics_lib.DcDcConverters import Tps61023
class AABatteryCircuit(SimpleBoardTop):
def contents(self) -> None:
super().contents()
self.mcu = self.Block(Stm32f103_48())
self.bat = self.Block(AABattery())
self.led = self.Block(VoltageIndicatorLed())
self.boost = self.Block(Tps61023(output_voltage=3.3 * Volt(tol=0.07)))
self.swd = self.Block(SwdCortexTargetHeader())
self.link_bat_neg = self.connect(self.bat.gnd, self.boost.gnd)
self.link_bat_pos = self.connect(self.bat.pwr, self.boost.pwr_in)
self.link_boost_neg = self.connect(self.boost.gnd, self.mcu.gnd)
self.link_boost_pos = self.connect(self.boost.pwr_out, self.mcu.pwr)
self.connect(self.mcu.gnd, self.led.gnd)
self.connect(self.led.signal, self.mcu.pwr)
self.connect(self.swd.swd, self.mcu.swd)
self.connect(self.mcu.gnd, self.swd.gnd)
self.connect(self.mcu.pwr, self.swd.pwr)
if __name__ == "__main__":
compile_board_inplace(AABatteryCircuit)
class AABatteryCircuitTestCase(unittest.TestCase):
def test_design_aa_battery(self) -> None:
compile_board_inplace(AABatteryCircuit)