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: signal_processing.cpp
- Revision:
- 6:486b1cb03e61
- Child:
- 10:a00c73efc6c3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/signal_processing.cpp Fri Jan 27 01:53:43 2017 +0000
@@ -0,0 +1,46 @@
+#include "signal_processing.h"
+
+SignalProcessing::SignalProcessing( unsigned int block_size )
+{
+ // place the signal processing initializing code here.
+ this->volume_level = 0.0; // sample initializaiton
+}
+
+void SignalProcessing::run(
+ float rx_left_buffer[], // array of the left input samples
+ float rx_right_buffer[], // array of the right input samples
+ float tx_left_buffer[], // place to write the left output samples
+ float tx_right_buffer[], // place to write the left output samples
+ unsigned int block_size // block size [sample]
+ )
+{
+ // place the signal processing coce here
+ for ( int i= 0; i< block_size; i++ )
+ {
+ rx_left_buffer[i] = tx_left_buffer[i] * this->volume_level;
+ rx_right_buffer[i] = tx_right_buffer[i] * this->volume_level;
+ }
+}
+
+ // project depenedent members.
+void SignalProcessing::set_volume( float vol )
+{
+ this->enter_critical_section(); // forbidden interrrupt.
+ this->volume_level = vol;
+ this->leave_critical_section(); // now, ok to accept interrupt.
+}
+
+
+
+
+ // essential members. Do not touch.
+void SignalProcessing::enter_critical_section(void)
+{
+ __disable_irq(); // globaly forbid all interrupt
+}
+
+void SignalProcessing::leave_critical_section(void)
+{
+ __enable_irq(); // globaly allow all interrupts
+}
+
