Fix Operacake GPIO mode initialisation
This commit is contained in:
@ -42,6 +42,7 @@ void hackrf_ui_set_first_if_frequency_null(const uint64_t frequency) { UNUSED(fr
|
||||
void hackrf_ui_set_filter_null(const rf_path_filter_t filter) { UNUSED(filter); }
|
||||
void hackrf_ui_set_antenna_bias_null(bool antenna_bias) { UNUSED(antenna_bias); }
|
||||
void hackrf_ui_set_clock_source_null(clock_source_t source) { UNUSED(source); }
|
||||
bool hackrf_ui_operacake_gpio_compatible_null(void) { return true; }
|
||||
|
||||
/* Null UI function table, used if there's no hardware UI detected. Eliminates the
|
||||
* need to check for null UI before calling a function in the table.
|
||||
@ -60,6 +61,7 @@ static const hackrf_ui_t hackrf_ui_null = {
|
||||
&hackrf_ui_set_filter_null,
|
||||
&hackrf_ui_set_antenna_bias_null,
|
||||
&hackrf_ui_set_clock_source_null,
|
||||
&hackrf_ui_operacake_gpio_compatible_null
|
||||
};
|
||||
|
||||
static const hackrf_ui_t* ui = NULL;
|
||||
|
@ -38,6 +38,7 @@ typedef void (*hackrf_ui_set_first_if_frequency_fn)(const uint64_t frequency);
|
||||
typedef void (*hackrf_ui_set_filter_fn)(const rf_path_filter_t filter);
|
||||
typedef void (*hackrf_ui_set_antenna_bias_fn)(bool antenna_bias);
|
||||
typedef void (*hackrf_ui_set_clock_source_fn)(clock_source_t source);
|
||||
typedef bool (*hackrf_ui_operacake_gpio_compatible_fn)(void);
|
||||
|
||||
typedef struct {
|
||||
hackrf_ui_init_fn init;
|
||||
@ -53,6 +54,7 @@ typedef struct {
|
||||
hackrf_ui_set_filter_fn set_filter;
|
||||
hackrf_ui_set_antenna_bias_fn set_antenna_bias;
|
||||
hackrf_ui_set_clock_source_fn set_clock_source;
|
||||
hackrf_ui_operacake_gpio_compatible_fn operacake_gpio_compatible;
|
||||
} hackrf_ui_t;
|
||||
|
||||
/* TODO: Lame hack to know that PortaPack was detected.
|
||||
|
@ -549,6 +549,10 @@ static void portapack_ui_set_clock_source(clock_source_t source) {
|
||||
portapack_lcd_draw_string(label_point, s);
|
||||
}
|
||||
|
||||
static bool portapack_ui_operacake_gpio_compatible(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hackrf_ui_t portapack_hackrf_ui = {
|
||||
&portapack_ui_init,
|
||||
&portapack_ui_set_frequency,
|
||||
@ -563,6 +567,7 @@ const hackrf_ui_t portapack_hackrf_ui = {
|
||||
&portapack_ui_set_filter,
|
||||
&portapack_ui_set_antenna_bias,
|
||||
&portapack_ui_set_clock_source,
|
||||
&portapack_ui_operacake_gpio_compatible,
|
||||
};
|
||||
|
||||
const hackrf_ui_t* portapack_hackrf_ui_init() {
|
||||
|
@ -88,6 +88,10 @@ static void rad1o_ui_set_clock_source(clock_source_t source) {
|
||||
hackrf_ui_setClockSource(source);
|
||||
}
|
||||
|
||||
static bool rad1o_ui_operacake_gpio_compatible(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const hackrf_ui_t rad1o_ui = {
|
||||
&rad1o_ui_init,
|
||||
&rad1o_ui_set_frequency,
|
||||
@ -102,6 +106,7 @@ static const hackrf_ui_t rad1o_ui = {
|
||||
&rad1o_ui_set_filter,
|
||||
&rad1o_ui_set_antenna_bias,
|
||||
&rad1o_ui_set_clock_source,
|
||||
&rad1o_ui_operacake_gpio_compatible,
|
||||
};
|
||||
|
||||
const hackrf_ui_t* rad1o_ui_setup(void) {
|
||||
|
@ -241,7 +241,7 @@ int main(void) {
|
||||
|
||||
rf_path_init(&rf_path);
|
||||
|
||||
if( hackrf_ui() == NULL ) {
|
||||
if( hackrf_ui()->operacake_gpio_compatible() ) {
|
||||
operacake_allow_gpio = true;
|
||||
} else {
|
||||
operacake_allow_gpio = false;
|
||||
|
Reference in New Issue
Block a user