"""
This example shows basic FNet SPI controller initialization and usage.
(c) iSYSTEM Labs, 2022
"""
import isystem.connect as ic
winidea_id = ''
try:
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
SessionCtrl = ic.CSessionCtrl(connMgr)
FNetCtrl = ic.CFNetCtrl(connMgr)
SPICtrl = FNetCtrl.SPI('ADIO.SPI1')
optSPICfg = SPICtrl.cfg()
optSPICfg.reset()
optSPICfg.set_enabled(bEnabled = True)
optSPICfg.set_operation(bCSActiveHigh = False, bSamplingOnSecondEdge = True, bClockIdleHigh = True)
optSPICfg.set_name('eMMC')
optSPICfg.add_description_file('eMMC.dbc')
SessionCtrl.end()
SessionCtrl.begin_prepare()
FTrig = 5
optSPIOp = SPICtrl.op()
SPICtrl.op_qualifier_enable(FTrig)
SPICtrl.op_qualifier_enable_on_start(False)
optSPIOp.set_record_all(False)
optSPIOp.set_comparator(
nComparator = 0,
bRecord = True,
nFTrig = FTrig,
nCS = 0,
nMOSI = False,
nOffset = 0,
nSize = 8,
bBigEndian = False,
nValue = 0x5,
nMask = 0x7
)
FNetCtrl.op_apply()
except Exception as ex:
print(ex)