examples/coredev_test: use CoreCom as a context manager

This commit is contained in:
Sebastien Bourdeauducq 2014-07-05 22:53:48 +02:00
parent b152ecca1f
commit 2f334589f0

View File

@ -9,9 +9,10 @@ class CompilerTest(Experiment):
self.led.set(1)
if __name__ == "__main__":
coredev = core.Core(runtime.Environment(), corecom_serial.CoreCom())
exp = CompilerTest(
core=coredev,
led=gpio_core.GPIOOut(coredev, 0)
)
exp.run()
with corecom_serial.CoreCom() as com:
coredev = core.Core(runtime.Environment(), com)
exp = CompilerTest(
core=coredev,
led=gpio_core.GPIOOut(coredev, 0)
)
exp.run()