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
ハードウェアおよびソフトウェアはskelton_unzen_nucleo_f746を基本にしています。
signal_processing.h@15:de22b9d147e0, 2017-01-30 (annotated)
- Committer:
- shorie
- Date:
- Mon Jan 30 15:01:29 2017 +0000
- Revision:
- 15:de22b9d147e0
- Parent:
- 14:cec63d8da48c
- Child:
- 16:d4ea3e6a0bce
Update VFO.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shorie | 6:486b1cb03e61 | 1 | #ifndef _SIGNAL_PROCESSING_H_ |
shorie | 6:486b1cb03e61 | 2 | #define _SIGNAL_PROCESSING_H_ |
shorie | 6:486b1cb03e61 | 3 | |
shorie | 6:486b1cb03e61 | 4 | #include "amakusa.h" |
shorie | 6:486b1cb03e61 | 5 | |
shorie | 14:cec63d8da48c | 6 | enum wave_style { triangle, square }; |
shorie | 14:cec63d8da48c | 7 | |
shorie | 14:cec63d8da48c | 8 | // User Signal processing Class |
shorie | 14:cec63d8da48c | 9 | class VFO { |
shorie | 14:cec63d8da48c | 10 | public: |
shorie | 14:cec63d8da48c | 11 | // essential members. Do not touch |
shorie | 14:cec63d8da48c | 12 | VFO( void ); |
shorie | 14:cec63d8da48c | 13 | void run( |
shorie | 14:cec63d8da48c | 14 | float out_buffer[], // place to write the right output samples |
shorie | 14:cec63d8da48c | 15 | unsigned int block_size // block size [sample] |
shorie | 14:cec63d8da48c | 16 | ); |
shorie | 14:cec63d8da48c | 17 | |
shorie | 14:cec63d8da48c | 18 | // parameter settings |
shorie | 14:cec63d8da48c | 19 | void set_frequency( int freq ); // unit is Hz. |
shorie | 14:cec63d8da48c | 20 | void set_Fs( int Fs ); // unit is Hz. |
shorie | 14:cec63d8da48c | 21 | void set_duty_cycle( float duty ); // 0 ... 0.5 |
shorie | 14:cec63d8da48c | 22 | void set_wave_style( wave_style style ); |
shorie | 14:cec63d8da48c | 23 | private: |
shorie | 14:cec63d8da48c | 24 | |
shorie | 14:cec63d8da48c | 25 | // internal variables.. |
shorie | 14:cec63d8da48c | 26 | int frequency; // VFO frequency [Hz] |
shorie | 14:cec63d8da48c | 27 | int Fs; // sampling Frequency [Hz] |
shorie | 14:cec63d8da48c | 28 | float duty_cycle; // VFO duty cycle. 0 ... 0.5 |
shorie | 14:cec63d8da48c | 29 | wave_style style; // style of the wave form. |
shorie | 15:de22b9d147e0 | 30 | int current_phase; // internal variable of VFO. |
shorie | 15:de22b9d147e0 | 31 | int half_way; // change point by duty cycle. ( period * duty_cycle ). |
shorie | 15:de22b9d147e0 | 32 | |
shorie | 15:de22b9d147e0 | 33 | void update_parameter(); // call one of the parameter is changed. |
shorie | 14:cec63d8da48c | 34 | }; |
shorie | 14:cec63d8da48c | 35 | |
shorie | 14:cec63d8da48c | 36 | |
shorie | 6:486b1cb03e61 | 37 | // User Signal processing Class |
shorie | 6:486b1cb03e61 | 38 | class SignalProcessing { |
shorie | 6:486b1cb03e61 | 39 | public: |
shorie | 6:486b1cb03e61 | 40 | // essential members. Do not touch |
shorie | 6:486b1cb03e61 | 41 | SignalProcessing( unsigned int block_size ); |
shorie | 6:486b1cb03e61 | 42 | void run( |
shorie | 6:486b1cb03e61 | 43 | float rx_left_buffer[], // array of the left input samples |
shorie | 6:486b1cb03e61 | 44 | float rx_right_buffer[], // array of the right input samples |
shorie | 6:486b1cb03e61 | 45 | float tx_left_buffer[], // place to write the left output samples |
shorie | 13:b33cb5925113 | 46 | float tx_right_buffer[], // place to write the right output samples |
shorie | 6:486b1cb03e61 | 47 | unsigned int block_size // block size [sample] |
shorie | 6:486b1cb03e61 | 48 | ); |
shorie | 6:486b1cb03e61 | 49 | |
shorie | 6:486b1cb03e61 | 50 | // project depenedent members. |
shorie | 6:486b1cb03e61 | 51 | void set_volume( float vol ); |
shorie | 14:cec63d8da48c | 52 | void set_Fs( int Fs ); // unit is Hz. |
shorie | 15:de22b9d147e0 | 53 | void set_vfo_frequency( int freq ); // unit is Hz. |
shorie | 15:de22b9d147e0 | 54 | void set_vfo_duty_cycle( float duty ); // 0 ... 0.5 |
shorie | 15:de22b9d147e0 | 55 | void set_vfo_wave_style( wave_style style ); |
shorie | 6:486b1cb03e61 | 56 | private: |
shorie | 6:486b1cb03e61 | 57 | // essential members. Do not touch. |
shorie | 6:486b1cb03e61 | 58 | void enter_critical_section(void); |
shorie | 6:486b1cb03e61 | 59 | void leave_critical_section(void); |
shorie | 6:486b1cb03e61 | 60 | |
shorie | 6:486b1cb03e61 | 61 | // project dependent members. |
shorie | 14:cec63d8da48c | 62 | float volume_level; // 0 ... 1.0 |
shorie | 14:cec63d8da48c | 63 | VFO *vfo; |
shorie | 6:486b1cb03e61 | 64 | }; |
shorie | 6:486b1cb03e61 | 65 | |
shorie | 6:486b1cb03e61 | 66 | #endif |