Move active pointer code to Rust
This commit is contained in:
parent
0acf55a971
commit
5658759cf3
10
radio.c
10
radio.c
@ -59,16 +59,6 @@ static radio_tab_t radio_tab[] = {
|
||||
};
|
||||
*/
|
||||
|
||||
static radio_device_t *active_device; // Device-dependent interface
|
||||
|
||||
radio_device_t* get_active_device() {
|
||||
return active_device;
|
||||
}
|
||||
|
||||
void set_active_device(radio_device_t* d) {
|
||||
active_device = d;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the configuration from text file, and modify the firmware.
|
||||
//
|
||||
|
15
src/radio.rs
15
src/radio.rs
@ -37,9 +37,6 @@ pub static mut radio_mem: [u8; 1024*1024*2] = [0; 1024*1024*2];
|
||||
|
||||
extern {
|
||||
|
||||
fn get_active_device() -> *const radio_device_t;
|
||||
fn set_active_device(device: *const radio_device_t);
|
||||
|
||||
fn radio_parse_config(device: *const radio_device_t, filename: *const c_char);
|
||||
|
||||
fn dfu_init(vid: c_uint, pid: c_uint) -> *const c_char;
|
||||
@ -55,6 +52,18 @@ extern {
|
||||
fn serial_close();
|
||||
}
|
||||
|
||||
|
||||
static mut active_device: *const radio_device_t = std::ptr::null(); // Device-dependent interface
|
||||
|
||||
unsafe fn get_active_device() -> *const radio_device_t {
|
||||
return active_device;
|
||||
}
|
||||
|
||||
unsafe fn set_active_device(d: *const radio_device_t) {
|
||||
active_device = d;
|
||||
}
|
||||
|
||||
|
||||
/// Connect to the radio via the serial port.
|
||||
/// and identify the type of device.
|
||||
pub fn connect() -> Radio {
|
||||
|
Loading…
Reference in New Issue
Block a user