use crate::utils::ffi;
pub fn emcy_get_history(
master_index: u16,
slave_index: u16,
max_records: usize,
) -> Vec<crate::utils::ffi::EmcyRecord> {
let mut records = vec![crate::utils::ffi::EmcyRecord::default(); max_records];
let count = unsafe {
ffi::EmcyGetHistory(
master_index,
slave_index,
records.as_mut_ptr(),
max_records as i32,
)
};
if count > 0 {
records.truncate(count as usize);
} else {
records.clear();
}
records
}
pub fn emcy_clear_history(master_index: u16, slave_index: u16) {
unsafe { ffi::EmcyClearHistory(master_index, slave_index); }
}
pub fn emcy_get_count(master_index: u16, slave_index: u16) -> i32 {
unsafe { ffi::EmcyGetCount(master_index, slave_index) }
}