00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MORSE_H
00022 #define MORSE_H
00023
00024 #include <stdint.h>
00025 #include "audio.h"
00026
00027
00029 #define DEBUG_GRAPH_INTERFACE 0
00030
00031
00033 #define FFT_DATA_SIZE_DIVISOR 4
00034
00036 typedef enum {
00038 NO_PLOT = 0,
00040 PLOT_FFT,
00042 PLOT_SCOPE
00043 } te_morse_plot_type;
00044
00046 typedef enum {
00048 MORSE_DISABLE_FILTER = 0,
00050 MORSE_ENABLE_FILTER
00051 } te_morse_filter_enable;
00052
00054 typedef enum {
00056 MORSE_DISABLE_AGC = 0,
00058 MORSE_ENABLE_AGC
00059 } te_morse_agc_enable;
00060
00062 typedef struct morse_stats_ts {
00063 double avg_dit_dur;
00064 double avg_dah_dur;
00065 double dah_dit_ratio;
00066 double wpm;
00067 } morse_stats_ts;
00068
00070 typedef void (*UI_update_status)(uint32_t ffts, uint32_t samples, double wpm);
00071 typedef void (*UI_scope_plot)(double *vector, uint32_t num_points);
00072 typedef void (*UI_display_character)(char *character);
00074 typedef void (*UI_debug_plot)(const int8_t *plot, int32_t y);
00075 typedef void (*UI_Morse_statistics)(const morse_stats_ts* morse_status_ps);
00076
00078 double morse_max_wpm_supported(double sample_frequency, double packet_length);
00079
00081 int32_t morse_start_threads(void);
00082
00084 typedef enum {
00085 THREADS_NOT_RUNNING = 0,
00086 THREADS_STARTING,
00087 THREADS_RUNNING,
00089 THREADS_CANCELING
00090 } te_morse_thread_state;
00091
00095 te_morse_thread_state morse_stop_threads(void);
00096
00098 void morse_set_cw_frequency(int32_t freq);
00099
00101 void morse_set_filter_bandwidth(int32_t bw);
00103 int32_t morse_get_filter_bandwidth(void);
00104
00106 void morse_set_filter_taps(uint32_t taps);
00108 uint32_t morse_get_filter_taps(void);
00109
00114 void morse_set_filter_apply(te_morse_filter_enable apply);
00115
00120 void morse_set_agc_apply(te_morse_agc_enable agc_apply);
00121
00123 uint32_t morse_get_tone_packet_size(void);
00125 void morse_set_tone_packet_size(int32_t tone_packet_size);
00126
00128 uint32_t morse_get_fft_data_size(void);
00130 void morse_set_fft_data_size(uint32_t fft_data_size);
00132 double morse_get_fft_graph_top(void);
00134 p_audio_device morse_audio_rec_dev_get(void);
00135
00139 int32_t morse_audio_device_type_id_get(void);
00140
00144 void morse_audio_device_type_id_set(int32_t audio_device_type_id);
00145
00149 void morse_audio_sample_rate_set(int32_t Hertz);
00150
00154 int32_t morse_audio_sample_rate_get(void);
00155
00157 te_morse_plot_type morse_get_plot_type(void);
00159 void morse_set_plot_type(te_morse_plot_type plt_type);
00161 te_morse_thread_state morse_get_thread_state(void);
00162
00166 void morse_initialize(void);
00167
00169 void morse_shutdown(void);
00170
00172 void set_update_status_hndlr(UI_update_status hndlr);
00173
00175 void set_scope_plot_hndlr(UI_scope_plot hndlr);
00176
00178 void set_display_character_hndlr(UI_display_character hndlr);
00179
00181 void set_Morse_statistics_display_hndlr(UI_Morse_statistics hndlr);
00182
00183 #if DEBUG_GRAPH_INTERFACE == 1
00184 void register_debug_plot(UI_debug_plot hndlr);
00185 #else
00186 #define register_debug_plot(a)
00187 #endif
00188
00189 #endif