arranged by katano

Dependencies:   MPU9150_DMP Neon_F303K8 QuaternionMath iSDIO mbed-rtos mbed

Fork of Neon_F303K8 by Yasuhiro ISHII

Files at this revision

API Documentation at this revision

Comitter:
yakatano
Date:
Fri Aug 05 15:05:20 2016 +0000
Parent:
3:5f0d6133d34c
Commit message:
??????

Changed in this revision

Neon_F303K8_03.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
taskLed.cpp Show annotated file Show diff for this revision Revisions of this file
taskSensor.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Neon_F303K8_03.lib	Fri Aug 05 15:05:20 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/yishii/code/Neon_F303K8/#5f0d6133d34c
--- a/main.cpp	Mon May 16 15:27:29 2016 +0000
+++ b/main.cpp	Fri Aug 05 15:05:20 2016 +0000
@@ -10,29 +10,60 @@
 
 extern void TaskSensor(void const* );
 extern void TaskLed(void const* );
-extern void TaskFA(void const* );
+//extern void TaskFA(void const* );
 
-Thread* threadLed = NULL;
+//Thread* threadLed = NULL;
 Thread* threadSensor = NULL;
-Thread* threadFA = NULL;
+//Thread* threadFA = NULL;
 
 Serial pc(USBTX, USBRX);
 
+
+
 int main() {
     pc.baud(115200);
     printf("Startup Neon main program\r\n");
 
     Thread::wait(500); // 適当な待ち時間
 
-    threadLed = new Thread(TaskLed, NULL, osPriorityNormal, DEFAULT_STACK_SIZE, NULL );
+    //threadLed = new Thread(TaskLed, NULL, osPriorityNormal, DEFAULT_STACK_SIZE, NULL );
     threadSensor = new Thread(TaskSensor, NULL, osPriorityNormal, DEFAULT_STACK_SIZE*2, NULL ); // スタックサイズ未検証
     //threadFA = new Thread(TaskFA, NULL, osPriorityNormal, DEFAULT_STACK_SIZE , NULL );
 
+    //pc.attach(pc_rx, Serial::RxIrq);
+    char recv[1024];
     while(true){
+        if(pc.readable())
+        {
+            char ch = pc.getc();
+            //pc.putc('$');
+            //pc.printf("%s\r\n", ch);
+            switch(ch){
+                case 'z':
+                    
+                    sprintf(recv, "");
+                    break;
+                case 'a':
+                    if(StatusLED == 1){StatusLED = 0;}
+                    else{StatusLED = 1;}
+                    break;
+                case '1':
+                    if(StatusLED == 1){StatusLED = 0;}
+                    else{StatusLED = 1;}
+                    break;
+                default:
+                    printf("%c\r\n", ch);
+                    //sprintf(recv, "%s%c", recv,ch);
+                    //pc.printf(recv);
+                    break;
+            }
+        }
+        /*
         StatusLED = 1;
         Thread::wait(800);
         StatusLED = 0;
         Thread::wait(800);
+        */
     }
 }
 
--- a/taskLed.cpp	Mon May 16 15:27:29 2016 +0000
+++ b/taskLed.cpp	Fri Aug 05 15:05:20 2016 +0000
@@ -125,7 +125,7 @@
     int i;
     int j;
     int k;
-    int8_t val = 255;
+    int8_t val = 128;
     
     printf("TaskLed started\r\n");
     
--- a/taskSensor.cpp	Mon May 16 15:27:29 2016 +0000
+++ b/taskSensor.cpp	Fri Aug 05 15:05:20 2016 +0000
@@ -63,7 +63,7 @@
             // 以下の#if 0~#endifを#if 1~#endifに変更すると、シリアルからセンサーの出力データが出る
 
             // 加速度センサー生値
-#if 1
+#if 0
             printf("%d, %d, %d\r\n",  (int32_t)(((int32_t)buffer[34] << 24) + ((int32_t)buffer[35] << 16) + ((int32_t)buffer[36] << 8) + (int32_t)buffer[37]), 
                                             (int32_t)(((int32_t)buffer[38] << 24) + ((int32_t)buffer[39] << 16) + ((int32_t)buffer[40] << 8) + (int32_t)buffer[41]), 
                                             (int32_t)(((int32_t)buffer[42] << 24) + ((int32_t)buffer[43] << 16) + ((int32_t)buffer[44] << 8) + (int32_t)buffer[45]));
@@ -74,13 +74,13 @@
                                             (int32_t)(((int32_t)buffer[20] << 24) + ((int32_t)buffer[21] << 16) + ((int32_t)buffer[22] << 8) + (int32_t)buffer[23]),
                                             (int32_t)(((int32_t)buffer[24] << 24) + ((int32_t)buffer[25] << 16) + ((int32_t)buffer[26] << 8) + (int32_t)buffer[27]));
 #endif
-#if 0                                            
+#if 0                                        
             // 地磁気センサー生値
             //pc.printf("%d, %d, %d\r\n",  (int16_t)(buffer[29] << 8) + buffer[28], 
                                             (int16_t)(buffer[31] << 8) + buffer[30], 
                                             (int16_t)(buffer[33] << 8) + buffer[32]);
 #endif
-#if 0
+#if 1
             // センサーフュージョンによるQuartanion
             printf("%f, %f, %f, %f\r\n", 
                 (float)((((int32_t)buffer[0] << 24) + ((int32_t)buffer[1] << 16) + ((int32_t)buffer[2] << 8) + buffer[3]))* (1.0 / (1<<30)),