Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of Signal_nucleo_f746 by
Diff: vfo.cpp
- Revision:
- 14:cec63d8da48c
- Child:
- 15:de22b9d147e0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vfo.cpp Mon Jan 30 14:48:42 2017 +0000
@@ -0,0 +1,57 @@
+#include "signal_processing.h"
+
+ // Modify this constructor to initialize your audio algorithm.
+VFO::VFO( void )
+{
+ // initial parameter setting.
+ this->style = triangle;
+ this->Fs = 48000;
+ this->frequency = 440;
+ this->duty_cycle = 0.5;
+} // End of constructor()
+
+
+ // Modify this method to implement your audio algorithm.
+void VFO::run(
+ float out_buffer[], // vfo output buffer
+ unsigned int block_size // block size [sample]
+ )
+{
+ // place the signal processing coce here
+ for ( int i= 0; i< block_size; i++ )
+ {
+ }
+} // End of run()
+
+
+void VFO::set_Fs( int Fs )
+{
+ // regulate the Fs.
+ if ( Fs != 32000 && Fs != 44100 && Fs != 96000 && Fs != 48000 )
+ Fs = 48000;
+ this->Fs = Fs;
+}
+
+void VFO::set_frequency( int freq )
+{
+ if ( freq > this->Fs / 4 )
+ freq = Fs/4;
+ this->frequency = freq;
+}
+
+void VFO::set_duty_cycle( float duty )
+{
+ if ( duty > 0.5f ) // high limit
+ duty = 0.5f;
+ if ( duty < 0.01f ) // low limit
+ duty = 0.01f;
+ this->duty_cycle = duty;
+}
+
+void VFO::set_wave_style( wave_style style )
+{
+ this->style = style;
+}
+
+
+
