Can I call a Raspberry pi object within a block, for a program deployed on Raspberry pi

3 ビュー (過去 30 日間)
Sylvain
Sylvain 2023 年 1 月 18 日
回答済み: Nikhilesh 2023 年 3 月 31 日
I am deploying an simulink algorithm on a raspberry pi, that connects to an i2c device.
All my testing has been done in matlab to communicate with the raspberry pi, to configure the registers...
example:
mypi = raspi()
i2csensor = i2cdev(mypi,'i2c-1','0x20')
tmp_reg = uint8(readRegister(i2csensor,hex2dec('08'),'uint8'))
tmp_reg = bitand(tmp_reg,uint8(hex2dec('0x32'))) %mask the register
% do some operation
writeRegister(i2csensor,hex2dec('08'),tmp_reg,'uint8')
To implement this in simulink, (with multiple readRegister and writeRegister), I willl have to use numerous blocks and delays which will cause long complation time, overhead, a lot of debugging maybe, while I could reuse the code above.
However, since the connection with RaspberryPi will be in used (tune and monitor) I won't be able to create the "mypi" object.
Hence my question: can I retrive the raspi object created by simulink ?

回答 (1 件)

Nikhilesh
Nikhilesh 2023 年 3 月 31 日
Hi Sylvain,
As per my understanding i belive you cannot retive the RasPi object created by simulink directly.

カテゴリ

Help Center および File ExchangeRaspberry Pi Hardware についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by