Merge hackrf_stop_tx_cmd and hackrf_start_tx_cmd.

These both do the same thing: set transceiver mode to OFF.
This commit is contained in:
Martin Ling
2022-03-18 10:56:58 +00:00
parent 958c742189
commit b109a31fd3

View File

@ -1884,7 +1884,7 @@ int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn cal
return result; return result;
} }
static int hackrf_stop_rx_cmd(hackrf_device* device) static int hackrf_stop_cmd(hackrf_device* device)
{ {
int result; int result;
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); 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 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) 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; 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. * Stop any pending transmit.
* *
@ -1949,7 +1942,7 @@ int ADDCALL hackrf_stop_tx(hackrf_device* device)
return result; return result;
} }
return hackrf_stop_tx_cmd(device); return hackrf_stop_cmd(device);
} }
int ADDCALL hackrf_close(hackrf_device* device) int ADDCALL hackrf_close(hackrf_device* device)
@ -1962,8 +1955,8 @@ int ADDCALL hackrf_close(hackrf_device* device)
if( device != NULL ) if( device != NULL )
{ {
result1 = hackrf_stop_rx_cmd(device); result1 = hackrf_stop_cmd(device);
result2 = hackrf_stop_tx_cmd(device); result2 = hackrf_stop_cmd(device);
/* /*
* Finally kill the transfer thread, which will * Finally kill the transfer thread, which will