Experimental implementation of the adaptive filter of "Interface" magazine in 2016-2017

Dependencies:   amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746

Fork of skeleton_unzen_nucleo_f746 by seiichi horie

ハードウェアおよびソフトウェアはskelton_unzen_nucleo_f746を基本にしています。

Files at this revision

API Documentation at this revision

Comitter:
shorie
Date:
Tue Jan 31 14:19:16 2017 +0000
Parent:
16:d4ea3e6a0bce
Child:
18:b9b1116f8768
Commit message:
VFO is now working.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
vfo.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jan 31 12:52:59 2017 +0000
+++ b/main.cpp	Tue Jan 31 14:19:16 2017 +0000
@@ -42,33 +42,47 @@
 int main() 
 {    
     uint32_t pushing, releasing, holding;
+    
+        // VFO style
+    wave_style style = triangle;
 
         // start audio. Do not touch
     initialize_system();
+    
+    process->set_vfo_frequency( 440 );
+    process->set_vfo_wave_style( style );
+    ukifune::turn_led_off( ukifune::led1_1 );
+    ukifune::turn_led_on( ukifune::led1_2 );
  
        // main loop. Signal processing is done in background.
     while(1)     
     {       // place your foreground program here.
 
             // get volume from UI panel, then apply it to signal processing.
-        process->set_volume( ukifune::get_volume(0) );   
+        process->set_volume( ukifune::get_volume(0) );  
+        process->set_vfo_duty_cycle( ukifune::get_volume(1) ); 
        
             // sample usage of button switch detection
         ukifune::get_button_state( pushing, releasing, holding);
 
             // pushing detection demo
         if ( pushing & (1 << ukifune::swm1 ) )      // is SWM1 switch pusshing down?
-            ukifune::toggle_led( ukifune::led1_1 ); // then, toggle LED1_1 
+            if  ( style == triangle )
+            {
+                style = square;
+                process->set_vfo_wave_style( style );
+                ukifune::turn_led_on( ukifune::led1_1 );
+                ukifune::turn_led_off( ukifune::led1_2 );
+            }
+            else
+            {
+                style = triangle;
+                process->set_vfo_wave_style( style );
+                ukifune::turn_led_off( ukifune::led1_1 );
+                ukifune::turn_led_on( ukifune::led1_2 );
+            }
+            
 
-            // releasing detection demo     
-        if ( releasing & (1 << ukifune::swm2 ) )    // is SWM2 switch releasing? 
-            ukifune::toggle_led( ukifune::led2_1 ); // then toggle LED2_1
-       
-            // holding detection demo     
-        if ( holding & (1 << ukifune::swm3 ) )    // is SWM3 switch holding? 
-            ukifune::turn_led_on( ukifune::led3_1 );    // then turn LED3_1 on
-        else
-            ukifune::turn_led_off( ukifune::led3_1 );   // else off
 
        
             // you have to call tick() every 20mS-50mS if you need get_volume()
--- a/vfo.cpp	Tue Jan 31 12:52:59 2017 +0000
+++ b/vfo.cpp	Tue Jan 31 14:19:16 2017 +0000
@@ -70,8 +70,8 @@
 {
     if ( duty > 0.5f )   // high limit
         duty = 0.5f;
-    if ( duty < 0.01f )  // low limit
-        duty = 0.01f;
+    if ( duty < 0.0f )  // low limit
+        duty = 0.0f;
     this->duty_cycle = duty;
     
     this->update_parameters();
@@ -87,7 +87,7 @@
 void VFO::update_parameters(void)
 {
         // calc the half_way;
-    this-> half_way = this->frequency * this-> duty_cycle;
+    this-> half_way = this->Fs * this-> duty_cycle;
 
         // forbid to be zero.
     if ( this-> half_way < this->frequency )