GNU Radio's TEST Package
fosphor.h
Go to the documentation of this file.
1 /*
2  * fosphor.h
3  *
4  * Main fosphor entry point
5  *
6  * Copyright (C) 2013-2014 Sylvain Munaut
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __FOSPHOR_FOSPHOR_H__
23 #define __FOSPHOR_FOSPHOR_H__
24 
25 /*! \defgroup fosphor
26  * @{
27  */
28 
29 /*! \file fosphor.h
30  * \brief Main fosphor entry point
31  */
32 
33 struct fosphor;
34 struct fosphor_render;
35 
36 
37 /* Main API */
38 
39 struct fosphor *fosphor_init(void);
40 void fosphor_release(struct fosphor *self);
41 
42 int fosphor_process(struct fosphor *self, void *samples, int len);
43 void fosphor_draw(struct fosphor *self, struct fosphor_render *render);
44 
45 void fosphor_set_fft_window_default(struct fosphor *self);
46 void fosphor_set_fft_window(struct fosphor *self, float *win);
47 
48 void fosphor_set_power_range(struct fosphor *self, int db_ref, int db_per_div);
49 void fosphor_set_frequency_range(struct fosphor *self,
50  double center, double span);
51 
52 
53 /* Render */
54 
55 #define FOSPHOR_MAX_CHANNELS 8
56 
58 {
59  int enabled; /*!< \brief Showed (1) or hidden (0) */
60  float center; /*!< \brief Normalized center frequency */
61  float width; /*!< \brief Normalized bandwidth */
62 };
63 
64 #define FRO_LIVE (1<<0) /*!< \brief Display live spectrum */
65 #define FRO_MAX_HOLD (1<<1) /*!< \brief Display max-hold spectrum */
66 #define FRO_HISTO (1<<2) /*!< \brief Display histogram */
67 #define FRO_WATERFALL (1<<3) /*!< \brief Display waterfall */
68 #define FRO_LABEL_FREQ (1<<4) /*!< \brief Display frequency labels */
69 #define FRO_LABEL_PWR (1<<5) /*!< \brief Display power labels */
70 #define FRO_LABEL_TIME (1<<6) /*!< \brief Display time labels */
71 #define FRO_CHANNELS (1<<7) /*!< \brief Display channels */
72 #define FRO_COLOR_SCALE (1<<8) /*!< \brief Display intensity color scale */
73 
74 /*! \brief fosphor render options */
76 {
77  /* User fields */
78  int pos_x; /*!< \brief X origin (lower left corner) */
79  int pos_y; /*!< \brief Y origin (lower left corner) */
80  int width; /*!< \brief Width */
81  int height; /*!< \brief Height */
82  int options; /*!< \brief Options (See FRO_??? constants) */
83  float histo_wf_ratio; /*!< \brief Ratio histogram/waterfall ]0,1[ */
84  int freq_n_div; /*!< \brief Number of frequency divisions */
85  float freq_start; /*!< \brief Frequency zoom start [0,1[ */
86  float freq_stop; /*!< \brief Frequency zoom stop ]0,1] */
87  float wf_span; /*!< \brief Waterfall time zoom ]0,1] */
88 
89  /*! \brief Displayed channels */
91 
92  /* Private fields */
93  int _wf_pos; /*!< \brief (private) Waterfall position */
94 
95  float _x_div; /*!< \brief (private) X divisions width */
96  float _x[2]; /*!< \brief (private) X endpoints */
97  float _x_label; /*!< \brief (private) X location for labels */
98 
99  float _y_histo_div; /*!< \brief (private) Y histogram divisions height */
100  float _y_histo[2]; /*!< \brief (private) Y histogram endpoints */
101  float _y_wf[2]; /*!< \brief (private) Y waterfall endpoints */
102  float _y_label; /*!< \brief (private) Y location for label */
103 };
104 
105 void fosphor_render_defaults(struct fosphor_render *render);
106 void fosphor_render_refresh(struct fosphor_render *render);
107 
108 
109 /*! @} */
110 
111 #endif /* __FOSPHOR_FOSPHOR_H__ */
#define FOSPHOR_MAX_CHANNELS
Definition: fosphor.h:55
void fosphor_render_defaults(struct fosphor_render *render)
void fosphor_release(struct fosphor *self)
void fosphor_set_fft_window(struct fosphor *self, float *win)
float wf_span
Waterfall time zoom ]0,1].
Definition: fosphor.h:87
float _x_label
(private) X location for labels
Definition: fosphor.h:97
Definition: fosphor.h:57
int pos_x
X origin (lower left corner)
Definition: fosphor.h:78
Definition: private.h:43
float freq_start
Frequency zoom start [0,1[.
Definition: fosphor.h:85
float _x_div
(private) X divisions width
Definition: fosphor.h:95
struct fosphor * fosphor_init(void)
int _wf_pos
(private) Waterfall position
Definition: fosphor.h:93
int enabled
Showed (1) or hidden (0)
Definition: fosphor.h:59
int width
Width.
Definition: fosphor.h:80
void fosphor_set_frequency_range(struct fosphor *self, double center, double span)
double center
Definition: private.h:65
void fosphor_set_fft_window_default(struct fosphor *self)
void fosphor_set_power_range(struct fosphor *self, int db_ref, int db_per_div)
float _y_label
(private) Y location for label
Definition: fosphor.h:102
int db_per_div
Definition: private.h:59
int options
Options (See FRO_??? constants)
Definition: fosphor.h:82
int height
Height.
Definition: fosphor.h:81
int fosphor_process(struct fosphor *self, void *samples, int len)
float _y_histo_div
(private) Y histogram divisions height
Definition: fosphor.h:99
float freq_stop
Frequency zoom stop ]0,1].
Definition: fosphor.h:86
int db_ref
Definition: private.h:58
fosphor render options
Definition: fosphor.h:75
void fosphor_render_refresh(struct fosphor_render *render)
int freq_n_div
Number of frequency divisions.
Definition: fosphor.h:84
void fosphor_draw(struct fosphor *self, struct fosphor_render *render)
int pos_y
Y origin (lower left corner)
Definition: fosphor.h:79
double span
Definition: private.h:66
float width
Normalized bandwidth.
Definition: fosphor.h:61
float center
Normalized center frequency.
Definition: fosphor.h:60
float histo_wf_ratio
Ratio histogram/waterfall ]0,1[.
Definition: fosphor.h:83