Nucleo F401REでFM音源を実装するやつ の実装途中で32ポリ音源にしたやつ 外部DACとオペアンプを利用 現在はMCP4922とNJM2737

Dependencies:   AOTTrigon I2CEEPROM MCP4922 mbed

Revision:
7:439c57c20593
Parent:
6:76e79bf6b571
Child:
10:0ffdefe75566
--- a/Main.cpp	Thu Dec 25 04:41:44 2014 +0000
+++ b/Main.cpp	Mon Dec 29 02:34:12 2014 +0000
@@ -3,14 +3,14 @@
 Ticker sampler;
 Timer master;
 MCP4922 output(D4,D3,D7);
-AOTTrigon t(64);
+AOTTrigon t;
 
 const double smpps = 40000.0;
 const double smptime = 1.0 / smpps;
 const double smpus = 1000000.0 / smpps;
 
 double ntime = 0.0;
-double freq = 2.5;
+double freq = 2.5f;
 
 void tick_sampling();
 
@@ -30,5 +30,5 @@
 void tick_sampling() {
     ntime=master.read_us()/1000000.0;
     for(int i=0;i<64;i++) t.sin(M_PI*2.0*freq*ntime);
-    output.write(MCP4922::DAC_A, t.sin(M_PI*2.0*freq*ntime)/2.0+0.5);
+    output.write(MCP4922::DAC_A, t.sin(M_PI*2.0f*freq*ntime)/2.0+0.5);
 }
\ No newline at end of file