summaryrefslogtreecommitdiff
path: root/digital/avr/modules/twi/test/test_twi.py
blob: 3b227f5b323b48b908a2f69f7c7ef63eb5dcd745 (plain)
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
import os, signal, time

from mex.hub import Hub
from mex.msg import Msg
from mex.node import Node
from utils.forked import Forked

h = Hub (min_clients = 3)
fh = Forked (h.wait)

n = Node ()
def nf ():
    while True:
        time.sleep (1)
        n.wait (n.date + 1000)
fn = Forked (nf)

slave = os.popen ('./slave/test_twi_slave.host', 'w')

try:
    os.system ('./master/test_twi_master.host')
finally:
    fn.kill ()
    fh.kill ()
    slave.close ()
    time.sleep (1)