can_multithreading

PROGRAMMA PORCO *

Files at this revision

API Documentation at this revision

Comitter:
gidiana
Date:
Fri Jun 21 07:44:46 2019 +0000
Parent:
2:861d341b0259
Commit message:
Paolone

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 20 07:26:59 2019 +0000
+++ b/main.cpp	Fri Jun 21 07:44:46 2019 +0000
@@ -1,5 +1,5 @@
  #include "mbed.h"
- #define FREQUENCY 500000
+ #define FREQUENCY 125000
 
 
 CAN can(PB_5, PB_6);
@@ -58,7 +58,7 @@
    messageOut.data[2] = speed >> 8;
    messageOut.data[3] = speed;
     
-    messageOut.id = 770;
+    messageOut.id = (20 << 8) + 2;
     status = can.write(messageOut);
     
     osDelay(1);
@@ -68,7 +68,7 @@
     
     
    printf("Send status: %d\r\n", status);
-   if (status==1) led2 = !led2;
+   if (status==1) led1 = !led1;
    osDelay(20);
 }
 
@@ -77,7 +77,7 @@
     while (true)
     {
         sendMessage();
-        osDelay(1000);
+       osDelay(1000);
     }
 }
 
@@ -85,8 +85,9 @@
 {
     int frequency = FREQUENCY;
     printf("CAN receive / transmit test. baudrate = %d \r\n", frequency);
-    can.frequency(500000);
-    messageOut.id = 769;
+    can.frequency(frequency);
+    can.reset();
+    //messageOut.id = 1200;
     messageOut.format = CANExtended;
    // messageOut.len = 0;
 
@@ -96,9 +97,10 @@
 
     while (true)
     {
-        speed = (int)((ain * 30000.0f) - 15000.0f);
+        //speed = (int)((ain * 30000.0f) - 15000.0f);
+        speed = 5000;
         
         //led1 = 0;
         osDelay(10);
     }
-}         
\ No newline at end of file
+}          
\ No newline at end of file
--- a/mbed_app.json	Thu Jun 20 07:26:59 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
- {
-  "target_overrides": { 
-   
-           
-        
-        "NUCLEO_F446RE": {
-                "platform.stdio-baud-rate": 115200,
-               "target.clock_source": "USE_PLL_HSI"
-            
-               }
-        }
-}
\ No newline at end of file