Generating Mex Files For Arduino Drivers - MS Compiler Not Working

조회 수: 5 (최근 30일)
I am trying to use existing Arduino libraries with the S-Function Builder or Legacy Code Tool (same result). Particularly, I am trying to use the Time library to bring Hour and Minute into my model. This problem also applies to most of the libraries that I have tried.
The problem is that Time.h and Time.cpp include keywords and syntax for the Arduino compiler (avr-gcc). The Microsoft compiler that is set up with my Matlab/Simulink installation chokes on this code.
I can set up sfunctions using the regular Arduino.h library... such as digital/analog IO, but when I try to use interfaces from other libraries, I run into this issue.
Question is: How can I create drivers without trying to change my compiler selection? I know setting avr-gcc is not one of the compilers that is recommended to be used with my matlab-simulink installation

채택된 답변

Nathan Crosty
Nathan Crosty 2013년 4월 29일
편집: Nathan Crosty 2013년 4월 29일
My question has been answered here http://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers. I needed to change the wrapper file extension from c to cpp, and add extern "C" before the function call in the wrapper. This did the trick.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by