Removed Select syscalls, handled in the driver
This commit is contained in:
30
third_party/libtock-drivers/src/nfc.rs
vendored
30
third_party/libtock-drivers/src/nfc.rs
vendored
@@ -12,14 +12,11 @@ mod command_nr {
|
||||
pub const RECEIVE: usize = 2;
|
||||
pub const EMULATE: usize = 3;
|
||||
pub const CONFIGURE: usize = 4;
|
||||
pub const FRAMEDELAYMAX: usize = 5;
|
||||
pub const SELECTED: usize = 6;
|
||||
}
|
||||
|
||||
mod subscribe_nr {
|
||||
pub const TRANSMIT: usize = 1;
|
||||
pub const RECEIVE: usize = 2;
|
||||
pub const SELECT: usize = 3;
|
||||
}
|
||||
|
||||
mod allow_nr {
|
||||
@@ -54,38 +51,11 @@ impl NfcTag {
|
||||
syscalls::command(DRIVER_NUMBER, command_nr::EMULATE, enabled as usize, 0).is_ok()
|
||||
}
|
||||
|
||||
/// Subscribe to the tag being SELECTED callback.
|
||||
pub fn selected() -> bool {
|
||||
let is_selected = Cell::new(false);
|
||||
let mut is_selected_alarm = || is_selected.set(true);
|
||||
let subscription = syscalls::subscribe::<callback::Identity0Consumer, _>(
|
||||
DRIVER_NUMBER,
|
||||
subscribe_nr::SELECT,
|
||||
&mut is_selected_alarm,
|
||||
);
|
||||
if subscription.is_err() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let result = syscalls::command(DRIVER_NUMBER, command_nr::SELECTED, 0, 0);
|
||||
if result.is_err() {
|
||||
return false;
|
||||
}
|
||||
|
||||
util::yieldk_for(|| is_selected.get());
|
||||
true
|
||||
}
|
||||
|
||||
/// Configure the tag type command.
|
||||
pub fn configure(tag_type: u8) -> bool {
|
||||
syscalls::command(DRIVER_NUMBER, command_nr::CONFIGURE, tag_type as usize, 0).is_ok()
|
||||
}
|
||||
|
||||
/// Set the maximum frame delay value to support transmission with the reader.
|
||||
pub fn set_framedelaymax(delay: u32) -> bool {
|
||||
syscalls::command(DRIVER_NUMBER, command_nr::FRAMEDELAYMAX, delay as usize, 0).is_ok()
|
||||
}
|
||||
|
||||
/// 1. Share with the driver a buffer.
|
||||
/// 2. Subscribe to having a successful receive callback.
|
||||
/// 3. Issue the request for reception.
|
||||
|
||||
Reference in New Issue
Block a user