An example of importing Embedded Coder code into the mbed IDE. Currently doesn't connect IO to PWM, ADC, and Encoder, instead provides random inputs and measures execution time.

Dependencies:   mbed-dsp mbed Nucleo_pmsmfoc

Dependents:   Nucleo_pmsmfoc

Revision:
1:83374f658183
Parent:
0:70d27fec6d71
--- a/main.cpp	Sat Oct 11 08:39:22 2014 +0000
+++ b/main.cpp	Sat Oct 11 10:04:49 2014 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "rtwdemo_pmsmfoc.h"           /* Model's header file */
 #include "rtwtypes.h"
+#include "math_helper.h"
 
 Timer timer1;
 
@@ -56,7 +57,7 @@
 
   timer1.stop();
   
-  printf("exec us: %d\r\n",timer1.read_us());
+  printf("exec us: %d err: %d\r\n",timer1.read_us(),error);
   timer1.reset();
   
   /* Get model outputs here */
@@ -88,12 +89,14 @@
       sensors.adc_phase_currents[1] = rand()%MAX_uint16_T;
       printf("%d %d\r\n",sensors.adc_phase_currents[0],sensors.adc_phase_currents[1]);
       sensors.encoder_valid = 1;
-      sensors.encoder_counter = i*10;
+      sensors.encoder_counter = i*20;
 
       rt_OneStep();
       
-      pc.printf("%d: pwm0: %d\r\n", i++, pwm_compare[0]);
+      pc.printf("%d: pwm0: %d vel: %f mode: %d\r\n", i++, pwm_compare[0], velocity_measured, controller_mode);
       myled = !myled;
+      
+      printf("arm: %f\r\n",arm_sin_f32(3.14159F/3));
   }
 }
  
\ No newline at end of file