morse.h File Reference

#include <stdint.h>
#include "audio.h"

Include dependency graph for morse.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  morse_stats_ts

Defines

#define DEBUG_GRAPH_INTERFACE   0
#define FFT_DATA_SIZE_DIVISOR   4
 Divide the number of FFT terms by this, before graphing.
#define register_debug_plot(a)

Typedefs

typedef void(* UI_update_status )(uint32_t ffts, uint32_t samples, double wpm)
 Inteface functions for morse GUI handling.
typedef void(* UI_scope_plot )(double *vector, uint32_t num_points)
typedef void(* UI_display_character )(char *character)
typedef void(* UI_debug_plot )(const int8_t *plot, int32_t y)
typedef void(* UI_Morse_statistics )(const morse_stats_ts *morse_status_ps)

Enumerations

enum  te_morse_plot_type { NO_PLOT = 0, PLOT_FFT, PLOT_SCOPE }
 Possible ploting type supported in GUI. More...
enum  te_morse_filter_enable { MORSE_DISABLE_FILTER = 0, MORSE_ENABLE_FILTER }
enum  te_morse_agc_enable { MORSE_DISABLE_AGC = 0, MORSE_ENABLE_AGC }
enum  te_morse_thread_state { THREADS_NOT_RUNNING = 0, THREADS_STARTING, THREADS_RUNNING, THREADS_CANCELING }
 Thread states. More...

Functions

double morse_max_wpm_supported (double sample_frequency, double packet_length)
 Returns the maximum words per minute that can be supported, based on seletected audio settings. */.
int32_t morse_start_threads (void)
 Starts the data acquisition and morse code detector threads.
te_morse_thread_state morse_stop_threads (void)
void morse_set_cw_frequency (int32_t freq)
void morse_set_filter_bandwidth (int32_t bw)
int32_t morse_get_filter_bandwidth (void)
void morse_set_filter_taps (uint32_t taps)
uint32_t morse_get_filter_taps (void)
void morse_set_filter_apply (te_morse_filter_enable apply)
void morse_set_agc_apply (te_morse_agc_enable agc_apply)
uint32_t morse_get_tone_packet_size (void)
 Returns the current packet size for FFT tone detection.
void morse_set_tone_packet_size (int32_t tone_packet_size)
 Sets the FFT data packet size to be used for morse tone detection.
uint32_t morse_get_fft_data_size (void)
 Returns the array size for the FFT data.
void morse_set_fft_data_size (uint32_t fft_data_size)
 Sets the array data size for the FFT data array.
double morse_get_fft_graph_top (void)
 Returns the top (max amplitude) of the current FFT window.
p_audio_device morse_audio_rec_dev_get (void)
int32_t morse_audio_device_type_id_get (void)
void morse_audio_device_type_id_set (int32_t audio_device_type_id)
void morse_audio_sample_rate_set (int32_t Hertz)
int32_t morse_audio_sample_rate_get (void)
te_morse_plot_type morse_get_plot_type (void)
 Returns the current plot type, FFT, Scope, or NONE.
void morse_set_plot_type (te_morse_plot_type plt_type)
 Set the desired plot type, this usually comes from some GUI callback/event.
te_morse_thread_state morse_get_thread_state (void)
void morse_initialize (void)
void morse_shutdown (void)
void set_update_status_hndlr (UI_update_status hndlr)
void set_scope_plot_hndlr (UI_scope_plot hndlr)
void set_display_character_hndlr (UI_display_character hndlr)
void set_Morse_statistics_display_hndlr (UI_Morse_statistics hndlr)


Define Documentation

#define DEBUG_GRAPH_INTERFACE   0

Use the plotting capabilities from rscw for debugging purposes.

Definition at line 29 of file morse.h.

#define FFT_DATA_SIZE_DIVISOR   4

Divide the number of FFT terms by this, before graphing.

Definition at line 33 of file morse.h.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

#define register_debug_plot (  ) 

Definition at line 186 of file morse.h.

Referenced by init_gui_interface_hooks().


Typedef Documentation

typedef void(* UI_debug_plot)(const int8_t *plot, int32_t y)

