How to call c2000 library functions with the S-Function builder?

5 views (last 30 days)
Hello everyone:
I need to communicate with a device via SPI which needs a special communications structure. For that I need to change some registers such us the transmit delay of the SPI.
To learn how to use the sfunctions. I start with something easier which is just to call the function GPIO_setPinConfig(). I included all the necessary headers but unfortunatly It gives me the following errors:
warning: implicit declaration of function 'GPIO_setPinConfig'
'GPIO_16_SPIA_SIMO' undeclared
I don't know how to solve that.
Here is the code I wrote so far.
Pls, could you give some advice about how to get this external functions to work?
Thanks in advance. I am looking forward to your reply.
  1 Comment
Ruben Galvez
Ruben Galvez on 29 Jul 2022
I've also tried adding the SRC PATH and even adding extern GPIO_set..., but without success

Sign in to comment.

Answers (1)

Benjamin Thompson
Benjamin Thompson on 29 Jul 2022
If you are using mex to compile this C code into a binary for Simulink to use as an S-Function block, you probably need to use the -l and -L switches to include an external C2000 library or object file or something like that. Type "help mex" to get more information. If this is not helpful please attach some sample files of your work.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by