daiki hiraoka / Mbed 2 deprecated EMG

Dependencies:   mbed-rtos mbed

Revision:
12:cbf6f5bbfbe6
Parent:
11:3afd371235c5
Child:
13:94ce8bd0c0e1
--- a/main.cpp	Wed May 03 04:07:32 2017 +0000
+++ b/main.cpp	Sat Sep 23 04:37:01 2017 +0000
@@ -1,4 +1,9 @@
-/*** Include ***/
+/* memo
+ * サンプリング1msでは筋電位には遅い?
+ * FFTの1kHz以上は取れなくなる
+ * 1kHzだとオシロでFFT見た時ぎりぎり
+ */
+ /*** Include ***/
 #include "mbed.h"
 #include "rtos.h"
 #include "FilterTest.h"
@@ -50,7 +55,7 @@
 uint32_t Fdiv;
 double InputData = 0.0;    
 
-
+FLT32 g_cntUp;
 
 /*** Functions ***/
 /* 通信関数宣言 */
@@ -154,6 +159,7 @@
     /* InputData = (int32_t)filter.calc( (double)(wave_in.read_u16() - INT16_MAX), hpf_on, lpf_on, brf_on ); */
     InputData = filter.calc( InputData, hpf_on, lpf_on, brf_on );
     
+    
     #ifdef DEBUG_
     /*pc.printf("attach: %d,%d\r\n", i, InputData);*/
     g_wave = i / 100 * 3.3;
@@ -176,10 +182,15 @@
     
     int i;
     char header = 0x01;
+    char hoge = 0x00;
     u64_dataType_g sendData;   
-    u32_dataType_g testData;   
+    u32_dataType_g testData;
+    /* test */
+    g_cntUp = g_cntUp + 0.001;
+    if(g_cntUp > 1.0) g_cntUp = 0.0;
+
     sendData.DData = data;
-    testData.DData = (float)data;
+    testData.DData = (float)g_cntUp;
     //testData.DData = (float)myled1;
     
     LPC_PINCON->PINSEL0 &= ~(3 << 4);
@@ -207,6 +218,10 @@
     pc.printf("send: %d,%lf\r\n", i,sendData.CData[i]);
     #endif
     }
+    for(i=0;i<3;i++)
+    {
+        LPC_UART0->THR = hoge;
+    }
     
 
     NVIC_EnableIRQ(UART0_IRQn);
@@ -222,6 +237,8 @@
    /*          1 2 3 4 5 6 7 8   */
    // Result = 0x0123456789ABCDEF;
    // Result = 2.0;
+   Result += 0.001;
+   if(Result > 3) Result = 0;
    /*aout= Result / 3.3;*/
    //wait_us(100);
    return Result;