Merge pull request #698 from miek/operacake_init_fixes
Operacake GPIO init fixes
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "hackrf_core.h"
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
#include "si5351c.h"
|
||||
#include "spi_ssp.h"
|
||||
#include "max2837.h"
|
||||
@ -916,4 +916,4 @@ void halt_and_flash(const uint32_t duration) {
|
||||
led_off(LED3);
|
||||
delay(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
#include "ui_portapack.h"
|
||||
#include "ui_rad1o.h"
|
||||
@ -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.
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <hackrf_core.h>
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
#include <mixer.h>
|
||||
#include <max2837.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "tuning.h"
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
#include <hackrf_core.h>
|
||||
#include <mixer.h>
|
||||
|
@ -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() {
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __UI_PORTAPACK_H__
|
||||
#define __UI_PORTAPACK_H__
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
const hackrf_ui_t* portapack_hackrf_ui_init() __attribute__((weak));
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __UI_RAD1O_H__
|
||||
#define __UI_RAD1O_H__
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
const hackrf_ui_t* rad1o_ui_setup(void) __attribute__((weak));
|
||||
|
||||
|
@ -159,7 +159,7 @@ macro(DeclareTargets)
|
||||
${PATH_HACKRF_FIRMWARE_COMMON}/spi_bus.c
|
||||
${PATH_HACKRF_FIRMWARE_COMMON}/spi_ssp.c
|
||||
${PATH_HACKRF_FIRMWARE_COMMON}/gpio_lpc.c
|
||||
${PATH_HACKRF_FIRMWARE_COMMON}/hackrf-ui.c
|
||||
${PATH_HACKRF_FIRMWARE_COMMON}/hackrf_ui.c
|
||||
)
|
||||
|
||||
if(BOARD STREQUAL "RAD1O")
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "cpld_xc2c.h"
|
||||
#include "portapack.h"
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
|
||||
extern uint32_t __m0_start__;
|
||||
extern uint32_t __m0_end__;
|
||||
@ -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;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "usb_api_transceiver.h"
|
||||
|
||||
#include "hackrf-ui.h"
|
||||
#include "hackrf_ui.h"
|
||||
#include <libopencm3/cm3/vector.h>
|
||||
#include "usb_bulk_buffer.h"
|
||||
|
||||
|
Reference in New Issue
Block a user