This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377S: Incorporating driver library code with Simulink State Flow generated code.

Part Number: TMS320F28377S

We are developing state machine of our project using Simulink State Flow.  There are discrete states of the system like initialization, standby, run and fault. In each state the DSP needs to execute some hardware related tasks that will need the use of driver library functions. For example we need to check if there is any new communication over the UART/SPI. Then it will be required to read the received data, process it and reply back. From my understanding state flow allows calling of Matlab functions and C code but I am not clear exactly how to incorporate the C code that makes usage of device driver library function. 

The following two approaches come to my mind:

1- I take out a state variable from Simulink state flow that indicate the current state and based on this, I call appropriate function that are written outside the state machine code.

2- I make some empty C function calls in the state flow and then manually copy the driver library code in those functions.

Kindly guide if there is a better approach to solve this requirement.