OSDN Git Service

demodulatorに浮動小数点のサンプルコードを入れた。現在880Hzで発振するだけ。また、Makefile.configを変更して、浮動小数点コードを受け入れ可能にした。
[trx-305dsp/dsp.git] / trx305 / demodulator.c
index cfa23ca..515d42c 100644 (file)
@@ -9,6 +9,7 @@
 #define _DEMODULATOR_H_
 
 #include "demodulator.h"
+#include <math.h>
 
 void init_demodulator(void)
 {
@@ -23,6 +24,15 @@ void radio_demodulate_wide_FM( short idata[], short qdata[], short* left, short*
 void radio_demodulate_non_wide_FM( int idata, int qdata, short* left, short* right )
 {
 
+    float f;
+    static short phase = 0;
+
+    f = sinf( 2 * 3.14 * phase / 32768 ) * 32767 * 0.5;
+    phase += 880 ;
+
+    * right = *left = f;
+
+
 }