Inteface functions for debug plots

Definition at line 74 of file morse.h.

typedef void(* UI_display_character)(char *character)

Definition at line 72 of file morse.h.

typedef void(* UI_Morse_statistics)(const morse_stats_ts *morse_status_ps)

Definition at line 75 of file morse.h.

typedef void(* UI_scope_plot)(double *vector, uint32_t num_points)

Definition at line 71 of file morse.h.

typedef void(* UI_update_status)(uint32_t ffts, uint32_t samples, double wpm)

Inteface functions for morse GUI handling.

Definition at line 70 of file morse.h.


Enumeration Type Documentation

AGC (automatic gain control) options.

Enumerator:
MORSE_DISABLE_AGC  Do not apply AGC.
MORSE_ENABLE_AGC  Apply AGC.

Definition at line 54 of file morse.h.

Filter apply options.

Enumerator:
MORSE_DISABLE_FILTER  Do not apply Filter.
MORSE_ENABLE_FILTER  Apply Filter.

Definition at line 46 of file morse.h.

Possible ploting type supported in GUI.

Enumerator:
NO_PLOT  No plot.
PLOT_FFT  Plot the FFT, normal for selecting frequency to decode.
PLOT_SCOPE  Plot a display of the incoming audio. good for setting correct audio level.

Definition at line 36 of file morse.h.

Thread states.

Enumerator:
THREADS_NOT_RUNNING 
THREADS_STARTING 
THREADS_RUNNING 
THREADS_CANCELING  Waiting for pthread_join.

Definition at line 84 of file morse.h.


Function Documentation

int32_t morse_audio_device_type_id_get ( void   ) 

Get the current audio device type Id.

Returns:
The audio devicetype ID.

Definition at line 979 of file morse.c.

References ts_morse_settings::audio_type_id.

Referenced by on_morse2txt_properties_show(), and save_config_file().

void morse_audio_device_type_id_set ( int32_t  audio_device_type_id  ) 

Set the current audio device type Id.

Parameters:
audio_device_type_id The Id of the audio device type..

Definition at line 986 of file morse.c.

References ts_morse_settings::audio_type_id.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

p_audio_device morse_audio_rec_dev_get ( void   ) 

Returns pointer to the audio record device.

Definition at line 970 of file morse.c.

References ts_morse_settings::audio_rec_dev.

Referenced by load_config_file(), on_morse2txt_properties_apply(), on_morse2txt_properties_show(), and save_config_file().

int32_t morse_audio_sample_rate_get ( void   ) 

Get the current audio sample rate.

Returns:
Sample frequency.
Note:
This assumes record and playback are at the same rate. The audio API could support multiple cards at different rates, but that capability will not be used for now.

Definition at line 976 of file morse.c.

References ts_morse_settings::sample_frequency.

Referenced by on_morse2txt_properties_show(), and save_config_file().

void morse_audio_sample_rate_set ( int32_t  Hertz  ) 

Set the audio sample rate.

Parameters:
Hertz The desired sample rate in Hertz.

Definition at line 971 of file morse.c.

References ts_morse_settings::sample_frequency.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

uint32_t morse_get_fft_data_size ( void   ) 

Returns the array size for the FFT data.

Definition at line 967 of file morse.c.

References ts_morse_settings::fft_data_size.

Referenced by get_fft_data_size(), on_morse2txt_properties_apply(), and on_scope_fft_button_clicked().

double morse_get_fft_graph_top ( void   ) 

Returns the top (max amplitude) of the current FFT window.

Definition at line 969 of file morse.c.

References FFT_GRAPH_TOP.

Referenced by get_fft_graph_top(), on_morse2txt_properties_apply(), and on_scope_fft_button_clicked().

int32_t morse_get_filter_bandwidth ( void   ) 

Get the bandwidth of the FIR window filter.

Definition at line 962 of file morse.c.

References ts_morse_data::filter_bandwidth.

Referenced by main(), and save_config_file().

uint32_t morse_get_filter_taps ( void   ) 

Get the number of taps in the FIR window filter.

Definition at line 964 of file morse.c.

