Error when referencing Arduino SPI.h library in Simulink

3 Ansichten (letzte 30 Tage)
Scott Heimendinger
Scott Heimendinger am 24 Nov. 2021
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 :-)

Antworten (0)

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by