From b109a31fd3f2c636783ffd62f68502bf1753a495 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Fri, 18 Mar 2022 10:56:58 +0000 Subject: [PATCH] Merge hackrf_stop_tx_cmd and hackrf_start_tx_cmd. These both do the same thing: set transceiver mode to OFF. --- host/libhackrf/src/hackrf.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 7b0c0e0e..b5c1554e 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -1884,7 +1884,7 @@ int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn cal return result; } -static int hackrf_stop_rx_cmd(hackrf_device* device) +static int hackrf_stop_cmd(hackrf_device* device) { int result; result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); @@ -1909,7 +1909,7 @@ int ADDCALL hackrf_stop_rx(hackrf_device* device) return result; } - return hackrf_stop_rx_cmd(device); + return hackrf_stop_cmd(device); } int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx) @@ -1925,13 +1925,6 @@ int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn cal return result; } -static int hackrf_stop_tx_cmd(hackrf_device* device) -{ - int result; - result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); - return result; -} - /* * Stop any pending transmit. * @@ -1949,7 +1942,7 @@ int ADDCALL hackrf_stop_tx(hackrf_device* device) return result; } - return hackrf_stop_tx_cmd(device); + return hackrf_stop_cmd(device); } int ADDCALL hackrf_close(hackrf_device* device) @@ -1962,8 +1955,8 @@ int ADDCALL hackrf_close(hackrf_device* device) if( device != NULL ) { - result1 = hackrf_stop_rx_cmd(device); - result2 = hackrf_stop_tx_cmd(device); + result1 = hackrf_stop_cmd(device); + result2 = hackrf_stop_cmd(device); /* * Finally kill the transfer thread, which will