References ts_morse_data::filter_taps.

Referenced by on_morse2txt_properties_show(), and save_config_file().

te_morse_plot_type morse_get_plot_type ( void   ) 

Returns the current plot type, FFT, Scope, or NONE.

Definition at line 1000 of file morse.c.

References scope_or_fft.

Referenced by on_scope_fft_button_clicked().

te_morse_thread_state morse_get_thread_state ( void   ) 

Returns the current state of the morse threads.

Definition at line 995 of file morse.c.

References run.

Referenced by on_startbutton_clicked().

uint32_t morse_get_tone_packet_size ( void   ) 

Returns the current packet size for FFT tone detection.

Definition at line 965 of file morse.c.

References ts_morse_settings::tone_packet_size.

Referenced by get_tone_packet_size(), load_config_file(), on_morse2txt_properties_apply(), on_morse2txt_properties_show(), on_scope_fft_button_clicked(), and save_config_file().

void morse_initialize ( void   ) 

Morse Constructor Make sure all interfaces are NULL to start, this must be called before running morse.

Definition at line 1088 of file morse.c.

References audio_create(), AUDIO_DEVICE_RECORD, ts_morse_settings::audio_rec_dev, ts_morse_settings::audio_type_id, IMorse::cb_display_character, IMorse::cb_Morse_statistics, IMorse::cb_morse_status, IMorse::cb_scope_plot, and IMorse::debug_plot.

Referenced by main().

Here is the call graph for this function:

double morse_max_wpm_supported ( double  sample_frequency,
double  packet_length 
)

Returns the maximum words per minute that can be supported, based on seletected audio settings. */.

Definition at line 1010 of file morse.c.

References MIN_NUM_PACKS_PER_DIT, and WPM_SECONDS_PER_DIT.

Referenced by on_morse2txt_properties_show(), and widget_in_property_box_changed().

void morse_set_agc_apply ( te_morse_agc_enable  agc_apply  ) 

Enables or disables AGC.

Parameters:
agc_apply AGC apply.
See also:
te_morse_filter_enable

Definition at line 951 of file morse.c.

References ts_morse_data::apply_agc.

Referenced by on_agc_apply_btn_toggled().

void morse_set_cw_frequency ( int32_t  freq  ) 

Set the desired CW frequency to decode.

Definition at line 952 of file morse.c.

References ts_morse_data::cw_frequency, and morse_recompute_filter().

Referenced by on_adjustment_release_event().

Here is the call graph for this function:

void morse_set_fft_data_size ( uint32_t  fft_data_size  ) 

Sets the array data size for the FFT data array.

Definition at line 968 of file morse.c.

References ts_morse_settings::fft_data_size.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

void morse_set_filter_apply ( te_morse_filter_enable  apply  ) 

Enables or disables filter.

Parameters:
apply Filter apply.
See also:
te_morse_filter_enable

Definition at line 950 of file morse.c.

References ts_morse_data::apply_fir.

Referenced by on_enable_fir_button_toggled().

void morse_set_filter_bandwidth ( int32_t  bw  ) 

Set the bandwidth of the FIR window filter.

Definition at line 957 of file morse.c.

References ts_morse_data::filter_bandwidth, and morse_recompute_filter().

Referenced by load_config_file(), and on_filter_bw_activate().

Here is the call graph for this function:

void morse_set_filter_taps ( uint32_t  taps  ) 

Set the number of taps in the FIR window filter.

Definition at line 963 of file morse.c.

References ts_morse_data::filter_taps.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

void morse_set_plot_type ( te_morse_plot_type  plt_type  ) 

Set the desired plot type, this usually comes from some GUI callback/event.

Definition at line 1004 of file morse.c.

References scope_or_fft.

Referenced by on_scope_fft_button_clicked().

void morse_set_tone_packet_size ( int32_t  tone_packet_size  ) 

Sets the FFT data packet size to be used for morse tone detection.

Definition at line 966 of file morse.c.

References ts_morse_settings::tone_packet_size.

Referenced by load_config_file(), and on_morse2txt_properties_apply().

