Error when referencing Arduino SPI.h library in Simulink
2 次查看(过去 30 天)
显示 更早的评论
I'm trying to control an AD9833 waveform generator with Simulink. I'm able to connect to my Arduino and run Simulink models using the built-in blocks for Arduino just fine. I followed the steps here to integrate the AD9833 Arduino library via an S-Function builder block. However, the AD9833 library has a dependency on SPI. I added SPI.h and SPI.cpp to my Matlab working folder and I included a reference to it in my custom wrapper.
But, no matter what I've tried, the Deploy and Build step always chokes when trying to compile SPI.h. I've found other threads with folks encountering the same (or similar) issues, but none with solutions that work. The specific error that registers first seems to vary depending on the Arduino board I'm using, but with the Arduino Nano BLE 33 Sense, the first failure is:
E:/Documents/MATLAB/Autotune/SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':
E:/Documents/MATLAB/Autotune/SPI.h:114:20: error: 'F_CPU' was not declared in this scope
if (clock >= F_CPU / 2) {
^~~~~
Followed by a bunch more errors like it.
I've attached my entire workign directory, including Simulink file and all the Arduino libraries I'm referencing. Any pointers? I'm on day 4 of baning my head against the workbench :-)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!