From 0e8e3c8d53d48f0174606593d5b9ec76894543c6 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 17 Sep 2013 15:27:16 -0700 Subject: [PATCH] Push MAX2837 state management into rf_path_set_direction(). --- firmware/common/rf_path.c | 5 +++++ firmware/hackrf_usb/hackrf_usb.c | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/firmware/common/rf_path.c b/firmware/common/rf_path.c index 0444ae0e..a8e10417 100644 --- a/firmware/common/rf_path.c +++ b/firmware/common/rf_path.c @@ -82,6 +82,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) { } else { rffc5071_enable(); } + max2837_start(); + max2837_tx(); break; case RF_PATH_DIRECTION_RX: @@ -96,6 +98,8 @@ void rf_path_set_direction(const rf_path_direction_t direction) { } else { rffc5071_enable(); } + max2837_start(); + max2837_rx(); break; case RF_PATH_DIRECTION_OFF: @@ -103,6 +107,7 @@ void rf_path_set_direction(const rf_path_direction_t direction) { /* Set RF path to receive direction when "off" */ switchctrl &= ~SWITCHCTRL_TX; rffc5071_disable(); + max2837_stop(); break; } diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 61c70430..dfa361a2 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -179,23 +179,16 @@ void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) { gpio_clear(PORT_LED1_3, PIN_LED3); gpio_set(PORT_LED1_3, PIN_LED2); usb_endpoint_init(&usb_endpoint_bulk_in); - rf_path_set_direction(RF_PATH_DIRECTION_RX); - max2837_start(); - max2837_rx(); } else if (transceiver_mode == TRANSCEIVER_MODE_TX) { gpio_clear(PORT_LED1_3, PIN_LED2); gpio_set(PORT_LED1_3, PIN_LED3); usb_endpoint_init(&usb_endpoint_bulk_out); - rf_path_set_direction(RF_PATH_DIRECTION_TX); - max2837_start(); - max2837_tx(); } else { gpio_clear(PORT_LED1_3, PIN_LED2); gpio_clear(PORT_LED1_3, PIN_LED3); rf_path_set_direction(RF_PATH_DIRECTION_OFF); - max2837_stop(); return; }