void morse_shutdown ( void   ) 

Morse Destructor

Definition at line 1100 of file morse.c.

References audio_destroy(), and ts_morse_settings::audio_rec_dev.

Referenced by main().

Here is the call graph for this function:

int32_t morse_start_threads ( void   ) 

Starts the data acquisition and morse code detector threads.

Note:
Goto's are bad? I'm sure that's what you were taught... It does yield a unified exit strategy for a function though, without explicit multiple exit points. No need to "nest" all of the above if statements as well.

Definition at line 413 of file morse.c.

References agc_create(), ts_morse_data::agc_dg, AGC_FULL_SCALE_DELAY_SECS, audio_data, audio_device_samples_get(), audio_open(), audio_post_process(), AUDIO_POST_PROCESSING_THREAD, ts_morse_settings::audio_rec_dev, audio_sample_rate_get(), ts_morse_data::dah_statistics, data_collection(), DATA_COLLECTION_THREAD, DG_MEDIAN, dglitch_create(), ts_morse_data::dit_statistics, DT_HAMMING_WINDOW, ts_morse_data::dt_w, dt_window_create(), ts_morse_data::fft_amp_pa, ts_morse_settings::fft_amp_pa_size, fft_data, FFT_DATA_MAX_GAIN, FFT_DATA_MIN_GAIN, ts_morse_settings::fft_freq_step, FFT_GRAPH_TOP, FFT_NOISE_FLOOR, fft_performed, FFT_SCOPE_GAIN_DOWN_CRR_FACTOR, ts_morse_data::filter_taps, ts_morse_data::fir_filter, free_all(), FW_BANDPASS, FW_BLACKMAN, fwin_create(), MIN_NUM_PACKS_PER_DIT, ts_morse_settings::minimum_tone_duration, MORSE_AGC_TYPE, morse_code(), MORSE_CODE_DECODING_THREAD, morse_recompute_filter(), ts_morse_data::packet_amp_array_dg, run, ts_morse_settings::sample_frequency, ts_morse_statistics::samples, samples_processed, ts_morse_data::scope_gain, THREADS_NOT_RUNNING, THREADS_RUNNING, THREADS_STARTING, tid, ts_morse_settings::tone_packet_duration, and ts_morse_settings::tone_packet_size.

Referenced by on_startbutton_clicked().

Here is the call graph for this function:

te_morse_thread_state morse_stop_threads ( void   ) 

Stops the data acquisition and morse code detector threads.

See also:
te_morse_thread_state

Definition at line 522 of file morse.c.

References AUDIO_POST_PROCESSING_THREAD, DATA_COLLECTION_THREAD, free_all(), MORSE_CODE_DECODING_THREAD, run, THREADS_CANCELING, THREADS_NOT_RUNNING, THREADS_RUNNING, and tid.

Referenced by threads_stop().

Here is the call graph for this function:

void set_display_character_hndlr ( UI_display_character  hndlr  ) 

Set the GUI handler that appends a decoded morece character to the display.

register display character handler.

Definition at line 1084 of file morse.c.

References IMorse::cb_display_character.

Referenced by init_gui_interface_hooks().

void set_Morse_statistics_display_hndlr ( UI_Morse_statistics  hndlr  ) 

Set the GUI handler that displays Morse statistics.

register Morse statistics display handler.

Definition at line 1086 of file morse.c.

References IMorse::cb_Morse_statistics.

Referenced by init_gui_interface_hooks().

void set_scope_plot_hndlr ( UI_scope_plot  hndlr  ) 

Set the GUI handler for real-time data plotting for either FFT's or Scope.

register plot handler.

Definition at line 1082 of file morse.c.

References IMorse::cb_scope_plot.

Referenced by init_gui_interface_hooks().

void set_update_status_hndlr ( UI_update_status  hndlr  ) 

Set the GUI handler for status bar updates.

register status bar GUI handler.

Definition at line 1080 of file morse.c.

References IMorse::cb_morse_status.

Referenced by init_gui_interface_hooks().


Generated on Mon Jun 22 21:39:36 2009 for morse2txt by  doxygen 1.5.6