1 /*
2  * Copyright (C) 2018 Jared Boone, ShareBrained Technology, Inc.
3  *
4  * This file is part of HackRF.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; see the file COPYING.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef HACKRF_UI_H
23 #define HACKRF_UI_H
24 
25 #include <hackrf_core.h>
26 #include <stdint.h>
27 
28 typedef void (*hackrf_ui_init_fn)(void);
29 typedef void (*hackrf_ui_deinit_fn)(void);
30 typedef void (*hackrf_ui_set_frequency_fn)(uint64_t frequency);
31 typedef void (*hackrf_ui_set_sample_rate_fn)(uint32_t sample_rate);
32 typedef void (*hackrf_ui_set_direction_fn)(const rf_path_direction_t direction);
33 typedef void (*hackrf_ui_set_filter_bw_fn)(uint32_t bandwidth);
34 typedef void (*hackrf_ui_set_lna_power_fn)(bool lna_on);
35 typedef void (*hackrf_ui_set_bb_lna_gain_fn)(const uint32_t gain_db);
36 typedef void (*hackrf_ui_set_bb_vga_gain_fn)(const uint32_t gain_db);
37 typedef void (*hackrf_ui_set_bb_tx_vga_gain_fn)(const uint32_t gain_db);
38 typedef void (*hackrf_ui_set_first_if_frequency_fn)(const uint64_t frequency);
39 typedef void (*hackrf_ui_set_filter_fn)(const rf_path_filter_t filter);
40 typedef void (*hackrf_ui_set_antenna_bias_fn)(bool antenna_bias);
41 typedef void (*hackrf_ui_set_clock_source_fn)(clock_source_t source);
42 typedef bool (*hackrf_ui_operacake_gpio_compatible_fn)(void);
43 
44 typedef struct {
45 	hackrf_ui_init_fn init;
46 	hackrf_ui_deinit_fn deinit;
47 	hackrf_ui_set_frequency_fn set_frequency;
48 	hackrf_ui_set_sample_rate_fn set_sample_rate;
49 	hackrf_ui_set_direction_fn set_direction;
50 	hackrf_ui_set_filter_bw_fn set_filter_bw;
51 	hackrf_ui_set_lna_power_fn set_lna_power;
52 	hackrf_ui_set_bb_lna_gain_fn set_bb_lna_gain;
53 	hackrf_ui_set_bb_vga_gain_fn set_bb_vga_gain;
54 	hackrf_ui_set_bb_tx_vga_gain_fn set_bb_tx_vga_gain;
55 	hackrf_ui_set_first_if_frequency_fn set_first_if_frequency;
56 	hackrf_ui_set_filter_fn set_filter;
57 	hackrf_ui_set_antenna_bias_fn set_antenna_bias;
58 	hackrf_ui_set_clock_source_fn set_clock_source;
59 	hackrf_ui_operacake_gpio_compatible_fn operacake_gpio_compatible;
60 } hackrf_ui_t;
61 
62 /* TODO: Lame hack to know that PortaPack was detected.
63  * In the future, whatever UI was detected will be returned here,
64  * or NULL if no UI was detected.
65  */
66 const hackrf_ui_t* hackrf_ui(void);
67 void hackrf_ui_set_enable(bool);
68 
69 #endif
70