1
2
3
4
5"""
6This example shows basic FNet LIN controller initialization and usage.
7
8(c) iSYSTEM Labs, 2022
9"""
10import isystem.connect as ic
11
12winidea_id = ''
13
14
15try:
16
17 connMgr = ic.ConnectionMgr()
18 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
19
20
21 SessionCtrl = ic.CSessionCtrl(connMgr)
22 FNetCtrl = ic.CFNetCtrl(connMgr)
23 LINCtrl = FNetCtrl.LIN('CAN/LIN.LIN1')
24
25
26
27 optLINCfg = LINCtrl.cfg()
28 optLINCfg.reset()
29
30 optLINCfg.set_baudrate_bps(9600)
31
32
33 optNetworkCfg = optLINCfg.opt_network()
34 optNetworkCfg.set_name('Windows')
35 optNetworkCfg.add_description_file('Windows.ldf')
36
37
38
39 SessionCtrl.end()
40 SessionCtrl.begin_prepare()
41
42
43
44
45 FTrig = 5
46
47 optLINOp = LINCtrl.op()
48
49 LINCtrl.op_qualifier_enable(FTrig)
50 LINCtrl.op_qualifier_enable_on_start(False)
51
52
53 optLINOp.set_record_all(False)
54
55 optLINOp.set_wake_up(bRecord = True, nFTrig = FTrig)
56
57 optLINOp.set_comparator(nComparator = 0, bRecord = True, nFTrig = FTrig, nID = 0x7, nMask = 0xf)
58
59
60 FNetCtrl.op_apply()
61
62except Exception as ex:
63 print(ex)