Remove radio disconnect

This commit is contained in:
Greg Shuflin 2021-02-28 11:33:05 -08:00
parent 2315ee4a74
commit cece963e91
2 changed files with 13 additions and 16 deletions

14
radio.c
View File

@ -63,20 +63,6 @@ static radio_device_t *device; // Device-dependent interface
unsigned char radio_mem [1024*1024*2]; // Radio memory contents, up to 2 Mbytes
int radio_progress; // Read/write progress counter
//
// Close the serial port.
//
void radio_disconnect()
{
fprintf(stderr, "Close device.\n");
// Restore the normal radio mode.
dfu_reboot();
dfu_close();
hid_close();
serial_close();
}
//
// Print a generic information about the device.
//

View File

@ -7,7 +7,7 @@ pub struct RadioDeviceT { _private: [u8; 0] }
extern {
fn radio_connect() -> *const RadioDeviceT;
fn radio_disconnect();
fn radio_download(device: *const RadioDeviceT);
fn radio_upload(device: *const RadioDeviceT, cont_flag: c_int);
fn radio_list_c();
@ -18,6 +18,11 @@ extern {
fn radio_save_image(device: *const RadioDeviceT, filename: *const c_char);
fn radio_parse_config(device: *const RadioDeviceT, filename: *const c_char);
fn radio_write_csv(device: *const RadioDeviceT, filename: *const c_char);
fn dfu_reboot();
fn dfu_close();
fn hid_close();
fn serial_close();
}
/// Connect to the radio via the serial port.
@ -30,8 +35,14 @@ pub fn connect() -> *const RadioDeviceT {
/// Close the serial port.
pub fn disconnect() {
eprintln!("Close device.");
unsafe {
radio_disconnect()
// Restore the normal radio mode.
dfu_reboot();
dfu_close();
hid_close();
serial_close();
}
}