1
2
3
4
5"""
6This example shows basic FNet SPI 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 SPICtrl = FNetCtrl.SPI('ADIO.SPI1')
24
25
26
27 optSPICfg = SPICtrl.cfg()
28 optSPICfg.reset()
29
30
31 optSPICfg.set_enabled(bEnabled = True)
32
33 optSPICfg.set_operation(bCSActiveHigh = False, bSamplingOnSecondEdge = True, bClockIdleHigh = True)
34
35
36 optSPICfg.set_name('eMMC')
37 optSPICfg.add_description_file('eMMC.dbc')
38
39
40
41 SessionCtrl.end()
42 SessionCtrl.begin_prepare()
43
44
45
46
47 FTrig = 5
48
49 optSPIOp = SPICtrl.op()
50
51 SPICtrl.op_qualifier_enable(FTrig)
52 SPICtrl.op_qualifier_enable_on_start(False)
53
54
55 optSPIOp.set_record_all(False)
56
57 optSPIOp.set_comparator(
58 nComparator = 0,
59 bRecord = True,
60 nFTrig = FTrig,
61 nCS = 0,
62 nMOSI = False,
63 nOffset = 0,
64 nSize = 8,
65 bBigEndian = False,
66 nValue = 0x5,
67 nMask = 0x7
68 )
69
70
71 FNetCtrl.op_apply()
72
73except Exception as ex:
74 print(ex)