#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
storage: Storage,
}
impl<Storage> __BindgenBitfieldUnit<Storage> {
#[inline]
pub const fn new(storage: Storage) -> Self {
Self { storage }
}
}
impl<Storage> __BindgenBitfieldUnit<Storage>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val {
*byte |= mask;
} else {
*byte &= !mask;
}
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
}
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
impl<T> __IncompleteArrayField<T> {
#[inline]
pub const fn new() -> Self {
__IncompleteArrayField(::core::marker::PhantomData, [])
}
#[inline]
pub fn as_ptr(&self) -> *const T {
self as *const _ as *const T
}
#[inline]
pub fn as_mut_ptr(&mut self) -> *mut T {
self as *mut _ as *mut T
}
#[inline]
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
::core::slice::from_raw_parts(self.as_ptr(), len)
}
#[inline]
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
}
}
impl<T> ::core::fmt::Debug for __IncompleteArrayField<T> {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.write_str("__IncompleteArrayField")
}
}
pub const API_VERSION: u32 = 4784128;
pub type wint_t = core::ffi::c_int;
pub type __uint_least8_t = core::ffi::c_uchar;
pub type __uint_least16_t = core::ffi::c_ushort;
pub type _off_t = core::ffi::c_long;
pub type _fpos_t = core::ffi::c_long;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct _mbstate_t {
pub __count: core::ffi::c_int,
pub __value: _mbstate_t__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union _mbstate_t__bindgen_ty_1 {
pub __wch: wint_t,
pub __wchb: [core::ffi::c_uchar; 4usize],
}
#[test]
fn bindgen_test_layout__mbstate_t__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<_mbstate_t__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_mbstate_t__bindgen_ty_1>(),
4usize,
concat!("Size of: ", stringify!(_mbstate_t__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<_mbstate_t__bindgen_ty_1>(),
4usize,
concat!("Alignment of ", stringify!(_mbstate_t__bindgen_ty_1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_mbstate_t__bindgen_ty_1),
"::",
stringify!(__wch)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_mbstate_t__bindgen_ty_1),
"::",
stringify!(__wchb)
)
);
}
#[test]
fn bindgen_test_layout__mbstate_t() {
const UNINIT: ::core::mem::MaybeUninit<_mbstate_t> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_mbstate_t>(),
8usize,
concat!("Size of: ", stringify!(_mbstate_t))
);
assert_eq!(
::core::mem::align_of::<_mbstate_t>(),
4usize,
concat!("Alignment of ", stringify!(_mbstate_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__count) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_mbstate_t),
"::",
stringify!(__count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__value) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_mbstate_t),
"::",
stringify!(__value)
)
);
}
pub type __ULong = core::ffi::c_ulong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __lock {
_unused: [u8; 0],
}
pub type _LOCK_T = *mut __lock;
extern "C" {
pub fn __retarget_lock_init_recursive(lock: *mut _LOCK_T);
}
extern "C" {
pub fn __retarget_lock_close_recursive(lock: _LOCK_T);
}
extern "C" {
pub fn __retarget_lock_acquire(lock: _LOCK_T);
}
extern "C" {
pub fn __retarget_lock_acquire_recursive(lock: _LOCK_T);
}
extern "C" {
pub fn __retarget_lock_release(lock: _LOCK_T);
}
extern "C" {
pub fn __retarget_lock_release_recursive(lock: _LOCK_T);
}
pub type _flock_t = _LOCK_T;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __locale_t {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _Bigint {
pub _next: *mut _Bigint,
pub _k: core::ffi::c_int,
pub _maxwds: core::ffi::c_int,
pub _sign: core::ffi::c_int,
pub _wds: core::ffi::c_int,
pub _x: [__ULong; 1usize],
}
#[test]
fn bindgen_test_layout__Bigint() {
const UNINIT: ::core::mem::MaybeUninit<_Bigint> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_Bigint>(),
24usize,
concat!("Size of: ", stringify!(_Bigint))
);
assert_eq!(
::core::mem::align_of::<_Bigint>(),
4usize,
concat!("Alignment of ", stringify!(_Bigint))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._next) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_next)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._k) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_k)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._maxwds) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_maxwds)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._sign) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_sign)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._wds) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_wds)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._x) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(_Bigint),
"::",
stringify!(_x)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __tm {
pub __tm_sec: core::ffi::c_int,
pub __tm_min: core::ffi::c_int,
pub __tm_hour: core::ffi::c_int,
pub __tm_mday: core::ffi::c_int,
pub __tm_mon: core::ffi::c_int,
pub __tm_year: core::ffi::c_int,
pub __tm_wday: core::ffi::c_int,
pub __tm_yday: core::ffi::c_int,
pub __tm_isdst: core::ffi::c_int,
}
#[test]
fn bindgen_test_layout___tm() {
const UNINIT: ::core::mem::MaybeUninit<__tm> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<__tm>(),
36usize,
concat!("Size of: ", stringify!(__tm))
);
assert_eq!(
::core::mem::align_of::<__tm>(),
4usize,
concat!("Alignment of ", stringify!(__tm))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_sec) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_sec)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_min) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_min)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_hour) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_hour)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_mday) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_mday)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_mon) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_mon)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_year) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_year)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_wday) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_wday)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_yday) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_yday)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__tm_isdst) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(__tm),
"::",
stringify!(__tm_isdst)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __sbuf {
pub _base: *mut core::ffi::c_uchar,
pub _size: core::ffi::c_int,
}
#[test]
fn bindgen_test_layout___sbuf() {
const UNINIT: ::core::mem::MaybeUninit<__sbuf> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<__sbuf>(),
8usize,
concat!("Size of: ", stringify!(__sbuf))
);
assert_eq!(
::core::mem::align_of::<__sbuf>(),
4usize,
concat!("Alignment of ", stringify!(__sbuf))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__sbuf),
"::",
stringify!(_base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(__sbuf),
"::",
stringify!(_size)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct __sFILE {
pub _p: *mut core::ffi::c_uchar,
pub _r: core::ffi::c_int,
pub _w: core::ffi::c_int,
pub _flags: core::ffi::c_short,
pub _file: core::ffi::c_short,
pub _bf: __sbuf,
pub _lbfsize: core::ffi::c_int,
pub _cookie: *mut core::ffi::c_void,
pub _read: ::core::option::Option<
unsafe extern "C" fn(
arg1: *mut _reent,
arg2: *mut core::ffi::c_void,
arg3: *mut core::ffi::c_char,
arg4: core::ffi::c_int,
) -> core::ffi::c_int,
>,
pub _write: ::core::option::Option<
unsafe extern "C" fn(
arg1: *mut _reent,
arg2: *mut core::ffi::c_void,
arg3: *const core::ffi::c_char,
arg4: core::ffi::c_int,
) -> core::ffi::c_int,
>,
pub _seek: ::core::option::Option<
unsafe extern "C" fn(
arg1: *mut _reent,
arg2: *mut core::ffi::c_void,
arg3: _fpos_t,
arg4: core::ffi::c_int,
) -> _fpos_t,
>,
pub _close: ::core::option::Option<
unsafe extern "C" fn(arg1: *mut _reent, arg2: *mut core::ffi::c_void) -> core::ffi::c_int,
>,
pub _ub: __sbuf,
pub _up: *mut core::ffi::c_uchar,
pub _ur: core::ffi::c_int,
pub _ubuf: [core::ffi::c_uchar; 3usize],
pub _nbuf: [core::ffi::c_uchar; 1usize],
pub _lb: __sbuf,
pub _blksize: core::ffi::c_int,
pub _offset: _off_t,
pub _data: *mut _reent,
pub _lock: _flock_t,
pub _mbstate: _mbstate_t,
pub _flags2: core::ffi::c_int,
}
#[test]
fn bindgen_test_layout___sFILE() {
const UNINIT: ::core::mem::MaybeUninit<__sFILE> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<__sFILE>(),
104usize,
concat!("Size of: ", stringify!(__sFILE))
);
assert_eq!(
::core::mem::align_of::<__sFILE>(),
4usize,
concat!("Alignment of ", stringify!(__sFILE))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._p) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_p)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._r) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_r)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._w) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_w)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._file) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_file)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._bf) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_bf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._lbfsize) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_lbfsize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._cookie) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_cookie)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._read) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_read)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._write) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_write)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._seek) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_seek)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._close) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_close)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._ub) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_ub)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._up) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_up)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._ur) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_ur)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._ubuf) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_ubuf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._nbuf) as usize - ptr as usize },
67usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_nbuf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._lb) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_lb)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._blksize) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_blksize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_offset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._data) as usize - ptr as usize },
84usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize },
88usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_lock)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mbstate) as usize - ptr as usize },
92usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_mbstate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize },
100usize,
concat!(
"Offset of field: ",
stringify!(__sFILE),
"::",
stringify!(_flags2)
)
);
}
pub type __FILE = __sFILE;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _rand48 {
pub _seed: [core::ffi::c_ushort; 3usize],
pub _mult: [core::ffi::c_ushort; 3usize],
pub _add: core::ffi::c_ushort,
}
#[test]
fn bindgen_test_layout__rand48() {
const UNINIT: ::core::mem::MaybeUninit<_rand48> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_rand48>(),
14usize,
concat!("Size of: ", stringify!(_rand48))
);
assert_eq!(
::core::mem::align_of::<_rand48>(),
2usize,
concat!("Alignment of ", stringify!(_rand48))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._seed) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_rand48),
"::",
stringify!(_seed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mult) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(_rand48),
"::",
stringify!(_mult)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._add) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(_rand48),
"::",
stringify!(_add)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct _reent {
pub _errno: core::ffi::c_int,
pub _stdin: *mut __FILE,
pub _stdout: *mut __FILE,
pub _stderr: *mut __FILE,
pub _inc: core::ffi::c_int,
pub _emergency: [core::ffi::c_char; 25usize],
pub _locale: *mut __locale_t,
pub __cleanup: ::core::option::Option<unsafe extern "C" fn(arg1: *mut _reent)>,
pub _result: *mut _Bigint,
pub _result_k: core::ffi::c_int,
pub _p5s: *mut _Bigint,
pub _freelist: *mut *mut _Bigint,
pub _cvtlen: core::ffi::c_int,
pub _cvtbuf: *mut core::ffi::c_char,
pub _new: _reent__bindgen_ty_1,
pub _sig_func: *mut ::core::option::Option<unsafe extern "C" fn(arg1: core::ffi::c_int)>,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union _reent__bindgen_ty_1 {
pub _reent: _reent__bindgen_ty_1__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct _reent__bindgen_ty_1__bindgen_ty_1 {
pub _strtok_last: *mut core::ffi::c_char,
pub _asctime_buf: [core::ffi::c_char; 26usize],
pub _localtime_buf: __tm,
pub _gamma_signgam: core::ffi::c_int,
pub _rand_next: core::ffi::c_ulonglong,
pub _r48: _rand48,
pub _mblen_state: _mbstate_t,
pub _mbtowc_state: _mbstate_t,
pub _wctomb_state: _mbstate_t,
pub _l64a_buf: [core::ffi::c_char; 8usize],
pub _signal_buf: [core::ffi::c_char; 24usize],
pub _getdate_err: core::ffi::c_int,
pub _mbrlen_state: _mbstate_t,
pub _mbrtowc_state: _mbstate_t,
pub _mbsrtowcs_state: _mbstate_t,
pub _wcrtomb_state: _mbstate_t,
pub _wcsrtombs_state: _mbstate_t,
pub _h_errno: core::ffi::c_int,
}
#[test]
fn bindgen_test_layout__reent__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<_reent__bindgen_ty_1__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_reent__bindgen_ty_1__bindgen_ty_1>(),
200usize,
concat!("Size of: ", stringify!(_reent__bindgen_ty_1__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<_reent__bindgen_ty_1__bindgen_ty_1>(),
8usize,
concat!(
"Alignment of ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._strtok_last) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_strtok_last)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._asctime_buf) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_asctime_buf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._localtime_buf) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_localtime_buf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._gamma_signgam) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_gamma_signgam)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._rand_next) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_rand_next)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._r48) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_r48)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mblen_state) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_mblen_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mbtowc_state) as usize - ptr as usize },
104usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_mbtowc_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._wctomb_state) as usize - ptr as usize },
112usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_wctomb_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._l64a_buf) as usize - ptr as usize },
120usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_l64a_buf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._signal_buf) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_signal_buf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._getdate_err) as usize - ptr as usize },
152usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_getdate_err)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mbrlen_state) as usize - ptr as usize },
156usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_mbrlen_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mbrtowc_state) as usize - ptr as usize },
164usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_mbrtowc_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._mbsrtowcs_state) as usize - ptr as usize },
172usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_mbsrtowcs_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._wcrtomb_state) as usize - ptr as usize },
180usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_wcrtomb_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._wcsrtombs_state) as usize - ptr as usize },
188usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_wcsrtombs_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._h_errno) as usize - ptr as usize },
196usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(_h_errno)
)
);
}
#[test]
fn bindgen_test_layout__reent__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<_reent__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_reent__bindgen_ty_1>(),
200usize,
concat!("Size of: ", stringify!(_reent__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<_reent__bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(_reent__bindgen_ty_1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._reent) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_reent__bindgen_ty_1),
"::",
stringify!(_reent)
)
);
}
#[test]
fn bindgen_test_layout__reent() {
const UNINIT: ::core::mem::MaybeUninit<_reent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_reent>(),
288usize,
concat!("Size of: ", stringify!(_reent))
);
assert_eq!(
::core::mem::align_of::<_reent>(),
8usize,
concat!("Alignment of ", stringify!(_reent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._errno) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_errno)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._stdin) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_stdin)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._stdout) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_stdout)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._stderr) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_stderr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._inc) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_inc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._emergency) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_emergency)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._locale) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_locale)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).__cleanup) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(__cleanup)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._result) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_result)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._result_k) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_result_k)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._p5s) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_p5s)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._freelist) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_freelist)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._cvtlen) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_cvtlen)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._cvtbuf) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_cvtbuf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._new) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_new)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr)._sig_func) as usize - ptr as usize },
280usize,
concat!(
"Offset of field: ",
stringify!(_reent),
"::",
stringify!(_sig_func)
)
);
}
extern "C" {
pub static mut _impure_ptr: *mut _reent;
}
extern "C" {
pub static mut _impure_data: _reent;
}
extern "C" {
pub fn abort() -> !;
}
extern "C" {
pub fn atoi(__nptr: *const core::ffi::c_char) -> core::ffi::c_int;
}
extern "C" {
pub fn calloc(arg1: core::ffi::c_uint, arg2: core::ffi::c_uint) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn free(arg1: *mut core::ffi::c_void);
}
extern "C" {
pub fn malloc(arg1: core::ffi::c_uint) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn rand() -> core::ffi::c_int;
}
extern "C" {
pub fn realloc(arg1: *mut core::ffi::c_void, arg2: core::ffi::c_uint)
-> *mut core::ffi::c_void;
}
extern "C" {
pub fn srand(__seed: core::ffi::c_uint);
}
extern "C" {
pub fn strtod(__n: *const core::ffi::c_char, __end_PTR: *mut *mut core::ffi::c_char) -> f64;
}
extern "C" {
pub fn strtof(__n: *const core::ffi::c_char, __end_PTR: *mut *mut core::ffi::c_char) -> f32;
}
extern "C" {
pub fn strtol(
__n: *const core::ffi::c_char,
__end_PTR: *mut *mut core::ffi::c_char,
__base: core::ffi::c_int,
) -> core::ffi::c_long;
}
extern "C" {
pub fn strtoul(
__n: *const core::ffi::c_char,
__end_PTR: *mut *mut core::ffi::c_char,
__base: core::ffi::c_int,
) -> core::ffi::c_ulong;
}
extern "C" {
pub fn itoa(
arg1: core::ffi::c_int,
arg2: *mut core::ffi::c_char,
arg3: core::ffi::c_int,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn random() -> core::ffi::c_long;
}
extern "C" {
pub fn strtoull(
__n: *const core::ffi::c_char,
__end_PTR: *mut *mut core::ffi::c_char,
__base: core::ffi::c_int,
) -> core::ffi::c_ulonglong;
}
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __FuriCriticalInfo {
pub isrm: u32,
pub from_isr: bool,
pub kernel_running: bool,
}
#[test]
fn bindgen_test_layout___FuriCriticalInfo() {
const UNINIT: ::core::mem::MaybeUninit<__FuriCriticalInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<__FuriCriticalInfo>(),
8usize,
concat!("Size of: ", stringify!(__FuriCriticalInfo))
);
assert_eq!(
::core::mem::align_of::<__FuriCriticalInfo>(),
4usize,
concat!("Alignment of ", stringify!(__FuriCriticalInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).isrm) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__FuriCriticalInfo),
"::",
stringify!(isrm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).from_isr) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(__FuriCriticalInfo),
"::",
stringify!(from_isr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).kernel_running) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(__FuriCriticalInfo),
"::",
stringify!(kernel_running)
)
);
}
extern "C" {
pub fn __furi_critical_enter() -> __FuriCriticalInfo;
}
extern "C" {
pub fn __furi_critical_exit(info: __FuriCriticalInfo);
}
extern "C" {
pub fn strcasecmp(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> core::ffi::c_int;
}
extern "C" {
pub fn strncasecmp(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
arg3: core::ffi::c_uint,
) -> core::ffi::c_int;
}
extern "C" {
pub fn memchr(
arg1: *const core::ffi::c_void,
arg2: core::ffi::c_int,
arg3: core::ffi::c_uint,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn memcmp(
arg1: *const core::ffi::c_void,
arg2: *const core::ffi::c_void,
arg3: core::ffi::c_uint,
) -> core::ffi::c_int;
}
extern "C" {
pub fn memcpy(
arg1: *mut core::ffi::c_void,
arg2: *const core::ffi::c_void,
arg3: core::ffi::c_uint,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn memmove(
arg1: *mut core::ffi::c_void,
arg2: *const core::ffi::c_void,
arg3: core::ffi::c_uint,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn memset(
arg1: *mut core::ffi::c_void,
arg2: core::ffi::c_int,
arg3: core::ffi::c_uint,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn strchr(arg1: *const core::ffi::c_char, arg2: core::ffi::c_int)
-> *mut core::ffi::c_char;
}
extern "C" {
pub fn strcmp(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> core::ffi::c_int;
}
extern "C" {
pub fn strcpy(
arg1: *mut core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strcspn(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> core::ffi::c_uint;
}
extern "C" {
pub fn strlen(arg1: *const core::ffi::c_char) -> core::ffi::c_uint;
}
extern "C" {
pub fn strncmp(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
arg3: core::ffi::c_uint,
) -> core::ffi::c_int;
}
extern "C" {
pub fn strncpy(
arg1: *mut core::ffi::c_char,
arg2: *const core::ffi::c_char,
arg3: core::ffi::c_uint,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strrchr(
arg1: *const core::ffi::c_char,
arg2: core::ffi::c_int,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strspn(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> core::ffi::c_uint;
}
extern "C" {
pub fn strstr(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strcasestr(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strdup(arg1: *const core::ffi::c_char) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn strlcat(
arg1: *mut core::ffi::c_char,
arg2: *const core::ffi::c_char,
arg3: core::ffi::c_uint,
) -> core::ffi::c_uint;
}
extern "C" {
pub fn strlcpy(
arg1: *mut core::ffi::c_char,
arg2: *const core::ffi::c_char,
arg3: core::ffi::c_uint,
) -> core::ffi::c_uint;
}
extern "C" {
pub static _ctype_: [core::ffi::c_char; 0usize];
}
extern "C" {
pub fn __assert_func(
arg1: *const core::ffi::c_char,
arg2: core::ffi::c_int,
arg3: *const core::ffi::c_char,
arg4: *const core::ffi::c_char,
) -> !;
}
pub type __gnuc_va_list = u32;
pub type va_list = __gnuc_va_list;
pub type FILE = __FILE;
extern "C" {
pub fn sscanf(
arg1: *const core::ffi::c_char,
arg2: *const core::ffi::c_char,
...
) -> core::ffi::c_int;
}
extern "C" {
pub fn snprintf(
arg1: *mut core::ffi::c_char,
arg2: core::ffi::c_uint,
arg3: *const core::ffi::c_char,
...
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Crash system"]
pub fn __furi_crash_implementation();
}
extern "C" {
#[doc = "Halt system"]
pub fn __furi_halt_implementation();
}
#[doc = "< Operation completed successfully."]
pub const FuriStatus_FuriStatusOk: FuriStatus = 0;
pub const FuriStatus_FuriStatusError: FuriStatus = -1;
#[doc = "< Operation not completed within the timeout period."]
pub const FuriStatus_FuriStatusErrorTimeout: FuriStatus = -2;
#[doc = "< Resource not available."]
pub const FuriStatus_FuriStatusErrorResource: FuriStatus = -3;
#[doc = "< Parameter error."]
pub const FuriStatus_FuriStatusErrorParameter: FuriStatus = -4;
pub const FuriStatus_FuriStatusErrorNoMemory: FuriStatus = -5;
pub const FuriStatus_FuriStatusErrorISR: FuriStatus = -6;
#[doc = "< Prevents enum down-size compiler optimization."]
pub const FuriStatus_FuriStatusReserved: FuriStatus = 2147483647;
pub type FuriStatus = core::ffi::c_int;
#[doc = "Subscribe to In events.\n\n In events occur on the following conditions:\n - One or more items were inserted into a FuriMessageQueue,\n - Enough data has been written to a FuriStreamBuffer,\n - A FuriSemaphore has been released at least once,\n - A FuriMutex has been released."]
pub const FuriEventLoopEvent_FuriEventLoopEventIn: FuriEventLoopEvent = 1;
#[doc = "Subscribe to Out events.\n\n Out events occur on the following conditions:\n - One or more items were removed from a FuriMessageQueue,\n - Any amount of data has been read out of a FuriStreamBuffer,\n - A FuriSemaphore has been acquired at least once,\n - A FuriMutex has been acquired."]
pub const FuriEventLoopEvent_FuriEventLoopEventOut: FuriEventLoopEvent = 2;
#[doc = "Special value containing the event direction bits, used internally."]
pub const FuriEventLoopEvent_FuriEventLoopEventMask: FuriEventLoopEvent = 3;
#[doc = "Use edge triggered events.\n\n By default, level triggered events are used. A level above zero\n is reported based on the following conditions:\n\n In events:\n - a FuriMessageQueue contains one or more items,\n - a FuriStreamBuffer contains one or more bytes,\n - a FuriSemaphore can be acquired at least once,\n - a FuriMutex can be acquired.\n\n Out events:\n - a FuriMessageQueue has at least one item of free space,\n - a FuriStreamBuffer has at least one byte of free space,\n - a FuriSemaphore has been acquired at least once,\n - a FuriMutex has been acquired.\n\n If this flag is NOT set, the event will be generated repeatedly until\n the level becomes zero (e.g. all items have been removed from\n a FuriMessageQueue in case of the \"In\" event, etc.)\n\n If this flag IS set, then the above check is skipped and the event\n is generated ONLY when a change occurs, with the event direction\n (In or Out) taken into account."]
pub const FuriEventLoopEvent_FuriEventLoopEventFlagEdge: FuriEventLoopEvent = 4;
#[doc = "Automatically unsubscribe from events after one time.\n\n By default, events will be generated each time the specified conditions\n have been met. If this flag IS set, the event subscription will be cancelled\n upon the first occurred event and no further events will be generated."]
pub const FuriEventLoopEvent_FuriEventLoopEventFlagOnce: FuriEventLoopEvent = 8;
#[doc = "Special value containing the event flag bits, used internally."]
pub const FuriEventLoopEvent_FuriEventLoopEventFlagMask: FuriEventLoopEvent = 4294967292;
#[doc = "Special value to force the enum to 32-bit values."]
pub const FuriEventLoopEvent_FuriEventLoopEventReserved: FuriEventLoopEvent = 4294967295;
#[doc = "Enumeration of event types, flags and masks.\n\n Only one event direction (In or Out) can be used per subscription.\n An object can have no more than one subscription for each direction.\n\n Additional flags that modify the behaviour can be\n set using the bitwise OR operation (see flag description)."]
pub type FuriEventLoopEvent = core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriEventLoop {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate Event Loop instance\n\n Couple things to keep in mind:\n - You can have 1 event_loop per 1 thread\n - You can not use event_loop instance in the other thread\n - Do not use blocking API to query object delegated to Event Loop\n\n # Returns\n\nThe Event Loop instance"]
pub fn furi_event_loop_alloc() -> *mut FuriEventLoop;
}
extern "C" {
#[doc = "Free Event Loop instance\n\n # Arguments\n\n* `instance` - The Event Loop instance"]
pub fn furi_event_loop_free(instance: *mut FuriEventLoop);
}
extern "C" {
#[doc = "Continuously poll for events\n\n Can be stopped with `furi_event_loop_stop`\n\n # Arguments\n\n* `instance` - The Event Loop instance"]
pub fn furi_event_loop_run(instance: *mut FuriEventLoop);
}
extern "C" {
#[doc = "Stop Event Loop instance\n\n # Arguments\n\n* `instance` - The Event Loop instance"]
pub fn furi_event_loop_stop(instance: *mut FuriEventLoop);
}
#[doc = "Tick callback type\n\n # Arguments\n\n* `context` - The context for callback"]
pub type FuriEventLoopTickCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Set Event Loop tick callback\n\n Tick callback is called periodically after specified inactivity time.\n It acts like a low-priority timer: it will only fire if there is time\n left after processing the synchronization primitives and the regular timers.\n Therefore, it is not monotonic: ticks will be skipped if the event loop is busy.\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `interval` (direction in) - The tick interval\n * `callback` (direction in) - The callback to call\n * `context` - The context for callback"]
pub fn furi_event_loop_tick_set(
instance: *mut FuriEventLoop,
interval: u32,
callback: FuriEventLoopTickCallback,
context: *mut core::ffi::c_void,
);
}
#[doc = "Timer callback type for functions to be called in a deferred manner.\n\n # Arguments\n\n* `context` (direction in, out) - pointer to a user-specific object that was provided during\n furi_event_loop_pend_callback() call"]
pub type FuriEventLoopPendingCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Call a function when all preceding timer commands are processed\n\n This function may be useful to call another function when the event loop has been started.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the current FuriEventLoop instance\n * `callback` (direction in) - pointer to the callback to be executed when previous commands have been processed\n * `context` (direction in, out) - pointer to a user-specific object (will be passed to the callback)"]
pub fn furi_event_loop_pend_callback(
instance: *mut FuriEventLoop,
callback: FuriEventLoopPendingCallback,
context: *mut core::ffi::c_void,
);
}
pub type FuriEventLoopObject = core::ffi::c_void;
#[doc = "Callback type for event loop events\n\n # Arguments\n\n* `object` - The object that triggered the event\n * `context` - The context that was provided upon subscription\n\n # Returns\n\ntrue if event was processed, false if we need to delay processing"]
pub type FuriEventLoopEventCallback = ::core::option::Option<
unsafe extern "C" fn(object: *mut FuriEventLoopObject, context: *mut core::ffi::c_void) -> bool,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriMessageQueue {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Subscribe to message queue events\n\n you can only have one subscription for one event type.\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `message_queue` - The message queue to add\n * `event` (direction in) - The Event Loop event to trigger on\n * `callback` (direction in) - The callback to call on event\n * `context` - The context for callback"]
pub fn furi_event_loop_subscribe_message_queue(
instance: *mut FuriEventLoop,
message_queue: *mut FuriMessageQueue,
event: FuriEventLoopEvent,
callback: FuriEventLoopEventCallback,
context: *mut core::ffi::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriStreamBuffer {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Subscribe to stream buffer events\n\n you can only have one subscription for one event type.\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `stream_buffer` - The stream buffer to add\n * `event` (direction in) - The Event Loop event to trigger on\n * `callback` (direction in) - The callback to call on event\n * `context` - The context for callback"]
pub fn furi_event_loop_subscribe_stream_buffer(
instance: *mut FuriEventLoop,
stream_buffer: *mut FuriStreamBuffer,
event: FuriEventLoopEvent,
callback: FuriEventLoopEventCallback,
context: *mut core::ffi::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriSemaphore {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Subscribe to semaphore events\n\n you can only have one subscription for one event type.\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `semaphore` - The semaphore to add\n * `event` (direction in) - The Event Loop event to trigger on\n * `callback` (direction in) - The callback to call on event\n * `context` - The context for callback"]
pub fn furi_event_loop_subscribe_semaphore(
instance: *mut FuriEventLoop,
semaphore: *mut FuriSemaphore,
event: FuriEventLoopEvent,
callback: FuriEventLoopEventCallback,
context: *mut core::ffi::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriMutex {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Subscribe to mutex events\n\n you can only have one subscription for one event type.\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `mutex` - The mutex to add\n * `event` (direction in) - The Event Loop event to trigger on\n * `callback` (direction in) - The callback to call on event\n * `context` - The context for callback"]
pub fn furi_event_loop_subscribe_mutex(
instance: *mut FuriEventLoop,
mutex: *mut FuriMutex,
event: FuriEventLoopEvent,
callback: FuriEventLoopEventCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Unsubscribe from events (common)\n\n # Arguments\n\n* `instance` - The Event Loop instance\n * `object` - The object to unsubscribe from"]
pub fn furi_event_loop_unsubscribe(
instance: *mut FuriEventLoop,
object: *mut FuriEventLoopObject,
);
}
#[doc = "< One-shot timer."]
pub const FuriEventLoopTimerType_FuriEventLoopTimerTypeOnce: FuriEventLoopTimerType = 0;
#[doc = "< Repeating timer."]
pub const FuriEventLoopTimerType_FuriEventLoopTimerTypePeriodic: FuriEventLoopTimerType = 1;
#[doc = "Enumeration of possible timer types."]
pub type FuriEventLoopTimerType = core::ffi::c_uchar;
#[doc = "Timer callback type for functions to be called when a timer expires.\n\n In the timer callback, it is ALLOWED:\n - To start, stop, or restart an existing timer,\n - To create new timers using furi_event_loop_timer_alloc(),\n - To delete timers using furi_event_loop_timer_free().\n\n # Arguments\n\n* `context` (direction in, out) - pointer to a user-specific object that was provided during timer creation"]
pub type FuriEventLoopTimerCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriEventLoopTimer {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Create a new event loop timer instance.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the current FuriEventLoop instance\n * `callback` (direction in) - pointer to the callback function to be executed upon timer timeout\n * `type` (direction in) - timer type value to determine its behavior (single-shot or periodic)\n * `context` (direction in, out) - pointer to a user-specific object (will be passed to the callback)\n # Returns\n\npointer to the created timer instance"]
pub fn furi_event_loop_timer_alloc(
instance: *mut FuriEventLoop,
callback: FuriEventLoopTimerCallback,
type_: FuriEventLoopTimerType,
context: *mut core::ffi::c_void,
) -> *mut FuriEventLoopTimer;
}
extern "C" {
#[doc = "Delete an event loop timer instance.\n\n The user code MUST call furi_event_loop_timer_free() on ALL instances\n associated with the current event loop BEFORE calling furi_event_loop_free().\n The event loop may EITHER be running OR stopped when the timers are being deleted.\n\n # Arguments\n\n* `timer` (direction in, out) - pointer to the timer instance to be deleted"]
pub fn furi_event_loop_timer_free(timer: *mut FuriEventLoopTimer);
}
extern "C" {
#[doc = "Start a timer or restart it with a new interval.\n\n # Arguments\n\n* `timer` (direction in, out) - pointer to the timer instance to be (re)started\n * `interval` (direction in) - timer interval in ticks"]
pub fn furi_event_loop_timer_start(timer: *mut FuriEventLoopTimer, interval: u32);
}
extern "C" {
#[doc = "Restart a timer with the previously set interval.\n\n # Arguments\n\n* `timer` (direction in, out) - pointer to the timer instance to be restarted"]
pub fn furi_event_loop_timer_restart(timer: *mut FuriEventLoopTimer);
}
extern "C" {
#[doc = "Stop a timer without firing its callback.\n\n It is safe to call this function on an already stopped timer (it will do nothing).\n\n # Arguments\n\n* `timer` (direction in, out) - pointer to the timer instance to be stopped"]
pub fn furi_event_loop_timer_stop(timer: *mut FuriEventLoopTimer);
}
extern "C" {
#[doc = "Get the time remaining before the timer becomes expires.\n\n For stopped or expired timers, this function returns 0.\n\n # Arguments\n\n* `timer` (direction in) - pointer to the timer to be queried\n # Returns\n\nremaining time in ticks"]
pub fn furi_event_loop_timer_get_remaining_time(timer: *const FuriEventLoopTimer) -> u32;
}
extern "C" {
#[doc = "Get the timer interval.\n\n # Arguments\n\n* `timer` (direction in) - pointer to the timer to be queried\n # Returns\n\ntimer interval in ticks"]
pub fn furi_event_loop_timer_get_interval(timer: *const FuriEventLoopTimer) -> u32;
}
extern "C" {
#[doc = "Check if the timer is currently running.\n\n A timer is considered running if it has not expired yet.\n # Arguments\n\n* `timer` (direction in) - pointer to the timer to be queried\n # Returns\n\ntrue if the timer is running, false otherwise"]
pub fn furi_event_loop_timer_is_running(timer: *const FuriEventLoopTimer) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriEventFlag {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate FuriEventFlag\n\n # Returns\n\npointer to FuriEventFlag"]
pub fn furi_event_flag_alloc() -> *mut FuriEventFlag;
}
extern "C" {
#[doc = "Deallocate FuriEventFlag\n\n # Arguments\n\n* `instance` - pointer to FuriEventFlag"]
pub fn furi_event_flag_free(instance: *mut FuriEventFlag);
}
extern "C" {
#[doc = "Set flags\n\n result of this function can be flags that you've just asked to\n set or not if someone was waiting for them and asked to clear it.\n It is highly recommended to read this function and\n xEventGroupSetBits source code.\n\n # Arguments\n\n* `instance` - pointer to FuriEventFlag\n * `flags` (direction in) - The flags to set\n\n # Returns\n\nResulting flags(see warning) or error (FuriStatus)"]
pub fn furi_event_flag_set(instance: *mut FuriEventFlag, flags: u32) -> u32;
}
extern "C" {
#[doc = "Clear flags\n\n # Arguments\n\n* `instance` - pointer to FuriEventFlag\n * `flags` (direction in) - The flags\n\n # Returns\n\nResulting flags or error (FuriStatus)"]
pub fn furi_event_flag_clear(instance: *mut FuriEventFlag, flags: u32) -> u32;
}
extern "C" {
#[doc = "Get flags\n\n # Arguments\n\n* `instance` - pointer to FuriEventFlag\n\n # Returns\n\nResulting flags"]
pub fn furi_event_flag_get(instance: *mut FuriEventFlag) -> u32;
}
extern "C" {
#[doc = "Wait flags\n\n # Arguments\n\n* `instance` - pointer to FuriEventFlag\n * `flags` (direction in) - The flags\n * `options` (direction in) - The option flags\n * `timeout` (direction in) - The timeout\n\n # Returns\n\nResulting flags or error (FuriStatus)"]
pub fn furi_event_flag_wait(
instance: *mut FuriEventFlag,
flags: u32,
options: u32,
timeout: u32,
) -> u32;
}
extern "C" {
#[doc = "Check if CPU is in IRQ or kernel running and IRQ is masked\n\n Originally this primitive was born as a workaround for FreeRTOS kernel primitives shenanigans with PRIMASK.\n\n Meaningful use cases are:\n\n - When kernel is started and you want to ensure that you are not in IRQ or IRQ is not masked(like in critical section)\n - When kernel is not started and you want to make sure that you are not in IRQ mode, ignoring PRIMASK.\n\n As you can see there will be edge case when kernel is not started and PRIMASK is not 0 that may cause some funky behavior.\n Most likely it will happen after kernel primitives being used, but control not yet passed to kernel.\n It's up to you to figure out if it is safe for your code or not.\n\n # Returns\n\ntrue if CPU is in IRQ or kernel running and IRQ is masked"]
pub fn furi_kernel_is_irq_or_masked() -> bool;
}
extern "C" {
#[doc = "Check if kernel is running\n\n # Returns\n\ntrue if running, false otherwise"]
pub fn furi_kernel_is_running() -> bool;
}
extern "C" {
#[doc = "Lock kernel, pause process scheduling\n\n This should never be called in interrupt request context.\n\n # Returns\n\nprevious lock state(0 - unlocked, 1 - locked)"]
pub fn furi_kernel_lock() -> i32;
}
extern "C" {
#[doc = "Unlock kernel, resume process scheduling\n\n This should never be called in interrupt request context.\n\n # Returns\n\nprevious lock state(0 - unlocked, 1 - locked)"]
pub fn furi_kernel_unlock() -> i32;
}
extern "C" {
#[doc = "Restore kernel lock state\n\n This should never be called in interrupt request context.\n\n # Arguments\n\n* `lock` (direction in) - The lock state\n\n # Returns\n\nnew lock state or error"]
pub fn furi_kernel_restore_lock(lock: i32) -> i32;
}
extern "C" {
#[doc = "Get kernel systick frequency\n\n # Returns\n\nsystick counts per second"]
pub fn furi_kernel_get_tick_frequency() -> u32;
}
extern "C" {
#[doc = "Delay execution\n\n This should never be called in interrupt request context.\n\n Also keep in mind delay is aliased to scheduler timer intervals.\n\n # Arguments\n\n* `ticks` (direction in) - The ticks count to pause"]
pub fn furi_delay_tick(ticks: u32);
}
extern "C" {
#[doc = "Delay until tick\n\n This should never be called in interrupt request context.\n\n # Arguments\n\n* `tick` (direction in) - The tick until which kerel should delay task execution\n\n # Returns\n\nThe furi status."]
pub fn furi_delay_until_tick(tick: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Get current tick counter\n\n System uptime, may overflow.\n\n # Returns\n\nCurrent ticks in milliseconds"]
pub fn furi_get_tick() -> u32;
}
extern "C" {
#[doc = "Convert milliseconds to ticks\n\n # Arguments\n\n* `milliseconds` (direction in) - time in milliseconds\n # Returns\n\ntime in ticks"]
pub fn furi_ms_to_ticks(milliseconds: u32) -> u32;
}
extern "C" {
#[doc = "Delay in milliseconds\n\n This method uses kernel ticks on the inside, which causes delay to be aliased to scheduler timer intervals.\n Real wait time will be between X+ milliseconds.\n Special value: 0, will cause task yield.\n Also if used when kernel is not running will fall back to `furi_delay_us`.\n\n Cannot be used from ISR\n\n # Arguments\n\n* `milliseconds` (direction in) - milliseconds to wait"]
pub fn furi_delay_ms(milliseconds: u32);
}
extern "C" {
#[doc = "Delay in microseconds\n\n Implemented using Cortex DWT counter. Blocking and non aliased.\n\n # Arguments\n\n* `microseconds` (direction in) - microseconds to wait"]
pub fn furi_delay_us(microseconds: u32);
}
pub const FuriLogLevel_FuriLogLevelDefault: FuriLogLevel = 0;
pub const FuriLogLevel_FuriLogLevelNone: FuriLogLevel = 1;
pub const FuriLogLevel_FuriLogLevelError: FuriLogLevel = 2;
pub const FuriLogLevel_FuriLogLevelWarn: FuriLogLevel = 3;
pub const FuriLogLevel_FuriLogLevelInfo: FuriLogLevel = 4;
pub const FuriLogLevel_FuriLogLevelDebug: FuriLogLevel = 5;
pub const FuriLogLevel_FuriLogLevelTrace: FuriLogLevel = 6;
pub type FuriLogLevel = core::ffi::c_uchar;
pub type FuriLogHandlerCallback = ::core::option::Option<
unsafe extern "C" fn(data: *const u8, size: usize, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriLogHandler {
pub callback: FuriLogHandlerCallback,
pub context: *mut core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_FuriLogHandler() {
const UNINIT: ::core::mem::MaybeUninit<FuriLogHandler> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriLogHandler>(),
8usize,
concat!("Size of: ", stringify!(FuriLogHandler))
);
assert_eq!(
::core::mem::align_of::<FuriLogHandler>(),
4usize,
concat!("Alignment of ", stringify!(FuriLogHandler))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriLogHandler),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriLogHandler),
"::",
stringify!(context)
)
);
}
extern "C" {
#[doc = "Add log TX callback\n\n # Arguments\n\n* `handler` (direction in) - The callback and its context\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn furi_log_add_handler(handler: FuriLogHandler) -> bool;
}
extern "C" {
#[doc = "Remove log TX callback\n\n # Arguments\n\n* `handler` (direction in) - The callback and its context\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn furi_log_remove_handler(handler: FuriLogHandler) -> bool;
}
extern "C" {
#[doc = "Transmit data through log IO callbacks\n\n # Arguments\n\n* `data` (direction in) - The data\n * `size` (direction in) - The size"]
pub fn furi_log_tx(data: *const u8, size: usize);
}
extern "C" {
#[doc = "Transmit data through log IO callbacks\n\n # Arguments\n\n* `data` (direction in) - The data, null-terminated C-string"]
pub fn furi_log_puts(data: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Print log record\n\n # Arguments\n\n* `level` -\n * `tag` -\n * `format` -\n * `...` -"]
pub fn furi_log_print_format(
level: FuriLogLevel,
tag: *const core::ffi::c_char,
format: *const core::ffi::c_char,
...
);
}
extern "C" {
#[doc = "Print log record\n\n # Arguments\n\n* `level` -\n * `format` -\n * `...` -"]
pub fn furi_log_print_raw_format(level: FuriLogLevel, format: *const core::ffi::c_char, ...);
}
extern "C" {
#[doc = "Set log level\n\n # Arguments\n\n* `level` (direction in) - The level"]
pub fn furi_log_set_level(level: FuriLogLevel);
}
extern "C" {
#[doc = "Get log level\n\n # Returns\n\nThe furi log level."]
pub fn furi_log_get_level() -> FuriLogLevel;
}
extern "C" {
#[doc = "Log level to string\n\n # Arguments\n\n* `level` (direction in) - The level\n * `str` (direction out) - String representation of the level\n\n # Returns\n\nTrue if success, False otherwise"]
pub fn furi_log_level_to_string(
level: FuriLogLevel,
str_: *mut *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Log level from string\n\n # Arguments\n\n* `str` (direction in) - The string\n * `level` (direction out) - The level\n\n # Returns\n\nTrue if success, False otherwise"]
pub fn furi_log_level_from_string(
str_: *const core::ffi::c_char,
level: *mut FuriLogLevel,
) -> bool;
}
extern "C" {
#[doc = "Get free heap size\n\n # Returns\n\nfree heap size in bytes"]
pub fn memmgr_get_free_heap() -> usize;
}
extern "C" {
#[doc = "Get total heap size\n\n # Returns\n\ntotal heap size in bytes"]
pub fn memmgr_get_total_heap() -> usize;
}
extern "C" {
#[doc = "Get heap watermark\n\n # Returns\n\nminimum heap in bytes"]
pub fn memmgr_get_minimum_free_heap() -> usize;
}
extern "C" {
#[doc = "An aligned version of malloc, used when you need to get the aligned space on the heap\n Freeing the received address is performed ONLY through the aligned_free function\n # Arguments\n\n* `size` -\n * `alignment` -\n # Returns\n\nvoid*"]
pub fn aligned_malloc(size: usize, alignment: usize) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Freed space obtained through the aligned_malloc function\n # Arguments\n\n* `p` - pointer to result of aligned_malloc"]
pub fn aligned_free(p: *mut core::ffi::c_void);
}
#[doc = "< Thread is stopped"]
pub const FuriThreadState_FuriThreadStateStopped: FuriThreadState = 0;
#[doc = "< Thread is starting"]
pub const FuriThreadState_FuriThreadStateStarting: FuriThreadState = 1;
#[doc = "< Thread is running"]
pub const FuriThreadState_FuriThreadStateRunning: FuriThreadState = 2;
#[doc = "Enumeration of possible FuriThread states.\n\n Many of the FuriThread functions MUST ONLY be called when the thread is STOPPED."]
pub type FuriThreadState = core::ffi::c_uchar;
#[doc = "< Uninitialized, choose system default"]
pub const FuriThreadPriority_FuriThreadPriorityNone: FuriThreadPriority = 0;
#[doc = "< Idle priority"]
pub const FuriThreadPriority_FuriThreadPriorityIdle: FuriThreadPriority = 1;
#[doc = "< Lowest"]
pub const FuriThreadPriority_FuriThreadPriorityLowest: FuriThreadPriority = 14;
#[doc = "< Low"]
pub const FuriThreadPriority_FuriThreadPriorityLow: FuriThreadPriority = 15;
#[doc = "< Normal"]
pub const FuriThreadPriority_FuriThreadPriorityNormal: FuriThreadPriority = 16;
#[doc = "< High"]
pub const FuriThreadPriority_FuriThreadPriorityHigh: FuriThreadPriority = 17;
#[doc = "< Highest"]
pub const FuriThreadPriority_FuriThreadPriorityHighest: FuriThreadPriority = 18;
pub const FuriThreadPriority_FuriThreadPriorityIsr: FuriThreadPriority = 31;
#[doc = "Enumeration of possible FuriThread priorities."]
pub type FuriThreadPriority = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriThread {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriThreadList {
_unused: [u8; 0],
}
#[doc = "Unique thread identifier type (used by the OS kernel)."]
pub type FuriThreadId = *mut core::ffi::c_void;
#[doc = "Thread callback function pointer type.\n\n The function to be used as a thread callback MUST follow this signature.\n\n # Arguments\n\n* `context` (direction in, out) - pointer to a user-specified object\n # Returns\n\nvalue to be used as the thread return code"]
pub type FuriThreadCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void) -> i32>;
#[doc = "Standard output callback function pointer type.\n\n The function to be used as a standard output callback MUST follow this signature.\n\n The handler MUST process ALL of the provided data before returning.\n\n # Arguments\n\n* `data` (direction in) - pointer to the data to be written to the standard out\n * `size` (direction in) - size of the data in bytes"]
pub type FuriThreadStdoutWriteCallback =
::core::option::Option<unsafe extern "C" fn(data: *const core::ffi::c_char, size: usize)>;
#[doc = "State change callback function pointer type.\n\n The function to be used as a state callback MUST follow this signature.\n\n # Arguments\n\n* `state` (direction in) - identifier of the state the thread has transitioned to\n * `context` (direction in, out) - pointer to a user-specified object"]
pub type FuriThreadStateCallback = ::core::option::Option<
unsafe extern "C" fn(state: FuriThreadState, context: *mut core::ffi::c_void),
>;
#[doc = "Signal handler callback function pointer type.\n\n The function to be used as a signal handler callback MUS follow this signature.\n\n # Arguments\n\n* `signal` (direction in) - value of the signal to be handled by the recipient\n * `arg` (direction in, out) - optional argument (can be of any value, including NULL)\n * `context` (direction in, out) - pointer to a user-specified object\n # Returns\n\ntrue if the signal was handled, false otherwise"]
pub type FuriThreadSignalCallback = ::core::option::Option<
unsafe extern "C" fn(
signal: u32,
arg: *mut core::ffi::c_void,
context: *mut core::ffi::c_void,
) -> bool,
>;
extern "C" {
#[doc = "Create a FuriThread instance.\n\n # Returns\n\npointer to the created FuriThread instance"]
pub fn furi_thread_alloc() -> *mut FuriThread;
}
extern "C" {
#[doc = "Create a FuriThread instance w/ extra parameters.\n\n # Arguments\n\n* `name` (direction in) - human-readable thread name (can be NULL)\n * `stack_size` (direction in) - stack size in bytes (can be changed later)\n * `callback` (direction in) - pointer to a function to be executed in this thread\n * `context` (direction in) - pointer to a user-specified object (will be passed to the callback)\n # Returns\n\npointer to the created FuriThread instance"]
pub fn furi_thread_alloc_ex(
name: *const core::ffi::c_char,
stack_size: u32,
callback: FuriThreadCallback,
context: *mut core::ffi::c_void,
) -> *mut FuriThread;
}
extern "C" {
#[doc = "Delete a FuriThread instance.\n\n The thread MUST be stopped when calling this function.\n\n see furi_thread_join for caveats on stopping a thread.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be deleted"]
pub fn furi_thread_free(thread: *mut FuriThread);
}
extern "C" {
#[doc = "Set the name of a FuriThread instance.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `name` (direction in) - human-readable thread name (can be NULL)"]
pub fn furi_thread_set_name(thread: *mut FuriThread, name: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set the application ID of a FuriThread instance.\n\n The thread MUST be stopped when calling this function.\n\n Technically, it is like a \"process id\", but it is not a system-wide unique identifier.\n All threads spawned by the same app will have the same appid.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `appid` (direction in) - thread application ID (can be NULL)"]
pub fn furi_thread_set_appid(thread: *mut FuriThread, appid: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set the stack size of a FuriThread instance.\n\n The thread MUST be stopped when calling this function. Additionally, it is NOT possible\n to change the stack size of a service thread under any circumstances.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `stack_size` (direction in) - stack size in bytes"]
pub fn furi_thread_set_stack_size(thread: *mut FuriThread, stack_size: usize);
}
extern "C" {
#[doc = "Set the user callback function to be executed in a FuriThread.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `callback` (direction in) - pointer to a user-specified function to be executed in this thread"]
pub fn furi_thread_set_callback(thread: *mut FuriThread, callback: FuriThreadCallback);
}
extern "C" {
#[doc = "Set the callback function context.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `context` (direction in) - pointer to a user-specified object (will be passed to the callback, can be NULL)"]
pub fn furi_thread_set_context(thread: *mut FuriThread, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set the priority of a FuriThread.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `priority` (direction in) - priority level value"]
pub fn furi_thread_set_priority(thread: *mut FuriThread, priority: FuriThreadPriority);
}
extern "C" {
#[doc = "Get the priority of a FuriThread.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\npriority level value"]
pub fn furi_thread_get_priority(thread: *mut FuriThread) -> FuriThreadPriority;
}
extern "C" {
#[doc = "Set the priority of the current FuriThread.\n\n # Arguments\n\n* `priority` - priority level value"]
pub fn furi_thread_set_current_priority(priority: FuriThreadPriority);
}
extern "C" {
#[doc = "Get the priority of the current FuriThread.\n\n # Returns\n\npriority level value"]
pub fn furi_thread_get_current_priority() -> FuriThreadPriority;
}
extern "C" {
#[doc = "Set the callback function to be executed upon a state thransition of a FuriThread.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `callback` (direction in) - pointer to a user-specified callback function"]
pub fn furi_thread_set_state_callback(
thread: *mut FuriThread,
callback: FuriThreadStateCallback,
);
}
extern "C" {
#[doc = "Set the state change callback context.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `context` (direction in) - pointer to a user-specified object (will be passed to the callback, can be NULL)"]
pub fn furi_thread_set_state_context(thread: *mut FuriThread, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Get the state of a FuriThread isntance.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\nthread state value"]
pub fn furi_thread_get_state(thread: *mut FuriThread) -> FuriThreadState;
}
extern "C" {
#[doc = "Set a signal handler callback for a FuriThread instance.\n\n The thread MUST be stopped when calling this function if calling it from another thread.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified\n * `callback` (direction in) - pointer to a user-specified callback function\n * `context` (direction in) - pointer to a user-specified object (will be passed to the callback, can be NULL)"]
pub fn furi_thread_set_signal_callback(
thread: *mut FuriThread,
callback: FuriThreadSignalCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get a signal callback for a FuriThread instance.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\npointer to the callback function or NULL if none has been set"]
pub fn furi_thread_get_signal_callback(thread: *const FuriThread) -> FuriThreadSignalCallback;
}
extern "C" {
#[doc = "Send a signal to a FuriThread instance.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be signaled\n * `signal` (direction in) - signal value to be sent\n * `arg` (direction in, out) - optional argument (can be of any value, including NULL)"]
pub fn furi_thread_signal(
thread: *const FuriThread,
signal: u32,
arg: *mut core::ffi::c_void,
) -> bool;
}
extern "C" {
#[doc = "Start a FuriThread instance.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be started"]
pub fn furi_thread_start(thread: *mut FuriThread);
}
extern "C" {
#[doc = "Wait for a FuriThread to exit.\n\n The thread callback function must return in order for the FuriThread instance to become joinable.\n\n Use this method only when the CPU is not busy (i.e. when the\n Idle task receives control), otherwise it will wait forever.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be joined\n # Returns\n\nalways true"]
pub fn furi_thread_join(thread: *mut FuriThread) -> bool;
}
extern "C" {
#[doc = "Get the unique identifier of a FuriThread instance.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\nunique identifier value or NULL if thread is not running"]
pub fn furi_thread_get_id(thread: *mut FuriThread) -> FuriThreadId;
}
extern "C" {
#[doc = "Enable heap usage tracing for a FuriThread.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in, out) - pointer to the FuriThread instance to be modified"]
pub fn furi_thread_enable_heap_trace(thread: *mut FuriThread);
}
extern "C" {
#[doc = "Get heap usage by a FuriThread instance.\n\n The heap trace MUST be enabled before callgin this function.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\nheap usage in bytes"]
pub fn furi_thread_get_heap_size(thread: *mut FuriThread) -> usize;
}
extern "C" {
#[doc = "Get the return code of a FuriThread instance.\n\n This value is equal to the return value of the thread callback function.\n\n The thread MUST be stopped when calling this function.\n\n # Arguments\n\n* `thread` (direction in) - pointer to the FuriThread instance to be queried\n # Returns\n\nreturn code value"]
pub fn furi_thread_get_return_code(thread: *mut FuriThread) -> i32;
}
extern "C" {
#[doc = "Get the unique identifier of the current FuriThread.\n\n # Returns\n\nunique identifier value"]
pub fn furi_thread_get_current_id() -> FuriThreadId;
}
extern "C" {
#[doc = "Get the FuriThread instance associated with the current thread.\n\n # Returns\n\npointer to a FuriThread instance or NULL if this thread does not belong to Furi"]
pub fn furi_thread_get_current() -> *mut FuriThread;
}
extern "C" {
#[doc = "Return control to the scheduler."]
pub fn furi_thread_yield();
}
extern "C" {
#[doc = "Set the thread flags of a FuriThread.\n\n Can be used as a simple inter-thread communication mechanism.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be notified\n * `flags` (direction in) - bitmask of thread flags to set\n # Returns\n\nbitmask combination of previous and newly set flags"]
pub fn furi_thread_flags_set(thread_id: FuriThreadId, flags: u32) -> u32;
}
extern "C" {
#[doc = "Clear the thread flags of the current FuriThread.\n\n # Arguments\n\n* `flags` (direction in) - bitmask of thread flags to clear\n # Returns\n\nbitmask of thread flags before clearing"]
pub fn furi_thread_flags_clear(flags: u32) -> u32;
}
extern "C" {
#[doc = "Get the thread flags of the current FuriThread.\n # Returns\n\ncurrent bitmask of thread flags"]
pub fn furi_thread_flags_get() -> u32;
}
extern "C" {
#[doc = "Wait for some thread flags to be set.\n\n [`FuriFlag`] for option and error flags.\n\n # Arguments\n\n* `flags` (direction in) - bitmask of thread flags to wait for\n * `options` (direction in) - combination of option flags determining the behavior of the function\n * `timeout` (direction in) - maximum time to wait in milliseconds (use FuriWaitForever to wait forever)\n # Returns\n\nbitmask combination of received thread and error flags"]
pub fn furi_thread_flags_wait(flags: u32, options: u32, timeout: u32) -> u32;
}
extern "C" {
#[doc = "Enumerate all threads.\n\n # Arguments\n\n* `thread_list` (direction out) - pointer to the FuriThreadList container\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn furi_thread_enumerate(thread_list: *mut FuriThreadList) -> bool;
}
extern "C" {
#[doc = "Get the name of a thread based on its unique identifier.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be queried\n # Returns\n\npointer to a zero-terminated string or NULL"]
pub fn furi_thread_get_name(thread_id: FuriThreadId) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get the application id of a thread based on its unique identifier.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be queried\n # Returns\n\npointer to a zero-terminated string"]
pub fn furi_thread_get_appid(thread_id: FuriThreadId) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get thread stack watermark.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be queried\n # Returns\n\nstack watermark value"]
pub fn furi_thread_get_stack_space(thread_id: FuriThreadId) -> u32;
}
extern "C" {
#[doc = "Get the standard output callback for the current thead.\n\n # Returns\n\npointer to the standard out callback function"]
pub fn furi_thread_get_stdout_callback() -> FuriThreadStdoutWriteCallback;
}
extern "C" {
#[doc = "Set standard output callback for the current thread.\n\n # Arguments\n\n* `callback` (direction in) - pointer to the callback function or NULL to clear"]
pub fn furi_thread_set_stdout_callback(callback: FuriThreadStdoutWriteCallback);
}
extern "C" {
#[doc = "Write data to buffered standard output.\n\n # Arguments\n\n* `data` (direction in) - pointer to the data to be written\n * `size` (direction in) - data size in bytes\n # Returns\n\nnumber of bytes that was actually written"]
pub fn furi_thread_stdout_write(data: *const core::ffi::c_char, size: usize) -> usize;
}
extern "C" {
#[doc = "Flush buffered data to standard output.\n\n # Returns\n\nerror code value"]
pub fn furi_thread_stdout_flush() -> i32;
}
extern "C" {
#[doc = "Suspend a thread.\n\n Suspended threads are no more receiving any of the processor time.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be suspended"]
pub fn furi_thread_suspend(thread_id: FuriThreadId);
}
extern "C" {
#[doc = "Resume a thread.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be resumed"]
pub fn furi_thread_resume(thread_id: FuriThreadId);
}
extern "C" {
#[doc = "Test if a thread is suspended.\n\n # Arguments\n\n* `thread_id` (direction in) - unique identifier of the thread to be queried\n # Returns\n\ntrue if thread is suspended, false otherwise"]
pub fn furi_thread_is_suspended(thread_id: FuriThreadId) -> bool;
}
extern "C" {
#[doc = "Memmgr heap enable thread allocation tracking\n\n # Arguments\n\n* `thread_id` - - thread id to track"]
pub fn memmgr_heap_enable_thread_trace(thread_id: FuriThreadId);
}
extern "C" {
#[doc = "Memmgr heap disable thread allocation tracking\n\n # Arguments\n\n* `thread_id` - - thread id to track"]
pub fn memmgr_heap_disable_thread_trace(thread_id: FuriThreadId);
}
extern "C" {
#[doc = "Memmgr heap get allocatred thread memory\n\n # Arguments\n\n* `thread_id` - - thread id to track\n\n # Returns\n\nbytes allocated right now"]
pub fn memmgr_heap_get_thread_memory(thread_id: FuriThreadId) -> usize;
}
extern "C" {
#[doc = "Memmgr heap get the max contiguous block size on the heap\n\n # Returns\n\nsize_t max contiguous block size"]
pub fn memmgr_heap_get_max_free_block() -> usize;
}
extern "C" {
#[doc = "Print the address and size of all free blocks to stdout"]
pub fn memmgr_heap_printf_free_blocks();
}
extern "C" {
#[doc = "Allocate furi message queue\n\n # Arguments\n\n* `msg_count` (direction in) - The message count\n * `msg_size` (direction in) - The message size\n\n # Returns\n\npointer to FuriMessageQueue instance"]
pub fn furi_message_queue_alloc(msg_count: u32, msg_size: u32) -> *mut FuriMessageQueue;
}
extern "C" {
#[doc = "Free queue\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance"]
pub fn furi_message_queue_free(instance: *mut FuriMessageQueue);
}
extern "C" {
#[doc = "Put message into queue\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n * `msg_ptr` (direction in) - The message pointer\n * `timeout` (direction in) - The timeout\n\n # Returns\n\nThe furi status."]
pub fn furi_message_queue_put(
instance: *mut FuriMessageQueue,
msg_ptr: *const core::ffi::c_void,
timeout: u32,
) -> FuriStatus;
}
extern "C" {
#[doc = "Get message from queue\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n * `msg_ptr` - The message pointer\n * `timeout` (direction in) - The timeout\n\n # Returns\n\nThe furi status."]
pub fn furi_message_queue_get(
instance: *mut FuriMessageQueue,
msg_ptr: *mut core::ffi::c_void,
timeout: u32,
) -> FuriStatus;
}
extern "C" {
#[doc = "Get queue capacity\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n\n # Returns\n\ncapacity in object count"]
pub fn furi_message_queue_get_capacity(instance: *mut FuriMessageQueue) -> u32;
}
extern "C" {
#[doc = "Get message size\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n\n # Returns\n\nMessage size in bytes"]
pub fn furi_message_queue_get_message_size(instance: *mut FuriMessageQueue) -> u32;
}
extern "C" {
#[doc = "Get message count in queue\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n\n # Returns\n\nMessage count"]
pub fn furi_message_queue_get_count(instance: *mut FuriMessageQueue) -> u32;
}
extern "C" {
#[doc = "Get queue available space\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n\n # Returns\n\nMessage count"]
pub fn furi_message_queue_get_space(instance: *mut FuriMessageQueue) -> u32;
}
extern "C" {
#[doc = "Reset queue\n\n # Arguments\n\n* `instance` - pointer to FuriMessageQueue instance\n\n # Returns\n\nThe furi status."]
pub fn furi_message_queue_reset(instance: *mut FuriMessageQueue) -> FuriStatus;
}
pub const FuriMutexType_FuriMutexTypeNormal: FuriMutexType = 0;
pub const FuriMutexType_FuriMutexTypeRecursive: FuriMutexType = 1;
pub type FuriMutexType = core::ffi::c_uchar;
extern "C" {
#[doc = "Allocate FuriMutex\n\n # Arguments\n\n* `type` (direction in) - The mutex type\n\n # Returns\n\npointer to FuriMutex instance"]
pub fn furi_mutex_alloc(type_: FuriMutexType) -> *mut FuriMutex;
}
extern "C" {
#[doc = "Free FuriMutex\n\n # Arguments\n\n* `instance` - The pointer to FuriMutex instance"]
pub fn furi_mutex_free(instance: *mut FuriMutex);
}
extern "C" {
#[doc = "Acquire mutex\n\n # Arguments\n\n* `instance` - The pointer to FuriMutex instance\n * `timeout` (direction in) - The timeout\n\n # Returns\n\nThe furi status."]
pub fn furi_mutex_acquire(instance: *mut FuriMutex, timeout: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Release mutex\n\n # Arguments\n\n* `instance` - The pointer to FuriMutex instance\n\n # Returns\n\nThe furi status."]
pub fn furi_mutex_release(instance: *mut FuriMutex) -> FuriStatus;
}
extern "C" {
#[doc = "Get mutex owner thread id\n\n # Arguments\n\n* `instance` - The pointer to FuriMutex instance\n\n # Returns\n\nThe furi thread identifier."]
pub fn furi_mutex_get_owner(instance: *mut FuriMutex) -> FuriThreadId;
}
#[doc = "FuriPubSub Callback type"]
pub type FuriPubSubCallback = ::core::option::Option<
unsafe extern "C" fn(message: *const core::ffi::c_void, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriPubSub {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriPubSubSubscription {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate FuriPubSub\n\n Reentrable, Not threadsafe, one owner\n\n # Returns\n\npointer to FuriPubSub instance"]
pub fn furi_pubsub_alloc() -> *mut FuriPubSub;
}
extern "C" {
#[doc = "Free FuriPubSub\n\n # Arguments\n\n* `pubsub` - FuriPubSub instance"]
pub fn furi_pubsub_free(pubsub: *mut FuriPubSub);
}
extern "C" {
#[doc = "Subscribe to FuriPubSub\n\n Threadsafe, Reentrable\n\n # Arguments\n\n* `pubsub` - pointer to FuriPubSub instance\n * `callback` (direction in) - The callback\n * `callback_context` - The callback context\n\n # Returns\n\npointer to FuriPubSubSubscription instance"]
pub fn furi_pubsub_subscribe(
pubsub: *mut FuriPubSub,
callback: FuriPubSubCallback,
callback_context: *mut core::ffi::c_void,
) -> *mut FuriPubSubSubscription;
}
extern "C" {
#[doc = "Unsubscribe from FuriPubSub\n\n No use of `pubsub_subscription` allowed after call of this method\n Threadsafe, Reentrable.\n\n # Arguments\n\n* `pubsub` - pointer to FuriPubSub instance\n * `pubsub_subscription` - pointer to FuriPubSubSubscription instance"]
pub fn furi_pubsub_unsubscribe(
pubsub: *mut FuriPubSub,
pubsub_subscription: *mut FuriPubSubSubscription,
);
}
extern "C" {
#[doc = "Publish message to FuriPubSub\n\n Threadsafe, Reentrable.\n\n # Arguments\n\n* `pubsub` - pointer to FuriPubSub instance\n * `message` - message pointer to publish"]
pub fn furi_pubsub_publish(pubsub: *mut FuriPubSub, message: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Check if record exists\n\n # Arguments\n\n* `name` - record name\n > **Note:** Thread safe. Create and destroy must be executed from the same\n thread."]
pub fn furi_record_exists(name: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Create record\n\n # Arguments\n\n* `name` - record name\n * `data` - data pointer\n > **Note:** Thread safe. Create and destroy must be executed from the same\n thread."]
pub fn furi_record_create(name: *const core::ffi::c_char, data: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Destroy record\n\n # Arguments\n\n* `name` - record name\n\n # Returns\n\ntrue if successful, false if still have holders or thread is not\n owner.\n > **Note:** Thread safe. Create and destroy must be executed from the same\n thread."]
pub fn furi_record_destroy(name: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Open record\n\n # Arguments\n\n* `name` - record name\n\n # Returns\n\npointer to the record\n > **Note:** Thread safe. Open and close must be executed from the same\n thread. Suspends caller thread till record is available"]
pub fn furi_record_open(name: *const core::ffi::c_char) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Close record\n\n # Arguments\n\n* `name` - record name\n > **Note:** Thread safe. Open and close must be executed from the same\n thread."]
pub fn furi_record_close(name: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Allocate semaphore\n\n # Arguments\n\n* `max_count` (direction in) - The maximum count\n * `initial_count` (direction in) - The initial count\n\n # Returns\n\npointer to FuriSemaphore instance"]
pub fn furi_semaphore_alloc(max_count: u32, initial_count: u32) -> *mut FuriSemaphore;
}
extern "C" {
#[doc = "Free semaphore\n\n # Arguments\n\n* `instance` - The pointer to FuriSemaphore instance"]
pub fn furi_semaphore_free(instance: *mut FuriSemaphore);
}
extern "C" {
#[doc = "Acquire semaphore\n\n # Arguments\n\n* `instance` - The pointer to FuriSemaphore instance\n * `timeout` (direction in) - The timeout\n\n # Returns\n\nThe furi status."]
pub fn furi_semaphore_acquire(instance: *mut FuriSemaphore, timeout: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Release semaphore\n\n # Arguments\n\n* `instance` - The pointer to FuriSemaphore instance\n\n # Returns\n\nThe furi status."]
pub fn furi_semaphore_release(instance: *mut FuriSemaphore) -> FuriStatus;
}
extern "C" {
#[doc = "Get semaphore count\n\n # Arguments\n\n* `instance` - The pointer to FuriSemaphore instance\n\n # Returns\n\nSemaphore count"]
pub fn furi_semaphore_get_count(instance: *mut FuriSemaphore) -> u32;
}
extern "C" {
#[doc = "Get available space\n\n # Arguments\n\n* `instance` - The pointer to FuriSemaphore instance\n\n # Returns\n\nSemaphore available space"]
pub fn furi_semaphore_get_space(instance: *mut FuriSemaphore) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriThreadListItem {
#[doc = "< Pointer to FuriThread, valid while it is running"]
pub thread: *mut FuriThread,
#[doc = "< Thread application id, valid while it is running"]
pub app_id: *const core::ffi::c_char,
#[doc = "< Thread name, valid while it is running"]
pub name: *const core::ffi::c_char,
#[doc = "< Thread priority"]
pub priority: FuriThreadPriority,
#[doc = "< Thread stack address"]
pub stack_address: u32,
#[doc = "< Thread heap size if tracking enabled, 0 - otherwise"]
pub heap: usize,
#[doc = "< Thread stack size"]
pub stack_size: u32,
#[doc = "< Thread minimum of the stack size ever reached"]
pub stack_min_free: u32,
#[doc = "< Thread state, can be: \"Running\", \"Ready\", \"Blocked\", \"Suspended\", \"Deleted\", \"Invalid\""]
pub state: *const core::ffi::c_char,
#[doc = "< Thread CPU usage time in percents (including interrupts happened while running)"]
pub cpu: f32,
#[doc = "< Thread previous runtime counter"]
pub counter_previous: u32,
#[doc = "< Thread current runtime counter"]
pub counter_current: u32,
#[doc = "< Thread last seen tick"]
pub tick: u32,
}
#[test]
fn bindgen_test_layout_FuriThreadListItem() {
const UNINIT: ::core::mem::MaybeUninit<FuriThreadListItem> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriThreadListItem>(),
52usize,
concat!("Size of: ", stringify!(FuriThreadListItem))
);
assert_eq!(
::core::mem::align_of::<FuriThreadListItem>(),
4usize,
concat!("Alignment of ", stringify!(FuriThreadListItem))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).thread) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(thread)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).app_id) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(app_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).priority) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(priority)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stack_address) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(stack_address)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).heap) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(heap)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(stack_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stack_min_free) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(stack_min_free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).state) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cpu) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(cpu)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter_previous) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(counter_previous)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter_current) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(counter_current)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tick) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(FuriThreadListItem),
"::",
stringify!(tick)
)
);
}
extern "C" {
#[doc = "Allocate FuriThreadList instance\n\n # Returns\n\nFuriThreadList instance"]
pub fn furi_thread_list_alloc() -> *mut FuriThreadList;
}
extern "C" {
#[doc = "Free FuriThreadList instance\n\n # Arguments\n\n* `instance` - The FuriThreadList instance to free"]
pub fn furi_thread_list_free(instance: *mut FuriThreadList);
}
extern "C" {
#[doc = "Get FuriThreadList instance size\n\n # Arguments\n\n* `instance` - The instance\n\n # Returns\n\nItem count"]
pub fn furi_thread_list_size(instance: *mut FuriThreadList) -> usize;
}
extern "C" {
#[doc = "Get item at position\n\n # Arguments\n\n* `instance` - The FuriThreadList instance\n * `position` (direction in) - The position of the item\n\n # Returns\n\nThe FuriThreadListItem instance"]
pub fn furi_thread_list_get_at(
instance: *mut FuriThreadList,
position: usize,
) -> *mut FuriThreadListItem;
}
extern "C" {
#[doc = "Get item by thread FuriThread pointer\n\n # Arguments\n\n* `instance` - The FuriThreadList instance\n * `thread` - The FuriThread pointer\n\n # Returns\n\nThe FuriThreadListItem instance"]
pub fn furi_thread_list_get_or_insert(
instance: *mut FuriThreadList,
thread: *mut FuriThread,
) -> *mut FuriThreadListItem;
}
extern "C" {
#[doc = "Process items in the FuriThreadList instance\n\n # Arguments\n\n* `instance` - The instance\n * `runtime` (direction in) - The runtime of the system since start\n * `tick` (direction in) - The tick when processing happened"]
pub fn furi_thread_list_process(instance: *mut FuriThreadList, runtime: u32, tick: u32);
}
extern "C" {
#[doc = "Get percent of time spent in ISR\n\n # Arguments\n\n* `instance` - The instance\n\n # Returns\n\npercent of time spent in ISR"]
pub fn furi_thread_list_get_isr_time(instance: *mut FuriThreadList) -> f32;
}
pub type FuriTimerCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "< One-shot timer."]
pub const FuriTimerType_FuriTimerTypeOnce: FuriTimerType = 0;
#[doc = "< Repeating timer."]
pub const FuriTimerType_FuriTimerTypePeriodic: FuriTimerType = 1;
pub type FuriTimerType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriTimer {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate timer\n\n # Arguments\n\n* `func` (direction in) - The callback function\n * `type` (direction in) - The timer type\n * `context` - The callback context\n\n # Returns\n\nThe pointer to FuriTimer instance"]
pub fn furi_timer_alloc(
func: FuriTimerCallback,
type_: FuriTimerType,
context: *mut core::ffi::c_void,
) -> *mut FuriTimer;
}
extern "C" {
#[doc = "Free timer\n\n # Arguments\n\n* `instance` - The pointer to FuriTimer instance"]
pub fn furi_timer_free(instance: *mut FuriTimer);
}
extern "C" {
#[doc = "Start timer\n\n This is asynchronous call, real operation will happen as soon as\n timer service process this request.\n\n # Arguments\n\n* `instance` - The pointer to FuriTimer instance\n * `ticks` (direction in) - The interval in ticks\n\n # Returns\n\nThe furi status."]
pub fn furi_timer_start(instance: *mut FuriTimer, ticks: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Restart timer with previous timeout value\n\n This is asynchronous call, real operation will happen as soon as\n timer service process this request.\n\n # Arguments\n\n* `instance` - The pointer to FuriTimer instance\n * `ticks` (direction in) - The interval in ticks\n\n # Returns\n\nThe furi status."]
pub fn furi_timer_restart(instance: *mut FuriTimer, ticks: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Stop timer\n\n This is asynchronous call, real operation will happen as soon as\n timer service process this request.\n\n # Arguments\n\n* `instance` - The pointer to FuriTimer instance\n\n # Returns\n\nThe furi status."]
pub fn furi_timer_stop(instance: *mut FuriTimer) -> FuriStatus;
}
extern "C" {
#[doc = "Is timer running\n\n This cal may and will return obsolete timer state if timer\n commands are still in the queue. Please read FreeRTOS timer\n documentation first.\n\n # Arguments\n\n* `instance` - The pointer to FuriTimer instance\n\n # Returns\n\n0: not running, 1: running"]
pub fn furi_timer_is_running(instance: *mut FuriTimer) -> u32;
}
extern "C" {
#[doc = "Get timer expire time\n\n # Arguments\n\n* `instance` - The Timer instance\n\n # Returns\n\nexpire tick"]
pub fn furi_timer_get_expire_time(instance: *mut FuriTimer) -> u32;
}
pub type FuriTimerPendigCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, arg: u32)>;
extern "C" {
pub fn furi_timer_pending_callback(
callback: FuriTimerPendigCallback,
context: *mut core::ffi::c_void,
arg: u32,
);
}
#[doc = "< Lower then other threads"]
pub const FuriTimerThreadPriority_FuriTimerThreadPriorityNormal: FuriTimerThreadPriority = 0;
#[doc = "< Same as other threads"]
pub const FuriTimerThreadPriority_FuriTimerThreadPriorityElevated: FuriTimerThreadPriority = 1;
pub type FuriTimerThreadPriority = core::ffi::c_uchar;
extern "C" {
#[doc = "Set Timer thread priority\n\n # Arguments\n\n* `priority` (direction in) - The priority"]
pub fn furi_timer_set_thread_priority(priority: FuriTimerThreadPriority);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriString {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate new FuriString.\n\n # Returns\n\npointer to the instance of FuriString"]
pub fn furi_string_alloc() -> *mut FuriString;
}
extern "C" {
#[doc = "Allocate new FuriString and set it to string.\n\n Allocate & Set the string a to the string.\n\n # Arguments\n\n* `source` - The source FuriString instance\n\n # Returns\n\npointer to the new instance of FuriString"]
pub fn furi_string_alloc_set(source: *const FuriString) -> *mut FuriString;
}
extern "C" {
#[doc = "Allocate new FuriString and set it to C string.\n\n Allocate & Set the string a to the C string.\n\n # Arguments\n\n* `cstr_source` - The C-string instance\n\n # Returns\n\npointer to the new instance of FuriString"]
pub fn furi_string_alloc_set_str(cstr_source: *const core::ffi::c_char) -> *mut FuriString;
}
extern "C" {
#[doc = "Allocate new FuriString and printf to it.\n\n Initialize and set a string to the given formatted value.\n\n # Arguments\n\n* `format` - The printf format\n * `...` (direction in) - args to format\n\n # Returns\n\npointer to the new instance of FuriString"]
pub fn furi_string_alloc_printf(format: *const core::ffi::c_char, ...) -> *mut FuriString;
}
extern "C" {
#[doc = "Allocate new FuriString and printf to it.\n\n Initialize and set a string to the given formatted value.\n\n # Arguments\n\n* `format` - The printf format\n * `args` - The format arguments\n\n # Returns\n\npointer to the new instance of FuriString"]
pub fn furi_string_alloc_vprintf(
format: *const core::ffi::c_char,
args: va_list,
) -> *mut FuriString;
}
extern "C" {
#[doc = "Allocate new FuriString and move source string content to it.\n\n Allocate the string, set it to the other one, and destroy the other one.\n\n # Arguments\n\n* `source` - The source FuriString instance\n\n # Returns\n\npointer to the new instance of FuriString"]
pub fn furi_string_alloc_move(source: *mut FuriString) -> *mut FuriString;
}
extern "C" {
#[doc = "Free FuriString.\n\n # Arguments\n\n* `string` - The FuriString instance to free"]
pub fn furi_string_free(string: *mut FuriString);
}
extern "C" {
#[doc = "Reserve memory for string.\n\n Modify the string capacity to be able to handle at least 'alloc' characters\n (including final null char).\n\n # Arguments\n\n* `string` - The FuriString instance\n * `size` - The size to reserve"]
pub fn furi_string_reserve(string: *mut FuriString, size: usize);
}
extern "C" {
#[doc = "Reset string.\n\n Make the string empty.\n\n # Arguments\n\n* `string` - The FuriString instance"]
pub fn furi_string_reset(string: *mut FuriString);
}
extern "C" {
#[doc = "Swap two strings.\n\n Swap the two strings string_1 and string_2.\n\n # Arguments\n\n* `string_1` - The FuriString instance 1\n * `string_2` - The FuriString instance 2"]
pub fn furi_string_swap(string_1: *mut FuriString, string_2: *mut FuriString);
}
extern "C" {
#[doc = "Move string_2 content to string_1.\n\n Set the string to the other one, and destroy the other one.\n\n # Arguments\n\n* `string_1` - The FuriString instance 1\n * `string_2` - The FuriString instance 2"]
pub fn furi_string_move(string_1: *mut FuriString, string_2: *mut FuriString);
}
extern "C" {
#[doc = "Compute a hash for the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n\n # Returns\n\nhash value"]
pub fn furi_string_hash(string: *const FuriString) -> usize;
}
extern "C" {
#[doc = "Get string size (usually length, but not for UTF-8)\n\n # Arguments\n\n* `string` - The FuriString instance\n\n # Returns\n\nsize of the string"]
pub fn furi_string_size(string: *const FuriString) -> usize;
}
extern "C" {
#[doc = "Check that string is empty or not\n\n # Arguments\n\n* `string` - The FuriString instance\n\n # Returns\n\ntrue if empty otherwise false"]
pub fn furi_string_empty(string: *const FuriString) -> bool;
}
extern "C" {
#[doc = "Get the character at the given index.\n\n Return the selected character of the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `index` - The index\n\n # Returns\n\ncharacter at index"]
pub fn furi_string_get_char(string: *const FuriString, index: usize) -> core::ffi::c_char;
}
extern "C" {
#[doc = "Return the string view a classic C string.\n\n # Arguments\n\n* `string` - The FuriString instance\n\n # Returns\n\nconst C-string, usable till first container change"]
pub fn furi_string_get_cstr(string: *const FuriString) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Set the string to the other string.\n\n Set the string to the source string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `source` - The source"]
pub fn furi_string_set(string: *mut FuriString, source: *mut FuriString);
}
extern "C" {
#[doc = "Set the string to the other C string.\n\n Set the string to the source C string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `source` - The source"]
pub fn furi_string_set_str(string: *mut FuriString, source: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set the string to the n first characters of the C string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `source` - The source\n * `length` - The length"]
pub fn furi_string_set_strn(
string: *mut FuriString,
source: *const core::ffi::c_char,
length: usize,
);
}
extern "C" {
#[doc = "Set the character at the given index.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `index` - The index\n * `c` - The character"]
pub fn furi_string_set_char(string: *mut FuriString, index: usize, c: core::ffi::c_char);
}
extern "C" {
#[doc = "Set the string to the n first characters of other one.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `source` - The source\n * `offset` - The offset\n * `length` - The length"]
pub fn furi_string_set_n(
string: *mut FuriString,
source: *const FuriString,
offset: usize,
length: usize,
);
}
extern "C" {
#[doc = "Format in the string the given printf format\n\n # Arguments\n\n* `string` - The string\n * `format` - The format\n * `...` (direction in) - The args\n\n # Returns\n\nnumber of characters printed or negative value on error"]
pub fn furi_string_printf(
string: *mut FuriString,
format: *const core::ffi::c_char,
...
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Format in the string the given printf format\n\n # Arguments\n\n* `string` - The FuriString instance\n * `format` - The format\n * `args` - The arguments\n\n # Returns\n\nnumber of characters printed or negative value on error"]
pub fn furi_string_vprintf(
string: *mut FuriString,
format: *const core::ffi::c_char,
args: va_list,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Append a character to the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `c` - The character"]
pub fn furi_string_push_back(string: *mut FuriString, c: core::ffi::c_char);
}
extern "C" {
#[doc = "Append a string to the string.\n\n Concatenate the string with the other string.\n\n # Arguments\n\n* `string_1` - The string 1\n * `string_2` - The string 2"]
pub fn furi_string_cat(string_1: *mut FuriString, string_2: *const FuriString);
}
extern "C" {
#[doc = "Append a C string to the string.\n\n Concatenate the string with the C string.\n\n # Arguments\n\n* `string_1` - The string 1\n * `cstring_2` - The cstring 2"]
pub fn furi_string_cat_str(string_1: *mut FuriString, cstring_2: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Append to the string the formatted string of the given printf format.\n\n # Arguments\n\n* `string` - The string\n * `format` - The format\n * `...` (direction in) - The args\n\n # Returns\n\nnumber of characters printed or negative value on error"]
pub fn furi_string_cat_printf(
string: *mut FuriString,
format: *const core::ffi::c_char,
...
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Append to the string the formatted string of the given printf format.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `format` - The format\n * `args` - The arguments\n\n # Returns\n\nnumber of characters printed or negative value on error"]
pub fn furi_string_cat_vprintf(
string: *mut FuriString,
format: *const core::ffi::c_char,
args: va_list,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Compare two strings and return the sort order.\n\n # Arguments\n\n* `string_1` - The string 1\n * `string_2` - The string 2\n\n # Returns\n\nzero if equal"]
pub fn furi_string_cmp(
string_1: *const FuriString,
string_2: *const FuriString,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Compare string with C string and return the sort order.\n\n # Arguments\n\n* `string_1` - The string 1\n * `cstring_2` - The cstring 2\n\n # Returns\n\nzero if equal"]
pub fn furi_string_cmp_str(
string_1: *const FuriString,
cstring_2: *const core::ffi::c_char,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Compare two strings (case insensitive according to the current locale) and\n return the sort order.\n\n Note: doesn't work with UTF-8 strings.\n\n # Arguments\n\n* `string_1` - The string 1\n * `string_2` - The string 2\n\n # Returns\n\nzero if equal"]
pub fn furi_string_cmpi(
string_1: *const FuriString,
string_2: *const FuriString,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Compare string with C string (case insensitive according to the current\n locale) and return the sort order.\n\n Note: doesn't work with UTF-8 strings.\n\n # Arguments\n\n* `string_1` - The string 1\n * `cstring_2` - The cstring 2\n\n # Returns\n\nzero if equal"]
pub fn furi_string_cmpi_str(
string_1: *const FuriString,
cstring_2: *const core::ffi::c_char,
) -> core::ffi::c_int;
}
extern "C" {
#[doc = "Search the first occurrence of the needle in the string from the position\n start.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `needle` - The needle\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nposition or FURI_STRING_FAILURE if not found"]
pub fn furi_string_search(
string: *const FuriString,
needle: *const FuriString,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Search the first occurrence of the needle in the string from the position\n start.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `needle` - The needle\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nposition or FURI_STRING_FAILURE if not found"]
pub fn furi_string_search_str(
string: *const FuriString,
needle: *const core::ffi::c_char,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Search for the position of the character c from the position start (include)\n in the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `c` - The character\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nposition or FURI_STRING_FAILURE if not found"]
pub fn furi_string_search_char(
string: *const FuriString,
c: core::ffi::c_char,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Reverse search for the position of the character c from the position start\n (include) in the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `c` - The character\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nposition or FURI_STRING_FAILURE if not found"]
pub fn furi_string_search_rchar(
string: *const FuriString,
c: core::ffi::c_char,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Test if two strings are equal.\n\n # Arguments\n\n* `string_1` - The string 1\n * `string_2` - The string 2\n\n # Returns\n\ntrue if equal false otherwise"]
pub fn furi_string_equal(string_1: *const FuriString, string_2: *const FuriString) -> bool;
}
extern "C" {
#[doc = "Test if the string is equal to the C string.\n\n # Arguments\n\n* `string_1` - The string 1\n * `cstring_2` - The cstring 2\n\n # Returns\n\ntrue if equal false otherwise"]
pub fn furi_string_equal_str(
string_1: *const FuriString,
cstring_2: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Replace in the string the sub-string at position 'pos' for 'len' bytes into\n the C string 'replace'.\n\n # Arguments\n\n* `string` - The string\n * `pos` - The position\n * `len` - The length\n * `replace` - The replace"]
pub fn furi_string_replace_at(
string: *mut FuriString,
pos: usize,
len: usize,
replace: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Replace a string 'needle' to string 'replace' in a string from 'start'\n position.\n\n # Arguments\n\n* `string` - The string\n * `needle` - The needle\n * `replace` - The replace\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nReturn FURI_STRING_FAILURE if 'needle' not found or replace position."]
pub fn furi_string_replace(
string: *mut FuriString,
needle: *mut FuriString,
replace: *mut FuriString,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Replace a C string 'needle' to C string 'replace' in a string from 'start'\n position.\n\n # Arguments\n\n* `string` - The string\n * `needle` - The needle\n * `replace` - The replace\n * `start` - The start (By default, start is zero)\n\n # Returns\n\nReturn FURI_STRING_FAILURE if 'needle' not found or replace position."]
pub fn furi_string_replace_str(
string: *mut FuriString,
needle: *const core::ffi::c_char,
replace: *const core::ffi::c_char,
start: usize,
) -> usize;
}
extern "C" {
#[doc = "Replace all occurrences of 'needle' string into 'replace' string.\n\n # Arguments\n\n* `string` - The string\n * `needle` - The needle\n * `replace` - The replace"]
pub fn furi_string_replace_all(
string: *mut FuriString,
needle: *const FuriString,
replace: *const FuriString,
);
}
extern "C" {
#[doc = "Replace all occurrences of 'needle' C string into 'replace' C string.\n\n # Arguments\n\n* `string` - The string\n * `needle` - The needle\n * `replace` - The replace"]
pub fn furi_string_replace_all_str(
string: *mut FuriString,
needle: *const core::ffi::c_char,
replace: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Test if the string starts with the given string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `start` - The FuriString instance\n\n # Returns\n\ntrue if string starts with"]
pub fn furi_string_start_with(string: *const FuriString, start: *const FuriString) -> bool;
}
extern "C" {
#[doc = "Test if the string starts with the given C string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `start` - The start\n\n # Returns\n\ntrue if string starts with"]
pub fn furi_string_start_with_str(
string: *const FuriString,
start: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Test if the string ends with the given string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `end` - The end\n\n # Returns\n\ntrue if string ends with"]
pub fn furi_string_end_with(string: *const FuriString, end: *const FuriString) -> bool;
}
extern "C" {
#[doc = "Test if the string ends with the given string (case insensitive according to the current locale).\n\n # Arguments\n\n* `string` - The FuriString instance\n * `end` - The end\n\n # Returns\n\ntrue if string ends with"]
pub fn furi_string_end_withi(string: *const FuriString, end: *const FuriString) -> bool;
}
extern "C" {
#[doc = "Test if the string ends with the given C string.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `end` - The end\n\n # Returns\n\ntrue if string ends with"]
pub fn furi_string_end_with_str(
string: *const FuriString,
end: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Test if the string ends with the given C string (case insensitive according to the current locale).\n\n # Arguments\n\n* `string` - The FuriString instance\n * `end` - The end\n\n # Returns\n\ntrue if string ends with"]
pub fn furi_string_end_withi_str(
string: *const FuriString,
end: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Trim the string left to the first 'index' bytes.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `index` - The index"]
pub fn furi_string_left(string: *mut FuriString, index: usize);
}
extern "C" {
#[doc = "Trim the string right from the 'index' position to the last position.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `index` - The index"]
pub fn furi_string_right(string: *mut FuriString, index: usize);
}
extern "C" {
#[doc = "Trim the string from position index to size bytes.\n\n See also furi_string_set_n.\n\n # Arguments\n\n* `string` - The FuriString instance\n * `index` - The index\n * `size` - The size"]
pub fn furi_string_mid(string: *mut FuriString, index: usize, size: usize);
}
extern "C" {
#[doc = "Trim a string from the given set of characters (default is \" # Arguments\n\n* `string` - The FuriString instance\n * `chars` - The characters"]
pub fn furi_string_trim(string: *mut FuriString, chars: *const core::ffi::c_char);
}
#[doc = "An unicode value"]
pub type FuriStringUnicodeValue = core::ffi::c_uint;
extern "C" {
#[doc = "Compute the length in UTF8 characters in the string.\n\n # Arguments\n\n* `string` - The FuriString instance\n\n # Returns\n\nstrings size"]
pub fn furi_string_utf8_length(string: *mut FuriString) -> usize;
}
extern "C" {
#[doc = "Push unicode into string, encoding it in UTF8.\n\n # Arguments\n\n* `string` - The string\n * `unicode` - The unicode"]
pub fn furi_string_utf8_push(string: *mut FuriString, unicode: FuriStringUnicodeValue);
}
pub const FuriStringUTF8State_FuriStringUTF8StateStarting: FuriStringUTF8State = 0;
pub const FuriStringUTF8State_FuriStringUTF8StateDecoding1: FuriStringUTF8State = 1;
pub const FuriStringUTF8State_FuriStringUTF8StateDecoding2: FuriStringUTF8State = 2;
pub const FuriStringUTF8State_FuriStringUTF8StateDecoding3: FuriStringUTF8State = 3;
pub const FuriStringUTF8State_FuriStringUTF8StateError: FuriStringUTF8State = 4;
#[doc = "State of the UTF8 decoding machine state"]
pub type FuriStringUTF8State = core::ffi::c_uchar;
extern "C" {
#[doc = "Main generic UTF8 decoder\n\n It takes a character, and the previous state and the previous value of the\n unicode value. It updates the state and the decoded unicode value. A decoded\n unicode encoded value is valid only when the state is\n FuriStringUTF8StateStarting.\n\n # Arguments\n\n* `c` - The character\n * `state` - The state\n * `unicode` - The unicode"]
pub fn furi_string_utf8_decode(
c: core::ffi::c_char,
state: *mut FuriStringUTF8State,
unicode: *mut FuriStringUnicodeValue,
);
}
extern "C" {
#[doc = "Allocate stream buffer instance.\n Stream buffer implementation assumes there is only one task or\n interrupt that will write to the buffer (the writer), and only one task or\n interrupt that will read from the buffer (the reader).\n\n # Arguments\n\n* `size` - The total number of bytes the stream buffer will be able to hold at any one time.\n * `trigger_level` - The number of bytes that must be in the stream buffer\n before a task that is blocked on the stream buffer to wait for data is moved out of the blocked state.\n # Returns\n\nThe stream buffer instance."]
pub fn furi_stream_buffer_alloc(size: usize, trigger_level: usize) -> *mut FuriStreamBuffer;
}
extern "C" {
#[doc = "Free stream buffer instance\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance."]
pub fn furi_stream_buffer_free(stream_buffer: *mut FuriStreamBuffer);
}
extern "C" {
#[doc = "Set trigger level for stream buffer.\n A stream buffer's trigger level is the number of bytes that must be in the\n stream buffer before a task that is blocked on the stream buffer to\n wait for data is moved out of the blocked state.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance\n * `trigger_level` - The new trigger level for the stream buffer.\n # Returns\n\ntrue if trigger level can be be updated (new trigger level was less than or equal to the stream buffer's length).\n false if trigger level can't be be updated (new trigger level was greater than the stream buffer's length)."]
pub fn furi_stream_set_trigger_level(
stream_buffer: *mut FuriStreamBuffer,
trigger_level: usize,
) -> bool;
}
extern "C" {
#[doc = "Sends bytes to a stream buffer. The bytes are copied into the stream buffer.\n Wakes up task waiting for data to become available if called from ISR.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n * `data` - A pointer to the data that is to be copied into the stream buffer.\n * `length` - The maximum number of bytes to copy from data into the stream buffer.\n * `timeout` - The maximum amount of time the task should remain in the\n Blocked state to wait for space to become available if the stream buffer is full.\n Will return immediately if timeout is zero.\n Setting timeout to FuriWaitForever will cause the task to wait indefinitely.\n Ignored if called from ISR.\n # Returns\n\nThe number of bytes actually written to the stream buffer."]
pub fn furi_stream_buffer_send(
stream_buffer: *mut FuriStreamBuffer,
data: *const core::ffi::c_void,
length: usize,
timeout: u32,
) -> usize;
}
extern "C" {
#[doc = "Receives bytes from a stream buffer.\n Wakes up task waiting for space to become available if called from ISR.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n * `data` - A pointer to the buffer into which the received bytes will be\n copied.\n * `length` - The length of the buffer pointed to by the data parameter.\n * `timeout` - The maximum amount of time the task should remain in the\n Blocked state to wait for data to become available if the stream buffer is empty.\n Will return immediately if timeout is zero.\n Setting timeout to FuriWaitForever will cause the task to wait indefinitely.\n Ignored if called from ISR.\n # Returns\n\nThe number of bytes read from the stream buffer, if any."]
pub fn furi_stream_buffer_receive(
stream_buffer: *mut FuriStreamBuffer,
data: *mut core::ffi::c_void,
length: usize,
timeout: u32,
) -> usize;
}
extern "C" {
#[doc = "Queries a stream buffer to see how much data it contains, which is equal to\n the number of bytes that can be read from the stream buffer before the stream\n buffer would be empty.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n # Returns\n\nThe number of bytes that can be read from the stream buffer before\n the stream buffer would be empty."]
pub fn furi_stream_buffer_bytes_available(stream_buffer: *mut FuriStreamBuffer) -> usize;
}
extern "C" {
#[doc = "Queries a stream buffer to see how much free space it contains, which is\n equal to the amount of data that can be sent to the stream buffer before it\n is full.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n # Returns\n\nThe number of bytes that can be written to the stream buffer before\n the stream buffer would be full."]
pub fn furi_stream_buffer_spaces_available(stream_buffer: *mut FuriStreamBuffer) -> usize;
}
extern "C" {
#[doc = "Queries a stream buffer to see if it is full.\n\n # Arguments\n\n* `stream_buffer` - stream buffer instance.\n # Returns\n\ntrue if the stream buffer is full.\n false if the stream buffer is not full."]
pub fn furi_stream_buffer_is_full(stream_buffer: *mut FuriStreamBuffer) -> bool;
}
extern "C" {
#[doc = "Queries a stream buffer to see if it is empty.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n # Returns\n\ntrue if the stream buffer is empty.\n false if the stream buffer is not empty."]
pub fn furi_stream_buffer_is_empty(stream_buffer: *mut FuriStreamBuffer) -> bool;
}
extern "C" {
#[doc = "Resets a stream buffer to its initial, empty, state. Any data that was\n in the stream buffer is discarded. A stream buffer can only be reset if there\n are no tasks blocked waiting to either send to or receive from the stream buffer.\n\n # Arguments\n\n* `stream_buffer` - The stream buffer instance.\n # Returns\n\nFuriStatusOk if the stream buffer is reset.\n FuriStatusError if there was a task blocked waiting to send to or read\n from the stream buffer then the stream buffer is not reset."]
pub fn furi_stream_buffer_reset(stream_buffer: *mut FuriStreamBuffer) -> FuriStatus;
}
extern "C" {
#[doc = "< System Clock Frequency"]
pub static mut SystemCoreClock: u32;
}
#[doc = "Comparator"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct COMP_TypeDef {
#[doc = "< COMP control and status register, Address offset: 0x00"]
pub CSR: u32,
}
#[test]
fn bindgen_test_layout_COMP_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<COMP_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<COMP_TypeDef>(),
4usize,
concat!("Size of: ", stringify!(COMP_TypeDef))
);
assert_eq!(
::core::mem::align_of::<COMP_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(COMP_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CSR) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(COMP_TypeDef),
"::",
stringify!(CSR)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DMA_TypeDef {
#[doc = "< DMA interrupt status register, Address offset: 0x00"]
pub ISR: u32,
#[doc = "< DMA interrupt flag clear register, Address offset: 0x04"]
pub IFCR: u32,
}
#[test]
fn bindgen_test_layout_DMA_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<DMA_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<DMA_TypeDef>(),
8usize,
concat!("Size of: ", stringify!(DMA_TypeDef))
);
assert_eq!(
::core::mem::align_of::<DMA_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(DMA_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ISR) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(DMA_TypeDef),
"::",
stringify!(ISR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).IFCR) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(DMA_TypeDef),
"::",
stringify!(IFCR)
)
);
}
#[doc = "General Purpose I/O"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GPIO_TypeDef {
#[doc = "< GPIO port mode register, Address offset: 0x00"]
pub MODER: u32,
#[doc = "< GPIO port output type register, Address offset: 0x04"]
pub OTYPER: u32,
#[doc = "< GPIO port output speed register, Address offset: 0x08"]
pub OSPEEDR: u32,
#[doc = "< GPIO port pull-up/pull-down register, Address offset: 0x0C"]
pub PUPDR: u32,
#[doc = "< GPIO port input data register, Address offset: 0x10"]
pub IDR: u32,
#[doc = "< GPIO port output data register, Address offset: 0x14"]
pub ODR: u32,
#[doc = "< GPIO port bit set/reset register, Address offset: 0x18"]
pub BSRR: u32,
#[doc = "< GPIO port configuration lock register, Address offset: 0x1C"]
pub LCKR: u32,
#[doc = "< GPIO alternate function registers, Address offset: 0x20-0x24"]
pub AFR: [u32; 2usize],
#[doc = "< GPIO Bit Reset register, Address offset: 0x28"]
pub BRR: u32,
}
#[test]
fn bindgen_test_layout_GPIO_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<GPIO_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GPIO_TypeDef>(),
44usize,
concat!("Size of: ", stringify!(GPIO_TypeDef))
);
assert_eq!(
::core::mem::align_of::<GPIO_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(GPIO_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MODER) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(MODER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OTYPER) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(OTYPER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OSPEEDR) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(OSPEEDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PUPDR) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(PUPDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).IDR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(IDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ODR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(ODR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BSRR) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(BSRR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).LCKR) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(LCKR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).AFR) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(AFR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BRR) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(GPIO_TypeDef),
"::",
stringify!(BRR)
)
);
}
#[doc = "Inter-integrated Circuit Interface"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct I2C_TypeDef {
#[doc = "< I2C Control register 1, Address offset: 0x00"]
pub CR1: u32,
#[doc = "< I2C Control register 2, Address offset: 0x04"]
pub CR2: u32,
#[doc = "< I2C Own address 1 register, Address offset: 0x08"]
pub OAR1: u32,
#[doc = "< I2C Own address 2 register, Address offset: 0x0C"]
pub OAR2: u32,
#[doc = "< I2C Timing register, Address offset: 0x10"]
pub TIMINGR: u32,
#[doc = "< I2C Timeout register, Address offset: 0x14"]
pub TIMEOUTR: u32,
#[doc = "< I2C Interrupt and status register, Address offset: 0x18"]
pub ISR: u32,
#[doc = "< I2C Interrupt clear register, Address offset: 0x1C"]
pub ICR: u32,
#[doc = "< I2C PEC register, Address offset: 0x20"]
pub PECR: u32,
#[doc = "< I2C Receive data register, Address offset: 0x24"]
pub RXDR: u32,
#[doc = "< I2C Transmit data register, Address offset: 0x28"]
pub TXDR: u32,
}
#[test]
fn bindgen_test_layout_I2C_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<I2C_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<I2C_TypeDef>(),
44usize,
concat!("Size of: ", stringify!(I2C_TypeDef))
);
assert_eq!(
::core::mem::align_of::<I2C_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(I2C_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(CR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR2) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(CR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OAR1) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(OAR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OAR2) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(OAR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TIMINGR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(TIMINGR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TIMEOUTR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(TIMEOUTR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ISR) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(ISR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ICR) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(ICR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PECR) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(PECR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RXDR) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(RXDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TXDR) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(I2C_TypeDef),
"::",
stringify!(TXDR)
)
);
}
#[doc = "LPTIMER"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LPTIM_TypeDef {
#[doc = "< LPTIM Interrupt and Status register, Address offset: 0x00"]
pub ISR: u32,
#[doc = "< LPTIM Interrupt Clear register, Address offset: 0x04"]
pub ICR: u32,
#[doc = "< LPTIM Interrupt Enable register, Address offset: 0x08"]
pub IER: u32,
#[doc = "< LPTIM Configuration register, Address offset: 0x0C"]
pub CFGR: u32,
#[doc = "< LPTIM Control register, Address offset: 0x10"]
pub CR: u32,
#[doc = "< LPTIM Compare register, Address offset: 0x14"]
pub CMP: u32,
#[doc = "< LPTIM Autoreload register, Address offset: 0x18"]
pub ARR: u32,
#[doc = "< LPTIM Counter register, Address offset: 0x1C"]
pub CNT: u32,
#[doc = "< LPTIM Option register, Address offset: 0x20"]
pub OR: u32,
}
#[test]
fn bindgen_test_layout_LPTIM_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LPTIM_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LPTIM_TypeDef>(),
36usize,
concat!("Size of: ", stringify!(LPTIM_TypeDef))
);
assert_eq!(
::core::mem::align_of::<LPTIM_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LPTIM_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ISR) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(ISR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ICR) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(ICR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).IER) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(IER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CFGR) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(CFGR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(CR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CMP) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(CMP)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ARR) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(ARR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CNT) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(CNT)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OR) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(LPTIM_TypeDef),
"::",
stringify!(OR)
)
);
}
#[doc = "Real-Time Clock"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RTC_TypeDef {
#[doc = "< RTC time register, Address offset: 0x00"]
pub TR: u32,
#[doc = "< RTC date register, Address offset: 0x04"]
pub DR: u32,
#[doc = "< RTC control register, Address offset: 0x08"]
pub CR: u32,
#[doc = "< RTC initialization and status register, Address offset: 0x0C"]
pub ISR: u32,
#[doc = "< RTC prescaler register, Address offset: 0x10"]
pub PRER: u32,
#[doc = "< RTC wakeup timer register, Address offset: 0x14"]
pub WUTR: u32,
#[doc = "< Reserved, Address offset: 0x18"]
pub RESERVED: u32,
#[doc = "< RTC alarm A register, Address offset: 0x1C"]
pub ALRMAR: u32,
#[doc = "< RTC alarm B register, Address offset: 0x20"]
pub ALRMBR: u32,
#[doc = "< RTC write protection register, Address offset: 0x24"]
pub WPR: u32,
#[doc = "< RTC sub second register, Address offset: 0x28"]
pub SSR: u32,
#[doc = "< RTC shift control register, Address offset: 0x2C"]
pub SHIFTR: u32,
#[doc = "< RTC time stamp time register, Address offset: 0x30"]
pub TSTR: u32,
#[doc = "< RTC time stamp date register, Address offset: 0x34"]
pub TSDR: u32,
#[doc = "< RTC time-stamp sub second register, Address offset: 0x38"]
pub TSSSR: u32,
#[doc = "< RTC calibration register, Address offset: 0x3C"]
pub CALR: u32,
#[doc = "< RTC tamper configuration register, Address offset: 0x40"]
pub TAMPCR: u32,
#[doc = "< RTC alarm A sub second register, Address offset: 0x44"]
pub ALRMASSR: u32,
#[doc = "< RTC alarm B sub second register, Address offset: 0x48"]
pub ALRMBSSR: u32,
#[doc = "< RTC option register, Address offset 0x4C"]
pub OR: u32,
#[doc = "< RTC backup register 0, Address offset: 0x50"]
pub BKP0R: u32,
#[doc = "< RTC backup register 1, Address offset: 0x54"]
pub BKP1R: u32,
#[doc = "< RTC backup register 2, Address offset: 0x58"]
pub BKP2R: u32,
#[doc = "< RTC backup register 3, Address offset: 0x5C"]
pub BKP3R: u32,
#[doc = "< RTC backup register 4, Address offset: 0x60"]
pub BKP4R: u32,
#[doc = "< RTC backup register 5, Address offset: 0x64"]
pub BKP5R: u32,
#[doc = "< RTC backup register 6, Address offset: 0x68"]
pub BKP6R: u32,
#[doc = "< RTC backup register 7, Address offset: 0x6C"]
pub BKP7R: u32,
#[doc = "< RTC backup register 8, Address offset: 0x70"]
pub BKP8R: u32,
#[doc = "< RTC backup register 9, Address offset: 0x74"]
pub BKP9R: u32,
#[doc = "< RTC backup register 10, Address offset: 0x78"]
pub BKP10R: u32,
#[doc = "< RTC backup register 11, Address offset: 0x7C"]
pub BKP11R: u32,
#[doc = "< RTC backup register 12, Address offset: 0x80"]
pub BKP12R: u32,
#[doc = "< RTC backup register 13, Address offset: 0x84"]
pub BKP13R: u32,
#[doc = "< RTC backup register 14, Address offset: 0x88"]
pub BKP14R: u32,
#[doc = "< RTC backup register 15, Address offset: 0x8C"]
pub BKP15R: u32,
#[doc = "< RTC backup register 16, Address offset: 0x90"]
pub BKP16R: u32,
#[doc = "< RTC backup register 17, Address offset: 0x94"]
pub BKP17R: u32,
#[doc = "< RTC backup register 18, Address offset: 0x98"]
pub BKP18R: u32,
#[doc = "< RTC backup register 19, Address offset: 0x9C"]
pub BKP19R: u32,
}
#[test]
fn bindgen_test_layout_RTC_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<RTC_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<RTC_TypeDef>(),
160usize,
concat!("Size of: ", stringify!(RTC_TypeDef))
);
assert_eq!(
::core::mem::align_of::<RTC_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(RTC_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TR) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(TR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DR) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(DR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(CR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ISR) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(ISR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PRER) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(PRER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).WUTR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(WUTR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RESERVED) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(RESERVED)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ALRMAR) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(ALRMAR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ALRMBR) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(ALRMBR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).WPR) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(WPR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SSR) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(SSR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SHIFTR) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(SHIFTR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TSTR) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(TSTR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TSDR) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(TSDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TSSSR) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(TSSSR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CALR) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(CALR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TAMPCR) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(TAMPCR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ALRMASSR) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(ALRMASSR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ALRMBSSR) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(ALRMBSSR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OR) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(OR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP0R) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP0R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP1R) as usize - ptr as usize },
84usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP1R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP2R) as usize - ptr as usize },
88usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP2R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP3R) as usize - ptr as usize },
92usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP3R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP4R) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP4R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP5R) as usize - ptr as usize },
100usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP5R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP6R) as usize - ptr as usize },
104usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP6R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP7R) as usize - ptr as usize },
108usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP7R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP8R) as usize - ptr as usize },
112usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP8R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP9R) as usize - ptr as usize },
116usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP9R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP10R) as usize - ptr as usize },
120usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP10R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP11R) as usize - ptr as usize },
124usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP11R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP12R) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP12R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP13R) as usize - ptr as usize },
132usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP13R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP14R) as usize - ptr as usize },
136usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP14R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP15R) as usize - ptr as usize },
140usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP15R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP16R) as usize - ptr as usize },
144usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP16R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP17R) as usize - ptr as usize },
148usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP17R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP18R) as usize - ptr as usize },
152usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP18R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BKP19R) as usize - ptr as usize },
156usize,
concat!(
"Offset of field: ",
stringify!(RTC_TypeDef),
"::",
stringify!(BKP19R)
)
);
}
#[doc = "Serial Peripheral Interface"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SPI_TypeDef {
#[doc = "< SPI Control register 1, Address offset: 0x00"]
pub CR1: u32,
#[doc = "< SPI Control register 2, Address offset: 0x04"]
pub CR2: u32,
#[doc = "< SPI Status register, Address offset: 0x08"]
pub SR: u32,
#[doc = "< SPI data register, Address offset: 0x0C"]
pub DR: u32,
#[doc = "< SPI CRC polynomial register, Address offset: 0x10"]
pub CRCPR: u32,
#[doc = "< SPI Rx CRC register, Address offset: 0x14"]
pub RXCRCR: u32,
#[doc = "< SPI Tx CRC register, Address offset: 0x18"]
pub TXCRCR: u32,
}
#[test]
fn bindgen_test_layout_SPI_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<SPI_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SPI_TypeDef>(),
28usize,
concat!("Size of: ", stringify!(SPI_TypeDef))
);
assert_eq!(
::core::mem::align_of::<SPI_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(SPI_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(CR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR2) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(CR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SR) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(SR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DR) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(DR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CRCPR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(CRCPR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RXCRCR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(RXCRCR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TXCRCR) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(SPI_TypeDef),
"::",
stringify!(TXCRCR)
)
);
}
#[doc = "TIM"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TIM_TypeDef {
#[doc = "< TIM control register 1, Address offset: 0x00"]
pub CR1: u32,
#[doc = "< TIM control register 2, Address offset: 0x04"]
pub CR2: u32,
#[doc = "< TIM slave mode control register, Address offset: 0x08"]
pub SMCR: u32,
#[doc = "< TIM DMA/interrupt enable register, Address offset: 0x0C"]
pub DIER: u32,
#[doc = "< TIM status register, Address offset: 0x10"]
pub SR: u32,
#[doc = "< TIM event generation register, Address offset: 0x14"]
pub EGR: u32,
#[doc = "< TIM capture/compare mode register 1, Address offset: 0x18"]
pub CCMR1: u32,
#[doc = "< TIM capture/compare mode register 2, Address offset: 0x1C"]
pub CCMR2: u32,
#[doc = "< TIM capture/compare enable register, Address offset: 0x20"]
pub CCER: u32,
#[doc = "< TIM counter register, Address offset: 0x24"]
pub CNT: u32,
#[doc = "< TIM prescaler register, Address offset: 0x28"]
pub PSC: u32,
#[doc = "< TIM auto-reload register, Address offset: 0x2C"]
pub ARR: u32,
#[doc = "< TIM repetition counter register, Address offset: 0x30"]
pub RCR: u32,
#[doc = "< TIM capture/compare register 1, Address offset: 0x34"]
pub CCR1: u32,
#[doc = "< TIM capture/compare register 2, Address offset: 0x38"]
pub CCR2: u32,
#[doc = "< TIM capture/compare register 3, Address offset: 0x3C"]
pub CCR3: u32,
#[doc = "< TIM capture/compare register 4, Address offset: 0x40"]
pub CCR4: u32,
#[doc = "< TIM break and dead-time register, Address offset: 0x44"]
pub BDTR: u32,
#[doc = "< TIM DMA control register, Address offset: 0x48"]
pub DCR: u32,
#[doc = "< TIM DMA address for full transfer, Address offset: 0x4C"]
pub DMAR: u32,
#[doc = "< TIM option register Address offset: 0x50"]
pub OR: u32,
#[doc = "< TIM capture/compare mode register 3, Address offset: 0x54"]
pub CCMR3: u32,
#[doc = "< TIM capture/compare register5, Address offset: 0x58"]
pub CCR5: u32,
#[doc = "< TIM capture/compare register6, Address offset: 0x5C"]
pub CCR6: u32,
#[doc = "< TIM Alternate function option register 1, Address offset: 0x60"]
pub AF1: u32,
#[doc = "< TIM Alternate function option register 2, Address offset: 0x64"]
pub AF2: u32,
}
#[test]
fn bindgen_test_layout_TIM_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<TIM_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<TIM_TypeDef>(),
104usize,
concat!("Size of: ", stringify!(TIM_TypeDef))
);
assert_eq!(
::core::mem::align_of::<TIM_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(TIM_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR2) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SMCR) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(SMCR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DIER) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(DIER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(SR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).EGR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(EGR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCMR1) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCMR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCMR2) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCMR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCER) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCER)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CNT) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CNT)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PSC) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(PSC)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ARR) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(ARR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RCR) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(RCR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR1) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR2) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR3) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR4) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR4)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BDTR) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(BDTR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DCR) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(DCR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DMAR) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(DMAR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OR) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(OR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCMR3) as usize - ptr as usize },
84usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCMR3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR5) as usize - ptr as usize },
88usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR5)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CCR6) as usize - ptr as usize },
92usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(CCR6)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).AF1) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(AF1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).AF2) as usize - ptr as usize },
100usize,
concat!(
"Offset of field: ",
stringify!(TIM_TypeDef),
"::",
stringify!(AF2)
)
);
}
#[doc = "Universal Synchronous Asynchronous Receiver Transmitter"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct USART_TypeDef {
#[doc = "< USART Control register 1, Address offset: 0x00"]
pub CR1: u32,
#[doc = "< USART Control register 2, Address offset: 0x04"]
pub CR2: u32,
#[doc = "< USART Control register 3, Address offset: 0x08"]
pub CR3: u32,
#[doc = "< USART Baud rate register, Address offset: 0x0C"]
pub BRR: u32,
#[doc = "< USART Guard time and prescaler register, Address offset: 0x10"]
pub GTPR: u32,
#[doc = "< USART Receiver Time Out register, Address offset: 0x14"]
pub RTOR: u32,
#[doc = "< USART Request register, Address offset: 0x18"]
pub RQR: u32,
#[doc = "< USART Interrupt and status register, Address offset: 0x1C"]
pub ISR: u32,
#[doc = "< USART Interrupt flag Clear register, Address offset: 0x20"]
pub ICR: u32,
#[doc = "< USART Receive Data register, Address offset: 0x24"]
pub RDR: u32,
#[doc = "< USART Transmit Data register, Address offset: 0x28"]
pub TDR: u32,
#[doc = "< USART Prescaler register, Address offset: 0x2C"]
pub PRESC: u32,
}
#[test]
fn bindgen_test_layout_USART_TypeDef() {
const UNINIT: ::core::mem::MaybeUninit<USART_TypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<USART_TypeDef>(),
48usize,
concat!("Size of: ", stringify!(USART_TypeDef))
);
assert_eq!(
::core::mem::align_of::<USART_TypeDef>(),
4usize,
concat!("Alignment of ", stringify!(USART_TypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(CR1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR2) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(CR2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CR3) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(CR3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BRR) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(BRR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).GTPR) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(GTPR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RTOR) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(RTOR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RQR) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(RQR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ISR) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(ISR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ICR) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(ICR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RDR) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(RDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TDR) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(TDR)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PRESC) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(USART_TypeDef),
"::",
stringify!(PRESC)
)
);
}
pub const ErrorStatus_SUCCESS: ErrorStatus = 0;
pub const ErrorStatus_ERROR: ErrorStatus = 1;
pub type ErrorStatus = core::ffi::c_uchar;
#[doc = "LL GPIO Init Structure definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_GPIO_InitTypeDef {
#[doc = "< Specifies the GPIO pins to be configured.\nThis parameter can be any value of GPIO_LL_EC_PIN"]
pub Pin: u32,
#[doc = "< Specifies the operating mode for the selected pins.\nThis parameter can be a value of GPIO_LL_EC_MODE.\n\nGPIO HW configuration can be modified afterwards using unitary function LL_GPIO_SetPinMode()."]
pub Mode: u32,
#[doc = "< Specifies the speed for the selected pins.\nThis parameter can be a value of GPIO_LL_EC_SPEED.\n\nGPIO HW configuration can be modified afterwards using unitary function LL_GPIO_SetPinSpeed()."]
pub Speed: u32,
#[doc = "< Specifies the operating output type for the selected pins.\nThis parameter can be a value of GPIO_LL_EC_OUTPUT.\n\nGPIO HW configuration can be modified afterwards using unitary function LL_GPIO_SetPinOutputType()."]
pub OutputType: u32,
#[doc = "< Specifies the operating Pull-up/Pull down for the selected pins.\nThis parameter can be a value of GPIO_LL_EC_PULL.\n\nGPIO HW configuration can be modified afterwards using unitary function LL_GPIO_SetPinPull()."]
pub Pull: u32,
#[doc = "< Specifies the Peripheral to be connected to the selected pins.\nThis parameter can be a value of GPIO_LL_EC_AF.\n\nGPIO HW configuration can be modified afterwards using unitary function LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15()."]
pub Alternate: u32,
}
#[test]
fn bindgen_test_layout_LL_GPIO_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_GPIO_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_GPIO_InitTypeDef>(),
24usize,
concat!("Size of: ", stringify!(LL_GPIO_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_GPIO_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_GPIO_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Pin) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(Pin)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Mode) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(Mode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Speed) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(Speed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OutputType) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(OutputType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Pull) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(Pull)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Alternate) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_GPIO_InitTypeDef),
"::",
stringify!(Alternate)
)
);
}
extern "C" {
pub fn LL_GPIO_Init(
GPIOx: *mut GPIO_TypeDef,
GPIO_InitStruct: *mut LL_GPIO_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "Interrupt callback prototype"]
pub type GpioExtiCallback =
::core::option::Option<unsafe extern "C" fn(ctx: *mut core::ffi::c_void)>;
pub const GpioMode_GpioModeInput: GpioMode = 0;
pub const GpioMode_GpioModeOutputPushPull: GpioMode = 1;
pub const GpioMode_GpioModeOutputOpenDrain: GpioMode = 2;
pub const GpioMode_GpioModeAltFunctionPushPull: GpioMode = 3;
pub const GpioMode_GpioModeAltFunctionOpenDrain: GpioMode = 4;
pub const GpioMode_GpioModeAnalog: GpioMode = 5;
pub const GpioMode_GpioModeInterruptRise: GpioMode = 6;
pub const GpioMode_GpioModeInterruptFall: GpioMode = 7;
pub const GpioMode_GpioModeInterruptRiseFall: GpioMode = 8;
pub const GpioMode_GpioModeEventRise: GpioMode = 9;
pub const GpioMode_GpioModeEventFall: GpioMode = 10;
pub const GpioMode_GpioModeEventRiseFall: GpioMode = 11;
#[doc = "Gpio modes"]
pub type GpioMode = core::ffi::c_uchar;
pub const GpioPull_GpioPullNo: GpioPull = 0;
pub const GpioPull_GpioPullUp: GpioPull = 1;
pub const GpioPull_GpioPullDown: GpioPull = 2;
#[doc = "Gpio pull modes"]
pub type GpioPull = core::ffi::c_uchar;
pub const GpioSpeed_GpioSpeedLow: GpioSpeed = 0;
pub const GpioSpeed_GpioSpeedMedium: GpioSpeed = 1;
pub const GpioSpeed_GpioSpeedHigh: GpioSpeed = 2;
pub const GpioSpeed_GpioSpeedVeryHigh: GpioSpeed = 3;
#[doc = "Gpio speed modes"]
pub type GpioSpeed = core::ffi::c_uchar;
#[doc = "< MCO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0MCO: GpioAltFn = 0;
#[doc = "< LSCO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0LSCO: GpioAltFn = 0;
#[doc = "< JTMS-SWDIO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0JTMS_SWDIO: GpioAltFn = 0;
#[doc = "< JTCK-SWCLK Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0JTCK_SWCLK: GpioAltFn = 0;
#[doc = "< JTDI Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0JTDI: GpioAltFn = 0;
#[doc = "< RCT_OUT Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0RTC_OUT: GpioAltFn = 0;
#[doc = "< JTDO-TRACESWO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0JTD_TRACE: GpioAltFn = 0;
#[doc = "< NJTRST Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0NJTRST: GpioAltFn = 0;
#[doc = "< RTC_REFIN Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0RTC_REFIN: GpioAltFn = 0;
#[doc = "< TRACED0 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRACED0: GpioAltFn = 0;
#[doc = "< TRACED1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRACED1: GpioAltFn = 0;
#[doc = "< TRACED2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRACED2: GpioAltFn = 0;
#[doc = "< TRACED3 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRACED3: GpioAltFn = 0;
#[doc = "< TRIG_INOUT Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRIG_INOUT: GpioAltFn = 0;
#[doc = "< TRACECK Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn0TRACECK: GpioAltFn = 0;
#[doc = "< System Function mapping"]
pub const GpioAltFn_GpioAltFn0SYS: GpioAltFn = 0;
#[doc = "< TIM1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn1TIM1: GpioAltFn = 1;
#[doc = "< TIM2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn1TIM2: GpioAltFn = 1;
#[doc = "< LPTIM1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn1LPTIM1: GpioAltFn = 1;
#[doc = "< TIM2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn2TIM2: GpioAltFn = 2;
#[doc = "< TIM1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn2TIM1: GpioAltFn = 2;
#[doc = "< SAI1_CK1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn3SAI1: GpioAltFn = 3;
#[doc = "< SPI2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn3SPI2: GpioAltFn = 3;
#[doc = "< TIM1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn3TIM1: GpioAltFn = 3;
#[doc = "< I2C1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn4I2C1: GpioAltFn = 4;
#[doc = "< I2C3 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn4I2C3: GpioAltFn = 4;
#[doc = "< SPI1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn5SPI1: GpioAltFn = 5;
#[doc = "< SPI2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn5SPI2: GpioAltFn = 5;
#[doc = "< MCO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6MCO: GpioAltFn = 6;
#[doc = "< LSCO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6LSCO: GpioAltFn = 6;
#[doc = "< RF_DTB0 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB0: GpioAltFn = 6;
#[doc = "< RF_DTB1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB1: GpioAltFn = 6;
#[doc = "< RF_DTB2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB2: GpioAltFn = 6;
#[doc = "< RF_DTB3 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB3: GpioAltFn = 6;
#[doc = "< RF_DTB4 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB4: GpioAltFn = 6;
#[doc = "< RF_DTB5 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB5: GpioAltFn = 6;
#[doc = "< RF_DTB6 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB6: GpioAltFn = 6;
#[doc = "< RF_DTB7 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB7: GpioAltFn = 6;
#[doc = "< RF_DTB8 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB8: GpioAltFn = 6;
#[doc = "< RF_DTB9 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB9: GpioAltFn = 6;
#[doc = "< RF_DTB10 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB10: GpioAltFn = 6;
#[doc = "< RF_DTB11 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB11: GpioAltFn = 6;
#[doc = "< RF_DTB12 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB12: GpioAltFn = 6;
#[doc = "< RF_DTB13 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB13: GpioAltFn = 6;
#[doc = "< RF_DTB14 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB14: GpioAltFn = 6;
#[doc = "< RF_DTB15 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB15: GpioAltFn = 6;
#[doc = "< RF_DTB16 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB16: GpioAltFn = 6;
#[doc = "< RF_DTB17 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB17: GpioAltFn = 6;
#[doc = "< RF_DTB18 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_DTB18: GpioAltFn = 6;
#[doc = "< RF_MISO Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_MISO: GpioAltFn = 6;
#[doc = "< RF_MOSI Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_MOSI: GpioAltFn = 6;
#[doc = "< RF_SCK Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_SCK: GpioAltFn = 6;
#[doc = "< RF_NSS Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn6RF_NSS: GpioAltFn = 6;
#[doc = "< USART1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn7USART1: GpioAltFn = 7;
#[doc = "< LPUART1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn8LPUART1: GpioAltFn = 8;
#[doc = "< IR Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn8IR: GpioAltFn = 8;
#[doc = "< TSC Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn9TSC: GpioAltFn = 9;
#[doc = "< QUADSPI Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn10QUADSPI: GpioAltFn = 10;
#[doc = "< USB Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn10USB: GpioAltFn = 10;
#[doc = "< LCD Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn11LCD: GpioAltFn = 11;
#[doc = "< COMP1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn12COMP1: GpioAltFn = 12;
#[doc = "< COMP2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn12COMP2: GpioAltFn = 12;
#[doc = "< TIM1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn12TIM1: GpioAltFn = 12;
#[doc = "< SAI1 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn13SAI1: GpioAltFn = 13;
#[doc = "< TIM2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn14TIM2: GpioAltFn = 14;
#[doc = "< TIM16 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn14TIM16: GpioAltFn = 14;
#[doc = "< TIM17 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn14TIM17: GpioAltFn = 14;
#[doc = "< LPTIM2 Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn14LPTIM2: GpioAltFn = 14;
#[doc = "< EVENTOUT Alternate Function mapping"]
pub const GpioAltFn_GpioAltFn15EVENTOUT: GpioAltFn = 15;
#[doc = "< just dummy value"]
pub const GpioAltFn_GpioAltFnUnused: GpioAltFn = 16;
#[doc = "Gpio alternate functions"]
pub type GpioAltFn = core::ffi::c_uchar;
#[doc = "Gpio structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GpioPin {
pub port: *mut GPIO_TypeDef,
pub pin: u16,
}
#[test]
fn bindgen_test_layout_GpioPin() {
const UNINIT: ::core::mem::MaybeUninit<GpioPin> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GpioPin>(),
8usize,
concat!("Size of: ", stringify!(GpioPin))
);
assert_eq!(
::core::mem::align_of::<GpioPin>(),
4usize,
concat!("Alignment of ", stringify!(GpioPin))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).port) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GpioPin),
"::",
stringify!(port)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pin) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GpioPin),
"::",
stringify!(pin)
)
);
}
extern "C" {
#[doc = "GPIO initialization function, simple version\n # Arguments\n\n* `gpio` - GpioPin\n * `mode` - GpioMode"]
pub fn furi_hal_gpio_init_simple(gpio: *const GpioPin, mode: GpioMode);
}
extern "C" {
#[doc = "GPIO initialization function, normal version\n # Arguments\n\n* `gpio` - GpioPin\n * `mode` - GpioMode\n * `pull` - GpioPull\n * `speed` - GpioSpeed"]
pub fn furi_hal_gpio_init(
gpio: *const GpioPin,
mode: GpioMode,
pull: GpioPull,
speed: GpioSpeed,
);
}
extern "C" {
#[doc = "GPIO initialization function, extended version\n # Arguments\n\n* `gpio` - GpioPin\n * `mode` - GpioMode\n * `pull` - GpioPull\n * `speed` - GpioSpeed\n * `alt_fn` - GpioAltFn"]
pub fn furi_hal_gpio_init_ex(
gpio: *const GpioPin,
mode: GpioMode,
pull: GpioPull,
speed: GpioSpeed,
alt_fn: GpioAltFn,
);
}
extern "C" {
#[doc = "Add and enable interrupt\n # Arguments\n\n* `gpio` - GpioPin\n * `cb` - GpioExtiCallback\n * `ctx` - context for callback"]
pub fn furi_hal_gpio_add_int_callback(
gpio: *const GpioPin,
cb: GpioExtiCallback,
ctx: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Enable interrupt\n # Arguments\n\n* `gpio` - GpioPin"]
pub fn furi_hal_gpio_enable_int_callback(gpio: *const GpioPin);
}
extern "C" {
#[doc = "Disable interrupt\n # Arguments\n\n* `gpio` - GpioPin"]
pub fn furi_hal_gpio_disable_int_callback(gpio: *const GpioPin);
}
extern "C" {
#[doc = "Remove interrupt\n # Arguments\n\n* `gpio` - GpioPin"]
pub fn furi_hal_gpio_remove_int_callback(gpio: *const GpioPin);
}
extern "C" {
pub fn powf(arg1: f32, arg2: f32) -> f32;
}
extern "C" {
pub fn roundf(arg1: f32) -> f32;
}
extern "C" {
pub fn scalbnf(arg1: f32, arg2: core::ffi::c_int) -> f32;
}
extern "C" {
pub fn furi_run();
}
#[doc = "Cortex timer provides high precision low level expiring timer"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalCortexTimer {
pub start: u32,
pub value: u32,
}
#[test]
fn bindgen_test_layout_FuriHalCortexTimer() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalCortexTimer> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalCortexTimer>(),
8usize,
concat!("Size of: ", stringify!(FuriHalCortexTimer))
);
assert_eq!(
::core::mem::align_of::<FuriHalCortexTimer>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalCortexTimer))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalCortexTimer),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalCortexTimer),
"::",
stringify!(value)
)
);
}
extern "C" {
#[doc = "Microseconds delay\n\n # Arguments\n\n* `microseconds` (direction in) - The microseconds to wait"]
pub fn furi_hal_cortex_delay_us(microseconds: u32);
}
extern "C" {
#[doc = "Get instructions per microsecond count\n\n # Returns\n\ninstructions per microsecond count"]
pub fn furi_hal_cortex_instructions_per_microsecond() -> u32;
}
extern "C" {
#[doc = "Get Timer\n\n # Arguments\n\n* `timeout_us` (direction in) - The expire timeout in us\n\n # Returns\n\nThe FuriHalCortexTimer"]
pub fn furi_hal_cortex_timer_get(timeout_us: u32) -> FuriHalCortexTimer;
}
extern "C" {
#[doc = "Check if timer expired\n\n # Arguments\n\n* `cortex_timer` (direction in) - The FuriHalCortexTimer\n\n # Returns\n\ntrue if expired"]
pub fn furi_hal_cortex_timer_is_expired(cortex_timer: FuriHalCortexTimer) -> bool;
}
extern "C" {
#[doc = "Wait for timer expire\n\n # Arguments\n\n* `cortex_timer` (direction in) - The FuriHalCortexTimer"]
pub fn furi_hal_cortex_timer_wait(cortex_timer: FuriHalCortexTimer);
}
pub const FuriHalCortexComp_FuriHalCortexComp0: FuriHalCortexComp = 0;
pub const FuriHalCortexComp_FuriHalCortexComp1: FuriHalCortexComp = 1;
pub const FuriHalCortexComp_FuriHalCortexComp2: FuriHalCortexComp = 2;
pub const FuriHalCortexComp_FuriHalCortexComp3: FuriHalCortexComp = 3;
pub type FuriHalCortexComp = core::ffi::c_uchar;
pub const FuriHalCortexCompSize_FuriHalCortexCompSizeWord: FuriHalCortexCompSize = 2;
pub const FuriHalCortexCompSize_FuriHalCortexCompSizeHalfWord: FuriHalCortexCompSize = 1;
pub const FuriHalCortexCompSize_FuriHalCortexCompSizeByte: FuriHalCortexCompSize = 0;
pub type FuriHalCortexCompSize = core::ffi::c_uchar;
pub const FuriHalCortexCompFunction_FuriHalCortexCompFunctionPC: FuriHalCortexCompFunction = 4;
pub const FuriHalCortexCompFunction_FuriHalCortexCompFunctionRead: FuriHalCortexCompFunction = 5;
pub const FuriHalCortexCompFunction_FuriHalCortexCompFunctionWrite: FuriHalCortexCompFunction = 6;
pub const FuriHalCortexCompFunction_FuriHalCortexCompFunctionReadWrite: FuriHalCortexCompFunction =
6;
pub type FuriHalCortexCompFunction = core::ffi::c_uchar;
extern "C" {
#[doc = "Enable DWT comparator\n\n Allows to programmatically set instruction/data breakpoints.\n\n More details on how it works can be found in armv7m official documentation:\n https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/The-Data-Watchpoint-and-Trace-unit/The-DWT-comparators\n https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/The-Data-Watchpoint-and-Trace-unit/Comparator-Function-registers--DWT-FUNCTIONn\n\n # Arguments\n\n* `comp` (direction in) - The Comparator\n * `function` (direction in) - The Comparator Function to use\n * `value` (direction in) - The value\n * `mask` (direction in) - The mask\n * `size` (direction in) - The size"]
pub fn furi_hal_cortex_comp_enable(
comp: FuriHalCortexComp,
function: FuriHalCortexCompFunction,
value: u32,
mask: u32,
size: FuriHalCortexCompSize,
);
}
extern "C" {
#[doc = "Reset DWT comparator\n\n # Arguments\n\n* `comp` (direction in) - The Comparator"]
pub fn furi_hal_cortex_comp_reset(comp: FuriHalCortexComp);
}
extern "C" {
pub fn LL_RCC_GetUSARTClockFreq(USARTxSource: u32) -> u32;
}
extern "C" {
pub fn LL_RCC_GetLPUARTClockFreq(LPUARTxSource: u32) -> u32;
}
pub const FuriHalClockMcoSourceId_FuriHalClockMcoLse: FuriHalClockMcoSourceId = 0;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoSysclk: FuriHalClockMcoSourceId = 1;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi100k: FuriHalClockMcoSourceId = 2;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi200k: FuriHalClockMcoSourceId = 3;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi400k: FuriHalClockMcoSourceId = 4;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi800k: FuriHalClockMcoSourceId = 5;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi1m: FuriHalClockMcoSourceId = 6;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi2m: FuriHalClockMcoSourceId = 7;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi4m: FuriHalClockMcoSourceId = 8;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi8m: FuriHalClockMcoSourceId = 9;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi16m: FuriHalClockMcoSourceId = 10;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi24m: FuriHalClockMcoSourceId = 11;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi32m: FuriHalClockMcoSourceId = 12;
pub const FuriHalClockMcoSourceId_FuriHalClockMcoMsi48m: FuriHalClockMcoSourceId = 13;
pub type FuriHalClockMcoSourceId = core::ffi::c_uchar;
pub const FuriHalClockMcoDivisorId_FuriHalClockMcoDiv1: FuriHalClockMcoDivisorId = 0;
pub const FuriHalClockMcoDivisorId_FuriHalClockMcoDiv2: FuriHalClockMcoDivisorId = 268435456;
pub const FuriHalClockMcoDivisorId_FuriHalClockMcoDiv4: FuriHalClockMcoDivisorId = 536870912;
pub const FuriHalClockMcoDivisorId_FuriHalClockMcoDiv8: FuriHalClockMcoDivisorId = 805306368;
pub const FuriHalClockMcoDivisorId_FuriHalClockMcoDiv16: FuriHalClockMcoDivisorId = 1073741824;
pub type FuriHalClockMcoDivisorId = core::ffi::c_uint;
extern "C" {
#[doc = "Enable clock output on MCO pin\n\n # Arguments\n\n* `source` - MCO clock source\n * `div` - MCO clock division"]
pub fn furi_hal_clock_mco_enable(
source: FuriHalClockMcoSourceId,
div: FuriHalClockMcoDivisorId,
);
}
extern "C" {
#[doc = "Disable clock output on MCO pin"]
pub fn furi_hal_clock_mco_disable();
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalAdcHandle {
_unused: [u8; 0],
}
#[doc = "< 2.048V scale"]
pub const FuriHalAdcScale_FuriHalAdcScale2048: FuriHalAdcScale = 0;
#[doc = "< 2.5V scale"]
pub const FuriHalAdcScale_FuriHalAdcScale2500: FuriHalAdcScale = 1;
pub type FuriHalAdcScale = core::ffi::c_uchar;
#[doc = "< 16MHZ, synchronous"]
pub const FuriHalAdcClock_FuriHalAdcClockSync16: FuriHalAdcClock = 0;
#[doc = "< 32MHZ, synchronous"]
pub const FuriHalAdcClock_FuriHalAdcClockSync32: FuriHalAdcClock = 1;
#[doc = "< 64MHz, synchronous"]
pub const FuriHalAdcClock_FuriHalAdcClockSync64: FuriHalAdcClock = 2;
pub type FuriHalAdcClock = core::ffi::c_uchar;
#[doc = "< ADC will take 2 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample2: FuriHalAdcOversample = 0;
#[doc = "< ADC will take 4 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample4: FuriHalAdcOversample = 1;
#[doc = "< ADC will take 8 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample8: FuriHalAdcOversample = 2;
#[doc = "< ADC will take 16 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample16: FuriHalAdcOversample = 3;
#[doc = "< ADC will take 32 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample32: FuriHalAdcOversample = 4;
#[doc = "< ADC will take 64 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample64: FuriHalAdcOversample = 5;
#[doc = "< ADC will take 128 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample128: FuriHalAdcOversample = 6;
#[doc = "< ADC will take 256 samples per each value"]
pub const FuriHalAdcOversample_FuriHalAdcOversample256: FuriHalAdcOversample = 7;
#[doc = "< disable oversampling"]
pub const FuriHalAdcOversample_FuriHalAdcOversampleNone: FuriHalAdcOversample = 8;
pub type FuriHalAdcOversample = core::ffi::c_uchar;
#[doc = "< Sampling time 2.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime2_5: FuriHalAdcSamplingTime = 0;
#[doc = "< Sampling time 6.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime6_5: FuriHalAdcSamplingTime = 1;
#[doc = "< Sampling time 12.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime12_5: FuriHalAdcSamplingTime = 2;
#[doc = "< Sampling time 24.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime24_5: FuriHalAdcSamplingTime = 3;
#[doc = "< Sampling time 47.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime47_5: FuriHalAdcSamplingTime = 4;
#[doc = "< Sampling time 92.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime92_5: FuriHalAdcSamplingTime = 5;
#[doc = "< Sampling time 247.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime247_5: FuriHalAdcSamplingTime = 6;
#[doc = "< Sampling time 640.5 ADC clock"]
pub const FuriHalAdcSamplingTime_FuriHalAdcSamplingtime640_5: FuriHalAdcSamplingTime = 7;
pub type FuriHalAdcSamplingTime = core::ffi::c_uchar;
#[doc = "< Internal channel, see `FuriHalAdcChannelVREFINT`."]
pub const FuriHalAdcChannel_FuriHalAdcChannel0: FuriHalAdcChannel = 0;
#[doc = "< Channel 1p"]
pub const FuriHalAdcChannel_FuriHalAdcChannel1: FuriHalAdcChannel = 1;
#[doc = "< Channel 2p or 1n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel2: FuriHalAdcChannel = 2;
#[doc = "< Channel 3p or 2n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel3: FuriHalAdcChannel = 3;
#[doc = "< Channel 4p or 3n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel4: FuriHalAdcChannel = 4;
#[doc = "< Channel 5p or 4n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel5: FuriHalAdcChannel = 5;
#[doc = "< Channel 6p or 5n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel6: FuriHalAdcChannel = 6;
#[doc = "< Channel 7p or 6n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel7: FuriHalAdcChannel = 7;
#[doc = "< Channel 8p or 7n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel8: FuriHalAdcChannel = 8;
#[doc = "< Channel 9p or 8n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel9: FuriHalAdcChannel = 9;
#[doc = "< Channel 10p or 9n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel10: FuriHalAdcChannel = 10;
#[doc = "< Channel 11p or 10n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel11: FuriHalAdcChannel = 11;
#[doc = "< Channel 12p or 11n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel12: FuriHalAdcChannel = 12;
#[doc = "< Channel 13p or 12n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel13: FuriHalAdcChannel = 13;
#[doc = "< Channel 14p or 13n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel14: FuriHalAdcChannel = 14;
#[doc = "< Channel 15p or 14n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel15: FuriHalAdcChannel = 15;
#[doc = "< Channel 16p or 15n"]
pub const FuriHalAdcChannel_FuriHalAdcChannel16: FuriHalAdcChannel = 16;
#[doc = "< Internal channel, see `FuriHalAdcChannelTEMPSENSOR`."]
pub const FuriHalAdcChannel_FuriHalAdcChannel17: FuriHalAdcChannel = 17;
#[doc = "< Internal channel, see `FuriHalAdcChannelVBAT`."]
pub const FuriHalAdcChannel_FuriHalAdcChannel18: FuriHalAdcChannel = 18;
#[doc = "< Special channel for VREFINT, used for calibration and self test"]
pub const FuriHalAdcChannel_FuriHalAdcChannelVREFINT: FuriHalAdcChannel = 19;
#[doc = "< Special channel for on-die temperature sensor, requires at least 5us of sampling time"]
pub const FuriHalAdcChannel_FuriHalAdcChannelTEMPSENSOR: FuriHalAdcChannel = 20;
#[doc = "< Special channel for VBAT/3 voltage, requires at least 12us of sampling time"]
pub const FuriHalAdcChannel_FuriHalAdcChannelVBAT: FuriHalAdcChannel = 21;
#[doc = "< No channel"]
pub const FuriHalAdcChannel_FuriHalAdcChannelNone: FuriHalAdcChannel = 22;
pub type FuriHalAdcChannel = core::ffi::c_uchar;
extern "C" {
#[doc = "Initialize ADC subsystem"]
pub fn furi_hal_adc_init();
}
extern "C" {
#[doc = "Acquire ADC handle\n\n Enables appropriate power and clocking domains\n\n # Returns\n\nFuriHalAdcHandle pointer"]
pub fn furi_hal_adc_acquire() -> *mut FuriHalAdcHandle;
}
extern "C" {
#[doc = "Release ADC handle\n\n # Arguments\n\n* `handle` - The ADC handle"]
pub fn furi_hal_adc_release(handle: *mut FuriHalAdcHandle);
}
extern "C" {
#[doc = "Configure with default parameters and enable ADC\n\n Parameters used:\n - FuriHalAdcScale2048 - 2.048V VREF Scale. Your signal should be in 0 -\n 2.048V range.\n - FuriHalAdcClockSync64 - Clocked from sysclk bus at 64MHz in synchronous\n mode. Fast, no delay on data bus access.\n - FuriHalAdcOversample64 - Going to acquire and average 64 samples. For\n circuits with slowly or not changing signal. Total time per one read:\n (1/64)*(12.5+247.5)*64 = 260us. The best results you'll get if your signal\n will stay on the same level all this time.\n - FuriHalAdcSamplingtime247_5 - Sampling(transfer from source to internal\n sampling capacitor) time is 247.5 ADC clocks: (1/64)*247.5 = 3.8671875us.\n For relatively high impedance circuits.\n\n Also keep your measurement circuit impedance under 10KOhm or oversampling\n results will be compromised. Verify your signal with oscilloscope(you may\n need fast oscilloscope: 200MHz bandwidth, 125MS/s), ensure that signal is not\n distorted by sampling.\n\n Those parameters were optimized for 0 - 2.048 voltage measurement with ~0.1%\n precision. You can get more, but it will require some magic.\n\n # Arguments\n\n* `handle` - The ADC handle"]
pub fn furi_hal_adc_configure(handle: *mut FuriHalAdcHandle);
}
extern "C" {
#[doc = "Configure with extended parameters and enable ADC\n\n General advice is to start with default parameters, figure out what exactly\n is not working for you and then tune it. Also in some cases changing\n circuit(adding caps, lowering impedance, adding opamp) may be better than changing\n parameters.\n\n In general ADC is a world of magic: make sure that you understand\n how your circuit and ADC works. Then carefully read STM32WB\n series reference manual. Setting incorrect parameters leads to\n very poor results. Also internal channels require special\n settings.\n\n # Arguments\n\n* `handle` - The ADC handle\n * `scale` (direction in) - The ADC voltage scale\n * `clock` (direction in) - The ADC clock\n * `oversample` (direction in) - The ADC oversample mode\n * `sampling_time` (direction in) - The ADC sampling time"]
pub fn furi_hal_adc_configure_ex(
handle: *mut FuriHalAdcHandle,
scale: FuriHalAdcScale,
clock: FuriHalAdcClock,
oversample: FuriHalAdcOversample,
sampling_time: FuriHalAdcSamplingTime,
);
}
extern "C" {
#[doc = "Read single ADC value\n\n # Arguments\n\n* `handle` - The ADC handle\n * `channel` (direction in) - The channel to sample\n\n # Returns\n\nvalue, 12 bits"]
pub fn furi_hal_adc_read(handle: *mut FuriHalAdcHandle, channel: FuriHalAdcChannel) -> u16;
}
extern "C" {
#[doc = "Convert sampled value to voltage\n\n # Arguments\n\n* `handle` - The ADC handle\n * `value` (direction in) - The value acquired with `furi_hal_adc_read`\n\n # Returns\n\nVoltage in mV"]
pub fn furi_hal_adc_convert_to_voltage(handle: *mut FuriHalAdcHandle, value: u16) -> f32;
}
extern "C" {
#[doc = "Convert sampled VREFINT value to voltage\n\n # Arguments\n\n* `handle` - The ADC handle\n * `value` (direction in) - The value acquired with `furi_hal_adc_read` for\n `FuriHalAdcChannelVREFINT` channel\n\n # Returns\n\nVoltage in mV"]
pub fn furi_hal_adc_convert_vref(handle: *mut FuriHalAdcHandle, value: u16) -> f32;
}
extern "C" {
#[doc = "Convert sampled TEMPSENSOR value to temperature\n\n # Arguments\n\n* `handle` - The ADC handle\n * `value` (direction in) - The value acquired with `furi_hal_adc_read` for\n `FuriHalAdcChannelTEMPSENSOR` channel\n\n # Returns\n\ntemperature in degree C"]
pub fn furi_hal_adc_convert_temp(handle: *mut FuriHalAdcHandle, value: u16) -> f32;
}
extern "C" {
#[doc = "Convert sampled VBAT value to voltage\n\n # Arguments\n\n* `handle` - The ADC handle\n * `value` (direction in) - The value acquired with `furi_hal_adc_read` for\n `FuriHalAdcChannelVBAT` channel\n\n # Returns\n\nVoltage in mV"]
pub fn furi_hal_adc_convert_vbat(handle: *mut FuriHalAdcHandle, value: u16) -> f32;
}
pub const FuriHalBus_FuriHalBusAHB1_GRP1: FuriHalBus = 0;
pub const FuriHalBus_FuriHalBusDMA1: FuriHalBus = 1;
pub const FuriHalBus_FuriHalBusDMA2: FuriHalBus = 2;
pub const FuriHalBus_FuriHalBusDMAMUX1: FuriHalBus = 3;
pub const FuriHalBus_FuriHalBusCRC: FuriHalBus = 4;
pub const FuriHalBus_FuriHalBusTSC: FuriHalBus = 5;
pub const FuriHalBus_FuriHalBusAHB2_GRP1: FuriHalBus = 6;
pub const FuriHalBus_FuriHalBusGPIOA: FuriHalBus = 7;
pub const FuriHalBus_FuriHalBusGPIOB: FuriHalBus = 8;
pub const FuriHalBus_FuriHalBusGPIOC: FuriHalBus = 9;
pub const FuriHalBus_FuriHalBusGPIOD: FuriHalBus = 10;
pub const FuriHalBus_FuriHalBusGPIOE: FuriHalBus = 11;
pub const FuriHalBus_FuriHalBusGPIOH: FuriHalBus = 12;
pub const FuriHalBus_FuriHalBusADC: FuriHalBus = 13;
pub const FuriHalBus_FuriHalBusAES1: FuriHalBus = 14;
pub const FuriHalBus_FuriHalBusAHB3_GRP1: FuriHalBus = 15;
pub const FuriHalBus_FuriHalBusQUADSPI: FuriHalBus = 16;
pub const FuriHalBus_FuriHalBusPKA: FuriHalBus = 17;
pub const FuriHalBus_FuriHalBusAES2: FuriHalBus = 18;
pub const FuriHalBus_FuriHalBusRNG: FuriHalBus = 19;
pub const FuriHalBus_FuriHalBusHSEM: FuriHalBus = 20;
pub const FuriHalBus_FuriHalBusIPCC: FuriHalBus = 21;
pub const FuriHalBus_FuriHalBusFLASH: FuriHalBus = 22;
pub const FuriHalBus_FuriHalBusAPB1_GRP1: FuriHalBus = 23;
pub const FuriHalBus_FuriHalBusTIM2: FuriHalBus = 24;
pub const FuriHalBus_FuriHalBusLCD: FuriHalBus = 25;
pub const FuriHalBus_FuriHalBusSPI2: FuriHalBus = 26;
pub const FuriHalBus_FuriHalBusI2C1: FuriHalBus = 27;
pub const FuriHalBus_FuriHalBusI2C3: FuriHalBus = 28;
pub const FuriHalBus_FuriHalBusCRS: FuriHalBus = 29;
pub const FuriHalBus_FuriHalBusUSB: FuriHalBus = 30;
pub const FuriHalBus_FuriHalBusLPTIM1: FuriHalBus = 31;
pub const FuriHalBus_FuriHalBusAPB1_GRP2: FuriHalBus = 32;
pub const FuriHalBus_FuriHalBusLPUART1: FuriHalBus = 33;
pub const FuriHalBus_FuriHalBusLPTIM2: FuriHalBus = 34;
pub const FuriHalBus_FuriHalBusAPB2_GRP1: FuriHalBus = 35;
pub const FuriHalBus_FuriHalBusTIM1: FuriHalBus = 36;
pub const FuriHalBus_FuriHalBusSPI1: FuriHalBus = 37;
pub const FuriHalBus_FuriHalBusUSART1: FuriHalBus = 38;
pub const FuriHalBus_FuriHalBusTIM16: FuriHalBus = 39;
pub const FuriHalBus_FuriHalBusTIM17: FuriHalBus = 40;
pub const FuriHalBus_FuriHalBusSAI1: FuriHalBus = 41;
pub const FuriHalBus_FuriHalBusAPB3_GRP1: FuriHalBus = 42;
pub const FuriHalBus_FuriHalBusRF: FuriHalBus = 43;
pub const FuriHalBus_FuriHalBusMAX: FuriHalBus = 44;
pub type FuriHalBus = core::ffi::c_uchar;
extern "C" {
#[doc = "Early initialization"]
pub fn furi_hal_bus_init_early();
}
extern "C" {
#[doc = "Early de-initialization"]
pub fn furi_hal_bus_deinit_early();
}
extern "C" {
#[doc = "Enable a peripheral by turning the clocking on and deasserting the reset.\n # Arguments\n\n* `[in]` - bus Peripheral to be enabled.\n Peripheral must be in disabled state in order to be enabled."]
pub fn furi_hal_bus_enable(bus: FuriHalBus);
}
extern "C" {
#[doc = "Reset a peripheral by sequentially asserting and deasserting the reset.\n # Arguments\n\n* `[in]` - bus Peripheral to be reset.\n Peripheral must be in enabled state in order to be reset."]
pub fn furi_hal_bus_reset(bus: FuriHalBus);
}
extern "C" {
#[doc = "Disable a peripheral by turning the clocking off and asserting the reset.\n # Arguments\n\n* `[in]` - bus Peripheral to be disabled.\n Peripheral must be in enabled state in order to be disabled."]
pub fn furi_hal_bus_disable(bus: FuriHalBus);
}
extern "C" {
#[doc = "Check if peripheral is enabled\n\n FuriHalBusAPB3_GRP1 is a special group of shared peripherals, for\n core1 its clock is always on and the only status we can report is\n peripheral reset status. Check code and Reference Manual for\n details.\n\n # Arguments\n\n* `bus` (direction in) - The peripheral to check\n\n # Returns\n\ntrue if enabled or always enabled, false otherwise"]
pub fn furi_hal_bus_is_enabled(bus: FuriHalBus) -> bool;
}
#[doc = "< Master key"]
pub const FuriHalCryptoKeyType_FuriHalCryptoKeyTypeMaster: FuriHalCryptoKeyType = 0;
#[doc = "< Simple unencrypted key"]
pub const FuriHalCryptoKeyType_FuriHalCryptoKeyTypeSimple: FuriHalCryptoKeyType = 1;
#[doc = "< Encrypted with Master key"]
pub const FuriHalCryptoKeyType_FuriHalCryptoKeyTypeEncrypted: FuriHalCryptoKeyType = 2;
#[doc = "FuriHalCryptoKey Type"]
pub type FuriHalCryptoKeyType = core::ffi::c_uchar;
pub const FuriHalCryptoKeySize_FuriHalCryptoKeySize128: FuriHalCryptoKeySize = 0;
pub const FuriHalCryptoKeySize_FuriHalCryptoKeySize256: FuriHalCryptoKeySize = 1;
#[doc = "FuriHalCryptoKey Size in bits"]
pub type FuriHalCryptoKeySize = core::ffi::c_uchar;
#[doc = "FuriHalCryptoKey"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalCryptoKey {
pub type_: FuriHalCryptoKeyType,
pub size: FuriHalCryptoKeySize,
pub data: *mut u8,
}
#[test]
fn bindgen_test_layout_FuriHalCryptoKey() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalCryptoKey> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalCryptoKey>(),
8usize,
concat!("Size of: ", stringify!(FuriHalCryptoKey))
);
assert_eq!(
::core::mem::align_of::<FuriHalCryptoKey>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalCryptoKey))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalCryptoKey),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(FuriHalCryptoKey),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalCryptoKey),
"::",
stringify!(data)
)
);
}
#[doc = "< operation successful"]
pub const FuriHalCryptoGCMState_FuriHalCryptoGCMStateOk: FuriHalCryptoGCMState = 0;
#[doc = "< error during encryption/decryption"]
pub const FuriHalCryptoGCMState_FuriHalCryptoGCMStateError: FuriHalCryptoGCMState = 1;
#[doc = "< tags do not match, auth failed"]
pub const FuriHalCryptoGCMState_FuriHalCryptoGCMStateAuthFailure: FuriHalCryptoGCMState = 2;
#[doc = "FuriHalCryptoGCMState Result of a GCM operation"]
pub type FuriHalCryptoGCMState = core::ffi::c_uchar;
extern "C" {
#[doc = "Verify factory provisioned keys\n\n # Arguments\n\n* `keys_nb` - The keys number of\n * `valid_keys_nb` - The valid keys number of\n\n # Returns\n\ntrue if all enclave keys are intact, false otherwise"]
pub fn furi_hal_crypto_enclave_verify(keys_nb: *mut u8, valid_keys_nb: *mut u8) -> bool;
}
extern "C" {
#[doc = "Ensure that requested slot and slots before this slot contains keys.\n\n This function is used to provision FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT. Also you\n may want to use it to generate some unique keys in user key slot range.\n\n Because of the sequential nature of the secure enclave this\n method will generate key for all slots from\n FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_END to the slot your requested.\n Keys are generated using on-chip RNG.\n\n # Arguments\n\n* `key_slot` (direction in) - The key slot to enclave\n\n # Returns\n\ntrue if key exists or created, false if enclave corrupted"]
pub fn furi_hal_crypto_enclave_ensure_key(key_slot: u8) -> bool;
}
extern "C" {
#[doc = "Store key in crypto enclave\n\n # Arguments\n\n* `key` - FuriHalCryptoKey to be stored\n * `slot` - pointer to int where enclave slot will be stored\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_enclave_store_key(key: *mut FuriHalCryptoKey, slot: *mut u8) -> bool;
}
extern "C" {
#[doc = "Init AES engine and load key from crypto enclave\n\n Use only with furi_hal_crypto_enclave_unload_key()\n\n # Arguments\n\n* `slot` - enclave slot\n * `iv` (direction in) - pointer to 16 bytes Initialization Vector data\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_enclave_load_key(slot: u8, iv: *const u8) -> bool;
}
extern "C" {
#[doc = "Unload key and deinit AES engine\n\n Use only with furi_hal_crypto_enclave_load_key()\n\n # Arguments\n\n* `slot` - enclave slot\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_enclave_unload_key(slot: u8) -> bool;
}
extern "C" {
#[doc = "Init AES engine and load supplied key\n\n Use only with furi_hal_crypto_unload_key()\n\n # Arguments\n\n* `key` (direction in) - pointer to 32 bytes key data\n * `iv` (direction in) - pointer to 16 bytes Initialization Vector data\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_load_key(key: *const u8, iv: *const u8) -> bool;
}
extern "C" {
#[doc = "Unload key and de-init AES engine\n\n Use this function only with furi_hal_crypto_load_key()\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_unload_key() -> bool;
}
extern "C" {
#[doc = "Encrypt data\n\n # Arguments\n\n* `input` - pointer to input data\n * `output` - pointer to output data\n * `size` - input/output buffer size in bytes\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_encrypt(input: *const u8, output: *mut u8, size: usize) -> bool;
}
extern "C" {
#[doc = "Decrypt data\n\n # Arguments\n\n* `input` - pointer to input data\n * `output` - pointer to output data\n * `size` - input/output buffer size in bytes\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_decrypt(input: *const u8, output: *mut u8, size: usize) -> bool;
}
extern "C" {
#[doc = "Encrypt the input using AES-CTR\n\n Decryption can be performed by supplying the ciphertext as input. Inits and\n deinits the AES engine internally.\n\n # Arguments\n\n* `key` (direction in) - pointer to 32 bytes key data\n * `iv` (direction in) - pointer to 12 bytes Initialization Vector data\n * `input` (direction in) - pointer to input data\n * `output` (direction out) - pointer to output data\n * `length` - length of the input and output in bytes\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_ctr(
key: *const u8,
iv: *const u8,
input: *const u8,
output: *mut u8,
length: usize,
) -> bool;
}
extern "C" {
#[doc = "Encrypt/decrypt the input using AES-GCM\n\n When decrypting the tag generated needs to be compared to the tag attached to\n the ciphertext in a constant-time fashion. If the tags are not equal, the\n decryption failed and the plaintext returned needs to be discarded. Inits and\n deinits the AES engine internally.\n\n # Arguments\n\n* `key` (direction in) - pointer to 32 bytes key data\n * `iv` (direction in) - pointer to 12 bytes Initialization Vector data\n * `aad` (direction in) - pointer to additional authentication data\n * `aad_length` - length of the additional authentication data in bytes\n * `input` (direction in) - pointer to input data\n * `output` (direction out) - pointer to output data\n * `length` - length of the input and output in bytes\n * `tag` (direction out) - pointer to 16 bytes space for the tag\n * `decrypt` - true for decryption, false otherwise\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_crypto_gcm(
key: *const u8,
iv: *const u8,
aad: *const u8,
aad_length: usize,
input: *const u8,
output: *mut u8,
length: usize,
tag: *mut u8,
decrypt: bool,
) -> bool;
}
extern "C" {
#[doc = "Encrypt the input using AES-GCM and generate a tag\n\n Inits and deinits the AES engine internally.\n\n # Arguments\n\n* `key` (direction in) - pointer to 32 bytes key data\n * `iv` (direction in) - pointer to 12 bytes Initialization Vector data\n * `aad` (direction in) - pointer to additional authentication data\n * `aad_length` - length of the additional authentication data in bytes\n * `input` (direction in) - pointer to input data\n * `output` (direction out) - pointer to output data\n * `length` - length of the input and output in bytes\n * `tag` (direction out) - pointer to 16 bytes space for the tag\n\n # Returns\n\nFuriHalCryptoGCMStateOk on success, FuriHalCryptoGCMStateError on\n failure"]
pub fn furi_hal_crypto_gcm_encrypt_and_tag(
key: *const u8,
iv: *const u8,
aad: *const u8,
aad_length: usize,
input: *const u8,
output: *mut u8,
length: usize,
tag: *mut u8,
) -> FuriHalCryptoGCMState;
}
extern "C" {
#[doc = "Decrypt the input using AES-GCM and verify the provided tag\n\n Inits and deinits the AES engine internally.\n\n # Arguments\n\n* `key` (direction in) - pointer to 32 bytes key data\n * `iv` (direction in) - pointer to 12 bytes Initialization Vector data\n * `aad` (direction in) - pointer to additional authentication data\n * `aad_length` - length of the additional authentication data in bytes\n * `input` (direction in) - pointer to input data\n * `output` (direction out) - pointer to output data\n * `length` - length of the input and output in bytes\n * `tag` (direction out) - pointer to 16 bytes tag\n\n # Returns\n\nFuriHalCryptoGCMStateOk on success, FuriHalCryptoGCMStateError on\n failure, FuriHalCryptoGCMStateAuthFailure if the tag does not\n match"]
pub fn furi_hal_crypto_gcm_decrypt_and_verify(
key: *const u8,
iv: *const u8,
aad: *const u8,
aad_length: usize,
input: *const u8,
output: *mut u8,
length: usize,
tag: *const u8,
) -> FuriHalCryptoGCMState;
}
extern "C" {
#[doc = "Enable MCU debug"]
pub fn furi_hal_debug_enable();
}
extern "C" {
#[doc = "Disable MCU debug"]
pub fn furi_hal_debug_disable();
}
extern "C" {
#[doc = "Check if GDB debug session is active"]
pub fn furi_hal_debug_is_gdb_session_active() -> bool;
}
extern "C" {
#[doc = "Early initialization"]
pub fn furi_hal_dma_init_early();
}
extern "C" {
#[doc = "Early de-initialization"]
pub fn furi_hal_dma_deinit_early();
}
extern "C" {
pub fn furi_hal_os_tick();
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalSdInfo {
#[doc = "< total capacity in bytes"]
pub capacity: u64,
#[doc = "< block size"]
pub block_size: u32,
#[doc = "< logical capacity in blocks"]
pub logical_block_count: u32,
#[doc = "< logical block size in bytes"]
pub logical_block_size: u32,
#[doc = "< manufacturer ID"]
pub manufacturer_id: u8,
#[doc = "< OEM ID, 2 characters + null terminator"]
pub oem_id: [core::ffi::c_char; 3usize],
#[doc = "< product name, 5 characters + null terminator"]
pub product_name: [core::ffi::c_char; 6usize],
#[doc = "< product revision major"]
pub product_revision_major: u8,
#[doc = "< product revision minor"]
pub product_revision_minor: u8,
#[doc = "< product serial number"]
pub product_serial_number: u32,
#[doc = "< manufacturing month"]
pub manufacturing_month: u8,
#[doc = "< manufacturing year"]
pub manufacturing_year: u16,
}
#[test]
fn bindgen_test_layout_FuriHalSdInfo() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalSdInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalSdInfo>(),
40usize,
concat!("Size of: ", stringify!(FuriHalSdInfo))
);
assert_eq!(
::core::mem::align_of::<FuriHalSdInfo>(),
8usize,
concat!("Alignment of ", stringify!(FuriHalSdInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).capacity) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(capacity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(block_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).logical_block_count) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(logical_block_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).logical_block_size) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(logical_block_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturer_id) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(manufacturer_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).oem_id) as usize - ptr as usize },
21usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(oem_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_name) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(product_name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_revision_major) as usize - ptr as usize },
30usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(product_revision_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_revision_minor) as usize - ptr as usize },
31usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(product_revision_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_serial_number) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(product_serial_number)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturing_month) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(manufacturing_month)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturing_year) as usize - ptr as usize },
38usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSdInfo),
"::",
stringify!(manufacturing_year)
)
);
}
extern "C" {
#[doc = "Init SD card presence detection"]
pub fn furi_hal_sd_presence_init();
}
extern "C" {
#[doc = "Get SD card status\n # Returns\n\ntrue if SD card is present"]
pub fn furi_hal_sd_is_present() -> bool;
}
extern "C" {
#[doc = "SD card max mount retry count\n # Returns\n\nuint8_t"]
pub fn furi_hal_sd_max_mount_retry_count() -> u8;
}
extern "C" {
#[doc = "Init SD card\n # Arguments\n\n* `power_reset` - reset card power\n # Returns\n\nFuriStatus"]
pub fn furi_hal_sd_init(power_reset: bool) -> FuriStatus;
}
extern "C" {
#[doc = "Read blocks from SD card\n # Arguments\n\n* `buff` -\n * `sector` -\n * `count` -\n # Returns\n\nFuriStatus"]
pub fn furi_hal_sd_read_blocks(buff: *mut u32, sector: u32, count: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Write blocks to SD card\n # Arguments\n\n* `buff` -\n * `sector` -\n * `count` -\n # Returns\n\nFuriStatus"]
pub fn furi_hal_sd_write_blocks(buff: *const u32, sector: u32, count: u32) -> FuriStatus;
}
extern "C" {
#[doc = "Get SD card info\n # Arguments\n\n* `info` -\n # Returns\n\nFuriStatus"]
pub fn furi_hal_sd_info(info: *mut FuriHalSdInfo) -> FuriStatus;
}
extern "C" {
#[doc = "Get SD card state\n # Returns\n\nFuriStatus"]
pub fn furi_hal_sd_get_card_state() -> FuriStatus;
}
#[doc = "I2C_LL_ES_INIT I2C Exported Init structure\n # "]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_I2C_InitTypeDef {
#[doc = "< Specifies the peripheral mode.\nThis parameter can be a value of I2C_LL_EC_PERIPHERAL_MODE.\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_SetMode()."]
pub PeripheralMode: u32,
#[doc = "< Specifies the SDA setup, hold time and the SCL high, low period values.\nThis parameter must be set by referring to the STM32CubeMX Tool and\nthe helper macro __LL_I2C_CONVERT_TIMINGS().\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_SetTiming()."]
pub Timing: u32,
#[doc = "< Enables or disables analog noise filter.\nThis parameter can be a value of I2C_LL_EC_ANALOGFILTER_SELECTION.\n\nThis feature can be modified afterwards using unitary functions\nLL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter()."]
pub AnalogFilter: u32,
#[doc = "< Configures the digital noise filter.\nThis parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F.\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_SetDigitalFilter()."]
pub DigitalFilter: u32,
#[doc = "< Specifies the device own address 1.\nThis parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF.\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_SetOwnAddress1()."]
pub OwnAddress1: u32,
#[doc = "< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive\nmatch code or next received byte.\nThis parameter can be a value of I2C_LL_EC_I2C_ACKNOWLEDGE.\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_AcknowledgeNextData()."]
pub TypeAcknowledge: u32,
#[doc = "< Specifies the device own address 1 size (7-bit or 10-bit).\nThis parameter can be a value of I2C_LL_EC_OWNADDRESS1.\n\nThis feature can be modified afterwards using unitary function\nLL_I2C_SetOwnAddress1()."]
pub OwnAddrSize: u32,
}
#[test]
fn bindgen_test_layout_LL_I2C_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_I2C_InitTypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_I2C_InitTypeDef>(),
28usize,
concat!("Size of: ", stringify!(LL_I2C_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_I2C_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_I2C_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PeripheralMode) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(PeripheralMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Timing) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(Timing)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).AnalogFilter) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(AnalogFilter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DigitalFilter) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(DigitalFilter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OwnAddress1) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(OwnAddress1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TypeAcknowledge) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(TypeAcknowledge)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OwnAddrSize) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_I2C_InitTypeDef),
"::",
stringify!(OwnAddrSize)
)
);
}
extern "C" {
#[doc = "I2C_LL_EF_Init Initialization and de-initialization functions\n # "]
pub fn LL_I2C_Init(
I2Cx: *mut I2C_TypeDef,
I2C_InitStruct: *const LL_I2C_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "< Bus initialization event, called on system start"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventInit: FuriHalI2cBusEvent = 0;
#[doc = "< Bus deinitialization event, called on system stop"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventDeinit: FuriHalI2cBusEvent = 1;
#[doc = "< Bus lock event, called before activation"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventLock: FuriHalI2cBusEvent = 2;
#[doc = "< Bus unlock event, called after deactivation"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventUnlock: FuriHalI2cBusEvent = 3;
#[doc = "< Bus activation event, called before handle activation"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventActivate: FuriHalI2cBusEvent = 4;
#[doc = "< Bus deactivation event, called after handle deactivation"]
pub const FuriHalI2cBusEvent_FuriHalI2cBusEventDeactivate: FuriHalI2cBusEvent = 5;
#[doc = "FuriHal i2c bus states"]
pub type FuriHalI2cBusEvent = core::ffi::c_uchar;
#[doc = "FuriHal i2c bus event callback"]
pub type FuriHalI2cBusEventCallback = ::core::option::Option<
unsafe extern "C" fn(bus: *mut FuriHalI2cBus, event: FuriHalI2cBusEvent),
>;
#[doc = "FuriHal i2c bus"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalI2cBus {
pub i2c: *mut I2C_TypeDef,
pub current_handle: *mut FuriHalI2cBusHandle,
pub callback: FuriHalI2cBusEventCallback,
}
#[test]
fn bindgen_test_layout_FuriHalI2cBus() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalI2cBus> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalI2cBus>(),
12usize,
concat!("Size of: ", stringify!(FuriHalI2cBus))
);
assert_eq!(
::core::mem::align_of::<FuriHalI2cBus>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalI2cBus))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).i2c) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalI2cBus),
"::",
stringify!(i2c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).current_handle) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalI2cBus),
"::",
stringify!(current_handle)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalI2cBus),
"::",
stringify!(callback)
)
);
}
#[doc = "< Handle activate: connect gpio and apply bus config"]
pub const FuriHalI2cBusHandleEvent_FuriHalI2cBusHandleEventActivate: FuriHalI2cBusHandleEvent = 0;
#[doc = "< Handle deactivate: disconnect gpio and reset bus config"]
pub const FuriHalI2cBusHandleEvent_FuriHalI2cBusHandleEventDeactivate: FuriHalI2cBusHandleEvent = 1;
#[doc = "FuriHal i2c handle states"]
pub type FuriHalI2cBusHandleEvent = core::ffi::c_uchar;
#[doc = "FuriHal i2c handle event callback"]
pub type FuriHalI2cBusHandleEventCallback = ::core::option::Option<
unsafe extern "C" fn(handle: *mut FuriHalI2cBusHandle, event: FuriHalI2cBusHandleEvent),
>;
#[doc = "FuriHal i2c handle"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalI2cBusHandle {
pub bus: *mut FuriHalI2cBus,
pub callback: FuriHalI2cBusHandleEventCallback,
}
#[test]
fn bindgen_test_layout_FuriHalI2cBusHandle() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalI2cBusHandle> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalI2cBusHandle>(),
8usize,
concat!("Size of: ", stringify!(FuriHalI2cBusHandle))
);
assert_eq!(
::core::mem::align_of::<FuriHalI2cBusHandle>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalI2cBusHandle))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bus) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalI2cBusHandle),
"::",
stringify!(bus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalI2cBusHandle),
"::",
stringify!(callback)
)
);
}
extern "C" {
#[doc = "Internal(power) i2c bus, I2C1, under reset when not used"]
pub static mut furi_hal_i2c_bus_power: FuriHalI2cBus;
}
extern "C" {
#[doc = "External i2c bus, I2C3, under reset when not used"]
pub static mut furi_hal_i2c_bus_external: FuriHalI2cBus;
}
extern "C" {
#[doc = "Handle for internal(power) i2c bus\n Bus: furi_hal_i2c_bus_external\n Pins: PA9(SCL) / PA10(SDA), float on release\n Params: 400khz"]
pub static mut furi_hal_i2c_handle_power: FuriHalI2cBusHandle;
}
extern "C" {
#[doc = "Handle for external i2c bus\n Bus: furi_hal_i2c_bus_external\n Pins: PC0(SCL) / PC1(SDA), float on release\n Params: 100khz"]
pub static mut furi_hal_i2c_handle_external: FuriHalI2cBusHandle;
}
#[doc = "Begin the transaction by sending a START condition followed by the\n address"]
pub const FuriHalI2cBegin_FuriHalI2cBeginStart: FuriHalI2cBegin = 0;
#[doc = "Begin the transaction by sending a RESTART condition followed by the\n address\n > **Note:** Must follow a transaction ended with\n FuriHalI2cEndAwaitRestart"]
pub const FuriHalI2cBegin_FuriHalI2cBeginRestart: FuriHalI2cBegin = 1;
#[doc = "Continue the previous transaction with new data\n > **Note:** Must follow a transaction ended with FuriHalI2cEndPause and\n be of the same type (RX/TX)"]
pub const FuriHalI2cBegin_FuriHalI2cBeginResume: FuriHalI2cBegin = 2;
#[doc = "Transaction beginning signal"]
pub type FuriHalI2cBegin = core::ffi::c_uchar;
#[doc = "End the transaction by sending a STOP condition"]
pub const FuriHalI2cEnd_FuriHalI2cEndStop: FuriHalI2cEnd = 0;
#[doc = "End the transaction by clock stretching\n > **Note:** Must be followed by a transaction using\n FuriHalI2cBeginRestart"]
pub const FuriHalI2cEnd_FuriHalI2cEndAwaitRestart: FuriHalI2cEnd = 1;
#[doc = "Pauses the transaction by clock stretching\n > **Note:** Must be followed by a transaction using FuriHalI2cBeginResume"]
pub const FuriHalI2cEnd_FuriHalI2cEndPause: FuriHalI2cEnd = 2;
#[doc = "Transaction end signal"]
pub type FuriHalI2cEnd = core::ffi::c_uchar;
extern "C" {
#[doc = "Acquire I2C bus handle\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance"]
pub fn furi_hal_i2c_acquire(handle: *mut FuriHalI2cBusHandle);
}
extern "C" {
#[doc = "Release I2C bus handle\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance acquired in\n `furi_hal_i2c_acquire`"]
pub fn furi_hal_i2c_release(handle: *mut FuriHalI2cBusHandle);
}
extern "C" {
#[doc = "Perform I2C TX transfer\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `address` - I2C slave address\n * `data` - Pointer to data buffer\n * `size` - Size of data buffer\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_tx(
handle: *mut FuriHalI2cBusHandle,
address: u8,
data: *const u8,
size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C TX transfer, with additional settings.\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `address` - I2C slave address\n * `ten_bit` - Whether the address is 10 bits wide\n * `data` - Pointer to data buffer\n * `size` - Size of data buffer\n * `begin` - How to begin the transaction\n * `end` - How to end the transaction\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_tx_ext(
handle: *mut FuriHalI2cBusHandle,
address: u16,
ten_bit: bool,
data: *const u8,
size: usize,
begin: FuriHalI2cBegin,
end: FuriHalI2cEnd,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C RX transfer\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `address` - I2C slave address\n * `data` - Pointer to data buffer\n * `size` - Size of data buffer\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_rx(
handle: *mut FuriHalI2cBusHandle,
address: u8,
data: *mut u8,
size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C RX transfer, with additional settings.\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `address` - I2C slave address\n * `ten_bit` - Whether the address is 10 bits wide\n * `data` - Pointer to data buffer\n * `size` - Size of data buffer\n * `begin` - How to begin the transaction\n * `end` - How to end the transaction\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_rx_ext(
handle: *mut FuriHalI2cBusHandle,
address: u16,
ten_bit: bool,
data: *mut u8,
size: usize,
begin: FuriHalI2cBegin,
end: FuriHalI2cEnd,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C TX and RX transfers\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `address` - I2C slave address\n * `tx_data` - Pointer to TX data buffer\n * `tx_size` - Size of TX data buffer\n * `rx_data` - Pointer to RX data buffer\n * `rx_size` - Size of RX data buffer\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_trx(
handle: *mut FuriHalI2cBusHandle,
address: u8,
tx_data: *const u8,
tx_size: usize,
rx_data: *mut u8,
rx_size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Check if I2C device presents on bus\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue if device present and is ready, false otherwise"]
pub fn furi_hal_i2c_is_device_ready(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device register read (8-bit)\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `reg_addr` - Register address\n * `data` - Pointer to register value\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_read_reg_8(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
reg_addr: u8,
data: *mut u8,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device register read (16-bit)\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `reg_addr` - Register address\n * `data` - Pointer to register value\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_read_reg_16(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
reg_addr: u8,
data: *mut u16,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device memory read\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `mem_addr` - Memory start address\n * `data` - Pointer to data buffer\n * `len` - Size of data buffer\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_read_mem(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
mem_addr: u8,
data: *mut u8,
len: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device register write (8-bit)\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `reg_addr` - Register address\n * `data` - Register value\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_write_reg_8(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
reg_addr: u8,
data: u8,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device register write (16-bit)\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `reg_addr` - Register address\n * `data` - Register value\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_write_reg_16(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
reg_addr: u8,
data: u16,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "Perform I2C device memory\n\n # Arguments\n\n* `handle` - Pointer to FuriHalI2cBusHandle instance\n * `i2c_addr` - I2C slave address\n * `mem_addr` - Memory start address\n * `data` - Pointer to data buffer\n * `len` - Size of data buffer\n * `timeout` - Timeout in milliseconds\n\n # Returns\n\ntrue on successful transfer, false otherwise"]
pub fn furi_hal_i2c_write_mem(
handle: *mut FuriHalI2cBusHandle,
i2c_addr: u8,
mem_addr: u8,
data: *const u8,
len: usize,
timeout: u32,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalRegionBand {
pub start: u32,
pub end: u32,
pub power_limit: i8,
pub duty_cycle: u8,
}
#[test]
fn bindgen_test_layout_FuriHalRegionBand() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalRegionBand> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalRegionBand>(),
12usize,
concat!("Size of: ", stringify!(FuriHalRegionBand))
);
assert_eq!(
::core::mem::align_of::<FuriHalRegionBand>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalRegionBand))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegionBand),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).end) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegionBand),
"::",
stringify!(end)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).power_limit) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegionBand),
"::",
stringify!(power_limit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).duty_cycle) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegionBand),
"::",
stringify!(duty_cycle)
)
);
}
#[repr(C)]
#[derive(Debug)]
pub struct FuriHalRegion {
pub country_code: [core::ffi::c_char; 4usize],
pub bands_count: u16,
pub bands: __IncompleteArrayField<FuriHalRegionBand>,
}
#[test]
fn bindgen_test_layout_FuriHalRegion() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalRegion> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalRegion>(),
8usize,
concat!("Size of: ", stringify!(FuriHalRegion))
);
assert_eq!(
::core::mem::align_of::<FuriHalRegion>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalRegion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).country_code) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegion),
"::",
stringify!(country_code)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bands_count) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegion),
"::",
stringify!(bands_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bands) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalRegion),
"::",
stringify!(bands)
)
);
}
extern "C" {
#[doc = "Get Region Data.\n\n Region data may be allocated in Flash or in RAM.\n Keep in mind that we don't do memory management on our side.\n\n # Returns\n\npointer to FuriHalRegion instance (in RAM or Flash, check before freeing on region update)"]
pub fn furi_hal_region_get() -> *const FuriHalRegion;
}
extern "C" {
#[doc = "Set device region data\n\n # Arguments\n\n* `region` - pointer to the FuriHalRegion"]
pub fn furi_hal_region_set(region: *mut FuriHalRegion);
}
extern "C" {
#[doc = "Check if region data provisioned\n\n # Returns\n\ntrue if provisioned, false otherwise"]
pub fn furi_hal_region_is_provisioned() -> bool;
}
extern "C" {
#[doc = "Get region name\n\n 2 letter Region code according to iso 3166 standard\n There are 2 extra values that we use in special cases:\n - \"00\" - developer edition, unlocked\n - \"WW\" - world wide, region provisioned by default\n - \"--\" - no provisioned region\n\n # Returns\n\nPointer to string"]
pub fn furi_hal_region_get_name() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Сheck if transmission is allowed on this frequency for your flipper region\n\n # Arguments\n\n* `frequency` (direction in) - The frequency\n * `value` - frequency in Hz\n\n # Returns\n\ntrue if allowed"]
pub fn furi_hal_region_is_frequency_allowed(frequency: u32) -> bool;
}
extern "C" {
#[doc = "Get band data for frequency\n\n\n\n # Arguments\n\n* `frequency` (direction in) - The frequency\n\n # Returns\n\n{ description_of_the_return_value }"]
pub fn furi_hal_region_get_band(frequency: u32) -> *const FuriHalRegionBand;
}
pub const InputKey_InputKeyUp: InputKey = 0;
pub const InputKey_InputKeyDown: InputKey = 1;
pub const InputKey_InputKeyRight: InputKey = 2;
pub const InputKey_InputKeyLeft: InputKey = 3;
pub const InputKey_InputKeyOk: InputKey = 4;
pub const InputKey_InputKeyBack: InputKey = 5;
#[doc = "< Special value"]
pub const InputKey_InputKeyMAX: InputKey = 6;
pub type InputKey = core::ffi::c_uchar;
pub const Light_LightRed: Light = 1;
pub const Light_LightGreen: Light = 2;
pub const Light_LightBlue: Light = 4;
pub const Light_LightBacklight: Light = 8;
pub type Light = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InputPin {
pub gpio: *const GpioPin,
pub key: InputKey,
pub inverted: bool,
pub name: *const core::ffi::c_char,
}
#[test]
fn bindgen_test_layout_InputPin() {
const UNINIT: ::core::mem::MaybeUninit<InputPin> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<InputPin>(),
12usize,
concat!("Size of: ", stringify!(InputPin))
);
assert_eq!(
::core::mem::align_of::<InputPin>(),
4usize,
concat!("Alignment of ", stringify!(InputPin))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).gpio) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(InputPin),
"::",
stringify!(gpio)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(InputPin),
"::",
stringify!(key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).inverted) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(InputPin),
"::",
stringify!(inverted)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(InputPin),
"::",
stringify!(name)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GpioPinRecord {
pub pin: *const GpioPin,
pub name: *const core::ffi::c_char,
pub channel: FuriHalAdcChannel,
pub number: u8,
pub debug: bool,
}
#[test]
fn bindgen_test_layout_GpioPinRecord() {
const UNINIT: ::core::mem::MaybeUninit<GpioPinRecord> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GpioPinRecord>(),
12usize,
concat!("Size of: ", stringify!(GpioPinRecord))
);
assert_eq!(
::core::mem::align_of::<GpioPinRecord>(),
4usize,
concat!("Alignment of ", stringify!(GpioPinRecord))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pin) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GpioPinRecord),
"::",
stringify!(pin)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GpioPinRecord),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).channel) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(GpioPinRecord),
"::",
stringify!(channel)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).number) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(GpioPinRecord),
"::",
stringify!(number)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).debug) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(GpioPinRecord),
"::",
stringify!(debug)
)
);
}
extern "C" {
pub static input_pins: [InputPin; 0usize];
}
extern "C" {
pub static input_pins_count: usize;
}
extern "C" {
pub static gpio_pins: [GpioPinRecord; 0usize];
}
extern "C" {
pub static gpio_pins_count: usize;
}
extern "C" {
pub static gpio_swdio: GpioPin;
}
extern "C" {
pub static gpio_swclk: GpioPin;
}
extern "C" {
pub static gpio_vibro: GpioPin;
}
extern "C" {
pub static gpio_ibutton: GpioPin;
}
extern "C" {
pub static gpio_cc1101_g0: GpioPin;
}
extern "C" {
pub static gpio_rf_sw_0: GpioPin;
}
extern "C" {
pub static gpio_subghz_cs: GpioPin;
}
extern "C" {
pub static gpio_display_cs: GpioPin;
}
extern "C" {
pub static gpio_display_rst_n: GpioPin;
}
extern "C" {
pub static gpio_display_di: GpioPin;
}
extern "C" {
pub static gpio_sdcard_cs: GpioPin;
}
extern "C" {
pub static gpio_sdcard_cd: GpioPin;
}
extern "C" {
pub static gpio_nfc_cs: GpioPin;
}
extern "C" {
pub static gpio_button_up: GpioPin;
}
extern "C" {
pub static gpio_button_down: GpioPin;
}
extern "C" {
pub static gpio_button_right: GpioPin;
}
extern "C" {
pub static gpio_button_left: GpioPin;
}
extern "C" {
pub static gpio_button_ok: GpioPin;
}
extern "C" {
pub static gpio_button_back: GpioPin;
}
extern "C" {
pub static gpio_spi_d_miso: GpioPin;
}
extern "C" {
pub static gpio_spi_d_mosi: GpioPin;
}
extern "C" {
pub static gpio_spi_d_sck: GpioPin;
}
extern "C" {
pub static gpio_spi_r_miso: GpioPin;
}
extern "C" {
pub static gpio_spi_r_mosi: GpioPin;
}
extern "C" {
pub static gpio_spi_r_sck: GpioPin;
}
extern "C" {
pub static gpio_ext_pc0: GpioPin;
}
extern "C" {
pub static gpio_ext_pc1: GpioPin;
}
extern "C" {
pub static gpio_ext_pc3: GpioPin;
}
extern "C" {
pub static gpio_ext_pb2: GpioPin;
}
extern "C" {
pub static gpio_ext_pb3: GpioPin;
}
extern "C" {
pub static gpio_ext_pa4: GpioPin;
}
extern "C" {
pub static gpio_ext_pa6: GpioPin;
}
extern "C" {
pub static gpio_ext_pa7: GpioPin;
}
extern "C" {
pub static gpio_nfc_irq_rfid_pull: GpioPin;
}
extern "C" {
pub static gpio_rfid_carrier_out: GpioPin;
}
extern "C" {
pub static gpio_rfid_data_in: GpioPin;
}
extern "C" {
pub static gpio_rfid_carrier: GpioPin;
}
extern "C" {
pub static gpio_infrared_rx: GpioPin;
}
extern "C" {
pub static gpio_infrared_tx: GpioPin;
}
extern "C" {
pub static gpio_usart_tx: GpioPin;
}
extern "C" {
pub static gpio_usart_rx: GpioPin;
}
extern "C" {
pub static gpio_i2c_power_sda: GpioPin;
}
extern "C" {
pub static gpio_i2c_power_scl: GpioPin;
}
extern "C" {
pub static gpio_speaker: GpioPin;
}
extern "C" {
pub static gpio_periph_power: GpioPin;
}
extern "C" {
pub static gpio_usb_dm: GpioPin;
}
extern "C" {
pub static gpio_usb_dp: GpioPin;
}
extern "C" {
#[doc = "Get a corresponding external connector pin number for a gpio\n\n # Arguments\n\n* `gpio` - GpioPin\n\n # Returns\n\npin number or -1 if gpio is not on the external connector"]
pub fn furi_hal_resources_get_ext_pin_number(gpio: *const GpioPin) -> i32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DateTime {
#[doc = "< Hour in 24H format: 0-23"]
pub hour: u8,
#[doc = "< Minute: 0-59"]
pub minute: u8,
#[doc = "< Second: 0-59"]
pub second: u8,
#[doc = "< Current day: 1-31"]
pub day: u8,
#[doc = "< Current month: 1-12"]
pub month: u8,
#[doc = "< Current year: 2000-2099"]
pub year: u16,
#[doc = "< Current weekday: 1-7"]
pub weekday: u8,
}
#[test]
fn bindgen_test_layout_DateTime() {
const UNINIT: ::core::mem::MaybeUninit<DateTime> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<DateTime>(),
10usize,
concat!("Size of: ", stringify!(DateTime))
);
assert_eq!(
::core::mem::align_of::<DateTime>(),
2usize,
concat!("Alignment of ", stringify!(DateTime))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hour) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(hour)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).minute) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(minute)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).second) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(second)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).day) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(day)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).month) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(month)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).year) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(year)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).weekday) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(DateTime),
"::",
stringify!(weekday)
)
);
}
extern "C" {
#[doc = "Validate Date Time\n\n # Arguments\n\n* `datetime` - The datetime to validate\n\n # Returns\n\n{ description_of_the_return_value }"]
pub fn datetime_validate_datetime(datetime: *mut DateTime) -> bool;
}
extern "C" {
#[doc = "Convert DateTime to UNIX timestamp\n\n Mind timezone when perform conversion\n\n # Arguments\n\n* `datetime` - The datetime (UTC)\n\n # Returns\n\nUNIX Timestamp in seconds from UNIX epoch start"]
pub fn datetime_datetime_to_timestamp(datetime: *mut DateTime) -> u32;
}
extern "C" {
#[doc = "Convert UNIX timestamp to DateTime\n\n Mind timezone when perform conversion\n\n # Arguments\n\n* `timestamp` (direction in) - UNIX Timestamp in seconds from UNIX epoch start\n * `datetime` (direction out) - The datetime (UTC)"]
pub fn datetime_timestamp_to_datetime(timestamp: u32, datetime: *mut DateTime);
}
extern "C" {
#[doc = "Gets the number of days in the year according to the Gregorian calendar.\n\n # Arguments\n\n* `year` - Input year.\n\n # Returns\n\nnumber of days in `year`."]
pub fn datetime_get_days_per_year(year: u16) -> u16;
}
extern "C" {
#[doc = "Check if a year a leap year in the Gregorian calendar.\n\n # Arguments\n\n* `year` - Input year.\n\n # Returns\n\ntrue if `year` is a leap year."]
pub fn datetime_is_leap_year(year: u16) -> bool;
}
extern "C" {
#[doc = "Get the number of days in the month.\n\n # Arguments\n\n* `leap_year` - true to calculate based on leap years\n * `month` - month to check, where 1 = January\n # Returns\n\nthe number of days in the month"]
pub fn datetime_get_days_per_month(leap_year: bool, month: u8) -> u8;
}
pub const FuriHalRtcFlag_FuriHalRtcFlagDebug: FuriHalRtcFlag = 1;
pub const FuriHalRtcFlag_FuriHalRtcFlagStorageFormatInternal: FuriHalRtcFlag = 2;
pub const FuriHalRtcFlag_FuriHalRtcFlagLock: FuriHalRtcFlag = 4;
pub const FuriHalRtcFlag_FuriHalRtcFlagC2Update: FuriHalRtcFlag = 8;
pub const FuriHalRtcFlag_FuriHalRtcFlagHandOrient: FuriHalRtcFlag = 16;
pub const FuriHalRtcFlag_FuriHalRtcFlagLegacySleep: FuriHalRtcFlag = 32;
pub const FuriHalRtcFlag_FuriHalRtcFlagStealthMode: FuriHalRtcFlag = 64;
pub const FuriHalRtcFlag_FuriHalRtcFlagDetailedFilename: FuriHalRtcFlag = 128;
pub type FuriHalRtcFlag = core::ffi::c_uchar;
#[doc = "< Normal boot mode, default value"]
pub const FuriHalRtcBootMode_FuriHalRtcBootModeNormal: FuriHalRtcBootMode = 0;
#[doc = "< Boot to DFU (MCU bootloader by ST)"]
pub const FuriHalRtcBootMode_FuriHalRtcBootModeDfu: FuriHalRtcBootMode = 1;
#[doc = "< Boot to Update, pre update"]
pub const FuriHalRtcBootMode_FuriHalRtcBootModePreUpdate: FuriHalRtcBootMode = 2;
#[doc = "< Boot to Update, main"]
pub const FuriHalRtcBootMode_FuriHalRtcBootModeUpdate: FuriHalRtcBootMode = 3;
#[doc = "< Boot to Update, post update"]
pub const FuriHalRtcBootMode_FuriHalRtcBootModePostUpdate: FuriHalRtcBootMode = 4;
pub type FuriHalRtcBootMode = core::ffi::c_uchar;
#[doc = "< Disable allocation tracking"]
pub const FuriHalRtcHeapTrackMode_FuriHalRtcHeapTrackModeNone: FuriHalRtcHeapTrackMode = 0;
#[doc = "< Enable allocation tracking for main application thread"]
pub const FuriHalRtcHeapTrackMode_FuriHalRtcHeapTrackModeMain: FuriHalRtcHeapTrackMode = 1;
#[doc = "< Enable allocation tracking for main and children application threads"]
pub const FuriHalRtcHeapTrackMode_FuriHalRtcHeapTrackModeTree: FuriHalRtcHeapTrackMode = 2;
#[doc = "< Enable allocation tracking for all threads"]
pub const FuriHalRtcHeapTrackMode_FuriHalRtcHeapTrackModeAll: FuriHalRtcHeapTrackMode = 3;
pub type FuriHalRtcHeapTrackMode = core::ffi::c_uchar;
#[doc = "< RTC structure header"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterHeader: FuriHalRtcRegister = 0;
#[doc = "< Various system bits"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterSystem: FuriHalRtcRegister = 1;
#[doc = "< Pointer to Version"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterVersion: FuriHalRtcRegister = 2;
#[doc = "< LFS geometry fingerprint"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterLfsFingerprint: FuriHalRtcRegister = 3;
#[doc = "< Pointer to last fault message"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterFaultData: FuriHalRtcRegister = 4;
#[doc = "< Failed PINs count"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterPinFails: FuriHalRtcRegister = 5;
pub const FuriHalRtcRegister_FuriHalRtcRegisterUpdateFolderFSIndex: FuriHalRtcRegister = 6;
#[doc = "< Encoded value of the currently set PIN"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterPinValue: FuriHalRtcRegister = 7;
#[doc = "< Service value, do not use"]
pub const FuriHalRtcRegister_FuriHalRtcRegisterMAX: FuriHalRtcRegister = 8;
pub type FuriHalRtcRegister = core::ffi::c_uchar;
#[doc = "< Metric measurement units"]
pub const FuriHalRtcLocaleUnits_FuriHalRtcLocaleUnitsMetric: FuriHalRtcLocaleUnits = 0;
#[doc = "< Imperial measurement units"]
pub const FuriHalRtcLocaleUnits_FuriHalRtcLocaleUnitsImperial: FuriHalRtcLocaleUnits = 1;
pub type FuriHalRtcLocaleUnits = core::ffi::c_uchar;
#[doc = "< 24-hour format"]
pub const FuriHalRtcLocaleTimeFormat_FuriHalRtcLocaleTimeFormat24h: FuriHalRtcLocaleTimeFormat = 0;
#[doc = "< 12-hour format"]
pub const FuriHalRtcLocaleTimeFormat_FuriHalRtcLocaleTimeFormat12h: FuriHalRtcLocaleTimeFormat = 1;
pub type FuriHalRtcLocaleTimeFormat = core::ffi::c_uchar;
#[doc = "< Day/Month/Year"]
pub const FuriHalRtcLocaleDateFormat_FuriHalRtcLocaleDateFormatDMY: FuriHalRtcLocaleDateFormat = 0;
#[doc = "< Month/Day/Year"]
pub const FuriHalRtcLocaleDateFormat_FuriHalRtcLocaleDateFormatMDY: FuriHalRtcLocaleDateFormat = 1;
#[doc = "< Year/Month/Day"]
pub const FuriHalRtcLocaleDateFormat_FuriHalRtcLocaleDateFormatYMD: FuriHalRtcLocaleDateFormat = 2;
pub type FuriHalRtcLocaleDateFormat = core::ffi::c_uchar;
#[doc = "< Default: USART"]
pub const FuriHalRtcLogDevice_FuriHalRtcLogDeviceUsart: FuriHalRtcLogDevice = 0;
#[doc = "< Default: LPUART"]
pub const FuriHalRtcLogDevice_FuriHalRtcLogDeviceLpuart: FuriHalRtcLogDevice = 1;
#[doc = "< Reserved for future use"]
pub const FuriHalRtcLogDevice_FuriHalRtcLogDeviceReserved: FuriHalRtcLogDevice = 2;
#[doc = "< None, disable serial logging"]
pub const FuriHalRtcLogDevice_FuriHalRtcLogDeviceNone: FuriHalRtcLogDevice = 3;
pub type FuriHalRtcLogDevice = core::ffi::c_uchar;
#[doc = "< 230400 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate230400: FuriHalRtcLogBaudRate = 0;
#[doc = "< 9600 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate9600: FuriHalRtcLogBaudRate = 1;
#[doc = "< 38400 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate38400: FuriHalRtcLogBaudRate = 2;
#[doc = "< 57600 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate57600: FuriHalRtcLogBaudRate = 3;
#[doc = "< 115200 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate115200: FuriHalRtcLogBaudRate = 4;
#[doc = "< 460800 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate460800: FuriHalRtcLogBaudRate = 5;
#[doc = "< 921600 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate921600: FuriHalRtcLogBaudRate = 6;
#[doc = "< 1843200 baud"]
pub const FuriHalRtcLogBaudRate_FuriHalRtcLogBaudRate1843200: FuriHalRtcLogBaudRate = 7;
pub type FuriHalRtcLogBaudRate = core::ffi::c_uchar;
extern "C" {
#[doc = "Force sync shadow registers"]
pub fn furi_hal_rtc_sync_shadow();
}
extern "C" {
#[doc = "Reset ALL RTC registers content"]
pub fn furi_hal_rtc_reset_registers();
}
extern "C" {
#[doc = "Get RTC register content\n\n # Arguments\n\n* `reg` (direction in) - The register identifier\n\n # Returns\n\ncontent of the register"]
pub fn furi_hal_rtc_get_register(reg: FuriHalRtcRegister) -> u32;
}
extern "C" {
#[doc = "Set register content\n\n # Arguments\n\n* `reg` (direction in) - The register identifier\n * `value` (direction in) - The value to store into register"]
pub fn furi_hal_rtc_set_register(reg: FuriHalRtcRegister, value: u32);
}
extern "C" {
#[doc = "Set Log Level value\n\n # Arguments\n\n* `level` (direction in) - The level to store"]
pub fn furi_hal_rtc_set_log_level(level: u8);
}
extern "C" {
#[doc = "Get Log Level value\n\n # Returns\n\nThe Log Level value"]
pub fn furi_hal_rtc_get_log_level() -> u8;
}
extern "C" {
#[doc = "Set logging device\n\n # Arguments\n\n* `device` (direction in) - The device"]
pub fn furi_hal_rtc_set_log_device(device: FuriHalRtcLogDevice);
}
extern "C" {
#[doc = "Get logging device\n\n # Returns\n\nThe furi hal rtc log device."]
pub fn furi_hal_rtc_get_log_device() -> FuriHalRtcLogDevice;
}
extern "C" {
#[doc = "Set logging baud rate\n\n # Arguments\n\n* `baud_rate` (direction in) - The baud rate"]
pub fn furi_hal_rtc_set_log_baud_rate(baud_rate: FuriHalRtcLogBaudRate);
}
extern "C" {
#[doc = "Get logging baud rate\n\n # Returns\n\nThe furi hal rtc log baud rate."]
pub fn furi_hal_rtc_get_log_baud_rate() -> FuriHalRtcLogBaudRate;
}
extern "C" {
#[doc = "Set RTC Flag\n\n # Arguments\n\n* `flag` (direction in) - The flag to set"]
pub fn furi_hal_rtc_set_flag(flag: FuriHalRtcFlag);
}
extern "C" {
#[doc = "Reset RTC Flag\n\n # Arguments\n\n* `flag` (direction in) - The flag to reset"]
pub fn furi_hal_rtc_reset_flag(flag: FuriHalRtcFlag);
}
extern "C" {
#[doc = "Check if RTC Flag is set\n\n # Arguments\n\n* `flag` (direction in) - The flag to check\n\n # Returns\n\ntrue if set"]
pub fn furi_hal_rtc_is_flag_set(flag: FuriHalRtcFlag) -> bool;
}
extern "C" {
#[doc = "Set RTC boot mode\n\n # Arguments\n\n* `mode` (direction in) - The mode to set"]
pub fn furi_hal_rtc_set_boot_mode(mode: FuriHalRtcBootMode);
}
extern "C" {
#[doc = "Get RTC boot mode\n\n # Returns\n\nThe RTC boot mode."]
pub fn furi_hal_rtc_get_boot_mode() -> FuriHalRtcBootMode;
}
extern "C" {
#[doc = "Set Heap Track mode\n\n # Arguments\n\n* `mode` (direction in) - The mode to set"]
pub fn furi_hal_rtc_set_heap_track_mode(mode: FuriHalRtcHeapTrackMode);
}
extern "C" {
#[doc = "Get RTC Heap Track mode\n\n # Returns\n\nThe RTC heap track mode."]
pub fn furi_hal_rtc_get_heap_track_mode() -> FuriHalRtcHeapTrackMode;
}
extern "C" {
#[doc = "Set locale units\n\n # Arguments\n\n* `value` (direction in) - The RTC Locale Units"]
pub fn furi_hal_rtc_set_locale_units(value: FuriHalRtcLocaleUnits);
}
extern "C" {
#[doc = "Get RTC Locale Units\n\n # Returns\n\nThe RTC Locale Units."]
pub fn furi_hal_rtc_get_locale_units() -> FuriHalRtcLocaleUnits;
}
extern "C" {
#[doc = "Set RTC Locale Time Format\n\n # Arguments\n\n* `value` (direction in) - The RTC Locale Time Format"]
pub fn furi_hal_rtc_set_locale_timeformat(value: FuriHalRtcLocaleTimeFormat);
}
extern "C" {
#[doc = "Get RTC Locale Time Format\n\n # Returns\n\nThe RTC Locale Time Format."]
pub fn furi_hal_rtc_get_locale_timeformat() -> FuriHalRtcLocaleTimeFormat;
}
extern "C" {
#[doc = "Set RTC Locale Date Format\n\n # Arguments\n\n* `value` (direction in) - The RTC Locale Date Format"]
pub fn furi_hal_rtc_set_locale_dateformat(value: FuriHalRtcLocaleDateFormat);
}
extern "C" {
#[doc = "Get RTC Locale Date Format\n\n # Returns\n\nThe RTC Locale Date Format"]
pub fn furi_hal_rtc_get_locale_dateformat() -> FuriHalRtcLocaleDateFormat;
}
extern "C" {
#[doc = "Set RTC Date Time\n\n # Arguments\n\n* `datetime` - The date time to set"]
pub fn furi_hal_rtc_set_datetime(datetime: *mut DateTime);
}
extern "C" {
#[doc = "Get RTC Date Time\n\n # Arguments\n\n* `datetime` - The datetime"]
pub fn furi_hal_rtc_get_datetime(datetime: *mut DateTime);
}
extern "C" {
#[doc = "Set RTC Fault Data\n\n # Arguments\n\n* `value` (direction in) - The value"]
pub fn furi_hal_rtc_set_fault_data(value: u32);
}
extern "C" {
#[doc = "Get RTC Fault Data\n\n # Returns\n\nRTC Fault Data value"]
pub fn furi_hal_rtc_get_fault_data() -> u32;
}
extern "C" {
#[doc = "Set PIN Fails count\n\n # Arguments\n\n* `value` (direction in) - The PIN Fails count"]
pub fn furi_hal_rtc_set_pin_fails(value: u32);
}
extern "C" {
#[doc = "Get PIN Fails count\n\n # Returns\n\nPIN Fails Count"]
pub fn furi_hal_rtc_get_pin_fails() -> u32;
}
extern "C" {
#[doc = "Get UNIX Timestamp\n\n # Returns\n\nUnix Timestamp in seconds from UNIX epoch start"]
pub fn furi_hal_rtc_get_timestamp() -> u32;
}
extern "C" {
#[doc = "Acquire speaker ownership\n\n You must acquire speaker ownership before use\n\n # Arguments\n\n* `timeout` - Timeout during which speaker ownership must be acquired\n\n # Returns\n\nbool returns true on success"]
pub fn furi_hal_speaker_acquire(timeout: u32) -> bool;
}
extern "C" {
#[doc = "Release speaker ownership\n\n You must release speaker ownership after use"]
pub fn furi_hal_speaker_release();
}
extern "C" {
#[doc = "Check current process speaker ownership\n\n always returns true if called from ISR\n\n # Returns\n\nbool returns true if process owns speaker"]
pub fn furi_hal_speaker_is_mine() -> bool;
}
extern "C" {
#[doc = "Play a note\n\n no ownership check if called from ISR\n\n # Arguments\n\n* `frequency` - The frequency\n * `volume` - The volume"]
pub fn furi_hal_speaker_start(frequency: f32, volume: f32);
}
extern "C" {
#[doc = "Set volume\n\n no ownership check if called from ISR\n\n # Arguments\n\n* `volume` - The volume"]
pub fn furi_hal_speaker_set_volume(volume: f32);
}
extern "C" {
#[doc = "Stop playback\n\n no ownership check if called from ISR"]
pub fn furi_hal_speaker_stop();
}
extern "C" {
#[doc = "Set light value\n\n # Arguments\n\n* `light` - Light\n * `value` - light brightness [0-255]"]
pub fn furi_hal_light_set(light: Light, value: u8);
}
extern "C" {
#[doc = "Start hardware LED blinking mode\n\n # Arguments\n\n* `light` - Light\n * `brightness` - light brightness [0-255]\n * `on_time` - LED on time in ms\n * `period` - LED blink period in ms"]
pub fn furi_hal_light_blink_start(light: Light, brightness: u8, on_time: u16, period: u16);
}
extern "C" {
#[doc = "Stop hardware LED blinking mode"]
pub fn furi_hal_light_blink_stop();
}
extern "C" {
#[doc = "Set color in hardware LED blinking mode\n\n # Arguments\n\n* `light` - Light"]
pub fn furi_hal_light_blink_set_color(light: Light);
}
extern "C" {
#[doc = "Execute sequence\n\n # Arguments\n\n* `sequence` - Sequence to execute"]
pub fn furi_hal_light_sequence(sequence: *const core::ffi::c_char);
}
#[doc = "Callback type called every time another key-value pair of device information is ready\n\n # Arguments\n\n* `key[in]` - device information type identifier\n * `value[in]` - device information value\n * `last[in]` - whether the passed key-value pair is the last one\n * `context[in]` - to pass to callback"]
pub type PropertyValueCallback = ::core::option::Option<
unsafe extern "C" fn(
key: *const core::ffi::c_char,
value: *const core::ffi::c_char,
last: bool,
context: *mut core::ffi::c_void,
),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct PropertyValueContext {
#[doc = "< key string buffer, must be initialised before use"]
pub key: *mut FuriString,
#[doc = "< value string buffer, must be initialised before use"]
pub value: *mut FuriString,
#[doc = "< output callback function"]
pub out: PropertyValueCallback,
#[doc = "< separator character between key parts"]
pub sep: core::ffi::c_char,
#[doc = "< flag to indicate last element"]
pub last: bool,
#[doc = "< user-defined context, passed through to out callback"]
pub context: *mut core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_PropertyValueContext() {
const UNINIT: ::core::mem::MaybeUninit<PropertyValueContext> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<PropertyValueContext>(),
20usize,
concat!("Size of: ", stringify!(PropertyValueContext))
);
assert_eq!(
::core::mem::align_of::<PropertyValueContext>(),
4usize,
concat!("Alignment of ", stringify!(PropertyValueContext))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(value)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).out) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(out)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sep) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(sep)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).last) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(last)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(PropertyValueContext),
"::",
stringify!(context)
)
);
}
extern "C" {
#[doc = "Builds key and value strings and outputs them via a callback function\n\n # Arguments\n\n* `ctx[in]` - local property context\n * `fmt[in]` - value format, set to NULL to bypass formatting\n * `nparts[in]` - number of key parts (separated by character)\n * `...[in]` - list of key parts followed by value"]
pub fn property_value_out(
ctx: *mut PropertyValueContext,
fmt: *const core::ffi::c_char,
nparts: core::ffi::c_uint,
...
);
}
pub const FuriHalPowerIC_FuriHalPowerICCharger: FuriHalPowerIC = 0;
pub const FuriHalPowerIC_FuriHalPowerICFuelGauge: FuriHalPowerIC = 1;
#[doc = "Power IC type"]
pub type FuriHalPowerIC = core::ffi::c_uchar;
extern "C" {
#[doc = "Check if gauge is ok\n\n Verifies that:\n - gauge is alive\n - correct profile loaded\n - self diagnostic status is good\n\n # Returns\n\ntrue if gauge is ok"]
pub fn furi_hal_power_gauge_is_ok() -> bool;
}
extern "C" {
#[doc = "Check if gauge requests system shutdown\n\n # Returns\n\ntrue if system shutdown requested"]
pub fn furi_hal_power_is_shutdown_requested() -> bool;
}
extern "C" {
#[doc = "Enter insomnia mode Prevents device from going to sleep\n Internally increases insomnia level Must be paired with\n furi_hal_power_insomnia_exit"]
pub fn furi_hal_power_insomnia_enter();
}
extern "C" {
#[doc = "Exit insomnia mode Allow device to go to sleep\n Internally decreases insomnia level. Must be paired with\n furi_hal_power_insomnia_enter"]
pub fn furi_hal_power_insomnia_exit();
}
extern "C" {
#[doc = "Check if sleep available\n\n # Returns\n\ntrue if available"]
pub fn furi_hal_power_sleep_available() -> bool;
}
extern "C" {
#[doc = "Go to sleep"]
pub fn furi_hal_power_sleep();
}
extern "C" {
#[doc = "Get predicted remaining battery capacity in percents\n\n # Returns\n\nremaining battery capacity in percents"]
pub fn furi_hal_power_get_pct() -> u8;
}
extern "C" {
#[doc = "Get battery health state in percents\n\n # Returns\n\nhealth in percents"]
pub fn furi_hal_power_get_bat_health_pct() -> u8;
}
extern "C" {
#[doc = "Get charging status\n\n # Returns\n\ntrue if charging"]
pub fn furi_hal_power_is_charging() -> bool;
}
extern "C" {
#[doc = "Get charge complete status\n\n # Returns\n\ntrue if done charging and connected to charger"]
pub fn furi_hal_power_is_charging_done() -> bool;
}
extern "C" {
#[doc = "Switch MCU to SHUTDOWN"]
pub fn furi_hal_power_shutdown();
}
extern "C" {
#[doc = "Poweroff device"]
pub fn furi_hal_power_off();
}
extern "C" {
#[doc = "Reset device"]
pub fn furi_hal_power_reset();
}
extern "C" {
#[doc = "OTG enable"]
pub fn furi_hal_power_enable_otg() -> bool;
}
extern "C" {
#[doc = "OTG disable"]
pub fn furi_hal_power_disable_otg();
}
extern "C" {
#[doc = "Check OTG status fault"]
pub fn furi_hal_power_check_otg_fault() -> bool;
}
extern "C" {
#[doc = "Check OTG status and disable it if falt happened"]
pub fn furi_hal_power_check_otg_status();
}
extern "C" {
#[doc = "Get OTG status\n\n # Returns\n\ntrue if enabled"]
pub fn furi_hal_power_is_otg_enabled() -> bool;
}
extern "C" {
#[doc = "Get battery charge voltage limit in V\n\n # Returns\n\nvoltage in V"]
pub fn furi_hal_power_get_battery_charge_voltage_limit() -> f32;
}
extern "C" {
#[doc = "Set battery charge voltage limit in V\n\n Invalid values will be clamped downward to the nearest valid value.\n\n # Arguments\n\n* `voltage` (direction in) - voltage in V"]
pub fn furi_hal_power_set_battery_charge_voltage_limit(voltage: f32);
}
extern "C" {
#[doc = "Get remaining battery battery capacity in mAh\n\n # Returns\n\ncapacity in mAh"]
pub fn furi_hal_power_get_battery_remaining_capacity() -> u32;
}
extern "C" {
#[doc = "Get full charge battery capacity in mAh\n\n # Returns\n\ncapacity in mAh"]
pub fn furi_hal_power_get_battery_full_capacity() -> u32;
}
extern "C" {
#[doc = "Get battery capacity in mAh from battery profile\n\n # Returns\n\ncapacity in mAh"]
pub fn furi_hal_power_get_battery_design_capacity() -> u32;
}
extern "C" {
#[doc = "Get battery voltage in V\n\n # Arguments\n\n* `ic` (direction in) - FuriHalPowerIc to get measurment\n\n # Returns\n\nvoltage in V"]
pub fn furi_hal_power_get_battery_voltage(ic: FuriHalPowerIC) -> f32;
}
extern "C" {
#[doc = "Get battery current in A\n\n # Arguments\n\n* `ic` (direction in) - FuriHalPowerIc to get measurment\n\n # Returns\n\ncurrent in A"]
pub fn furi_hal_power_get_battery_current(ic: FuriHalPowerIC) -> f32;
}
extern "C" {
#[doc = "Get temperature in C\n\n # Arguments\n\n* `ic` (direction in) - FuriHalPowerIc to get measurment\n\n # Returns\n\ntemperature in C"]
pub fn furi_hal_power_get_battery_temperature(ic: FuriHalPowerIC) -> f32;
}
extern "C" {
#[doc = "Get USB voltage in V\n\n # Returns\n\nvoltage in V"]
pub fn furi_hal_power_get_usb_voltage() -> f32;
}
extern "C" {
#[doc = "Enable 3.3v on external gpio and sd card"]
pub fn furi_hal_power_enable_external_3_3v();
}
extern "C" {
#[doc = "Disable 3.3v on external gpio and sd card"]
pub fn furi_hal_power_disable_external_3_3v();
}
extern "C" {
#[doc = "Enter supress charge mode.\n\n Use this function when your application need clean power supply."]
pub fn furi_hal_power_suppress_charge_enter();
}
extern "C" {
#[doc = "Exit supress charge mode"]
pub fn furi_hal_power_suppress_charge_exit();
}
extern "C" {
#[doc = "Get power information\n\n # Arguments\n\n* `callback` (direction in) - callback to provide with new data\n * `sep` (direction in) - category separator character\n * `context` (direction in) - context to pass to callback"]
pub fn furi_hal_power_info_get(
callback: PropertyValueCallback,
sep: core::ffi::c_char,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get power debug information\n\n # Arguments\n\n* `callback` (direction in) - callback to provide with new data\n * `context` (direction in) - context to pass to callback"]
pub fn furi_hal_power_debug_get(
callback: PropertyValueCallback,
context: *mut core::ffi::c_void,
);
}
#[doc = "TIM Time Base configuration structure definition."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_TIM_InitTypeDef {
#[doc = "< Specifies the prescaler value used to divide the TIM clock.\nThis parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_SetPrescaler()."]
pub Prescaler: u16,
#[doc = "< Specifies the counter mode.\nThis parameter can be a value of TIM_LL_EC_COUNTERMODE.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_SetCounterMode()."]
pub CounterMode: u32,
#[doc = "< Specifies the auto reload value to be loaded into the active\nAuto-Reload Register at the next update event.\nThis parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.\nSome timer instances may support 32 bits counters. In that case this parameter must\nbe a number between 0x0000 and 0xFFFFFFFF.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_SetAutoReload()."]
pub Autoreload: u32,
#[doc = "< Specifies the clock division.\nThis parameter can be a value of TIM_LL_EC_CLOCKDIVISION.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_SetClockDivision()."]
pub ClockDivision: u32,
#[doc = "< Specifies the repetition counter value. Each time the RCR downcounter\nreaches zero, an update event is generated and counting restarts\nfrom the RCR value (N).\nThis means in PWM mode that (N+1) corresponds to:\n- the number of PWM periods in edge-aligned mode\n- the number of half PWM period in center-aligned mode\nGP timers: this parameter must be a number between Min_Data = 0x00 and\nMax_Data = 0xFF.\nAdvanced timers: this parameter must be a number between Min_Data = 0x0000 and\nMax_Data = 0xFFFF.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_SetRepetitionCounter()."]
pub RepetitionCounter: u32,
}
#[test]
fn bindgen_test_layout_LL_TIM_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_TIM_InitTypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_TIM_InitTypeDef>(),
20usize,
concat!("Size of: ", stringify!(LL_TIM_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_TIM_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_TIM_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Prescaler) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_InitTypeDef),
"::",
stringify!(Prescaler)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CounterMode) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_InitTypeDef),
"::",
stringify!(CounterMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Autoreload) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_InitTypeDef),
"::",
stringify!(Autoreload)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ClockDivision) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_InitTypeDef),
"::",
stringify!(ClockDivision)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).RepetitionCounter) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_InitTypeDef),
"::",
stringify!(RepetitionCounter)
)
);
}
#[doc = "TIM Output Compare configuration structure definition."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_TIM_OC_InitTypeDef {
#[doc = "< Specifies the output mode.\nThis parameter can be a value of TIM_LL_EC_OCMODE.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetMode()."]
pub OCMode: u32,
#[doc = "< Specifies the TIM Output Compare state.\nThis parameter can be a value of TIM_LL_EC_OCSTATE.\n\nThis feature can be modified afterwards using unitary functions\nLL_TIM_CC_EnableChannel() or LL_TIM_CC_DisableChannel()."]
pub OCState: u32,
#[doc = "< Specifies the TIM complementary Output Compare state.\nThis parameter can be a value of TIM_LL_EC_OCSTATE.\n\nThis feature can be modified afterwards using unitary functions\nLL_TIM_CC_EnableChannel() or LL_TIM_CC_DisableChannel()."]
pub OCNState: u32,
#[doc = "< Specifies the Compare value to be loaded into the Capture Compare Register.\nThis parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetCompareCHx (x=1..6)."]
pub CompareValue: u32,
#[doc = "< Specifies the output polarity.\nThis parameter can be a value of TIM_LL_EC_OCPOLARITY.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetPolarity()."]
pub OCPolarity: u32,
#[doc = "< Specifies the complementary output polarity.\nThis parameter can be a value of TIM_LL_EC_OCPOLARITY.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetPolarity()."]
pub OCNPolarity: u32,
#[doc = "< Specifies the TIM Output Compare pin state during Idle state.\nThis parameter can be a value of TIM_LL_EC_OCIDLESTATE.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetIdleState()."]
pub OCIdleState: u32,
#[doc = "< Specifies the TIM Output Compare pin state during Idle state.\nThis parameter can be a value of TIM_LL_EC_OCIDLESTATE.\n\nThis feature can be modified afterwards using unitary function\nLL_TIM_OC_SetIdleState()."]
pub OCNIdleState: u32,
}
#[test]
fn bindgen_test_layout_LL_TIM_OC_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_TIM_OC_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_TIM_OC_InitTypeDef>(),
32usize,
concat!("Size of: ", stringify!(LL_TIM_OC_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_TIM_OC_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_TIM_OC_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCMode) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCState) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCState)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCNState) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCNState)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CompareValue) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(CompareValue)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCPolarity) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCPolarity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCNPolarity) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCNPolarity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCIdleState) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCIdleState)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OCNIdleState) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(LL_TIM_OC_InitTypeDef),
"::",
stringify!(OCNIdleState)
)
);
}
extern "C" {
#[doc = "TIM_LL_EF_Init Initialisation and deinitialisation functions\n # "]
pub fn LL_TIM_DeInit(TIMx: *mut TIM_TypeDef) -> ErrorStatus;
}
extern "C" {
pub fn LL_TIM_Init(
TIMx: *mut TIM_TypeDef,
TIM_InitStruct: *const LL_TIM_InitTypeDef,
) -> ErrorStatus;
}
extern "C" {
pub fn LL_TIM_OC_Init(
TIMx: *mut TIM_TypeDef,
Channel: u32,
TIM_OC_InitStruct: *const LL_TIM_OC_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "Timer ISR"]
pub type FuriHalInterruptISR =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub const FuriHalInterruptId_FuriHalInterruptIdTim1TrgComTim17: FuriHalInterruptId = 0;
pub const FuriHalInterruptId_FuriHalInterruptIdTim1Cc: FuriHalInterruptId = 1;
pub const FuriHalInterruptId_FuriHalInterruptIdTim1UpTim16: FuriHalInterruptId = 2;
pub const FuriHalInterruptId_FuriHalInterruptIdTIM2: FuriHalInterruptId = 3;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch1: FuriHalInterruptId = 4;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch2: FuriHalInterruptId = 5;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch3: FuriHalInterruptId = 6;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch4: FuriHalInterruptId = 7;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch5: FuriHalInterruptId = 8;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch6: FuriHalInterruptId = 9;
pub const FuriHalInterruptId_FuriHalInterruptIdDma1Ch7: FuriHalInterruptId = 10;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch1: FuriHalInterruptId = 11;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch2: FuriHalInterruptId = 12;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch3: FuriHalInterruptId = 13;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch4: FuriHalInterruptId = 14;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch5: FuriHalInterruptId = 15;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch6: FuriHalInterruptId = 16;
pub const FuriHalInterruptId_FuriHalInterruptIdDma2Ch7: FuriHalInterruptId = 17;
pub const FuriHalInterruptId_FuriHalInterruptIdRcc: FuriHalInterruptId = 18;
pub const FuriHalInterruptId_FuriHalInterruptIdCOMP: FuriHalInterruptId = 19;
pub const FuriHalInterruptId_FuriHalInterruptIdHsem: FuriHalInterruptId = 20;
pub const FuriHalInterruptId_FuriHalInterruptIdLpTim1: FuriHalInterruptId = 21;
pub const FuriHalInterruptId_FuriHalInterruptIdLpTim2: FuriHalInterruptId = 22;
pub const FuriHalInterruptId_FuriHalInterruptIdUart1: FuriHalInterruptId = 23;
pub const FuriHalInterruptId_FuriHalInterruptIdLpUart1: FuriHalInterruptId = 24;
pub const FuriHalInterruptId_FuriHalInterruptIdMax: FuriHalInterruptId = 25;
pub type FuriHalInterruptId = core::ffi::c_uchar;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityLowest: FuriHalInterruptPriority = -3;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityLower: FuriHalInterruptPriority = -2;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityLow: FuriHalInterruptPriority = -1;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityNormal: FuriHalInterruptPriority = 0;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityHigh: FuriHalInterruptPriority = 1;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityHigher: FuriHalInterruptPriority = 2;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityHighest: FuriHalInterruptPriority = 3;
pub const FuriHalInterruptPriority_FuriHalInterruptPriorityKamiSama: FuriHalInterruptPriority = 6;
pub type FuriHalInterruptPriority = core::ffi::c_schar;
extern "C" {
#[doc = "Set ISR and enable interrupt with default priority\n\n Interrupt flags are not cleared automatically. You may want to\n ensure that your peripheral status flags are cleared.\n\n # Arguments\n\n* `index` - - interrupt ID\n * `isr` - - your interrupt service routine or use NULL to clear\n * `context` - - isr context"]
pub fn furi_hal_interrupt_set_isr(
index: FuriHalInterruptId,
isr: FuriHalInterruptISR,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Set ISR and enable interrupt with custom priority\n\n Interrupt flags are not cleared automatically. You may want to\n ensure that your peripheral status flags are cleared.\n\n # Arguments\n\n* `index` - - interrupt ID\n * `priority` - - One of FuriHalInterruptPriority\n * `isr` - - your interrupt service routine or use NULL to clear\n * `context` - - isr context"]
pub fn furi_hal_interrupt_set_isr_ex(
index: FuriHalInterruptId,
priority: FuriHalInterruptPriority,
isr: FuriHalInterruptISR,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get interrupt name by exception number.\n Exception number can be obtained from IPSR register.\n\n # Arguments\n\n* `exception_number` -\n # Returns\n\nconst char* or NULL if interrupt name is not found"]
pub fn furi_hal_interrupt_get_name(exception_number: u8) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get total time(in CPU clocks) spent in ISR\n\n # Returns\n\ntotal time in CPU clocks"]
pub fn furi_hal_interrupt_get_time_in_isr_total() -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Version {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Get current running firmware version handle.\n\n You can store it somewhere. But if you want to retrieve data, you have to use\n 'version_*_get()' set of functions. Also, 'version_*_get()' imply to use this\n handle if no handle (NULL_PTR) provided.\n\n # Returns\n\npointer to Version data."]
pub fn version_get() -> *const Version;
}
extern "C" {
#[doc = "Get git commit hash.\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\ngit hash"]
pub fn version_get_githash(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get git branch.\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\ngit branch"]
pub fn version_get_gitbranch(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get number of commit in git branch.\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\nnumber of commit"]
pub fn version_get_gitbranchnum(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get build date.\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\nbuild date"]
pub fn version_get_builddate(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get build version. Build version is last tag in git history.\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\nbuild date"]
pub fn version_get_version(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get hardware target this firmware was built for\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\nbuild date"]
pub fn version_get_target(v: *const Version) -> u8;
}
extern "C" {
#[doc = "Get flag indicating if this build is \"dirty\" (source code had uncommited changes)\n\n # Arguments\n\n* `v` - pointer to Version data. NULL for currently running\n software.\n\n # Returns\n\nbuild date"]
pub fn version_get_dirty_flag(v: *const Version) -> bool;
}
extern "C" {
#[doc = "Get firmware origin. \"Official\" for mainline firmware, fork name for forks.\n Set by FIRMWARE_ORIGIN fbt argument."]
pub fn version_get_firmware_origin(v: *const Version) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get git repo origin"]
pub fn version_get_git_origin(v: *const Version) -> *const core::ffi::c_char;
}
pub const FuriHalVersionOtpVersion_FuriHalVersionOtpVersion0: FuriHalVersionOtpVersion = 0;
pub const FuriHalVersionOtpVersion_FuriHalVersionOtpVersion1: FuriHalVersionOtpVersion = 1;
pub const FuriHalVersionOtpVersion_FuriHalVersionOtpVersion2: FuriHalVersionOtpVersion = 2;
pub const FuriHalVersionOtpVersion_FuriHalVersionOtpVersionEmpty: FuriHalVersionOtpVersion =
4294967294;
pub const FuriHalVersionOtpVersion_FuriHalVersionOtpVersionUnknown: FuriHalVersionOtpVersion =
4294967295;
#[doc = "OTP Versions enum"]
pub type FuriHalVersionOtpVersion = core::ffi::c_uint;
pub const FuriHalVersionColor_FuriHalVersionColorUnknown: FuriHalVersionColor = 0;
pub const FuriHalVersionColor_FuriHalVersionColorBlack: FuriHalVersionColor = 1;
pub const FuriHalVersionColor_FuriHalVersionColorWhite: FuriHalVersionColor = 2;
pub const FuriHalVersionColor_FuriHalVersionColorTransparent: FuriHalVersionColor = 3;
#[doc = "Device Colors"]
pub type FuriHalVersionColor = core::ffi::c_uchar;
pub const FuriHalVersionRegion_FuriHalVersionRegionUnknown: FuriHalVersionRegion = 0;
pub const FuriHalVersionRegion_FuriHalVersionRegionEuRu: FuriHalVersionRegion = 1;
pub const FuriHalVersionRegion_FuriHalVersionRegionUsCaAu: FuriHalVersionRegion = 2;
pub const FuriHalVersionRegion_FuriHalVersionRegionJp: FuriHalVersionRegion = 3;
pub const FuriHalVersionRegion_FuriHalVersionRegionWorld: FuriHalVersionRegion = 4;
#[doc = "Device Regions"]
pub type FuriHalVersionRegion = core::ffi::c_uchar;
pub const FuriHalVersionDisplay_FuriHalVersionDisplayUnknown: FuriHalVersionDisplay = 0;
pub const FuriHalVersionDisplay_FuriHalVersionDisplayErc: FuriHalVersionDisplay = 1;
pub const FuriHalVersionDisplay_FuriHalVersionDisplayMgg: FuriHalVersionDisplay = 2;
#[doc = "Device Display"]
pub type FuriHalVersionDisplay = core::ffi::c_uchar;
extern "C" {
#[doc = "Check target firmware version\n\n # Returns\n\ntrue if target and real matches"]
pub fn furi_hal_version_do_i_belong_here() -> bool;
}
extern "C" {
#[doc = "Get model name\n\n # Returns\n\nmodel name C-string"]
pub fn furi_hal_version_get_model_name() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get model name\n\n # Returns\n\nmodel code C-string"]
pub fn furi_hal_version_get_model_code() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get FCC ID\n\n # Returns\n\nFCC id as C-string"]
pub fn furi_hal_version_get_fcc_id() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get IC id\n\n # Returns\n\nIC id as C-string"]
pub fn furi_hal_version_get_ic_id() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get MIC id\n\n # Returns\n\nMIC id as C-string"]
pub fn furi_hal_version_get_mic_id() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get SRRC id\n\n # Returns\n\nSRRC id as C-string"]
pub fn furi_hal_version_get_srrc_id() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get NCC id\n\n # Returns\n\nNCC id as C-string"]
pub fn furi_hal_version_get_ncc_id() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get OTP version\n\n # Returns\n\nOTP Version"]
pub fn furi_hal_version_get_otp_version() -> FuriHalVersionOtpVersion;
}
extern "C" {
#[doc = "Get hardware version\n\n # Returns\n\nHardware Version"]
pub fn furi_hal_version_get_hw_version() -> u8;
}
extern "C" {
#[doc = "Get hardware target\n\n # Returns\n\nHardware Target"]
pub fn furi_hal_version_get_hw_target() -> u8;
}
extern "C" {
#[doc = "Get hardware body\n\n # Returns\n\nHardware Body"]
pub fn furi_hal_version_get_hw_body() -> u8;
}
extern "C" {
#[doc = "Get hardware body color\n\n # Returns\n\nHardware Color"]
pub fn furi_hal_version_get_hw_color() -> FuriHalVersionColor;
}
extern "C" {
#[doc = "Get hardware connect\n\n # Returns\n\nHardware Interconnect"]
pub fn furi_hal_version_get_hw_connect() -> u8;
}
extern "C" {
#[doc = "Get hardware region\n\n # Returns\n\nHardware Region"]
pub fn furi_hal_version_get_hw_region() -> FuriHalVersionRegion;
}
extern "C" {
#[doc = "Get hardware region name\n\n # Returns\n\nHardware Region name"]
pub fn furi_hal_version_get_hw_region_name() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get hardware display id\n\n # Returns\n\nDisplay id"]
pub fn furi_hal_version_get_hw_display() -> FuriHalVersionDisplay;
}
extern "C" {
#[doc = "Get hardware timestamp\n\n # Returns\n\nHardware Manufacture timestamp"]
pub fn furi_hal_version_get_hw_timestamp() -> u32;
}
extern "C" {
#[doc = "Get pointer to target name\n\n # Returns\n\nHardware Name C-string"]
pub fn furi_hal_version_get_name_ptr() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get pointer to target device name\n\n # Returns\n\nHardware Device Name C-string"]
pub fn furi_hal_version_get_device_name_ptr() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get pointer to target ble local device name\n\n # Returns\n\nBle Device Name C-string"]
pub fn furi_hal_version_get_ble_local_device_name_ptr() -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get BLE MAC address\n\n # Returns\n\npointer to BLE MAC address"]
pub fn furi_hal_version_get_ble_mac() -> *const u8;
}
extern "C" {
#[doc = "Get address of version structure of firmware.\n\n # Returns\n\nAddress of firmware version structure."]
pub fn furi_hal_version_get_firmware_version() -> *const Version;
}
extern "C" {
#[doc = "Get platform UID size in bytes\n\n # Returns\n\nUID size in bytes"]
pub fn furi_hal_version_uid_size() -> usize;
}
extern "C" {
#[doc = "Get const pointer to UID\n\n # Returns\n\npointer to UID"]
pub fn furi_hal_version_uid() -> *const u8;
}
pub const GapEventType_GapEventTypeConnected: GapEventType = 0;
pub const GapEventType_GapEventTypeDisconnected: GapEventType = 1;
pub const GapEventType_GapEventTypeStartAdvertising: GapEventType = 2;
pub const GapEventType_GapEventTypeStopAdvertising: GapEventType = 3;
pub const GapEventType_GapEventTypePinCodeShow: GapEventType = 4;
pub const GapEventType_GapEventTypePinCodeVerify: GapEventType = 5;
pub const GapEventType_GapEventTypeUpdateMTU: GapEventType = 6;
pub const GapEventType_GapEventTypeBeaconStart: GapEventType = 7;
pub const GapEventType_GapEventTypeBeaconStop: GapEventType = 8;
pub type GapEventType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Copy, Clone)]
pub union GapEventData {
pub pin_code: u32,
pub max_packet_size: u16,
}
#[test]
fn bindgen_test_layout_GapEventData() {
const UNINIT: ::core::mem::MaybeUninit<GapEventData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GapEventData>(),
4usize,
concat!("Size of: ", stringify!(GapEventData))
);
assert_eq!(
::core::mem::align_of::<GapEventData>(),
4usize,
concat!("Alignment of ", stringify!(GapEventData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pin_code) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapEventData),
"::",
stringify!(pin_code)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_packet_size) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapEventData),
"::",
stringify!(max_packet_size)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GapEvent {
pub type_: GapEventType,
pub data: GapEventData,
}
#[test]
fn bindgen_test_layout_GapEvent() {
const UNINIT: ::core::mem::MaybeUninit<GapEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GapEvent>(),
8usize,
concat!("Size of: ", stringify!(GapEvent))
);
assert_eq!(
::core::mem::align_of::<GapEvent>(),
4usize,
concat!("Alignment of ", stringify!(GapEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GapEvent),
"::",
stringify!(data)
)
);
}
pub type GapEventCallback = ::core::option::Option<
unsafe extern "C" fn(event: GapEvent, context: *mut core::ffi::c_void) -> bool,
>;
pub const GapPairing_GapPairingNone: GapPairing = 0;
pub const GapPairing_GapPairingPinCodeShow: GapPairing = 1;
pub const GapPairing_GapPairingPinCodeVerifyYesNo: GapPairing = 2;
pub type GapPairing = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GapConnectionParamsRequest {
pub conn_int_min: u16,
pub conn_int_max: u16,
pub slave_latency: u16,
pub supervisor_timeout: u16,
}
#[test]
fn bindgen_test_layout_GapConnectionParamsRequest() {
const UNINIT: ::core::mem::MaybeUninit<GapConnectionParamsRequest> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GapConnectionParamsRequest>(),
8usize,
concat!("Size of: ", stringify!(GapConnectionParamsRequest))
);
assert_eq!(
::core::mem::align_of::<GapConnectionParamsRequest>(),
2usize,
concat!("Alignment of ", stringify!(GapConnectionParamsRequest))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).conn_int_min) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapConnectionParamsRequest),
"::",
stringify!(conn_int_min)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).conn_int_max) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(GapConnectionParamsRequest),
"::",
stringify!(conn_int_max)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).slave_latency) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GapConnectionParamsRequest),
"::",
stringify!(slave_latency)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).supervisor_timeout) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(GapConnectionParamsRequest),
"::",
stringify!(supervisor_timeout)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GapConfig {
pub adv_service_uuid: u16,
pub appearance_char: u16,
pub bonding_mode: bool,
pub pairing_method: GapPairing,
pub mac_address: [u8; 6usize],
pub adv_name: [core::ffi::c_char; 18usize],
pub conn_param: GapConnectionParamsRequest,
}
#[test]
fn bindgen_test_layout_GapConfig() {
const UNINIT: ::core::mem::MaybeUninit<GapConfig> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GapConfig>(),
38usize,
concat!("Size of: ", stringify!(GapConfig))
);
assert_eq!(
::core::mem::align_of::<GapConfig>(),
2usize,
concat!("Alignment of ", stringify!(GapConfig))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).adv_service_uuid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(adv_service_uuid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).appearance_char) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(appearance_char)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bonding_mode) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(bonding_mode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pairing_method) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(pairing_method)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mac_address) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(mac_address)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).adv_name) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(adv_name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).conn_param) as usize - ptr as usize },
30usize,
concat!(
"Offset of field: ",
stringify!(GapConfig),
"::",
stringify!(conn_param)
)
);
}
pub const GapAdvChannelMap_GapAdvChannelMap37: GapAdvChannelMap = 1;
pub const GapAdvChannelMap_GapAdvChannelMap38: GapAdvChannelMap = 2;
pub const GapAdvChannelMap_GapAdvChannelMap39: GapAdvChannelMap = 4;
pub const GapAdvChannelMap_GapAdvChannelMapAll: GapAdvChannelMap = 7;
pub type GapAdvChannelMap = core::ffi::c_uchar;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg40dBm: GapAdvPowerLevelInd = 0;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg20_85dBm: GapAdvPowerLevelInd = 1;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg19_75dBm: GapAdvPowerLevelInd = 2;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg18_85dBm: GapAdvPowerLevelInd = 3;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg17_6dBm: GapAdvPowerLevelInd = 4;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg16_5dBm: GapAdvPowerLevelInd = 5;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg15_25dBm: GapAdvPowerLevelInd = 6;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg14_1dBm: GapAdvPowerLevelInd = 7;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg13_15dBm: GapAdvPowerLevelInd = 8;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg12_05dBm: GapAdvPowerLevelInd = 9;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg10_9dBm: GapAdvPowerLevelInd = 10;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg9_9dBm: GapAdvPowerLevelInd = 11;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg8_85dBm: GapAdvPowerLevelInd = 12;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg7_8dBm: GapAdvPowerLevelInd = 13;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg6_9dBm: GapAdvPowerLevelInd = 14;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg5_9dBm: GapAdvPowerLevelInd = 15;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg4_95dBm: GapAdvPowerLevelInd = 16;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg4dBm: GapAdvPowerLevelInd = 17;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg3_15dBm: GapAdvPowerLevelInd = 18;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg2_45dBm: GapAdvPowerLevelInd = 19;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg1_8dBm: GapAdvPowerLevelInd = 20;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg1_3dBm: GapAdvPowerLevelInd = 21;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg0_85dBm: GapAdvPowerLevelInd = 22;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg0_5dBm: GapAdvPowerLevelInd = 23;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_Neg0_15dBm: GapAdvPowerLevelInd = 24;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_0dBm: GapAdvPowerLevelInd = 25;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_1dBm: GapAdvPowerLevelInd = 26;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_2dBm: GapAdvPowerLevelInd = 27;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_3dBm: GapAdvPowerLevelInd = 28;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_4dBm: GapAdvPowerLevelInd = 29;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_5dBm: GapAdvPowerLevelInd = 30;
pub const GapAdvPowerLevelInd_GapAdvPowerLevel_6dBm: GapAdvPowerLevelInd = 31;
pub type GapAdvPowerLevelInd = core::ffi::c_uchar;
pub const GapAddressType_GapAddressTypePublic: GapAddressType = 0;
pub const GapAddressType_GapAddressTypeRandom: GapAddressType = 1;
pub type GapAddressType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GapExtraBeaconConfig {
pub min_adv_interval_ms: u16,
pub max_adv_interval_ms: u16,
pub adv_channel_map: GapAdvChannelMap,
pub adv_power_level: GapAdvPowerLevelInd,
pub address_type: GapAddressType,
pub address: [u8; 6usize],
}
#[test]
fn bindgen_test_layout_GapExtraBeaconConfig() {
const UNINIT: ::core::mem::MaybeUninit<GapExtraBeaconConfig> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<GapExtraBeaconConfig>(),
14usize,
concat!("Size of: ", stringify!(GapExtraBeaconConfig))
);
assert_eq!(
::core::mem::align_of::<GapExtraBeaconConfig>(),
2usize,
concat!("Alignment of ", stringify!(GapExtraBeaconConfig))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).min_adv_interval_ms) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(min_adv_interval_ms)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_adv_interval_ms) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(max_adv_interval_ms)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).adv_channel_map) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(adv_channel_map)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).adv_power_level) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(adv_power_level)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).address_type) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(address_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).address) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(GapExtraBeaconConfig),
"::",
stringify!(address)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalBleProfileBase {
pub config: *const FuriHalBleProfileTemplate,
}
#[test]
fn bindgen_test_layout_FuriHalBleProfileBase() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalBleProfileBase> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalBleProfileBase>(),
4usize,
concat!("Size of: ", stringify!(FuriHalBleProfileBase))
);
assert_eq!(
::core::mem::align_of::<FuriHalBleProfileBase>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalBleProfileBase))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).config) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalBleProfileBase),
"::",
stringify!(config)
)
);
}
pub type FuriHalBleProfileParams = *mut core::ffi::c_void;
pub type FuriHalBleProfileStart = ::core::option::Option<
unsafe extern "C" fn(profile_params: FuriHalBleProfileParams) -> *mut FuriHalBleProfileBase,
>;
pub type FuriHalBleProfileStop =
::core::option::Option<unsafe extern "C" fn(profile: *mut FuriHalBleProfileBase)>;
pub type FuriHalBleProfileGetGapConfig = ::core::option::Option<
unsafe extern "C" fn(target_config: *mut GapConfig, profile_params: FuriHalBleProfileParams),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalBleProfileTemplate {
pub start: FuriHalBleProfileStart,
pub stop: FuriHalBleProfileStop,
pub get_gap_config: FuriHalBleProfileGetGapConfig,
}
#[test]
fn bindgen_test_layout_FuriHalBleProfileTemplate() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalBleProfileTemplate> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalBleProfileTemplate>(),
12usize,
concat!("Size of: ", stringify!(FuriHalBleProfileTemplate))
);
assert_eq!(
::core::mem::align_of::<FuriHalBleProfileTemplate>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalBleProfileTemplate))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalBleProfileTemplate),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stop) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalBleProfileTemplate),
"::",
stringify!(stop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_gap_config) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalBleProfileTemplate),
"::",
stringify!(get_gap_config)
)
);
}
pub const BleGlueC2Mode_BleGlueC2ModeUnknown: BleGlueC2Mode = 0;
pub const BleGlueC2Mode_BleGlueC2ModeFUS: BleGlueC2Mode = 1;
pub const BleGlueC2Mode_BleGlueC2ModeStack: BleGlueC2Mode = 2;
pub type BleGlueC2Mode = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleGlueC2Info {
pub mode: BleGlueC2Mode,
#[doc = "Wireless Info"]
pub VersionMajor: u8,
pub VersionMinor: u8,
pub VersionSub: u8,
pub VersionBranch: u8,
pub VersionReleaseType: u8,
pub MemorySizeSram2B: u8,
pub MemorySizeSram2A: u8,
pub MemorySizeSram1: u8,
pub MemorySizeFlash: u8,
pub StackType: u8,
pub StackTypeString: [core::ffi::c_char; 20usize],
#[doc = "Fus Info"]
pub FusVersionMajor: u8,
pub FusVersionMinor: u8,
pub FusVersionSub: u8,
pub FusMemorySizeSram2B: u8,
pub FusMemorySizeSram2A: u8,
pub FusMemorySizeFlash: u8,
}
#[test]
fn bindgen_test_layout_BleGlueC2Info() {
const UNINIT: ::core::mem::MaybeUninit<BleGlueC2Info> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGlueC2Info>(),
37usize,
concat!("Size of: ", stringify!(BleGlueC2Info))
);
assert_eq!(
::core::mem::align_of::<BleGlueC2Info>(),
1usize,
concat!("Alignment of ", stringify!(BleGlueC2Info))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mode) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(mode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).VersionMajor) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(VersionMajor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).VersionMinor) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(VersionMinor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).VersionSub) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(VersionSub)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).VersionBranch) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(VersionBranch)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).VersionReleaseType) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(VersionReleaseType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram2B) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(MemorySizeSram2B)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram2A) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(MemorySizeSram2A)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram1) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(MemorySizeSram1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeFlash) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(MemorySizeFlash)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).StackType) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(StackType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).StackTypeString) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(StackTypeString)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusVersionMajor) as usize - ptr as usize },
31usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusVersionMajor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusVersionMinor) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusVersionMinor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusVersionSub) as usize - ptr as usize },
33usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusVersionSub)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeSram2B) as usize - ptr as usize },
34usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusMemorySizeSram2B)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeSram2A) as usize - ptr as usize },
35usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusMemorySizeSram2A)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeFlash) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(BleGlueC2Info),
"::",
stringify!(FusMemorySizeFlash)
)
);
}
pub type BleGlueKeyStorageChangedCallback = ::core::option::Option<
unsafe extern "C" fn(change_addr_start: *mut u8, size: u16, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Initialize start core2 and initialize transport"]
pub fn ble_glue_init();
}
extern "C" {
#[doc = "Is core2 alive and at least FUS is running\n\n # Returns\n\ntrue if core2 is alive"]
pub fn ble_glue_is_alive() -> bool;
}
extern "C" {
#[doc = "Waits for C2 to reports its mode to callback\n\n # Returns\n\ntrue if it reported before reaching timeout"]
pub fn ble_glue_wait_for_c2_start(timeout_ms: i32) -> bool;
}
extern "C" {
pub fn ble_glue_get_c2_info() -> *const BleGlueC2Info;
}
extern "C" {
#[doc = "Is core2 radio stack present and ready\n\n # Returns\n\ntrue if present and ready"]
pub fn ble_glue_is_radio_stack_ready() -> bool;
}
extern "C" {
#[doc = "Set callback for NVM in RAM changes\n\n # Arguments\n\n* `callback` (direction in) - The callback to call on NVM change\n * `context` - The context for callback"]
pub fn ble_glue_set_key_storage_changed_callback(
callback: BleGlueKeyStorageChangedCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn ble_glue_reinit_c2() -> bool;
}
pub const BleGlueCommandResult_BleGlueCommandResultUnknown: BleGlueCommandResult = 0;
pub const BleGlueCommandResult_BleGlueCommandResultOK: BleGlueCommandResult = 1;
pub const BleGlueCommandResult_BleGlueCommandResultError: BleGlueCommandResult = 2;
pub const BleGlueCommandResult_BleGlueCommandResultRestartPending: BleGlueCommandResult = 3;
pub const BleGlueCommandResult_BleGlueCommandResultOperationOngoing: BleGlueCommandResult = 4;
pub type BleGlueCommandResult = core::ffi::c_uchar;
extern "C" {
#[doc = "Restart MCU to launch radio stack firmware if necessary\n\n # Returns\n\ntrue on radio stack start command"]
pub fn ble_glue_force_c2_mode(mode: BleGlueC2Mode) -> BleGlueCommandResult;
}
pub const FuriHalBtStack_FuriHalBtStackUnknown: FuriHalBtStack = 0;
pub const FuriHalBtStack_FuriHalBtStackLight: FuriHalBtStack = 1;
pub const FuriHalBtStack_FuriHalBtStackFull: FuriHalBtStack = 2;
pub type FuriHalBtStack = core::ffi::c_uchar;
extern "C" {
#[doc = "Lock core2 state transition"]
pub fn furi_hal_bt_lock_core2();
}
extern "C" {
#[doc = "Lock core2 state transition"]
pub fn furi_hal_bt_unlock_core2();
}
extern "C" {
#[doc = "Start radio stack\n\n # Returns\n\ntrue on successfull radio stack start"]
pub fn furi_hal_bt_start_radio_stack() -> bool;
}
extern "C" {
#[doc = "Get radio stack type\n\n # Returns\n\nFuriHalBtStack instance"]
pub fn furi_hal_bt_get_radio_stack() -> FuriHalBtStack;
}
extern "C" {
#[doc = "Check if radio stack supports BLE GAT/GAP\n\n # Returns\n\ntrue if supported"]
pub fn furi_hal_bt_is_gatt_gap_supported() -> bool;
}
extern "C" {
#[doc = "Check if radio stack supports testing\n\n # Returns\n\ntrue if supported"]
pub fn furi_hal_bt_is_testing_supported() -> bool;
}
extern "C" {
#[doc = "Check if particular instance of profile belongs to given type\n\n # Arguments\n\n* `profile` - FuriHalBtProfile instance. If NULL, uses current profile\n * `profile_template` - basic profile template to check against\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_check_profile_type(
profile: *mut FuriHalBleProfileBase,
profile_template: *const FuriHalBleProfileTemplate,
) -> bool;
}
extern "C" {
#[doc = "Start BLE app\n\n # Arguments\n\n* `profile_template` - FuriHalBleProfileTemplate instance\n * `params` - Parameters to pass to the profile. Can be NULL\n * `event_cb` - GapEventCallback instance\n * `context` - pointer to context\n\n # Returns\n\ninstance of profile, NULL on failure"]
pub fn furi_hal_bt_start_app(
profile_template: *const FuriHalBleProfileTemplate,
params: FuriHalBleProfileParams,
event_cb: GapEventCallback,
context: *mut core::ffi::c_void,
) -> *mut FuriHalBleProfileBase;
}
extern "C" {
#[doc = "Reinitialize core2\n\n Also can be used to prepare core2 for stop modes"]
pub fn furi_hal_bt_reinit();
}
extern "C" {
#[doc = "Change BLE app\n Restarts 2nd core\n\n # Arguments\n\n* `profile_template` - FuriHalBleProfileTemplate instance\n * `profile_params` - Parameters to pass to the profile. Can be NULL\n * `event_cb` - GapEventCallback instance\n * `context` - pointer to context\n\n # Returns\n\ninstance of profile, NULL on failure"]
pub fn furi_hal_bt_change_app(
profile_template: *const FuriHalBleProfileTemplate,
profile_params: FuriHalBleProfileParams,
event_cb: GapEventCallback,
context: *mut core::ffi::c_void,
) -> *mut FuriHalBleProfileBase;
}
extern "C" {
#[doc = "Update battery level\n\n # Arguments\n\n* `battery_level` - battery level"]
pub fn furi_hal_bt_update_battery_level(battery_level: u8);
}
extern "C" {
#[doc = "Update battery power state"]
pub fn furi_hal_bt_update_power_state(charging: bool);
}
extern "C" {
#[doc = "Checks if BLE state is active\n\n # Returns\n\ntrue if device is connected or advertising, false otherwise"]
pub fn furi_hal_bt_is_active() -> bool;
}
extern "C" {
#[doc = "Start advertising"]
pub fn furi_hal_bt_start_advertising();
}
extern "C" {
#[doc = "Stop advertising"]
pub fn furi_hal_bt_stop_advertising();
}
extern "C" {
#[doc = "Get BT/BLE system component state\n\n # Arguments\n\n* `buffer` (direction in) - FuriString* buffer to write to"]
pub fn furi_hal_bt_dump_state(buffer: *mut FuriString);
}
extern "C" {
#[doc = "Get BT/BLE system component state\n\n # Returns\n\ntrue if core2 is alive"]
pub fn furi_hal_bt_is_alive() -> bool;
}
extern "C" {
#[doc = "Get key storage buffer address and size\n\n # Arguments\n\n* `key_buff_addr` - pointer to store buffer address\n * `key_buff_size` - pointer to store buffer size"]
pub fn furi_hal_bt_get_key_storage_buff(key_buff_addr: *mut *mut u8, key_buff_size: *mut u16);
}
extern "C" {
#[doc = "Get SRAM2 hardware semaphore\n > **Note:** Must be called before SRAM2 read/write operations"]
pub fn furi_hal_bt_nvm_sram_sem_acquire();
}
extern "C" {
#[doc = "Release SRAM2 hardware semaphore\n > **Note:** Must be called after SRAM2 read/write operations"]
pub fn furi_hal_bt_nvm_sram_sem_release();
}
extern "C" {
#[doc = "Clear key storage\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_clear_white_list() -> bool;
}
extern "C" {
#[doc = "Set key storage change callback\n\n # Arguments\n\n* `callback` - BleGlueKeyStorageChangedCallback instance\n * `context` - pointer to context"]
pub fn furi_hal_bt_set_key_storage_change_callback(
callback: BleGlueKeyStorageChangedCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start ble tone tx at given channel and power\n\n # Arguments\n\n* `channel` (direction in) - The channel\n * `power` (direction in) - The power"]
pub fn furi_hal_bt_start_tone_tx(channel: u8, power: u8);
}
extern "C" {
#[doc = "Stop ble tone tx"]
pub fn furi_hal_bt_stop_tone_tx();
}
extern "C" {
#[doc = "Start sending ble packets at a given frequency and datarate\n\n # Arguments\n\n* `channel` (direction in) - The channel\n * `pattern` (direction in) - The pattern\n * `datarate` (direction in) - The datarate"]
pub fn furi_hal_bt_start_packet_tx(channel: u8, pattern: u8, datarate: u8);
}
extern "C" {
#[doc = "Stop sending ble packets\n\n # Returns\n\nsent packet count"]
pub fn furi_hal_bt_stop_packet_test() -> u16;
}
extern "C" {
#[doc = "Start receiving packets\n\n # Arguments\n\n* `channel` (direction in) - RX channel\n * `datarate` (direction in) - Datarate"]
pub fn furi_hal_bt_start_packet_rx(channel: u8, datarate: u8);
}
extern "C" {
#[doc = "Set up the RF to listen to a given RF channel\n\n # Arguments\n\n* `channel` (direction in) - RX channel"]
pub fn furi_hal_bt_start_rx(channel: u8);
}
extern "C" {
#[doc = "Stop RF listenning"]
pub fn furi_hal_bt_stop_rx();
}
extern "C" {
#[doc = "Get RSSI\n\n # Returns\n\nRSSI in dBm"]
pub fn furi_hal_bt_get_rssi() -> f32;
}
extern "C" {
#[doc = "Get number of transmitted packets\n\n # Returns\n\npacket count"]
pub fn furi_hal_bt_get_transmitted_packets() -> u32;
}
extern "C" {
#[doc = "Check & switch C2 to given mode\n\n # Arguments\n\n* `mode` (direction in) - mode to switch into"]
pub fn furi_hal_bt_ensure_c2_mode(mode: BleGlueC2Mode) -> bool;
}
extern "C" {
#[doc = "Set extra beacon data. Can be called in any state\n\n # Arguments\n\n* `data` (direction in) - data to set\n * `len` (direction in) - data length. Must be <= EXTRA_BEACON_MAX_DATA_SIZE\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_extra_beacon_set_data(data: *const u8, len: u8) -> bool;
}
extern "C" {
#[doc = "Get last configured extra beacon data\n\n # Arguments\n\n* `data` - data buffer to write to. Must be at least EXTRA_BEACON_MAX_DATA_SIZE bytes long\n\n # Returns\n\nvalid data length"]
pub fn furi_hal_bt_extra_beacon_get_data(data: *mut u8) -> u8;
}
extern "C" {
#[doc = "Configure extra beacon.\n\n # Arguments\n\n* `config` (direction in) - extra beacon config: interval, power, address, etc.\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_extra_beacon_set_config(config: *const GapExtraBeaconConfig) -> bool;
}
extern "C" {
#[doc = "Start extra beacon.\n Beacon must configured with furi_hal_bt_extra_beacon_set_config()\n and in stopped state before calling this function.\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_extra_beacon_start() -> bool;
}
extern "C" {
#[doc = "Stop extra beacon\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_bt_extra_beacon_stop() -> bool;
}
extern "C" {
#[doc = "Check if extra beacon is active.\n\n # Returns\n\nextra beacon state"]
pub fn furi_hal_bt_extra_beacon_is_active() -> bool;
}
extern "C" {
#[doc = "Get last configured extra beacon config\n\n # Returns\n\nextra beacon config. NULL if beacon had never been configured."]
pub fn furi_hal_bt_extra_beacon_get_config() -> *const GapExtraBeaconConfig;
}
#[doc = "SPI Init structures definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_SPI_InitTypeDef {
#[doc = "< Specifies the SPI unidirectional or bidirectional data mode.\nThis parameter can be a value of SPI_LL_EC_TRANSFER_MODE.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetTransferDirection()."]
pub TransferDirection: u32,
#[doc = "< Specifies the SPI mode (Master/Slave).\nThis parameter can be a value of SPI_LL_EC_MODE.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetMode()."]
pub Mode: u32,
#[doc = "< Specifies the SPI data width.\nThis parameter can be a value of SPI_LL_EC_DATAWIDTH.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetDataWidth()."]
pub DataWidth: u32,
#[doc = "< Specifies the serial clock steady state.\nThis parameter can be a value of SPI_LL_EC_POLARITY.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetClockPolarity()."]
pub ClockPolarity: u32,
#[doc = "< Specifies the clock active edge for the bit capture.\nThis parameter can be a value of SPI_LL_EC_PHASE.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetClockPhase()."]
pub ClockPhase: u32,
#[doc = "< Specifies whether the NSS signal is managed by hardware (NSS pin) or by software using the SSI bit.\nThis parameter can be a value of SPI_LL_EC_NSS_MODE.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetNSSMode()."]
pub NSS: u32,
#[doc = "< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock.\nThis parameter can be a value of SPI_LL_EC_BAUDRATEPRESCALER.\n> **Note:** The communication clock is derived from the master clock. The slave clock does not need to be set.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetBaudRatePrescaler()."]
pub BaudRate: u32,
#[doc = "< Specifies whether data transfers start from MSB or LSB bit.\nThis parameter can be a value of SPI_LL_EC_BIT_ORDER.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetTransferBitOrder()."]
pub BitOrder: u32,
#[doc = "< Specifies if the CRC calculation is enabled or not.\nThis parameter can be a value of SPI_LL_EC_CRC_CALCULATION.\n\nThis feature can be modified afterwards using unitary functions LL_SPI_EnableCRC() and LL_SPI_DisableCRC()."]
pub CRCCalculation: u32,
#[doc = "< Specifies the polynomial used for the CRC calculation.\nThis parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF.\n\nThis feature can be modified afterwards using unitary function LL_SPI_SetCRCPolynomial()."]
pub CRCPoly: u32,
}
#[test]
fn bindgen_test_layout_LL_SPI_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_SPI_InitTypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_SPI_InitTypeDef>(),
40usize,
concat!("Size of: ", stringify!(LL_SPI_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_SPI_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_SPI_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TransferDirection) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(TransferDirection)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Mode) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(Mode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DataWidth) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(DataWidth)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ClockPolarity) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(ClockPolarity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ClockPhase) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(ClockPhase)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).NSS) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(NSS)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BaudRate) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(BaudRate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BitOrder) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(BitOrder)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CRCCalculation) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(CRCCalculation)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).CRCPoly) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(LL_SPI_InitTypeDef),
"::",
stringify!(CRCPoly)
)
);
}
extern "C" {
pub fn LL_SPI_Init(
SPIx: *mut SPI_TypeDef,
SPI_InitStruct: *mut LL_SPI_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "< Bus initialization event, called on system start"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventInit: FuriHalSpiBusEvent = 0;
#[doc = "< Bus deinitialization event, called on system stop"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventDeinit: FuriHalSpiBusEvent = 1;
#[doc = "< Bus lock event, called before activation"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventLock: FuriHalSpiBusEvent = 2;
#[doc = "< Bus unlock event, called after deactivation"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventUnlock: FuriHalSpiBusEvent = 3;
#[doc = "< Bus activation event, called before handle activation"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventActivate: FuriHalSpiBusEvent = 4;
#[doc = "< Bus deactivation event, called after handle deactivation"]
pub const FuriHalSpiBusEvent_FuriHalSpiBusEventDeactivate: FuriHalSpiBusEvent = 5;
#[doc = "FuriHal spi bus states"]
pub type FuriHalSpiBusEvent = core::ffi::c_uchar;
#[doc = "FuriHal spi bus event callback"]
pub type FuriHalSpiBusEventCallback = ::core::option::Option<
unsafe extern "C" fn(bus: *mut FuriHalSpiBus, event: FuriHalSpiBusEvent),
>;
#[doc = "FuriHal spi bus"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalSpiBus {
pub spi: *mut SPI_TypeDef,
pub callback: FuriHalSpiBusEventCallback,
pub current_handle: *mut FuriHalSpiBusHandle,
}
#[test]
fn bindgen_test_layout_FuriHalSpiBus() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalSpiBus> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalSpiBus>(),
12usize,
concat!("Size of: ", stringify!(FuriHalSpiBus))
);
assert_eq!(
::core::mem::align_of::<FuriHalSpiBus>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalSpiBus))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).spi) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBus),
"::",
stringify!(spi)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBus),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).current_handle) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBus),
"::",
stringify!(current_handle)
)
);
}
#[doc = "< Handle init, called on system start, initialize gpio for idle state"]
pub const FuriHalSpiBusHandleEvent_FuriHalSpiBusHandleEventInit: FuriHalSpiBusHandleEvent = 0;
#[doc = "< Handle deinit, called on system stop, deinitialize gpio for default state"]
pub const FuriHalSpiBusHandleEvent_FuriHalSpiBusHandleEventDeinit: FuriHalSpiBusHandleEvent = 1;
#[doc = "< Handle activate: connect gpio and apply bus config"]
pub const FuriHalSpiBusHandleEvent_FuriHalSpiBusHandleEventActivate: FuriHalSpiBusHandleEvent = 2;
#[doc = "< Handle deactivate: disconnect gpio and reset bus config"]
pub const FuriHalSpiBusHandleEvent_FuriHalSpiBusHandleEventDeactivate: FuriHalSpiBusHandleEvent = 3;
#[doc = "FuriHal spi handle states"]
pub type FuriHalSpiBusHandleEvent = core::ffi::c_uchar;
#[doc = "FuriHal spi handle event callback"]
pub type FuriHalSpiBusHandleEventCallback = ::core::option::Option<
unsafe extern "C" fn(handle: *mut FuriHalSpiBusHandle, event: FuriHalSpiBusHandleEvent),
>;
#[doc = "FuriHal spi handle"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalSpiBusHandle {
pub bus: *mut FuriHalSpiBus,
pub callback: FuriHalSpiBusHandleEventCallback,
pub miso: *const GpioPin,
pub mosi: *const GpioPin,
pub sck: *const GpioPin,
pub cs: *const GpioPin,
}
#[test]
fn bindgen_test_layout_FuriHalSpiBusHandle() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalSpiBusHandle> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalSpiBusHandle>(),
24usize,
concat!("Size of: ", stringify!(FuriHalSpiBusHandle))
);
assert_eq!(
::core::mem::align_of::<FuriHalSpiBusHandle>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalSpiBusHandle))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bus) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(bus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).miso) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(miso)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mosi) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(mosi)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sck) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(sck)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cs) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(FuriHalSpiBusHandle),
"::",
stringify!(cs)
)
);
}
extern "C" {
#[doc = "Preset for ST25R916"]
pub static furi_hal_spi_preset_2edge_low_8m: LL_SPI_InitTypeDef;
}
extern "C" {
#[doc = "Preset for CC1101"]
pub static furi_hal_spi_preset_1edge_low_8m: LL_SPI_InitTypeDef;
}
extern "C" {
#[doc = "Preset for ST7567 (Display)"]
pub static furi_hal_spi_preset_1edge_low_4m: LL_SPI_InitTypeDef;
}
extern "C" {
#[doc = "Preset for SdCard in fast mode"]
pub static furi_hal_spi_preset_1edge_low_16m: LL_SPI_InitTypeDef;
}
extern "C" {
#[doc = "Preset for SdCard in slow mode"]
pub static furi_hal_spi_preset_1edge_low_2m: LL_SPI_InitTypeDef;
}
extern "C" {
#[doc = "Furi Hal Spi Bus R (Radio: CC1101, Nfc, External)"]
pub static mut furi_hal_spi_bus_r: FuriHalSpiBus;
}
extern "C" {
#[doc = "Furi Hal Spi Bus D (Display, SdCard)"]
pub static mut furi_hal_spi_bus_d: FuriHalSpiBus;
}
extern "C" {
#[doc = "CC1101 on `furi_hal_spi_bus_r`"]
pub static mut furi_hal_spi_bus_handle_subghz: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "ST25R3916 on `furi_hal_spi_bus_r`"]
pub static mut furi_hal_spi_bus_handle_nfc: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "External on `furi_hal_spi_bus_r`\n Preset: `furi_hal_spi_preset_1edge_low_2m`\n\n miso: pa6\n mosi: pa7\n sck: pb3\n cs: pa4 (software controlled)\n\n not initialized by default, call `furi_hal_spi_bus_handle_init` to initialize\n Bus pins are floating on inactive state, CS high after initialization\n"]
pub static mut furi_hal_spi_bus_handle_external: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "ST7567(Display) on `furi_hal_spi_bus_d`"]
pub static mut furi_hal_spi_bus_handle_display: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "SdCard in fast mode on `furi_hal_spi_bus_d`"]
pub static mut furi_hal_spi_bus_handle_sd_fast: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "SdCard in slow mode on `furi_hal_spi_bus_d`"]
pub static mut furi_hal_spi_bus_handle_sd_slow: FuriHalSpiBusHandle;
}
extern "C" {
#[doc = "Initialize SPI Bus\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBus instance"]
pub fn furi_hal_spi_bus_init(bus: *mut FuriHalSpiBus);
}
extern "C" {
#[doc = "Deinitialize SPI Bus\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBus instance"]
pub fn furi_hal_spi_bus_deinit(bus: *mut FuriHalSpiBus);
}
extern "C" {
#[doc = "Initialize SPI Bus Handle\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance"]
pub fn furi_hal_spi_bus_handle_init(handle: *mut FuriHalSpiBusHandle);
}
extern "C" {
#[doc = "Deinitialize SPI Bus Handle\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance"]
pub fn furi_hal_spi_bus_handle_deinit(handle: *mut FuriHalSpiBusHandle);
}
extern "C" {
#[doc = "Acquire SPI bus\n\n blocking, calls `furi_crash` on programming error, CS transition is up to handler event routine\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance"]
pub fn furi_hal_spi_acquire(handle: *mut FuriHalSpiBusHandle);
}
extern "C" {
#[doc = "Release SPI bus\n\n calls `furi_crash` on programming error, CS transition is up to handler event routine\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance"]
pub fn furi_hal_spi_release(handle: *mut FuriHalSpiBusHandle);
}
extern "C" {
#[doc = "SPI Receive\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance\n * `buffer` - receive buffer\n * `size` - transaction size (buffer size)\n * `timeout` - operation timeout in ms\n\n # Returns\n\ntrue on sucess"]
pub fn furi_hal_spi_bus_rx(
handle: *mut FuriHalSpiBusHandle,
buffer: *mut u8,
size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "SPI Transmit\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance\n * `buffer` - transmit buffer\n * `size` - transaction size (buffer size)\n * `timeout` - operation timeout in ms\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_spi_bus_tx(
handle: *mut FuriHalSpiBusHandle,
buffer: *const u8,
size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "SPI Transmit and Receive\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance\n * `tx_buffer` - pointer to tx buffer\n * `rx_buffer` - pointer to rx buffer\n * `size` - transaction size (buffer size)\n * `timeout` - operation timeout in ms\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_spi_bus_trx(
handle: *mut FuriHalSpiBusHandle,
tx_buffer: *const u8,
rx_buffer: *mut u8,
size: usize,
timeout: u32,
) -> bool;
}
extern "C" {
#[doc = "SPI Transmit and Receive with DMA\n\n # Arguments\n\n* `handle` - pointer to FuriHalSpiBusHandle instance\n * `tx_buffer` - pointer to tx buffer\n * `rx_buffer` - pointer to rx buffer\n * `size` - transaction size (buffer size)\n * `timeout_ms` - operation timeout in ms\n\n # Returns\n\ntrue on success"]
pub fn furi_hal_spi_bus_trx_dma(
handle: *mut FuriHalSpiBusHandle,
tx_buffer: *mut u8,
rx_buffer: *mut u8,
size: usize,
timeout_ms: u32,
) -> bool;
}
extern "C" {
#[doc = "Turn on/off vibro\n\n # Arguments\n\n* `value` (direction in) - new state"]
pub fn furi_hal_vibro_on(value: bool);
}
#[doc = "<Function has an error, STALLPID will be issued."]
pub const _usbd_respond_usbd_fail: _usbd_respond = 0;
#[doc = "<Function completes request accepted ZLP or data will be send."]
pub const _usbd_respond_usbd_ack: _usbd_respond = 1;
#[doc = "<Function is busy. NAK handshake."]
pub const _usbd_respond_usbd_nak: _usbd_respond = 2;
#[doc = "Reporting status results."]
pub type _usbd_respond = core::ffi::c_uchar;
#[doc = "Reporting status results."]
pub use self::_usbd_respond as usbd_respond;
#[doc = "Represents a USB device data."]
pub type usbd_device = _usbd_device;
#[doc = "Represents generic USB control request."]
#[repr(C)]
#[derive(Debug)]
pub struct usbd_ctlreq {
#[doc = "<This bitmapped field identifies the characteristics of\n the specific request."]
pub bmRequestType: u8,
#[doc = "<This field specifies the particular request."]
pub bRequest: u8,
#[doc = "<It is used to pass a parameter to the device, specific to\n the request."]
pub wValue: u16,
#[doc = "<It is used to pass a parameter to the device, specific to\n the request."]
pub wIndex: u16,
#[doc = "<This field specifies the length of the data transferred\n during the second phase of the control transfer."]
pub wLength: u16,
#[doc = "<Data payload."]
pub data: __IncompleteArrayField<u8>,
}
#[test]
fn bindgen_test_layout_usbd_ctlreq() {
const UNINIT: ::core::mem::MaybeUninit<usbd_ctlreq> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<usbd_ctlreq>(),
8usize,
concat!("Size of: ", stringify!(usbd_ctlreq))
);
assert_eq!(
::core::mem::align_of::<usbd_ctlreq>(),
2usize,
concat!("Alignment of ", stringify!(usbd_ctlreq))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bmRequestType) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(bmRequestType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bRequest) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(bRequest)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wValue) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(wValue)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wIndex) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(wIndex)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wLength) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(wLength)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(usbd_ctlreq),
"::",
stringify!(data)
)
);
}
#[doc = "USB device status data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct usbd_status {
#[doc = "<Pointer to data buffer used for control requests."]
pub data_buf: *mut core::ffi::c_void,
#[doc = "<Pointer to current data for control request."]
pub data_ptr: *mut core::ffi::c_void,
#[doc = "<Count remained data for control request."]
pub data_count: u16,
#[doc = "<Size of the data buffer for control requests."]
pub data_maxsize: u16,
#[doc = "<Size of the control endpoint."]
pub ep0size: u8,
#[doc = "<Current device configuration number."]
pub device_cfg: u8,
#[doc = "<Current usbd_machine_state."]
pub device_state: u8,
#[doc = "<Current usbd_ctl_state."]
pub control_state: u8,
}
#[test]
fn bindgen_test_layout_usbd_status() {
const UNINIT: ::core::mem::MaybeUninit<usbd_status> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<usbd_status>(),
16usize,
concat!("Size of: ", stringify!(usbd_status))
);
assert_eq!(
::core::mem::align_of::<usbd_status>(),
4usize,
concat!("Alignment of ", stringify!(usbd_status))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_buf) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(data_buf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_ptr) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(data_ptr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_count) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(data_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_maxsize) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(data_maxsize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep0size) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(ep0size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).device_cfg) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(device_cfg)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).device_state) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(device_state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).control_state) as usize - ptr as usize },
15usize,
concat!(
"Offset of field: ",
stringify!(usbd_status),
"::",
stringify!(control_state)
)
);
}
#[doc = "Generic USB device event callback for events and endpoints processing\n # Arguments\n\n* `dev` (direction in) - pointer to USB device\n * `event` - USB_EVENTS \"USB event\"\n * `ep` - active endpoint number\n > **Note:** endpoints with same indexes i.e. 0x01 and 0x81 shares same callback."]
pub type usbd_evt_callback =
::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device, event: u8, ep: u8)>;
#[doc = "USB control transfer completed callback function.\n # Arguments\n\n* `dev` (direction in) - pointer to USB device\n * `req` (direction in) - pointer to usb request structure\n > **Note:** usbd_device->complete_callback will be set to NULL after this callback completion."]
pub type usbd_rqc_callback =
::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device, req: *mut usbd_ctlreq)>;
#[doc = "USB control callback function.\n \n\nUses for the control request processing.\n Some requests will be handled by core if callback don't process it (returns FALSE).\n If request was not processed STALL PID will be issued.\n - GET_CONFIGURATION\n - SET_CONFIGURATION (passes to usbd_cfg_callback)\n - GET_DESCRIPTOR (passes to usbd_dsc_callback)\n - GET_STATUS\n - SET_FEATURE, CLEAR_FEATURE (endpoints only)\n - SET_ADDRESS\n # Arguments\n\n* `dev` (direction in) - points to USB device\n * `req` (direction in) - points to usb control request\n * `*callback` (direction out) - USB control transfer completion callback, default is NULL (no callback)\n # Returns\n\nusbd_respond status."]
pub type usbd_ctl_callback = ::core::option::Option<
unsafe extern "C" fn(
dev: *mut usbd_device,
req: *mut usbd_ctlreq,
callback: *mut usbd_rqc_callback,
) -> usbd_respond,
>;
#[doc = "USB get descriptor callback function\n \n\nCalled when GET_DESCRIPTOR request issued\n # Arguments\n\n* `req` (direction in) - pointer to usb control request structure\n * `address` (direction in, out) - pointer to the descriptor in memory. Points to req->data by default. You\n can use this buffer.\n * `dsize` (direction in, out) - descriptor size. maximum buffer size by default.\n # Returns\n\nusbd_ack if you passed the correct descriptor, usbd_fail otherwise."]
pub type usbd_dsc_callback = ::core::option::Option<
unsafe extern "C" fn(
req: *mut usbd_ctlreq,
address: *mut *mut core::ffi::c_void,
dsize: *mut u16,
) -> usbd_respond,
>;
#[doc = "USB set configuration callback function\n \n\ncalled when SET_CONFIGURATION request issued\n # Arguments\n\n* `dev` (direction in) - pointer to USB device\n * `cfg` (direction in) - configuration number.\n > **Note:** if config is 0 device endpoints should be de-configured\n # Returns\n\nTRUE if success"]
pub type usbd_cfg_callback =
::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device, cfg: u8) -> usbd_respond>;
#[doc = "USBD_HW\n # /\n/**Get USB device status and capabilities.\n # Returns\n\nHardware status and capabilities USBD_HW_CAPS"]
pub type usbd_hw_getinfo = ::core::option::Option<unsafe extern "C" fn() -> u32>;
#[doc = "Enables or disables USB hardware\n # Arguments\n\n* `enable` - Enables USB when TRUE disables otherwise."]
pub type usbd_hw_enable = ::core::option::Option<unsafe extern "C" fn(enable: bool)>;
#[doc = "Connects or disconnects USB hardware to/from usb host\n # Arguments\n\n* `connect` - Connects USB to host if TRUE, disconnects otherwise\n # Returns\n\nlanes connection status."]
pub type usbd_hw_connect = ::core::option::Option<unsafe extern "C" fn(connect: bool) -> u8>;
#[doc = "Sets USB hardware address\n # Arguments\n\n* `address` - USB address"]
pub type usbd_hw_setaddr = ::core::option::Option<unsafe extern "C" fn(address: u8)>;
#[doc = "Configures endpoint\n # Arguments\n\n* `ep` - endpoint address. Use USB_EPDIR_ macros to set endpoint direction\n * `eptype` - endpoint type. Use USB_EPTYPE_* macros.\n * `epsize` - endpoint size in bytes\n # Returns\n\nTRUE if success"]
pub type usbd_hw_ep_config =
::core::option::Option<unsafe extern "C" fn(ep: u8, eptype: u8, epsize: u16) -> bool>;
#[doc = "De-configures, cleans and disables endpoint\n # Arguments\n\n* `ep` - endpoint index\n > **Note:** if you have two one-direction single-buffered endpoints with same index (i.e. 0x02 and 0x82)\n both will be deconfigured."]
pub type usbd_hw_ep_deconfig = ::core::option::Option<unsafe extern "C" fn(ep: u8)>;
#[doc = "Reads data from OUT or control endpoint\n # Arguments\n\n* `ep` - endpoint index, should belong to OUT or CONTROL endpoint.\n * `buf` - pointer to read buffer\n * `blen` - size of the read buffer in bytes\n # Returns\n\nsize of the actually received data, -1 on error.\n > **Note:** if data does not fit buffer it will be truncated"]
pub type usbd_hw_ep_read = ::core::option::Option<
unsafe extern "C" fn(ep: u8, buf: *mut core::ffi::c_void, blen: u16) -> i32,
>;
#[doc = "Writes data to IN or control endpoint\n # Arguments\n\n* `ep` - endpoint index, hould belong to IN or CONTROL endpoint\n * `buf` - pointer to data buffer\n * `blen` - size of data will be written\n # Returns\n\nnumber of written bytes"]
pub type usbd_hw_ep_write = ::core::option::Option<
unsafe extern "C" fn(ep: u8, buf: *const core::ffi::c_void, blen: u16) -> i32,
>;
#[doc = "Stalls and unstalls endpoint\n # Arguments\n\n* `ep` - endpoint address\n * `stall` - endpoint will be stalled if TRUE and unstalled otherwise.\n > **Note:** Has no effect on inactive endpoints."]
pub type usbd_hw_ep_setstall = ::core::option::Option<unsafe extern "C" fn(ep: u8, stall: bool)>;
#[doc = "Checks endpoint for stalled state\n # Arguments\n\n* `ep` - endpoint address\n # Returns\n\nTRUE if endpoint is stalled"]
pub type usbd_hw_ep_isstalled = ::core::option::Option<unsafe extern "C" fn(ep: u8) -> bool>;
#[doc = "Polls USB hardware for the events\n # Arguments\n\n* `dev` (direction in) - pointer to usb device structure\n * `callback` - callback to event processing subroutine"]
pub type usbd_hw_poll = ::core::option::Option<
unsafe extern "C" fn(dev: *mut usbd_device, callback: usbd_evt_callback),
>;
#[doc = "Gets frame number from usb hardware."]
pub type usbd_hw_get_frameno = ::core::option::Option<unsafe extern "C" fn() -> u16>;
#[doc = "Makes a string descriptor contains unique serial number from hardware ID's\n # Arguments\n\n* `buffer` (direction in) - pointer to buffer for the descriptor\n # Returns\n\nof the descriptor in bytes"]
pub type usbd_hw_get_serialno =
::core::option::Option<unsafe extern "C" fn(buffer: *mut core::ffi::c_void) -> u16>;
#[doc = "Represents a hardware USB driver call table."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct usbd_driver {
#[doc = "<usbd_hw_getinfo"]
pub getinfo: usbd_hw_getinfo,
#[doc = "<usbd_hw_enable"]
pub enable: usbd_hw_enable,
#[doc = "<usbd_hw_connect"]
pub connect: usbd_hw_connect,
#[doc = "<usbd_hw_setaddr"]
pub setaddr: usbd_hw_setaddr,
#[doc = "<usbd_hw_ep_config"]
pub ep_config: usbd_hw_ep_config,
#[doc = "<usbd_hw_ep_deconfig"]
pub ep_deconfig: usbd_hw_ep_deconfig,
#[doc = "<usbd_hw_ep_read"]
pub ep_read: usbd_hw_ep_read,
#[doc = "<usbd_hw_ep_write"]
pub ep_write: usbd_hw_ep_write,
#[doc = "<usbd_hw_ep_setstall"]
pub ep_setstall: usbd_hw_ep_setstall,
#[doc = "<usbd_hw_ep_isstalled"]
pub ep_isstalled: usbd_hw_ep_isstalled,
#[doc = "<usbd_hw_poll"]
pub poll: usbd_hw_poll,
#[doc = "<usbd_hw_get_frameno"]
pub frame_no: usbd_hw_get_frameno,
#[doc = "<usbd_hw_get_serialno"]
pub get_serialno_desc: usbd_hw_get_serialno,
}
#[test]
fn bindgen_test_layout_usbd_driver() {
const UNINIT: ::core::mem::MaybeUninit<usbd_driver> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<usbd_driver>(),
52usize,
concat!("Size of: ", stringify!(usbd_driver))
);
assert_eq!(
::core::mem::align_of::<usbd_driver>(),
4usize,
concat!("Alignment of ", stringify!(usbd_driver))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).getinfo) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(getinfo)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).enable) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(enable)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).connect) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(connect)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).setaddr) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(setaddr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_config) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_config)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_deconfig) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_deconfig)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_read) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_read)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_write) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_write)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_setstall) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_setstall)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_isstalled) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(ep_isstalled)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).poll) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(poll)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frame_no) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(frame_no)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_serialno_desc) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(usbd_driver),
"::",
stringify!(get_serialno_desc)
)
);
}
#[doc = "Represents a USB device data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _usbd_device {
#[doc = "<usbd_driver"]
pub driver: *const usbd_driver,
#[doc = "<usbd_ctl_callback"]
pub control_callback: usbd_ctl_callback,
#[doc = "<usbd_rqc_callback"]
pub complete_callback: usbd_rqc_callback,
#[doc = "<usbd_cfg_callback"]
pub config_callback: usbd_cfg_callback,
#[doc = "<usbd_dsc_callback"]
pub descriptor_callback: usbd_dsc_callback,
#[doc = "<array of the event callbacks."]
pub events: [usbd_evt_callback; 8usize],
#[doc = "<array of the endpoint callbacks."]
pub endpoint: [usbd_evt_callback; 8usize],
#[doc = "<usbd_status"]
pub status: usbd_status,
}
#[test]
fn bindgen_test_layout__usbd_device() {
const UNINIT: ::core::mem::MaybeUninit<_usbd_device> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<_usbd_device>(),
100usize,
concat!("Size of: ", stringify!(_usbd_device))
);
assert_eq!(
::core::mem::align_of::<_usbd_device>(),
4usize,
concat!("Alignment of ", stringify!(_usbd_device))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).driver) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(driver)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).control_callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(control_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).complete_callback) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(complete_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(config_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).descriptor_callback) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(descriptor_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).events) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(events)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).endpoint) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(endpoint)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).status) as usize - ptr as usize },
84usize,
concat!(
"Offset of field: ",
stringify!(_usbd_device),
"::",
stringify!(status)
)
);
}
#[doc = "Represents a USB device descriptor\n \n\nA device descriptor describes general information about a USB device. It includes\n information that applies globally to the device and all of the device’s configurations. A USB\n device has only one device descriptor. A high-speed capable device that has different device\n information for full-speed and high-speed must also have a usb_qualifier_descriptor."]
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct usb_device_descriptor {
#[doc = "<Size of the descriptor, in bytes."]
pub bLength: u8,
#[doc = "<USB_DTYPE_DEVICE Device descriptor."]
pub bDescriptorType: u8,
#[doc = "<BCD of the supported USB specification."]
pub bcdUSB: u16,
#[doc = "<USB device class."]
pub bDeviceClass: u8,
#[doc = "<USB device subclass."]
pub bDeviceSubClass: u8,
#[doc = "<USB device protocol."]
pub bDeviceProtocol: u8,
#[doc = "<Size of the control endpoint's bank in bytes."]
pub bMaxPacketSize0: u8,
#[doc = "<Vendor ID for the USB product."]
pub idVendor: u16,
#[doc = "<Unique product ID for the USB product."]
pub idProduct: u16,
#[doc = "<Product release (version) number."]
pub bcdDevice: u16,
#[doc = "<String index for the manufacturer's name."]
pub iManufacturer: u8,
#[doc = "<String index for the product name/details."]
pub iProduct: u8,
#[doc = "<String index for the product serial number."]
pub iSerialNumber: u8,
#[doc = "<Total number of configurations supported by the device."]
pub bNumConfigurations: u8,
}
#[test]
fn bindgen_test_layout_usb_device_descriptor() {
const UNINIT: ::core::mem::MaybeUninit<usb_device_descriptor> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<usb_device_descriptor>(),
18usize,
concat!("Size of: ", stringify!(usb_device_descriptor))
);
assert_eq!(
::core::mem::align_of::<usb_device_descriptor>(),
1usize,
concat!("Alignment of ", stringify!(usb_device_descriptor))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bLength) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bLength)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bDescriptorType) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bDescriptorType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bcdUSB) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bcdUSB)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bDeviceClass) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bDeviceClass)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bDeviceSubClass) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bDeviceSubClass)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bDeviceProtocol) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bDeviceProtocol)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bMaxPacketSize0) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bMaxPacketSize0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).idVendor) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(idVendor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).idProduct) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(idProduct)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bcdDevice) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bcdDevice)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iManufacturer) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(iManufacturer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iProduct) as usize - ptr as usize },
15usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(iProduct)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iSerialNumber) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(iSerialNumber)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bNumConfigurations) as usize - ptr as usize },
17usize,
concat!(
"Offset of field: ",
stringify!(usb_device_descriptor),
"::",
stringify!(bNumConfigurations)
)
);
}
extern "C" {
pub static usbd_devfs: usbd_driver;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalUsbInterface {
pub init: ::core::option::Option<
unsafe extern "C" fn(
dev: *mut usbd_device,
intf: *mut FuriHalUsbInterface,
ctx: *mut core::ffi::c_void,
),
>,
pub deinit: ::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device)>,
pub wakeup: ::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device)>,
pub suspend: ::core::option::Option<unsafe extern "C" fn(dev: *mut usbd_device)>,
pub dev_descr: *mut usb_device_descriptor,
pub str_manuf_descr: *mut core::ffi::c_void,
pub str_prod_descr: *mut core::ffi::c_void,
pub str_serial_descr: *mut core::ffi::c_void,
pub cfg_descr: *mut core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_FuriHalUsbInterface() {
const UNINIT: ::core::mem::MaybeUninit<FuriHalUsbInterface> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FuriHalUsbInterface>(),
36usize,
concat!("Size of: ", stringify!(FuriHalUsbInterface))
);
assert_eq!(
::core::mem::align_of::<FuriHalUsbInterface>(),
4usize,
concat!("Alignment of ", stringify!(FuriHalUsbInterface))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).init) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(init)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).deinit) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(deinit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wakeup) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(wakeup)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).suspend) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(suspend)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dev_descr) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(dev_descr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).str_manuf_descr) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(str_manuf_descr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).str_prod_descr) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(str_prod_descr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).str_serial_descr) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(str_serial_descr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cfg_descr) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(FuriHalUsbInterface),
"::",
stringify!(cfg_descr)
)
);
}
extern "C" {
#[doc = "USB device interface modes"]
pub static mut usb_cdc_single: FuriHalUsbInterface;
}
extern "C" {
pub static mut usb_cdc_dual: FuriHalUsbInterface;
}
extern "C" {
pub static mut usb_hid: FuriHalUsbInterface;
}
extern "C" {
pub static mut usb_hid_u2f: FuriHalUsbInterface;
}
extern "C" {
pub static mut usb_ccid: FuriHalUsbInterface;
}
extern "C" {
#[doc = "Set USB device configuration\n\n # Arguments\n\n* `mode` - new USB device mode\n * `ctx` - context passed to device mode init function\n # Returns\n\ntrue - mode switch started, false - mode switch is locked"]
pub fn furi_hal_usb_set_config(
new_if: *mut FuriHalUsbInterface,
ctx: *mut core::ffi::c_void,
) -> bool;
}
extern "C" {
#[doc = "Get USB device configuration\n\n # Returns\n\ncurrent USB device mode"]
pub fn furi_hal_usb_get_config() -> *mut FuriHalUsbInterface;
}
extern "C" {
#[doc = "Lock USB device mode switch"]
pub fn furi_hal_usb_lock();
}
extern "C" {
#[doc = "Unlock USB device mode switch"]
pub fn furi_hal_usb_unlock();
}
extern "C" {
#[doc = "Check if USB device mode switch locked\n\n # Returns\n\nlock state"]
pub fn furi_hal_usb_is_locked() -> bool;
}
extern "C" {
#[doc = "Disable USB device"]
pub fn furi_hal_usb_disable();
}
extern "C" {
#[doc = "Enable USB device"]
pub fn furi_hal_usb_enable();
}
extern "C" {
#[doc = "Restart USB device"]
pub fn furi_hal_usb_reinit();
}
pub type HidStateCallback =
::core::option::Option<unsafe extern "C" fn(state: bool, context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Get USB HID connection state\n\n # Returns\n\ntrue / false"]
pub fn furi_hal_hid_is_connected() -> bool;
}
extern "C" {
#[doc = "Get USB HID keyboard leds state\n\n # Returns\n\nleds state"]
pub fn furi_hal_hid_get_led_state() -> u8;
}
extern "C" {
#[doc = "Set USB HID connect/disconnect callback\n\n # Arguments\n\n* `cb` - callback\n * `ctx` - callback context"]
pub fn furi_hal_hid_set_state_callback(cb: HidStateCallback, ctx: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set the following key to pressed state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_kb_press(button: u16) -> bool;
}
extern "C" {
#[doc = "Set the following key to released state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_kb_release(button: u16) -> bool;
}
extern "C" {
#[doc = "Clear all pressed keys and send HID report\n"]
pub fn furi_hal_hid_kb_release_all() -> bool;
}
extern "C" {
#[doc = "Set mouse movement and send HID report\n\n # Arguments\n\n* `dx` - x coordinate delta\n * `dy` - y coordinate delta"]
pub fn furi_hal_hid_mouse_move(dx: i8, dy: i8) -> bool;
}
extern "C" {
#[doc = "Set mouse button to pressed state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_mouse_press(button: u8) -> bool;
}
extern "C" {
#[doc = "Set mouse button to released state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_mouse_release(button: u8) -> bool;
}
extern "C" {
#[doc = "Set mouse wheel position and send HID report\n\n # Arguments\n\n* `delta` - number of scroll steps"]
pub fn furi_hal_hid_mouse_scroll(delta: i8) -> bool;
}
extern "C" {
#[doc = "Set the following consumer key to pressed state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_consumer_key_press(button: u16) -> bool;
}
extern "C" {
#[doc = "Set the following consumer key to released state and send HID report\n\n # Arguments\n\n* `button` - key code"]
pub fn furi_hal_hid_consumer_key_release(button: u16) -> bool;
}
extern "C" {
#[doc = "Clear all pressed consumer keys and send HID report\n"]
pub fn furi_hal_hid_consumer_key_release_all() -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CcidCallbacks {
pub icc_power_on_callback: ::core::option::Option<
unsafe extern "C" fn(
dataBlock: *mut u8,
dataBlockLen: *mut u32,
context: *mut core::ffi::c_void,
),
>,
pub xfr_datablock_callback: ::core::option::Option<
unsafe extern "C" fn(
pcToReaderDataBlock: *const u8,
pcToReaderDataBlockLen: u32,
readerToPcDataBlock: *mut u8,
readerToPcDataBlockLen: *mut u32,
context: *mut core::ffi::c_void,
),
>,
}
#[test]
fn bindgen_test_layout_CcidCallbacks() {
const UNINIT: ::core::mem::MaybeUninit<CcidCallbacks> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<CcidCallbacks>(),
8usize,
concat!("Size of: ", stringify!(CcidCallbacks))
);
assert_eq!(
::core::mem::align_of::<CcidCallbacks>(),
4usize,
concat!("Alignment of ", stringify!(CcidCallbacks))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).icc_power_on_callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(CcidCallbacks),
"::",
stringify!(icc_power_on_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xfr_datablock_callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(CcidCallbacks),
"::",
stringify!(xfr_datablock_callback)
)
);
}
extern "C" {
#[doc = "Set CCID callbacks\n\n # Arguments\n\n* `cb` - CcidCallbacks instance\n * `context` - The context for callbacks"]
pub fn furi_hal_usb_ccid_set_callbacks(cb: *mut CcidCallbacks, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Insert Smart Card"]
pub fn furi_hal_usb_ccid_insert_smartcard();
}
extern "C" {
#[doc = "Remove Smart Card"]
pub fn furi_hal_usb_ccid_remove_smartcard();
}
pub const FuriHalSerialId_FuriHalSerialIdUsart: FuriHalSerialId = 0;
pub const FuriHalSerialId_FuriHalSerialIdLpuart: FuriHalSerialId = 1;
pub const FuriHalSerialId_FuriHalSerialIdMax: FuriHalSerialId = 2;
#[doc = "UART channels"]
pub type FuriHalSerialId = core::ffi::c_uchar;
pub const FuriHalSerialDirection_FuriHalSerialDirectionTx: FuriHalSerialDirection = 0;
pub const FuriHalSerialDirection_FuriHalSerialDirectionRx: FuriHalSerialDirection = 1;
pub const FuriHalSerialDirection_FuriHalSerialDirectionMax: FuriHalSerialDirection = 2;
pub type FuriHalSerialDirection = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FuriHalSerialHandle {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Initialize Serial Control"]
pub fn furi_hal_serial_control_init();
}
extern "C" {
#[doc = "De-Initialize Serial Control"]
pub fn furi_hal_serial_control_deinit();
}
extern "C" {
#[doc = "Acquire Serial Interface Handler\n\n # Arguments\n\n* `serial_id` (direction in) - The serial transceiver identifier\n\n # Returns\n\nThe Serial Interface Handle or null if interfaces is in use"]
pub fn furi_hal_serial_control_acquire(serial_id: FuriHalSerialId) -> *mut FuriHalSerialHandle;
}
extern "C" {
#[doc = "Release Serial Interface Handler\n\n # Arguments\n\n* `handle` - The handle"]
pub fn furi_hal_serial_control_release(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Acquire Serial Interface Handler\n\n # Arguments\n\n* `serial_id` (direction in) - The serial transceiver identifier\n\n # Returns\n\ntrue if handle is acquired by someone"]
pub fn furi_hal_serial_control_is_busy(serial_id: FuriHalSerialId) -> bool;
}
extern "C" {
#[doc = "Acquire Serial Interface Handler\n\n # Arguments\n\n* `serial_id` (direction in) - The serial transceiver identifier. Use FuriHalSerialIdMax to disable logging.\n * `baud_rate` (direction in) - The baud rate\n\n # Returns\n\nThe Serial Interface Handle or null if interfaces is in use"]
pub fn furi_hal_serial_control_set_logging_config(serial_id: FuriHalSerialId, baud_rate: u32);
}
#[doc = "Expansion module detection callback type.\n\n # Arguments\n\n* `context` (direction in, out) - Pointer to the user-defined context object."]
pub type FuriHalSerialControlExpansionCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Enable expansion module detection for a given serial interface.\n\n Passing NULL as the callback parameter disables external module detection.\n\n # Arguments\n\n* `serial_id` (direction in) - Identifier of the serial interface to be used.\n * `callback` (direction in) - Pointer to the callback function to be called upon module detection.\n * `context` (direction in, out) - Pointer to the user-defined context object. Will be passed to the callback function."]
pub fn furi_hal_serial_control_set_expansion_callback(
serial_id: FuriHalSerialId,
callback: FuriHalSerialControlExpansionCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Initialize Serial\n\n Configures GPIO, configures and enables transceiver.\n\n # Arguments\n\n* `handle` - Serial handle\n * `baud` - baud rate"]
pub fn furi_hal_serial_init(handle: *mut FuriHalSerialHandle, baud: u32);
}
extern "C" {
#[doc = "De-initialize Serial\n\n Configures GPIO to analog, clears callback and callback context, disables\n hardware\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_deinit(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Suspend operation\n\n Suspend hardware, settings and callbacks are preserved\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_suspend(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Resume operation\n\n Resumes hardware from suspended state\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_resume(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Determine whether a certain baud rate is supported\n\n # Arguments\n\n* `handle` - Serial handle\n * `baud` - baud rate to be checked\n # Returns\n\ntrue if baud rate is supported, false otherwise."]
pub fn furi_hal_serial_is_baud_rate_supported(
handle: *mut FuriHalSerialHandle,
baud: u32,
) -> bool;
}
extern "C" {
#[doc = "Changes baud rate\n\n # Arguments\n\n* `handle` - Serial handle\n * `baud` - baud rate"]
pub fn furi_hal_serial_set_br(handle: *mut FuriHalSerialHandle, baud: u32);
}
extern "C" {
#[doc = "Transmits data in semi-blocking mode\n\n Fills transmission pipe with data, returns as soon as all bytes from buffer\n are in the pipe.\n\n Real transmission will be completed later. Use\n `furi_hal_serial_tx_wait_complete` to wait for completion if you need it.\n\n # Arguments\n\n* `handle` - Serial handle\n * `buffer` - data\n * `buffer_size` - data size (in bytes)"]
pub fn furi_hal_serial_tx(
handle: *mut FuriHalSerialHandle,
buffer: *const u8,
buffer_size: usize,
);
}
extern "C" {
#[doc = "Wait until transmission is completed\n\n Ensures that all data has been sent.\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_tx_wait_complete(handle: *mut FuriHalSerialHandle);
}
#[doc = "< Data: new data available"]
pub const FuriHalSerialRxEvent_FuriHalSerialRxEventData: FuriHalSerialRxEvent = 1;
#[doc = "< Idle: bus idle detected"]
pub const FuriHalSerialRxEvent_FuriHalSerialRxEventIdle: FuriHalSerialRxEvent = 2;
#[doc = "< Framing Error: incorrect frame detected"]
pub const FuriHalSerialRxEvent_FuriHalSerialRxEventFrameError: FuriHalSerialRxEvent = 4;
#[doc = "< Noise Error: noise on the line detected"]
pub const FuriHalSerialRxEvent_FuriHalSerialRxEventNoiseError: FuriHalSerialRxEvent = 8;
#[doc = "< Overrun Error: no space for received data"]
pub const FuriHalSerialRxEvent_FuriHalSerialRxEventOverrunError: FuriHalSerialRxEvent = 16;
#[doc = "Serial RX events"]
pub type FuriHalSerialRxEvent = core::ffi::c_uchar;
#[doc = "Receive callback\n\n Callback will be called in interrupt context, ensure thread\n safety on your side.\n # Arguments\n\n* `handle` - Serial handle\n * `event` - FuriHalSerialRxEvent\n * `context` - Callback context provided earlier"]
pub type FuriHalSerialAsyncRxCallback = ::core::option::Option<
unsafe extern "C" fn(
handle: *mut FuriHalSerialHandle,
event: FuriHalSerialRxEvent,
context: *mut core::ffi::c_void,
),
>;
extern "C" {
#[doc = "Start and sets Serial Receive callback\n\n Callback will be called in interrupt context, ensure thread\n safety on your side\n\n # Arguments\n\n* `handle` - Serial handle\n * `callback` - callback pointer\n * `context` - callback context\n * `report_errors` (direction in) - report RX error"]
pub fn furi_hal_serial_async_rx_start(
handle: *mut FuriHalSerialHandle,
callback: FuriHalSerialAsyncRxCallback,
context: *mut core::ffi::c_void,
report_errors: bool,
);
}
extern "C" {
#[doc = "Stop Serial Receive\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_async_rx_stop(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Check if there is data available for reading\n\n This function must be called only from the callback\n FuriHalSerialAsyncRxCallback\n\n # Arguments\n\n* `handle` - Serial handle\n # Returns\n\ntrue if data is available for reading, false otherwise"]
pub fn furi_hal_serial_async_rx_available(handle: *mut FuriHalSerialHandle) -> bool;
}
extern "C" {
#[doc = "Get data Serial receive\n\n This function must be called only from the callback\n FuriHalSerialAsyncRxCallback\n\n # Arguments\n\n* `handle` - Serial handle\n\n # Returns\n\ndata"]
pub fn furi_hal_serial_async_rx(handle: *mut FuriHalSerialHandle) -> u8;
}
#[doc = "Receive DMA callback\n\n DMA Callback will be called in interrupt context, ensure thread\n safety on your side.\n\n # Arguments\n\n* `handle` - Serial handle\n * `event` - FuriHalSerialDmaRxEvent\n * `data_len` - Received data\n * `context` - Callback context provided earlier"]
pub type FuriHalSerialDmaRxCallback = ::core::option::Option<
unsafe extern "C" fn(
handle: *mut FuriHalSerialHandle,
event: FuriHalSerialRxEvent,
data_len: usize,
context: *mut core::ffi::c_void,
),
>;
extern "C" {
#[doc = "Enable an input/output directon\n\n Takes over the respective pin by reconfiguring it to\n the appropriate alternative function.\n\n # Arguments\n\n* `handle` - Serial handle\n * `direction` - Direction to enable"]
pub fn furi_hal_serial_enable_direction(
handle: *mut FuriHalSerialHandle,
direction: FuriHalSerialDirection,
);
}
extern "C" {
#[doc = "Disable an input/output directon\n\n Releases the respective pin by reconfiguring it to\n initial state, making possible its use for other purposes.\n\n # Arguments\n\n* `handle` - Serial handle\n * `direction` - Direction to disable"]
pub fn furi_hal_serial_disable_direction(
handle: *mut FuriHalSerialHandle,
direction: FuriHalSerialDirection,
);
}
extern "C" {
#[doc = "Get the GPIO pin associated with a serial\n\n # Arguments\n\n* `handle` - Serial handle\n * `direction` - Direction to query\n # Returns\n\npointer to the respective pin instance"]
pub fn furi_hal_serial_get_gpio_pin(
handle: *mut FuriHalSerialHandle,
direction: FuriHalSerialDirection,
) -> *const GpioPin;
}
extern "C" {
#[doc = "Start and sets Serial event callback receive DMA\n\n # Arguments\n\n* `handle` - Serial handle\n * `callback` - callback pointer\n * `context` - callback context\n * `report_errors` (direction in) - report RX error"]
pub fn furi_hal_serial_dma_rx_start(
handle: *mut FuriHalSerialHandle,
callback: FuriHalSerialDmaRxCallback,
context: *mut core::ffi::c_void,
report_errors: bool,
);
}
extern "C" {
#[doc = "Stop Serial receive DMA\n\n # Arguments\n\n* `handle` - Serial handle"]
pub fn furi_hal_serial_dma_rx_stop(handle: *mut FuriHalSerialHandle);
}
extern "C" {
#[doc = "Get data Serial receive DMA\n\n This function must be called only from the callback\n FuriHalSerialDmaRxCallback\n\n # Arguments\n\n* `handle` - Serial handle\n * `data` - pointer to data buffer\n * `len` - get data size (in bytes)\n\n # Returns\n\nsize actual data receive (in bytes)"]
pub fn furi_hal_serial_dma_rx(
handle: *mut FuriHalSerialHandle,
data: *mut u8,
len: usize,
) -> usize;
}
extern "C" {
pub fn furi_hal_info_get_api_version(major: *mut u16, minor: *mut u16);
}
extern "C" {
#[doc = "Get device information\n\n # Arguments\n\n* `callback` (direction in) - callback to provide with new data\n * `sep` (direction in) - category separator character\n * `context` (direction in) - context to pass to callback"]
pub fn furi_hal_info_get(
callback: PropertyValueCallback,
sep: core::ffi::c_char,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Initialize random subsystem"]
pub fn furi_hal_random_init();
}
extern "C" {
#[doc = "Get random value\n furi_hal_random_get() gives up to FURI_HAL_RANDOM_MAX\n rand() and random() give up to RAND_MAX\n\n # Returns\n\n32 bit random value (up to FURI_HAL_RANDOM_MAX)"]
pub fn furi_hal_random_get() -> u32;
}
extern "C" {
#[doc = "Fill buffer with random data\n\n # Arguments\n\n* `buf` - buffer pointer\n * `data` - buffer len"]
pub fn furi_hal_random_fill_buf(buf: *mut u8, len: u32);
}
#[doc = "< default configuration"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetIDLE: FuriHalSubGhzPreset = 0;
#[doc = "< OOK, bandwidth 270kHz, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetOok270Async: FuriHalSubGhzPreset = 1;
#[doc = "< OOK, bandwidth 650kHz, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetOok650Async: FuriHalSubGhzPreset = 2;
#[doc = "< FM, deviation 2.380371 kHz, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPreset2FSKDev238Async: FuriHalSubGhzPreset = 3;
#[doc = "< FM, deviation 47.60742 kHz, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPreset2FSKDev476Async: FuriHalSubGhzPreset = 4;
#[doc = "< MSK, deviation 47.60742 kHz, 99.97Kb/s, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetMSK99_97KbAsync: FuriHalSubGhzPreset = 5;
#[doc = "< GFSK, deviation 19.042969 kHz, 9.996Kb/s, asynchronous"]
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetGFSK9_99KbAsync: FuriHalSubGhzPreset = 6;
pub const FuriHalSubGhzPreset_FuriHalSubGhzPresetCustom: FuriHalSubGhzPreset = 7;
#[doc = "Radio Presets"]
pub type FuriHalSubGhzPreset = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LevelDuration {
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[test]
fn bindgen_test_layout_LevelDuration() {
assert_eq!(
::core::mem::size_of::<LevelDuration>(),
4usize,
concat!("Size of: ", stringify!(LevelDuration))
);
assert_eq!(
::core::mem::align_of::<LevelDuration>(),
4usize,
concat!("Alignment of ", stringify!(LevelDuration))
);
}
impl LevelDuration {
#[inline]
pub fn duration(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 30u8) as u32) }
}
#[inline]
pub fn set_duration(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 30u8, val as u64)
}
}
#[inline]
pub fn level(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(30usize, 2u8) as u8) }
}
#[inline]
pub fn set_level(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(30usize, 2u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(duration: u32, level: u8) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 30u8, {
let duration: u32 = unsafe { ::core::mem::transmute(duration) };
duration as u64
});
__bindgen_bitfield_unit.set(30usize, 2u8, {
let level: u8 = unsafe { ::core::mem::transmute(level) };
level as u64
});
__bindgen_bitfield_unit
}
}
#[doc = "< Isolate Radio from antenna"]
pub const FuriHalSubGhzPath_FuriHalSubGhzPathIsolate: FuriHalSubGhzPath = 0;
#[doc = "< Center Frequency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL"]
pub const FuriHalSubGhzPath_FuriHalSubGhzPath433: FuriHalSubGhzPath = 1;
#[doc = "< Center Frequency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL"]
pub const FuriHalSubGhzPath_FuriHalSubGhzPath315: FuriHalSubGhzPath = 2;
#[doc = "< Center Frequency: 868MHz. Path 3: SW1RF3-SW2RF3, LCLC"]
pub const FuriHalSubGhzPath_FuriHalSubGhzPath868: FuriHalSubGhzPath = 3;
#[doc = "Switchable Radio Paths"]
pub type FuriHalSubGhzPath = core::ffi::c_uchar;
extern "C" {
pub fn furi_hal_subghz_set_async_mirror_pin(pin: *const GpioPin);
}
extern "C" {
#[doc = "Get data GPIO\n\n # Returns\n\npointer to the gpio pin structure"]
pub fn furi_hal_subghz_get_data_gpio() -> *const GpioPin;
}
extern "C" {
#[doc = "Send device to sleep mode"]
pub fn furi_hal_subghz_sleep();
}
extern "C" {
#[doc = "Load custom registers from preset\n\n # Arguments\n\n* `preset_data` - registers to load"]
pub fn furi_hal_subghz_load_custom_preset(preset_data: *const u8);
}
extern "C" {
#[doc = "Load registers\n\n # Arguments\n\n* `data` - Registers data"]
pub fn furi_hal_subghz_load_registers(data: *const u8);
}
extern "C" {
#[doc = "Load PATABLE\n\n # Arguments\n\n* `data` - 8 uint8_t values"]
pub fn furi_hal_subghz_load_patable(data: *const u8);
}
extern "C" {
#[doc = "Write packet to FIFO\n\n # Arguments\n\n* `data` - bytes array\n * `size` - size"]
pub fn furi_hal_subghz_write_packet(data: *const u8, size: u8);
}
extern "C" {
#[doc = "Check if receive pipe is not empty\n\n # Returns\n\ntrue if not empty"]
pub fn furi_hal_subghz_rx_pipe_not_empty() -> bool;
}
extern "C" {
#[doc = "Check if received data crc is valid\n\n # Returns\n\ntrue if valid"]
pub fn furi_hal_subghz_is_rx_data_crc_valid() -> bool;
}
extern "C" {
#[doc = "Read packet from FIFO\n\n # Arguments\n\n* `data` - pointer\n * `size` - size"]
pub fn furi_hal_subghz_read_packet(data: *mut u8, size: *mut u8);
}
extern "C" {
#[doc = "Flush rx FIFO buffer"]
pub fn furi_hal_subghz_flush_rx();
}
extern "C" {
#[doc = "Flush tx FIFO buffer"]
pub fn furi_hal_subghz_flush_tx();
}
extern "C" {
#[doc = "Shutdown Issue SPWD command\n registers content will be lost"]
pub fn furi_hal_subghz_shutdown();
}
extern "C" {
#[doc = "Reset Issue reset command\n registers content will be lost"]
pub fn furi_hal_subghz_reset();
}
extern "C" {
#[doc = "Switch to Idle"]
pub fn furi_hal_subghz_idle();
}
extern "C" {
#[doc = "Switch to Receive"]
pub fn furi_hal_subghz_rx();
}
extern "C" {
#[doc = "Switch to Transmit\n\n # Returns\n\ntrue if the transfer is allowed by belonging to the region"]
pub fn furi_hal_subghz_tx() -> bool;
}
extern "C" {
#[doc = "Get RSSI value in dBm\n\n # Returns\n\nRSSI value"]
pub fn furi_hal_subghz_get_rssi() -> f32;
}
extern "C" {
#[doc = "Get LQI\n\n # Returns\n\nLQI value"]
pub fn furi_hal_subghz_get_lqi() -> u8;
}
extern "C" {
#[doc = "Check if frequency is in valid range\n\n # Arguments\n\n* `value` - frequency in Hz\n\n # Returns\n\ntrue if frequency is valid, otherwise false"]
pub fn furi_hal_subghz_is_frequency_valid(value: u32) -> bool;
}
extern "C" {
#[doc = "Set frequency and path This function automatically selects antenna matching\n network\n\n # Arguments\n\n* `value` - frequency in Hz\n\n # Returns\n\nreal frequency in Hz"]
pub fn furi_hal_subghz_set_frequency_and_path(value: u32) -> u32;
}
extern "C" {
#[doc = "Set frequency\n\n # Arguments\n\n* `value` - frequency in Hz\n\n # Returns\n\nreal frequency in Hz"]
pub fn furi_hal_subghz_set_frequency(value: u32) -> u32;
}
extern "C" {
#[doc = "Set path\n\n # Arguments\n\n* `path` - path to use"]
pub fn furi_hal_subghz_set_path(path: FuriHalSubGhzPath);
}
#[doc = "Signal Timings Capture callback"]
pub type FuriHalSubGhzCaptureCallback = ::core::option::Option<
unsafe extern "C" fn(level: bool, duration: u32, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Enable signal timings capture Initializes GPIO and TIM2 for timings capture\n\n # Arguments\n\n* `callback` - FuriHalSubGhzCaptureCallback\n * `context` - callback context"]
pub fn furi_hal_subghz_start_async_rx(
callback: FuriHalSubGhzCaptureCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Disable signal timings capture Resets GPIO and TIM2"]
pub fn furi_hal_subghz_stop_async_rx();
}
#[doc = "Async TX callback type\n # Arguments\n\n* `context` - callback context\n # Returns\n\nLevelDuration"]
pub type FuriHalSubGhzAsyncTxCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void) -> LevelDuration>;
extern "C" {
#[doc = "Start async TX Initializes GPIO, TIM2 and DMA1 for signal output\n\n # Arguments\n\n* `callback` - FuriHalSubGhzAsyncTxCallback\n * `context` - callback context\n\n # Returns\n\ntrue if the transfer is allowed by belonging to the region"]
pub fn furi_hal_subghz_start_async_tx(
callback: FuriHalSubGhzAsyncTxCallback,
context: *mut core::ffi::c_void,
) -> bool;
}
extern "C" {
#[doc = "Wait for async transmission to complete\n\n # Returns\n\ntrue if TX complete"]
pub fn furi_hal_subghz_is_async_tx_complete() -> bool;
}
extern "C" {
#[doc = "Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1"]
pub fn furi_hal_subghz_stop_async_tx();
}
pub type FuriHalIbuttonEmulateCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Start emulation timer\n # Arguments\n\n* `period` - timer period\n * `callback` - timer callback\n * `context` - callback context"]
pub fn furi_hal_ibutton_emulate_start(
period: u32,
callback: FuriHalIbuttonEmulateCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Update emulation timer period\n # Arguments\n\n* `period` - new timer period"]
pub fn furi_hal_ibutton_emulate_set_next(period: u32);
}
extern "C" {
#[doc = "Stop emulation timer"]
pub fn furi_hal_ibutton_emulate_stop();
}
extern "C" {
#[doc = "Set the pin to normal mode (open collector), and sets it to float"]
pub fn furi_hal_ibutton_pin_configure();
}
extern "C" {
#[doc = "Sets the pin to analog mode, and sets it to float"]
pub fn furi_hal_ibutton_pin_reset();
}
extern "C" {
#[doc = "iButton write pin\n # Arguments\n\n* `state` - true / false"]
pub fn furi_hal_ibutton_pin_write(state: bool);
}
extern "C" {
#[doc = "Config rfid pins to reset state"]
pub fn furi_hal_rfid_pins_reset();
}
extern "C" {
#[doc = "Release rfid pull pin"]
pub fn furi_hal_rfid_pin_pull_release();
}
extern "C" {
#[doc = "Pulldown rfid pull pin"]
pub fn furi_hal_rfid_pin_pull_pulldown();
}
extern "C" {
#[doc = "Start read timer\n # Arguments\n\n* `freq` - timer frequency\n * `duty_cycle` - timer duty cycle, 0.0-1.0"]
pub fn furi_hal_rfid_tim_read_start(freq: f32, duty_cycle: f32);
}
extern "C" {
#[doc = "Pause read timer, to be able to continue later"]
pub fn furi_hal_rfid_tim_read_pause();
}
extern "C" {
#[doc = "Continue read timer"]
pub fn furi_hal_rfid_tim_read_continue();
}
extern "C" {
#[doc = "Stop read timer"]
pub fn furi_hal_rfid_tim_read_stop();
}
pub type FuriHalRfidReadCaptureCallback = ::core::option::Option<
unsafe extern "C" fn(level: bool, duration: u32, context: *mut core::ffi::c_void),
>;
extern "C" {
pub fn furi_hal_rfid_tim_read_capture_start(
callback: FuriHalRfidReadCaptureCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn furi_hal_rfid_tim_read_capture_stop();
}
pub type FuriHalRfidDMACallback =
::core::option::Option<unsafe extern "C" fn(half: bool, context: *mut core::ffi::c_void)>;
extern "C" {
pub fn furi_hal_rfid_tim_emulate_dma_start(
duration: *mut u32,
pulse: *mut u32,
length: usize,
callback: FuriHalRfidDMACallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn furi_hal_rfid_tim_emulate_dma_stop();
}
extern "C" {
#[doc = "Set read timer period\n\n # Arguments\n\n* `period` - overall duration"]
pub fn furi_hal_rfid_set_read_period(period: u32);
}
extern "C" {
#[doc = "Set read timer pulse\n\n # Arguments\n\n* `pulse` - duration of high level"]
pub fn furi_hal_rfid_set_read_pulse(pulse: u32);
}
extern "C" {
#[doc = "Start/Enable comparator"]
pub fn furi_hal_rfid_comp_start();
}
extern "C" {
#[doc = "Stop/Disable comparator"]
pub fn furi_hal_rfid_comp_stop();
}
pub type FuriHalRfidCompCallback =
::core::option::Option<unsafe extern "C" fn(level: bool, context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Set comparator callback"]
pub fn furi_hal_rfid_comp_set_callback(
callback: FuriHalRfidCompCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start/Enable Field Presence detect"]
pub fn furi_hal_rfid_field_detect_start();
}
extern "C" {
#[doc = "Stop/Disable Field Presence detect"]
pub fn furi_hal_rfid_field_detect_stop();
}
extern "C" {
#[doc = "Check Field Presence\n\n # Arguments\n\n* `frequency` (direction out) - pointer to frequency value to be set if filed detected\n\n # Returns\n\ntrue if field is present, false if not"]
pub fn furi_hal_rfid_field_is_present(frequency: *mut u32) -> bool;
}
#[doc = "< Oscillator has been started."]
pub const FuriHalNfcEvent_FuriHalNfcEventOscOn: FuriHalNfcEvent = 1;
#[doc = "< External field (carrier) has been detected."]
pub const FuriHalNfcEvent_FuriHalNfcEventFieldOn: FuriHalNfcEvent = 2;
#[doc = "< External field (carrier) has been lost."]
pub const FuriHalNfcEvent_FuriHalNfcEventFieldOff: FuriHalNfcEvent = 4;
#[doc = "< Reader has issued a wake-up command."]
pub const FuriHalNfcEvent_FuriHalNfcEventListenerActive: FuriHalNfcEvent = 8;
#[doc = "< Transmission has started."]
pub const FuriHalNfcEvent_FuriHalNfcEventTxStart: FuriHalNfcEvent = 16;
#[doc = "< Transmission has ended."]
pub const FuriHalNfcEvent_FuriHalNfcEventTxEnd: FuriHalNfcEvent = 32;
#[doc = "< Reception has started."]
pub const FuriHalNfcEvent_FuriHalNfcEventRxStart: FuriHalNfcEvent = 64;
#[doc = "< Reception has ended."]
pub const FuriHalNfcEvent_FuriHalNfcEventRxEnd: FuriHalNfcEvent = 128;
#[doc = "< A collision has occurred."]
pub const FuriHalNfcEvent_FuriHalNfcEventCollision: FuriHalNfcEvent = 256;
#[doc = "< Frame wait timer has expired."]
pub const FuriHalNfcEvent_FuriHalNfcEventTimerFwtExpired: FuriHalNfcEvent = 512;
#[doc = "< Transmission block timer has expired."]
pub const FuriHalNfcEvent_FuriHalNfcEventTimerBlockTxExpired: FuriHalNfcEvent = 1024;
pub const FuriHalNfcEvent_FuriHalNfcEventTimeout: FuriHalNfcEvent = 2048;
pub const FuriHalNfcEvent_FuriHalNfcEventAbortRequest: FuriHalNfcEvent = 4096;
#[doc = "Enumeration of possible NFC HAL events."]
pub type FuriHalNfcEvent = core::ffi::c_ushort;
#[doc = "< No error has occurred."]
pub const FuriHalNfcError_FuriHalNfcErrorNone: FuriHalNfcError = 0;
#[doc = "< The communication bus is busy."]
pub const FuriHalNfcError_FuriHalNfcErrorBusy: FuriHalNfcError = 1;
#[doc = "< NFC hardware did not respond or responded unexpectedly."]
pub const FuriHalNfcError_FuriHalNfcErrorCommunication: FuriHalNfcError = 2;
#[doc = "< Oscillator failed to start."]
pub const FuriHalNfcError_FuriHalNfcErrorOscillator: FuriHalNfcError = 3;
#[doc = "< NFC hardware did not respond in time."]
pub const FuriHalNfcError_FuriHalNfcErrorCommunicationTimeout: FuriHalNfcError = 4;
#[doc = "< Receive buffer was too small for the received data."]
pub const FuriHalNfcError_FuriHalNfcErrorBufferOverflow: FuriHalNfcError = 5;
#[doc = "< Not enough data was received to parse a valid frame."]
pub const FuriHalNfcError_FuriHalNfcErrorIncompleteFrame: FuriHalNfcError = 6;
#[doc = "< Cannot parse a frame due to unexpected/invalid data."]
pub const FuriHalNfcError_FuriHalNfcErrorDataFormat: FuriHalNfcError = 7;
#[doc = "Enumeration of possible NFC HAL errors."]
pub type FuriHalNfcError = core::ffi::c_uchar;
#[doc = "< Configure NFC HAL to operate as a poller."]
pub const FuriHalNfcMode_FuriHalNfcModePoller: FuriHalNfcMode = 0;
#[doc = "< Configure NFC HAL to operate as a listener."]
pub const FuriHalNfcMode_FuriHalNfcModeListener: FuriHalNfcMode = 1;
#[doc = "< Special value equal to the operating modes count. Internal use."]
pub const FuriHalNfcMode_FuriHalNfcModeNum: FuriHalNfcMode = 2;
#[doc = "Enumeration of possible NFC HAL operating modes."]
pub type FuriHalNfcMode = core::ffi::c_uchar;
#[doc = "< Configure NFC HAL to use the ISO14443 (type A) technology."]
pub const FuriHalNfcTech_FuriHalNfcTechIso14443a: FuriHalNfcTech = 0;
#[doc = "< Configure NFC HAL to use the ISO14443 (type B) technology."]
pub const FuriHalNfcTech_FuriHalNfcTechIso14443b: FuriHalNfcTech = 1;
#[doc = "< Configure NFC HAL to use the ISO15693 technology."]
pub const FuriHalNfcTech_FuriHalNfcTechIso15693: FuriHalNfcTech = 2;
#[doc = "< Configure NFC HAL to use the FeliCa technology."]
pub const FuriHalNfcTech_FuriHalNfcTechFelica: FuriHalNfcTech = 3;
#[doc = "< Special value equal to the supported technologies count. Internal use."]
pub const FuriHalNfcTech_FuriHalNfcTechNum: FuriHalNfcTech = 4;
#[doc = "< Special value indicating the unconfigured state. Internal use."]
pub const FuriHalNfcTech_FuriHalNfcTechInvalid: FuriHalNfcTech = 5;
#[doc = "Enumeration of supported NFC technologies."]
pub type FuriHalNfcTech = core::ffi::c_uchar;
extern "C" {
#[doc = "Initialise the NFC HAL and associated hardware.\n\n This function is called automatically during the firmware initialisation,\n so there is no need to call it explicitly.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_init() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Check whether the NFC HAL was properly initialised and is ready.\n\n # Returns\n\nFuriHalNfcErrorNone if ready, any other error code if not ready."]
pub fn furi_hal_nfc_is_hal_ready() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Exclusively take over the NFC HAL and associated hardware.\n\n This function needs to be called whenever an interaction with the NFC HAL\n is to take place (usually once upon the application start).\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_acquire() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Release the exclusive lock and make the NFC HAL available for others.\n\n This function needs to be called when the user code is done working\n with the NFC HAL (usually once upon application exit). It must be called\n from the same thread that has called furi_hal_nfc_acquire().\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_release() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Configure the NFC hardware to enter the low-power mode.\n\n This function must be called each time when the user code is done working\n with the NFC HAL for the time being (e.g. waiting on user input).\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_low_power_mode_start() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Configure the NFC hardware to exit the low-power mode.\n\n This function must be called each time when the user code begins working\n with the NFC HAL, as the default state is low-power mode.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_low_power_mode_stop() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Configure the NFC HAL to work in a particular mode.\n\n Not all technologies implement the listener operating mode.\n\n # Arguments\n\n* `mode` (direction in) - required operating mode.\n * `tech` (direction in) - required technology configuration.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_set_mode(mode: FuriHalNfcMode, tech: FuriHalNfcTech) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Reset the NFC HAL to its default (unconfigured) state.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_reset_mode() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Enable field (carrier) detection by the NFC hardware.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_field_detect_start() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Disable field (carrier) detection by the NFC hardware.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_field_detect_stop() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Check if the reader field (carrier) was detected by the NFC hardware.\n\n # Returns\n\ntrue if the field was detected, false otherwise."]
pub fn furi_hal_nfc_field_is_present() -> bool;
}
extern "C" {
#[doc = "Enable field (carrier) generation by the NFC hardware.\n\n No carrier modulation will occur unless a transmission is explicitly started.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_poller_field_on() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Wait for an NFC HAL event in poller mode.\n\n # Arguments\n\n* `timeout_ms` (direction in) - time to wait (timeout) in milliseconds.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_poller_wait_event(timeout_ms: u32) -> FuriHalNfcEvent;
}
extern "C" {
#[doc = "Wait for an NFC HAL event in listener mode.\n # Arguments\n\n* `timeout_ms` (direction in) - time to wait (timeout) in milliseconds.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_wait_event(timeout_ms: u32) -> FuriHalNfcEvent;
}
extern "C" {
#[doc = "Transmit data in poller mode.\n\n # Arguments\n\n* `tx_data` (direction in) - pointer to a byte array containing the data to be transmitted.\n * `tx_bits` (direction in) - transmit data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_poller_tx(tx_data: *const u8, tx_bits: usize) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Receive data in poller mode.\n\n The receive buffer must be big enough to accomodate all of the expected data.\n\n # Arguments\n\n* `rx_data` (direction out) - pointer to a byte array to be filled with received data.\n * `rx_data_size` (direction in) - maximum received data size, in bytes.\n * `rx_bits` (direction out) - pointer to the variable to hold received data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_poller_rx(
rx_data: *mut u8,
rx_data_size: usize,
rx_bits: *mut usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Transmit data in listener mode.\n\n # Arguments\n\n* `tx_data` (direction in) - pointer to a byte array containing the data to be transmitted.\n * `tx_bits` (direction in) - transmit data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_tx(tx_data: *const u8, tx_bits: usize) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Receive data in listener mode.\n\n The receive buffer must be big enough to accomodate all of the expected data.\n\n # Arguments\n\n* `rx_data` (direction out) - pointer to a byte array to be filled with received data.\n * `rx_data_size` (direction in) - maximum received data size, in bytes.\n * `rx_bits` (direction out) - pointer to the variable to hold received data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_rx(
rx_data: *mut u8,
rx_data_size: usize,
rx_bits: *mut usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Go to sleep in listener mode.\n\n Puts the passive target logic into Sleep (Halt) state.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_sleep() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Go to idle in listener mode.\n\n Puts the passive target logic into Sense (Idle) state.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_idle() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Enable reception in listener mode.\n\n Starts hardware receivers and receive decoders.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_listener_enable_rx() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Reset communication.\n\n Resets the communication state and stops all activities: transmission, reception, etc.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_trx_reset() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Enable generation of NFC HAL events.\n\n This function must be called from the same thread from which\n the the furi_hal_nfc_*_wait_event() calls will be made.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_event_start() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Disable generation of NFC HAL events.\n\n Unlike furi_hal_nfc_event_start(), this function may be called from any thread.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_event_stop() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Manually emit the FuriHalNfcEventAbortRequest event.\n\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_abort() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Start frame wait timeout timer.\n\n # Arguments\n\n* `time_fc` (direction in) - time to wait, in carrier cycles."]
pub fn furi_hal_nfc_timer_fwt_start(time_fc: u32);
}
extern "C" {
#[doc = "Stop frame wait timeout timer."]
pub fn furi_hal_nfc_timer_fwt_stop();
}
extern "C" {
#[doc = "Start block transmit (frame delay) timer.\n\n # Arguments\n\n* `time_fc` (direction in) - time to wait, in carrier cycles."]
pub fn furi_hal_nfc_timer_block_tx_start(time_fc: u32);
}
extern "C" {
#[doc = "Start block transmit (frame delay) timer.\n\n # Arguments\n\n* `time_us` (direction in) - time to wait, in microseconds."]
pub fn furi_hal_nfc_timer_block_tx_start_us(time_us: u32);
}
extern "C" {
#[doc = "Stop block transmit (frame delay) timer."]
pub fn furi_hal_nfc_timer_block_tx_stop();
}
extern "C" {
#[doc = "Check whether block transmit (frame delay) timer is running.\n\n # Returns\n\ntrue if timer is running, false otherwise."]
pub fn furi_hal_nfc_timer_block_tx_is_running() -> bool;
}
pub const FuriHalNfcaShortFrame_FuriHalNfcaShortFrameAllReq: FuriHalNfcaShortFrame = 0;
pub const FuriHalNfcaShortFrame_FuriHalNfcaShortFrameSensReq: FuriHalNfcaShortFrame = 1;
#[doc = "Enumeration of ISO14443 (Type A) short frame types."]
pub type FuriHalNfcaShortFrame = core::ffi::c_uchar;
extern "C" {
#[doc = "Transmit ISO14443 (Type A) short frame in poller mode.\n\n # Arguments\n\n* `frame` (direction in) - short frame type to be transmitted.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_poller_trx_short_frame(
frame: FuriHalNfcaShortFrame,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Transmit ISO14443 (Type A) SDD frame in poller mode.\n\n # Arguments\n\n* `tx_data` (direction in) - pointer to a byte array containing the data to be transmitted.\n * `tx_bits` (direction in) - transmit data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_tx_sdd_frame(
tx_data: *const u8,
tx_bits: usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Receive ISO14443 (Type A) SDD frame in poller mode.\n\n The receive buffer must be big enough to accomodate all of the expected data.\n\n # Arguments\n\n* `rx_data` (direction in) - pointer to a byte array to be filled with received data.\n * `rx_data_size` (direction in) - maximum received data size, in bytes.\n * `rx_bits` (direction in) - pointer to the variable to hold received data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_rx_sdd_frame(
rx_data: *mut u8,
rx_data_size: usize,
rx_bits: *mut usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Transmit ISO14443 (Type A) frame with custom parity bits in poller mode.\n\n Same as furi_hal_nfc_poller_tx(), but uses the parity bits provided\n by the user code instead of calculating them automatically.\n\n # Arguments\n\n* `tx_data` (direction in) - pointer to a byte array containing the data to be transmitted.\n * `tx_bits` (direction in) - transmit data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_poller_tx_custom_parity(
tx_data: *const u8,
tx_bits: usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Set ISO14443 (Type A) collision resolution parameters in listener mode.\n\n Configures the NFC hardware for automatic collision resolution.\n\n # Arguments\n\n* `uid` (direction in) - pointer to a byte array containing the UID.\n * `uid_len` (direction in) - UID length in bytes (must be supported by the protocol).\n * `atqa` (direction in) - ATQA byte value.\n * `sak` (direction in) - SAK byte value.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_listener_set_col_res_data(
uid: *mut u8,
uid_len: u8,
atqa: *mut u8,
sak: u8,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Transmit ISO14443 (Type A) frame with custom parity bits in listener mode.\n\n # Arguments\n\n* `tx_data` (direction in) - pointer to a byte array containing the data to be transmitted.\n * `tx_parity` (direction in) - pointer to a (bit-packed) byte array containing the parity to be transmitted.\n * `tx_bits` (direction in) - transmit data size, in bits.\n # Returns\n\nFuriHalNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_iso14443a_listener_tx_custom_parity(
tx_data: *const u8,
tx_parity: *const u8,
tx_bits: usize,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Send ISO15693 SOF in listener mode\n\n # Returns\n\nFuriHalNfcError"]
pub fn furi_hal_nfc_iso15693_listener_tx_sof() -> FuriHalNfcError;
}
extern "C" {
#[doc = "Set FeliCa collision resolution parameters in listener mode.\n\n Configures the NFC hardware for automatic collision resolution.\n\n # Arguments\n\n* `idm` (direction in) - pointer to a byte array containing the IDm.\n * `idm_len` (direction in) - IDm length in bytes.\n * `pmm` (direction in) - pointer to a byte array containing the PMm.\n * `pmm_len` (direction in) - PMm length in bytes.\n * `sys_code` (direction in) - System code from SYS_C block\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn furi_hal_nfc_felica_listener_set_sensf_res_data(
idm: *const u8,
idm_len: u8,
pmm: *const u8,
pmm_len: u8,
sys_code: u16,
) -> FuriHalNfcError;
}
extern "C" {
#[doc = "Jump to the void*\n\n Allow your code to transfer control to another firmware.\n\n This code doesn't reset system before jump. Call it only from\n main thread, no kernel should be running. Ensure that no\n peripheral blocks active and no interrupts are pending.\n\n # Arguments\n\n* `address` - The System Vector address(start of your new firmware)"]
pub fn furi_hal_switch(address: *mut core::ffi::c_void);
}
pub type Elf32_Addr = u32;
#[doc = "Interface for ELF loader to resolve symbols"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ElfApiInterface {
pub api_version_major: u16,
pub api_version_minor: u16,
pub resolver_callback: ::core::option::Option<
unsafe extern "C" fn(
interface: *const ElfApiInterface,
hash: u32,
address: *mut Elf32_Addr,
) -> bool,
>,
}
#[test]
fn bindgen_test_layout_ElfApiInterface() {
const UNINIT: ::core::mem::MaybeUninit<ElfApiInterface> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ElfApiInterface>(),
8usize,
concat!("Size of: ", stringify!(ElfApiInterface))
);
assert_eq!(
::core::mem::align_of::<ElfApiInterface>(),
4usize,
concat!("Alignment of ", stringify!(ElfApiInterface))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).api_version_major) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ElfApiInterface),
"::",
stringify!(api_version_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).api_version_minor) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(ElfApiInterface),
"::",
stringify!(api_version_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).resolver_callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ElfApiInterface),
"::",
stringify!(resolver_callback)
)
);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub struct FlipperApplicationManifestBase {
pub manifest_magic: u32,
pub manifest_version: u32,
pub api_version: FlipperApplicationManifestBase__bindgen_ty_1,
pub hardware_target_id: u16,
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub union FlipperApplicationManifestBase__bindgen_ty_1 {
pub __bindgen_anon_1: FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1,
pub version: u32,
}
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1 {
pub minor: u16,
pub major: u16,
}
#[test]
fn bindgen_test_layout_FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<
FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1,
> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).minor) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).major) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(major)
)
);
}
#[test]
fn bindgen_test_layout_FlipperApplicationManifestBase__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<FlipperApplicationManifestBase__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperApplicationManifestBase__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<FlipperApplicationManifestBase__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase__bindgen_ty_1),
"::",
stringify!(version)
)
);
}
#[test]
fn bindgen_test_layout_FlipperApplicationManifestBase() {
const UNINIT: ::core::mem::MaybeUninit<FlipperApplicationManifestBase> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperApplicationManifestBase>(),
14usize,
concat!("Size of: ", stringify!(FlipperApplicationManifestBase))
);
assert_eq!(
::core::mem::align_of::<FlipperApplicationManifestBase>(),
1usize,
concat!("Alignment of ", stringify!(FlipperApplicationManifestBase))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manifest_magic) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase),
"::",
stringify!(manifest_magic)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manifest_version) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase),
"::",
stringify!(manifest_version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).api_version) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase),
"::",
stringify!(api_version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hardware_target_id) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestBase),
"::",
stringify!(hardware_target_id)
)
);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub struct FlipperApplicationManifestV1 {
pub base: FlipperApplicationManifestBase,
pub stack_size: u16,
pub app_version: u32,
pub name: [core::ffi::c_char; 32usize],
pub has_icon: core::ffi::c_char,
pub icon: [core::ffi::c_char; 32usize],
}
#[test]
fn bindgen_test_layout_FlipperApplicationManifestV1() {
const UNINIT: ::core::mem::MaybeUninit<FlipperApplicationManifestV1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperApplicationManifestV1>(),
85usize,
concat!("Size of: ", stringify!(FlipperApplicationManifestV1))
);
assert_eq!(
::core::mem::align_of::<FlipperApplicationManifestV1>(),
1usize,
concat!("Alignment of ", stringify!(FlipperApplicationManifestV1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stack_size) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(stack_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).app_version) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(app_version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).has_icon) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(has_icon)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).icon) as usize - ptr as usize },
53usize,
concat!(
"Offset of field: ",
stringify!(FlipperApplicationManifestV1),
"::",
stringify!(icon)
)
);
}
pub type FlipperApplicationManifest = FlipperApplicationManifestV1;
extern "C" {
#[doc = "Check if manifest is valid\n\n # Arguments\n\n* `manifest` -\n # Returns\n\nbool"]
pub fn flipper_application_manifest_is_valid(
manifest: *const FlipperApplicationManifest,
) -> bool;
}
extern "C" {
#[doc = "Check if API Version declared in manifest is older than firmware ELF API interface\n\n # Arguments\n\n* `manifest` - The manifest\n * `api_interface` - The api interface\n\n # Returns\n\nbool"]
pub fn flipper_application_manifest_is_too_old(
manifest: *const FlipperApplicationManifest,
api_interface: *const ElfApiInterface,
) -> bool;
}
extern "C" {
#[doc = "Check if API Version declared in manifest is newer than firmware ELF API interface\n\n # Arguments\n\n* `manifest` - The manifest\n * `api_interface` - The api interface\n\n # Returns\n\nbool"]
pub fn flipper_application_manifest_is_too_new(
manifest: *const FlipperApplicationManifest,
api_interface: *const ElfApiInterface,
) -> bool;
}
extern "C" {
#[doc = "Check if application is compatible with current hardware\n\n # Arguments\n\n* `manifest` -\n # Returns\n\nbool"]
pub fn flipper_application_manifest_is_target_compatible(
manifest: *const FlipperApplicationManifest,
) -> bool;
}
#[doc = "< Read access"]
pub const FS_AccessMode_FSAM_READ: FS_AccessMode = 1;
#[doc = "< Write access"]
pub const FS_AccessMode_FSAM_WRITE: FS_AccessMode = 2;
#[doc = "< Read and write access"]
pub const FS_AccessMode_FSAM_READ_WRITE: FS_AccessMode = 3;
#[doc = "Access mode flags"]
pub type FS_AccessMode = core::ffi::c_uchar;
#[doc = "< Open file, fail if file doesn't exist"]
pub const FS_OpenMode_FSOM_OPEN_EXISTING: FS_OpenMode = 1;
#[doc = "< Open file. Create new file if not exist"]
pub const FS_OpenMode_FSOM_OPEN_ALWAYS: FS_OpenMode = 2;
#[doc = "< Open file. Create new file if not exist. Set R/W pointer to EOF"]
pub const FS_OpenMode_FSOM_OPEN_APPEND: FS_OpenMode = 4;
#[doc = "< Creates a new file. Fails if the file is exist"]
pub const FS_OpenMode_FSOM_CREATE_NEW: FS_OpenMode = 8;
#[doc = "< Creates a new file. If file exist, truncate to zero size"]
pub const FS_OpenMode_FSOM_CREATE_ALWAYS: FS_OpenMode = 16;
#[doc = "Open mode flags"]
pub type FS_OpenMode = core::ffi::c_uchar;
#[doc = "< No error"]
pub const FS_Error_FSE_OK: FS_Error = 0;
#[doc = "< FS not ready"]
pub const FS_Error_FSE_NOT_READY: FS_Error = 1;
#[doc = "< File/Dir already exist"]
pub const FS_Error_FSE_EXIST: FS_Error = 2;
#[doc = "< File/Dir does not exist"]
pub const FS_Error_FSE_NOT_EXIST: FS_Error = 3;
#[doc = "< Invalid API parameter"]
pub const FS_Error_FSE_INVALID_PARAMETER: FS_Error = 4;
#[doc = "< Access denied"]
pub const FS_Error_FSE_DENIED: FS_Error = 5;
#[doc = "< Invalid name/path"]
pub const FS_Error_FSE_INVALID_NAME: FS_Error = 6;
#[doc = "< Internal error"]
pub const FS_Error_FSE_INTERNAL: FS_Error = 7;
#[doc = "< Function not implemented"]
pub const FS_Error_FSE_NOT_IMPLEMENTED: FS_Error = 8;
#[doc = "< File/Dir already opened"]
pub const FS_Error_FSE_ALREADY_OPEN: FS_Error = 9;
#[doc = "API errors enumeration"]
pub type FS_Error = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct File {
_unused: [u8; 0],
}
#[doc = "Structure that hold file info"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FileInfo {
#[doc = "< flags from FS_Flags enum"]
pub flags: u8,
#[doc = "< file size"]
pub size: u64,
}
#[test]
fn bindgen_test_layout_FileInfo() {
const UNINIT: ::core::mem::MaybeUninit<FileInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FileInfo>(),
16usize,
concat!("Size of: ", stringify!(FileInfo))
);
assert_eq!(
::core::mem::align_of::<FileInfo>(),
8usize,
concat!("Alignment of ", stringify!(FileInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FileInfo),
"::",
stringify!(flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FileInfo),
"::",
stringify!(size)
)
);
}
extern "C" {
#[doc = "Gets the error text from FS_Error\n # Arguments\n\n* `error_id` - error id\n # Returns\n\nconst char* error text"]
pub fn filesystem_api_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Checks if file info is directory\n # Arguments\n\n* `file_info` - file info pointer\n # Returns\n\nbool is directory"]
pub fn file_info_is_dir(file_info: *const FileInfo) -> bool;
}
pub const SDFsType_FST_UNKNOWN: SDFsType = 0;
pub const SDFsType_FST_FAT12: SDFsType = 1;
pub const SDFsType_FST_FAT16: SDFsType = 2;
pub const SDFsType_FST_FAT32: SDFsType = 3;
pub const SDFsType_FST_EXFAT: SDFsType = 4;
pub type SDFsType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SDInfo {
pub fs_type: SDFsType,
pub kb_total: u32,
pub kb_free: u32,
pub cluster_size: u16,
pub sector_size: u16,
pub label: [core::ffi::c_char; 34usize],
pub manufacturer_id: u8,
pub oem_id: [core::ffi::c_char; 3usize],
pub product_name: [core::ffi::c_char; 6usize],
pub product_revision_major: u8,
pub product_revision_minor: u8,
pub product_serial_number: u32,
pub manufacturing_month: u8,
pub manufacturing_year: u16,
}
#[test]
fn bindgen_test_layout_SDInfo() {
const UNINIT: ::core::mem::MaybeUninit<SDInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SDInfo>(),
72usize,
concat!("Size of: ", stringify!(SDInfo))
);
assert_eq!(
::core::mem::align_of::<SDInfo>(),
4usize,
concat!("Alignment of ", stringify!(SDInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fs_type) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(fs_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).kb_total) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(kb_total)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).kb_free) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(kb_free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cluster_size) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(cluster_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sector_size) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(sector_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).label) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(label)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturer_id) as usize - ptr as usize },
50usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(manufacturer_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).oem_id) as usize - ptr as usize },
51usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(oem_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_name) as usize - ptr as usize },
54usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(product_name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_revision_major) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(product_revision_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_revision_minor) as usize - ptr as usize },
61usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(product_revision_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).product_serial_number) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(product_serial_number)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturing_month) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(manufacturing_month)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturing_year) as usize - ptr as usize },
70usize,
concat!(
"Offset of field: ",
stringify!(SDInfo),
"::",
stringify!(manufacturing_year)
)
);
}
extern "C" {
pub fn sd_api_get_fs_type_text(fs_type: SDFsType) -> *const core::ffi::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Storage {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and initialize a file instance.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\npointer to the created instance."]
pub fn storage_file_alloc(storage: *mut Storage) -> *mut File;
}
extern "C" {
#[doc = "Free the file instance.\n\n If the file was open, calling this function will close it automatically.\n # Arguments\n\n* `file` - pointer to the file instance to be freed."]
pub fn storage_file_free(file: *mut File);
}
extern "C" {
#[doc = "Get the storage pubsub instance.\n\n Storage will send StorageEvent messages.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\npointer to the pubsub instance."]
pub fn storage_get_pubsub(storage: *mut Storage) -> *mut FuriPubSub;
}
extern "C" {
#[doc = "Open an existing file or create a new one.\n\n The calling code MUST call storage_file_close() even if the open operation had failed.\n\n # Arguments\n\n* `file` - pointer to the file instance to be opened.\n * `path` - pointer to a zero-terminated string containing the path to the file to be opened.\n * `access_mode` - access mode from FS_AccessMode.\n * `open_mode` - open mode from FS_OpenMode\n # Returns\n\ntrue if the file was successfully opened, false otherwise."]
pub fn storage_file_open(
file: *mut File,
path: *const core::ffi::c_char,
access_mode: FS_AccessMode,
open_mode: FS_OpenMode,
) -> bool;
}
extern "C" {
#[doc = "Close the file.\n\n # Arguments\n\n* `file` - pointer to the file instance to be closed.\n # Returns\n\ntrue if the file was successfully closed, false otherwise."]
pub fn storage_file_close(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Check whether the file is open.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n # Returns\n\ntrue if the file is open, false otherwise."]
pub fn storage_file_is_open(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Check whether a file instance represents a directory.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n # Returns\n\ntrue if the file instance represents a directory, false otherwise."]
pub fn storage_file_is_dir(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Read bytes from a file into a buffer.\n\n # Arguments\n\n* `file` - pointer to the file instance to read from.\n * `buff` - pointer to the buffer to be filled with read data.\n * `bytes_to_read` - number of bytes to read. Must be less than or equal to the size of the buffer.\n # Returns\n\nactual number of bytes read (may be fewer than requested)."]
pub fn storage_file_read(
file: *mut File,
buff: *mut core::ffi::c_void,
bytes_to_read: usize,
) -> usize;
}
extern "C" {
#[doc = "Write bytes from a buffer to a file.\n\n # Arguments\n\n* `file` - pointer to the file instance to write into.\n * `buff` - pointer to the buffer containing the data to be written.\n * `bytes_to_write` - number of bytes to write. Must be less than or equal to the size of the buffer.\n # Returns\n\nactual number of bytes written (may be fewer than requested)."]
pub fn storage_file_write(
file: *mut File,
buff: *const core::ffi::c_void,
bytes_to_write: usize,
) -> usize;
}
extern "C" {
#[doc = "Change the current access position in a file.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n * `offset` - access position offset (meaning depends on from_start parameter).\n * `from_start` - if true, set the access position relative to the file start, otherwise relative to the current position.\n # Returns\n\nsuccess flag"]
pub fn storage_file_seek(file: *mut File, offset: u32, from_start: bool) -> bool;
}
extern "C" {
#[doc = "Get the current access position.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n # Returns\n\ncurrent access position."]
pub fn storage_file_tell(file: *mut File) -> u64;
}
extern "C" {
#[doc = "Truncate the file size to the current access position.\n\n # Arguments\n\n* `file` - pointer to the file instance to be truncated.\n # Returns\n\ntrue if the file was successfully truncated, false otherwise."]
pub fn storage_file_truncate(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Get the file size.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n # Returns\n\nsize of the file, in bytes."]
pub fn storage_file_size(file: *mut File) -> u64;
}
extern "C" {
#[doc = "Synchronise the file cache with the actual storage.\n\n # Arguments\n\n* `file` - pointer to the file instance in question.\n # Returns\n\ntrue if the file was successfully synchronised, false otherwise."]
pub fn storage_file_sync(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Check whether the current access position is at the end of the file.\n\n # Arguments\n\n* `file` - pointer to a file instance in question.\n # Returns\n\nbool true if the current access position is at the end of the file, false otherwise."]
pub fn storage_file_eof(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Check whether a file exists.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path to the file in question.\n # Returns\n\ntrue if the file exists, false otherwise."]
pub fn storage_file_exists(storage: *mut Storage, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Copy data from a source file to the destination file.\n\n Both files must be opened prior to calling this function.\n\n The requested amount of bytes will be copied from the current access position\n in the source file to the current access position in the destination file.\n\n # Arguments\n\n* `source` - pointer to a source file instance.\n * `destination` - pointer to a destination file instance.\n * `size` - data size to be copied, in bytes.\n # Returns\n\ntrue if the data was successfully copied, false otherwise."]
pub fn storage_file_copy_to_file(
source: *mut File,
destination: *mut File,
size: usize,
) -> bool;
}
extern "C" {
#[doc = "Open a directory.\n\n Opening a directory is necessary to be able to read its contents with storage_dir_read().\n\n The calling code MUST call storage_dir_close() even if the open operation had failed.\n\n # Arguments\n\n* `file` - pointer to a file instance representing the directory in question.\n * `path` - pointer to a zero-terminated string containing the path of the directory in question.\n # Returns\n\ntrue if the directory was successfully opened, false otherwise."]
pub fn storage_dir_open(file: *mut File, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Close the directory.\n\n # Arguments\n\n* `file` - pointer to a file instance representing the directory in question.\n # Returns\n\ntrue if the directory was successfully closed, false otherwise."]
pub fn storage_dir_close(file: *mut File) -> bool;
}
extern "C" {
#[doc = "Get the next item in the directory.\n\n If the next object does not exist, this function returns false as well\n and sets the file error id to FSE_NOT_EXIST.\n\n # Arguments\n\n* `file` - pointer to a file instance representing the directory in question.\n * `fileinfo` - pointer to the FileInfo structure to contain the info (may be NULL).\n * `name` - pointer to the buffer to contain the name (may be NULL).\n * `name_length` - maximum capacity of the name buffer, in bytes.\n # Returns\n\ntrue if the next item was successfully read, false otherwise."]
pub fn storage_dir_read(
file: *mut File,
fileinfo: *mut FileInfo,
name: *mut core::ffi::c_char,
name_length: u16,
) -> bool;
}
extern "C" {
#[doc = "Check whether a directory exists.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path of the directory in question.\n # Returns\n\ntrue if the directory exists, false otherwise."]
pub fn storage_dir_exists(storage: *mut Storage, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Get the last access time in UNIX format.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path of the item in question.\n * `timestamp` - pointer to a value to contain the timestamp.\n # Returns\n\nFSE_OK if the timestamp has been successfully received, any other error code on failure."]
pub fn storage_common_timestamp(
storage: *mut Storage,
path: *const core::ffi::c_char,
timestamp: *mut u32,
) -> FS_Error;
}
extern "C" {
#[doc = "Get information about a file or a directory.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path of the item in question.\n * `fileinfo` - pointer to the FileInfo structure to contain the info (may be NULL).\n # Returns\n\nFSE_OK if the info has been successfully received, any other error code on failure."]
pub fn storage_common_stat(
storage: *mut Storage,
path: *const core::ffi::c_char,
fileinfo: *mut FileInfo,
) -> FS_Error;
}
extern "C" {
#[doc = "Remove a file or a directory.\n\n The directory must be empty.\n The file or the directory must NOT be open.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path of the item to be removed.\n # Returns\n\nFSE_OK if the file or directory has been successfully removed, any other error code on failure."]
pub fn storage_common_remove(storage: *mut Storage, path: *const core::ffi::c_char)
-> FS_Error;
}
extern "C" {
#[doc = "Rename a file or a directory.\n\n The file or the directory must NOT be open.\n Will overwrite the destination file if it already exists.\n\n Renaming a regular file to itself does nothing and always succeeds.\n Renaming a directory to itself or to a subdirectory of itself always fails.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `old_path` - pointer to a zero-terminated string containing the source path.\n * `new_path` - pointer to a zero-terminated string containing the destination path.\n # Returns\n\nFSE_OK if the file or directory has been successfully renamed, any other error code on failure."]
pub fn storage_common_rename(
storage: *mut Storage,
old_path: *const core::ffi::c_char,
new_path: *const core::ffi::c_char,
) -> FS_Error;
}
extern "C" {
#[doc = "Copy the file to a new location.\n\n The file must NOT be open at the time of calling this function.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `old_path` - pointer to a zero-terminated string containing the source path.\n * `new_path` - pointer to a zero-terminated string containing the destination path.\n # Returns\n\nFSE_OK if the file has been successfully copied, any other error code on failure."]
pub fn storage_common_copy(
storage: *mut Storage,
old_path: *const core::ffi::c_char,
new_path: *const core::ffi::c_char,
) -> FS_Error;
}
extern "C" {
#[doc = "Copy the contents of one directory into another and rename all conflicting files.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `old_path` - pointer to a zero-terminated string containing the source path.\n * `new_path` - pointer to a zero-terminated string containing the destination path.\n # Returns\n\nFSE_OK if the directories have been successfully merged, any other error code on failure."]
pub fn storage_common_merge(
storage: *mut Storage,
old_path: *const core::ffi::c_char,
new_path: *const core::ffi::c_char,
) -> FS_Error;
}
extern "C" {
#[doc = "Create a directory.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the directory path.\n # Returns\n\nFSE_OK if the directory has been successfully created, any other error code on failure."]
pub fn storage_common_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> FS_Error;
}
extern "C" {
#[doc = "Get the general information about the storage.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `fs_path` - pointer to a zero-terminated string containing the path to the storage question.\n * `total_space` - pointer to the value to contain the total capacity, in bytes.\n * `free_space` - pointer to the value to contain the available space, in bytes.\n # Returns\n\nFSE_OK if the information has been successfully received, any other error code on failure."]
pub fn storage_common_fs_info(
storage: *mut Storage,
fs_path: *const core::ffi::c_char,
total_space: *mut u64,
free_space: *mut u64,
) -> FS_Error;
}
extern "C" {
#[doc = "Parse aliases in a path and replace them with the real path.\n\n Necessary special directories will be created automatically if they did not exist.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path in question."]
pub fn storage_common_resolve_path_and_ensure_app_directory(
storage: *mut Storage,
path: *mut FuriString,
);
}
extern "C" {
#[doc = "Move the contents of source folder to destination one and rename all conflicting files.\n\n Source folder will be deleted if the migration was successful.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `source` - pointer to a zero-terminated string containing the source path.\n * `dest` - pointer to a zero-terminated string containing the destination path.\n # Returns\n\nFSE_OK if the migration was successfull completed, any other error code on failure."]
pub fn storage_common_migrate(
storage: *mut Storage,
source: *const core::ffi::c_char,
dest: *const core::ffi::c_char,
) -> FS_Error;
}
extern "C" {
#[doc = "Check whether a file or a directory exists.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the path in question.\n # Returns\n\ntrue if a file or a directory exists, false otherwise."]
pub fn storage_common_exists(storage: *mut Storage, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Check whether two paths are equivalent.\n\n This function will resolve aliases and apply filesystem-specific\n rules to determine whether the two given paths are equivalent.\n\n Examples:\n - /int/text and /ext/test -> false (Different storages),\n - /int/Test and /int/test -> false (Case-sensitive storage),\n - /ext/Test and /ext/test -> true (Case-insensitive storage).\n\n If the truncate parameter is set to true, the second path will be\n truncated to be no longer than the first one. It is useful to determine\n whether path2 is a subdirectory of path1.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path1` - pointer to a zero-terminated string containing the first path.\n * `path2` - pointer to a zero-terminated string containing the second path.\n * `truncate` - whether to truncate path2 to be no longer than path1.\n # Returns\n\ntrue if paths are equivalent, false otherwise."]
pub fn storage_common_equivalent_path(
storage: *mut Storage,
path1: *const core::ffi::c_char,
path2: *const core::ffi::c_char,
truncate: bool,
) -> bool;
}
extern "C" {
#[doc = "Get the textual description of a numeric error identifer.\n\n # Arguments\n\n* `error_id` - numeric identifier of the error in question.\n # Returns\n\npointer to a statically allocated zero-terminated string containing the respective error text."]
pub fn storage_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get the numeric error identifier from a file instance.\n\n It is not possible to get the error identifier after the file has been closed.\n\n # Arguments\n\n* `file` - pointer to the file instance in question (must NOT be NULL).\n # Returns\n\nnumeric identifier of the last error associated with the file instance."]
pub fn storage_file_get_error(file: *mut File) -> FS_Error;
}
extern "C" {
#[doc = "Get the textual description of a the last error associated with a file instance.\n\n It is not possible to get the error text after the file has been closed.\n\n # Arguments\n\n* `file` - pointer to the file instance in question (must NOT be NULL).\n # Returns\n\npointer to a statically allocated zero-terminated string containing the respective error text."]
pub fn storage_file_get_error_desc(file: *mut File) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Format the SD Card.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\nFSE_OK if the card was successfully formatted, any other error code on failure."]
pub fn storage_sd_format(storage: *mut Storage) -> FS_Error;
}
extern "C" {
#[doc = "Unmount the SD card.\n\n These return values have special meaning:\n - FSE_NOT_READY if the SD card is not mounted.\n - FSE_DENIED if there are open files on the SD card.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\nFSE_OK if the card was successfully formatted, any other error code on failure."]
pub fn storage_sd_unmount(storage: *mut Storage) -> FS_Error;
}
extern "C" {
#[doc = "Mount the SD card.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\nFSE_OK if the card was successfully mounted, any other error code on failure."]
pub fn storage_sd_mount(storage: *mut Storage) -> FS_Error;
}
extern "C" {
#[doc = "Get SD card information.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `info` - pointer to the info object to contain the requested information.\n # Returns\n\nFSE_OK if the info was successfully received, any other error code on failure."]
pub fn storage_sd_info(storage: *mut Storage, info: *mut SDInfo) -> FS_Error;
}
extern "C" {
#[doc = "Get SD card status.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n # Returns\n\nstorage status in the form of a numeric error identifier."]
pub fn storage_sd_status(storage: *mut Storage) -> FS_Error;
}
#[doc = "Internal Storage Backup/Restore"]
pub type StorageNameConverter = ::core::option::Option<unsafe extern "C" fn(arg1: *mut FuriString)>;
extern "C" {
#[doc = "Back up the internal storage contents to a *.tar archive.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `dstname` - pointer to a zero-terminated string containing the archive file path.\n # Returns\n\nFSE_OK if the storage was successfully backed up, any other error code on failure."]
pub fn storage_int_backup(storage: *mut Storage, dstname: *const core::ffi::c_char)
-> FS_Error;
}
extern "C" {
#[doc = "Restore the internal storage contents from a *.tar archive.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `dstname` - pointer to a zero-terminated string containing the archive file path.\n * `converter` - pointer to a filename conversion function (may be NULL).\n # Returns\n\nFSE_OK if the storage was successfully restored, any other error code on failure."]
pub fn storage_int_restore(
storage: *mut Storage,
dstname: *const core::ffi::c_char,
converter: StorageNameConverter,
) -> FS_Error;
}
extern "C" {
#[doc = "Remove a file or a directory.\n\n The following conditions must be met:\n - the directory must be empty.\n - the file or the directory must NOT be open.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the item path.\n # Returns\n\ntrue on success or if the item does not exist, false otherwise."]
pub fn storage_simply_remove(storage: *mut Storage, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Recursively remove a file or a directory.\n\n Unlike storage_simply_remove(), the directory does not need to be empty.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the item path.\n # Returns\n\ntrue on success or if the item does not exist, false otherwise."]
pub fn storage_simply_remove_recursive(
storage: *mut Storage,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Create a directory.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `path` - pointer to a zero-terminated string containing the directory path.\n # Returns\n\ntrue on success or if directory does already exist, false otherwise."]
pub fn storage_simply_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Get the next free filename in a directory.\n\n Usage example:\n ```c\n FuriString* file_name = furi_string_alloc();\n Storage* storage = furi_record_open(RECORD_STORAGE);\n\n storage_get_next_filename(storage,\n \"/ext/test\",\n \"cookies\",\n \".yum\",\n 20);\n\n furi_record_close(RECORD_STORAGE);\n\n use_file_name(file_name);\n\n furi_string_free(file_name);\n ```\n Possible file_name values after calling storage_get_next_filename():\n \"cookies\", \"cookies1\", \"cookies2\", ... etc depending on whether any of\n these files have already existed in the directory.\n\n > **Note:** If the resulting next file name length is greater than set by the max_len\n parameter, the original filename will be returned instead.\n\n # Arguments\n\n* `storage` - pointer to a storage API instance.\n * `dirname` - pointer to a zero-terminated string containing the directory path.\n * `filename` - pointer to a zero-terminated string containing the file name.\n * `fileextension` - pointer to a zero-terminated string containing the file extension.\n * `nextfilename` - pointer to a dynamic string containing the resulting file name.\n * `max_len` - maximum length of the new name."]
pub fn storage_get_next_filename(
storage: *mut Storage,
dirname: *const core::ffi::c_char,
filename: *const core::ffi::c_char,
fileextension: *const core::ffi::c_char,
nextfilename: *mut FuriString,
max_len: u8,
);
}
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusSuccess:
FlipperApplicationPreloadStatus = 0;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusInvalidFile:
FlipperApplicationPreloadStatus = 1;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusNotEnoughMemory:
FlipperApplicationPreloadStatus = 2;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusInvalidManifest:
FlipperApplicationPreloadStatus = 3;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusApiTooOld:
FlipperApplicationPreloadStatus = 4;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusApiTooNew:
FlipperApplicationPreloadStatus = 5;
pub const FlipperApplicationPreloadStatus_FlipperApplicationPreloadStatusTargetMismatch:
FlipperApplicationPreloadStatus = 6;
pub type FlipperApplicationPreloadStatus = core::ffi::c_uchar;
pub const FlipperApplicationLoadStatus_FlipperApplicationLoadStatusSuccess:
FlipperApplicationLoadStatus = 0;
pub const FlipperApplicationLoadStatus_FlipperApplicationLoadStatusUnspecifiedError:
FlipperApplicationLoadStatus = 1;
pub const FlipperApplicationLoadStatus_FlipperApplicationLoadStatusMissingImports:
FlipperApplicationLoadStatus = 2;
pub type FlipperApplicationLoadStatus = core::ffi::c_uchar;
extern "C" {
#[doc = "Get text description of preload status\n # Arguments\n\n* `status` - Status code\n # Returns\n\nString pointer to description"]
pub fn flipper_application_preload_status_to_string(
status: FlipperApplicationPreloadStatus,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get text description of load status\n # Arguments\n\n* `status` - Status code\n # Returns\n\nString pointer to description"]
pub fn flipper_application_load_status_to_string(
status: FlipperApplicationLoadStatus,
) -> *const core::ffi::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FlipperApplication {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Initialize FlipperApplication object\n # Arguments\n\n* `storage` - Storage instance\n * `api_interface` - ELF API interface to use for pre-loading and symbol resolving\n # Returns\n\nApplication instance"]
pub fn flipper_application_alloc(
storage: *mut Storage,
api_interface: *const ElfApiInterface,
) -> *mut FlipperApplication;
}
extern "C" {
#[doc = "Destroy FlipperApplication object\n # Arguments\n\n* `app` - Application pointer"]
pub fn flipper_application_free(app: *mut FlipperApplication);
}
extern "C" {
#[doc = "Validate elf file and load application metadata\n\n # Arguments\n\n* `app` - Application pointer\n * `path` (direction in) - The path to fap file\n\n # Returns\n\nPreload result code"]
pub fn flipper_application_preload(
app: *mut FlipperApplication,
path: *const core::ffi::c_char,
) -> FlipperApplicationPreloadStatus;
}
extern "C" {
#[doc = "Validate elf file and load application manifest\n\n # Arguments\n\n* `app` - Application pointer\n * `path` (direction in) - The path to fap file\n\n # Returns\n\nPreload result code"]
pub fn flipper_application_preload_manifest(
app: *mut FlipperApplication,
path: *const core::ffi::c_char,
) -> FlipperApplicationPreloadStatus;
}
extern "C" {
#[doc = "Get pointer to application manifest for preloaded application\n # Arguments\n\n* `app` - Application pointer\n # Returns\n\nPointer to application manifest"]
pub fn flipper_application_get_manifest(
app: *mut FlipperApplication,
) -> *const FlipperApplicationManifest;
}
extern "C" {
#[doc = "Load sections and process relocations for already pre-loaded application\n # Arguments\n\n* `app` - Application pointer\n # Returns\n\nLoad result code"]
pub fn flipper_application_map_to_memory(
app: *mut FlipperApplication,
) -> FlipperApplicationLoadStatus;
}
extern "C" {
#[doc = "Allocate application thread at entry point address, using app name and\n stack size from metadata. Returned thread isn't started yet.\n Can be only called once for application instance.\n # Arguments\n\n* `app` - Applicaiton pointer\n * `args` - Args to pass to app's entry point\n # Returns\n\nCreated thread"]
pub fn flipper_application_alloc_thread(
app: *mut FlipperApplication,
args: *const core::ffi::c_char,
) -> *mut FuriThread;
}
extern "C" {
#[doc = "Check if application is a plugin (not a runnable standalone app)\n # Arguments\n\n* `app` - Application pointer\n # Returns\n\ntrue if application is a plugin, false otherwise"]
pub fn flipper_application_is_plugin(app: *mut FlipperApplication) -> bool;
}
#[doc = "An object that describes a plugin - must be returned by plugin's entry point"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FlipperAppPluginDescriptor {
pub appid: *const core::ffi::c_char,
pub ep_api_version: u32,
pub entry_point: *const core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_FlipperAppPluginDescriptor() {
const UNINIT: ::core::mem::MaybeUninit<FlipperAppPluginDescriptor> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperAppPluginDescriptor>(),
12usize,
concat!("Size of: ", stringify!(FlipperAppPluginDescriptor))
);
assert_eq!(
::core::mem::align_of::<FlipperAppPluginDescriptor>(),
4usize,
concat!("Alignment of ", stringify!(FlipperAppPluginDescriptor))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).appid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperAppPluginDescriptor),
"::",
stringify!(appid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ep_api_version) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FlipperAppPluginDescriptor),
"::",
stringify!(ep_api_version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).entry_point) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FlipperAppPluginDescriptor),
"::",
stringify!(entry_point)
)
);
}
extern "C" {
#[doc = "Get plugin descriptor for preloaded plugin\n # Arguments\n\n* `app` - Application pointer\n # Returns\n\nPointer to plugin descriptor"]
pub fn flipper_application_plugin_get_descriptor(
app: *mut FlipperApplication,
) -> *const FlipperAppPluginDescriptor;
}
extern "C" {
#[doc = "Load name and icon from FAP file.\n\n # Arguments\n\n* `path` - Path to FAP file.\n * `storage` - Storage instance.\n * `icon_ptr` - Icon pointer.\n * `item_name` - Application name.\n # Returns\n\ntrue if icon and name were loaded successfully."]
pub fn flipper_application_load_name_and_icon(
path: *mut FuriString,
storage: *mut Storage,
icon_ptr: *mut *mut u8,
item_name: *mut FuriString,
) -> bool;
}
pub type SubGhzBegin = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzEnd = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzIsConnect = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzReset = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzSleep = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzIdle = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzLoadPreset =
::core::option::Option<unsafe extern "C" fn(preset: FuriHalSubGhzPreset, preset_data: *mut u8)>;
pub type SubGhzSetFrequency = ::core::option::Option<unsafe extern "C" fn(frequency: u32) -> u32>;
pub type SubGhzIsFrequencyValid =
::core::option::Option<unsafe extern "C" fn(frequency: u32) -> bool>;
pub type SubGhzSetAsyncMirrorPin =
::core::option::Option<unsafe extern "C" fn(gpio: *const GpioPin)>;
pub type SubGhzGetDataGpio = ::core::option::Option<unsafe extern "C" fn() -> *const GpioPin>;
pub type SubGhzSetTx = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzFlushTx = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzStartAsyncTx = ::core::option::Option<
unsafe extern "C" fn(callback: *mut core::ffi::c_void, context: *mut core::ffi::c_void) -> bool,
>;
pub type SubGhzIsAsyncCompleteTx = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzStopAsyncTx = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzSetRx = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzFlushRx = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzStartAsyncRx = ::core::option::Option<
unsafe extern "C" fn(callback: *mut core::ffi::c_void, context: *mut core::ffi::c_void),
>;
pub type SubGhzStopAsyncRx = ::core::option::Option<unsafe extern "C" fn()>;
pub type SubGhzGetRSSI = ::core::option::Option<unsafe extern "C" fn() -> f32>;
pub type SubGhzGetLQI = ::core::option::Option<unsafe extern "C" fn() -> u8>;
pub type SubGhzRxPipeNotEmpty = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzRxIsDataCrcValid = ::core::option::Option<unsafe extern "C" fn() -> bool>;
pub type SubGhzReadPacket =
::core::option::Option<unsafe extern "C" fn(data: *mut u8, size: *mut u8)>;
pub type SubGhzWritePacket =
::core::option::Option<unsafe extern "C" fn(data: *const u8, size: u8)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzDeviceInterconnect {
pub begin: SubGhzBegin,
pub end: SubGhzEnd,
pub is_connect: SubGhzIsConnect,
pub reset: SubGhzReset,
pub sleep: SubGhzSleep,
pub idle: SubGhzIdle,
pub load_preset: SubGhzLoadPreset,
pub set_frequency: SubGhzSetFrequency,
pub is_frequency_valid: SubGhzIsFrequencyValid,
pub set_async_mirror_pin: SubGhzSetAsyncMirrorPin,
pub get_data_gpio: SubGhzGetDataGpio,
pub set_tx: SubGhzSetTx,
pub flush_tx: SubGhzFlushTx,
pub start_async_tx: SubGhzStartAsyncTx,
pub is_async_complete_tx: SubGhzIsAsyncCompleteTx,
pub stop_async_tx: SubGhzStopAsyncTx,
pub set_rx: SubGhzSetRx,
pub flush_rx: SubGhzFlushRx,
pub start_async_rx: SubGhzStartAsyncRx,
pub stop_async_rx: SubGhzStopAsyncRx,
pub get_rssi: SubGhzGetRSSI,
pub get_lqi: SubGhzGetLQI,
pub rx_pipe_not_empty: SubGhzRxPipeNotEmpty,
pub is_rx_data_crc_valid: SubGhzRxIsDataCrcValid,
pub read_packet: SubGhzReadPacket,
pub write_packet: SubGhzWritePacket,
}
#[test]
fn bindgen_test_layout_SubGhzDeviceInterconnect() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzDeviceInterconnect> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzDeviceInterconnect>(),
104usize,
concat!("Size of: ", stringify!(SubGhzDeviceInterconnect))
);
assert_eq!(
::core::mem::align_of::<SubGhzDeviceInterconnect>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzDeviceInterconnect))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).begin) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(begin)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).end) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(end)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_connect) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(is_connect)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reset) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(reset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sleep) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(sleep)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).idle) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(idle)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).load_preset) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(load_preset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).set_frequency) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(set_frequency)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_frequency_valid) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(is_frequency_valid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).set_async_mirror_pin) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(set_async_mirror_pin)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_data_gpio) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(get_data_gpio)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).set_tx) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(set_tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flush_tx) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(flush_tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start_async_tx) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(start_async_tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_async_complete_tx) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(is_async_complete_tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stop_async_tx) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(stop_async_tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).set_rx) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(set_rx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flush_rx) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(flush_rx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start_async_rx) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(start_async_rx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stop_async_rx) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(stop_async_rx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_rssi) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(get_rssi)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_lqi) as usize - ptr as usize },
84usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(get_lqi)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rx_pipe_not_empty) as usize - ptr as usize },
88usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(rx_pipe_not_empty)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_rx_data_crc_valid) as usize - ptr as usize },
92usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(is_rx_data_crc_valid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).read_packet) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(read_packet)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).write_packet) as usize - ptr as usize },
100usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDeviceInterconnect),
"::",
stringify!(write_packet)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzDevice {
pub name: *const core::ffi::c_char,
pub interconnect: *const SubGhzDeviceInterconnect,
}
#[test]
fn bindgen_test_layout_SubGhzDevice() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzDevice> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzDevice>(),
8usize,
concat!("Size of: ", stringify!(SubGhzDevice))
);
assert_eq!(
::core::mem::align_of::<SubGhzDevice>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzDevice))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDevice),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).interconnect) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzDevice),
"::",
stringify!(interconnect)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Bt {
_unused: [u8; 0],
}
pub const BtStatus_BtStatusUnavailable: BtStatus = 0;
pub const BtStatus_BtStatusOff: BtStatus = 1;
pub const BtStatus_BtStatusAdvertising: BtStatus = 2;
pub const BtStatus_BtStatusConnected: BtStatus = 3;
pub type BtStatus = core::ffi::c_uchar;
pub type BtStatusChangedCallback =
::core::option::Option<unsafe extern "C" fn(status: BtStatus, context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Change BLE Profile\n > **Note:** Call of this function leads to 2nd core restart\n\n # Arguments\n\n* `bt` - Bt instance\n * `profile_template` - Profile template to change to\n * `params` - Profile parameters. Can be NULL\n\n # Returns\n\ntrue on success"]
pub fn bt_profile_start(
bt: *mut Bt,
profile_template: *const FuriHalBleProfileTemplate,
params: FuriHalBleProfileParams,
) -> *mut FuriHalBleProfileBase;
}
extern "C" {
#[doc = "Stop current BLE Profile and restore default profile\n > **Note:** Call of this function leads to 2nd core restart\n\n # Arguments\n\n* `bt` - Bt instance\n\n # Returns\n\ntrue on success"]
pub fn bt_profile_restore_default(bt: *mut Bt) -> bool;
}
extern "C" {
#[doc = "Disconnect from Central\n\n # Arguments\n\n* `bt` - Bt instance"]
pub fn bt_disconnect(bt: *mut Bt);
}
extern "C" {
#[doc = "Set callback for Bluetooth status change notification\n\n # Arguments\n\n* `bt` - Bt instance\n * `callback` - BtStatusChangedCallback instance\n * `context` - pointer to context"]
pub fn bt_set_status_changed_callback(
bt: *mut Bt,
callback: BtStatusChangedCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Forget bonded devices\n > **Note:** Leads to wipe ble key storage and deleting bt.keys\n\n # Arguments\n\n* `bt` - Bt instance"]
pub fn bt_forget_bonded_devices(bt: *mut Bt);
}
extern "C" {
#[doc = "Set keys storage file path\n\n # Arguments\n\n* `bt` - Bt instance\n * `keys_storage_path` - Path to file with saved keys"]
pub fn bt_keys_storage_set_storage_path(
bt: *mut Bt,
keys_storage_path: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Set default keys storage file path\n\n # Arguments\n\n* `bt` - Bt instance"]
pub fn bt_keys_storage_set_default_path(bt: *mut Bt);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BtKeysStorage {
_unused: [u8; 0],
}
extern "C" {
pub fn bt_keys_storage_alloc(keys_storage_path: *const core::ffi::c_char)
-> *mut BtKeysStorage;
}
extern "C" {
pub fn bt_keys_storage_free(instance: *mut BtKeysStorage);
}
extern "C" {
pub fn bt_keys_storage_set_file_path(
instance: *mut BtKeysStorage,
path: *const core::ffi::c_char,
);
}
extern "C" {
pub fn bt_keys_storage_set_ram_params(instance: *mut BtKeysStorage, buff: *mut u8, size: u16);
}
extern "C" {
pub fn bt_keys_storage_is_changed(instance: *mut BtKeysStorage) -> bool;
}
extern "C" {
pub fn bt_keys_storage_load(instance: *mut BtKeysStorage) -> bool;
}
extern "C" {
pub fn bt_keys_storage_update(
instance: *mut BtKeysStorage,
start_addr: *mut u8,
size: u32,
) -> bool;
}
extern "C" {
pub fn bt_keys_storage_delete(instance: *mut BtKeysStorage) -> bool;
}
#[doc = "< Default, loader lock is used"]
pub const CliCommandFlag_CliCommandFlagDefault: CliCommandFlag = 0;
pub const CliCommandFlag_CliCommandFlagParallelSafe: CliCommandFlag = 1;
#[doc = "< Safe to run with insomnia mode on"]
pub const CliCommandFlag_CliCommandFlagInsomniaSafe: CliCommandFlag = 2;
pub type CliCommandFlag = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Cli {
_unused: [u8; 0],
}
#[doc = "Cli callback function pointer. Implement this interface and use\n add_cli_command\n # Arguments\n\n* `args` - string with what was passed after command\n * `context` - pointer to whatever you gave us on cli_add_command"]
pub type CliCallback = ::core::option::Option<
unsafe extern "C" fn(cli: *mut Cli, args: *mut FuriString, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Add cli command Registers you command callback\n\n # Arguments\n\n* `cli` - pointer to cli instance\n * `name` - command name\n * `flags` - CliCommandFlag\n * `callback` - callback function\n * `context` - pointer to whatever we need to pass to callback"]
pub fn cli_add_command(
cli: *mut Cli,
name: *const core::ffi::c_char,
flags: CliCommandFlag,
callback: CliCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Print unified cmd usage tip\n\n # Arguments\n\n* `cmd` - cmd name\n * `usage` - usage tip\n * `arg` - arg passed by user"]
pub fn cli_print_usage(
cmd: *const core::ffi::c_char,
usage: *const core::ffi::c_char,
arg: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Delete cli command\n\n # Arguments\n\n* `cli` - pointer to cli instance\n * `name` - command name"]
pub fn cli_delete_command(cli: *mut Cli, name: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Read from terminal\n\n # Arguments\n\n* `cli` - Cli instance\n * `buffer` - pointer to buffer\n * `size` - size of buffer in bytes\n\n # Returns\n\nbytes read"]
pub fn cli_read(cli: *mut Cli, buffer: *mut u8, size: usize) -> usize;
}
extern "C" {
#[doc = "Non-blocking read from terminal\n\n # Arguments\n\n* `cli` - Cli instance\n * `buffer` - pointer to buffer\n * `size` - size of buffer in bytes\n * `timeout` - timeout value in ms\n\n # Returns\n\nbytes read"]
pub fn cli_read_timeout(cli: *mut Cli, buffer: *mut u8, size: usize, timeout: u32) -> usize;
}
extern "C" {
#[doc = "Non-blocking check for interrupt command received\n\n # Arguments\n\n* `cli` - Cli instance\n\n # Returns\n\ntrue if received"]
pub fn cli_cmd_interrupt_received(cli: *mut Cli) -> bool;
}
extern "C" {
#[doc = "Write to terminal Do it only from inside of cli call.\n\n # Arguments\n\n* `cli` - Cli instance\n * `buffer` - pointer to buffer\n * `size` - size of buffer in bytes"]
pub fn cli_write(cli: *mut Cli, buffer: *const u8, size: usize);
}
extern "C" {
#[doc = "Read character\n\n # Arguments\n\n* `cli` - Cli instance\n\n # Returns\n\nchar"]
pub fn cli_getc(cli: *mut Cli) -> core::ffi::c_char;
}
extern "C" {
#[doc = "New line Send new ine sequence"]
pub fn cli_nl(cli: *mut Cli);
}
extern "C" {
pub fn cli_session_open(cli: *mut Cli, session: *mut core::ffi::c_void);
}
extern "C" {
pub fn cli_session_close(cli: *mut Cli);
}
extern "C" {
pub fn cli_is_connected(cli: *mut Cli) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CliSession {
_unused: [u8; 0],
}
extern "C" {
pub static mut cli_vcp: CliSession;
}
extern "C" {
#[doc = "Get icon width\n\n # Arguments\n\n* `instance` (direction in) - pointer to Icon data\n\n # Returns\n\nwidth in pixels"]
pub fn icon_get_width(instance: *const Icon) -> u16;
}
extern "C" {
#[doc = "Get icon height\n\n # Arguments\n\n* `instance` (direction in) - pointer to Icon data\n\n # Returns\n\nheight in pixels"]
pub fn icon_get_height(instance: *const Icon) -> u16;
}
extern "C" {
#[doc = "Get Icon XBM bitmap data for the first frame\n\n # Arguments\n\n* `instance` (direction in) - pointer to Icon data\n\n # Returns\n\npointer to compressed XBM bitmap data"]
pub fn icon_get_data(instance: *const Icon) -> *const u8;
}
extern "C" {
#[doc = "Get Icon frame count\n\n # Arguments\n\n* `instance` (direction in) - pointer to Icon data\n\n # Returns\n\nframe count"]
pub fn icon_get_frame_count(instance: *const Icon) -> u32;
}
extern "C" {
#[doc = "Get Icon XBM bitmap data for a particular frame\n\n # Arguments\n\n* `instance` (direction in) - pointer to Icon data\n * `frame` (direction in) - frame index\n\n # Returns\n\npointer to compressed XBM bitmap data"]
pub fn icon_get_frame_data(instance: *const Icon, frame: u32) -> *const u8;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct IconAnimation {
_unused: [u8; 0],
}
#[doc = "Icon Animation Callback. Used for update notification"]
pub type IconAnimationCallback = ::core::option::Option<
unsafe extern "C" fn(instance: *mut IconAnimation, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Allocate icon animation instance with const icon data.\n\n always returns Icon or stops system if not enough memory\n\n # Arguments\n\n* `icon` (direction in) - pointer to Icon data\n\n # Returns\n\nIconAnimation instance"]
pub fn icon_animation_alloc(icon: *const Icon) -> *mut IconAnimation;
}
extern "C" {
#[doc = "Release icon animation instance\n\n # Arguments\n\n* `instance` - IconAnimation instance"]
pub fn icon_animation_free(instance: *mut IconAnimation);
}
extern "C" {
#[doc = "Set IconAnimation update callback\n\n Normally you do not need to use this function, use view_tie_icon_animation\n instead.\n\n # Arguments\n\n* `instance` - IconAnimation instance\n * `callback` (direction in) - IconAnimationCallback\n * `context` - callback context"]
pub fn icon_animation_set_update_callback(
instance: *mut IconAnimation,
callback: IconAnimationCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get icon animation width\n\n # Arguments\n\n* `instance` - IconAnimation instance\n\n # Returns\n\nwidth in pixels"]
pub fn icon_animation_get_width(instance: *const IconAnimation) -> u8;
}
extern "C" {
#[doc = "Get icon animation height\n\n # Arguments\n\n* `instance` - IconAnimation instance\n\n # Returns\n\nheight in pixels"]
pub fn icon_animation_get_height(instance: *const IconAnimation) -> u8;
}
extern "C" {
#[doc = "Start icon animation\n\n # Arguments\n\n* `instance` - IconAnimation instance"]
pub fn icon_animation_start(instance: *mut IconAnimation);
}
extern "C" {
#[doc = "Stop icon animation\n\n # Arguments\n\n* `instance` - IconAnimation instance"]
pub fn icon_animation_stop(instance: *mut IconAnimation);
}
extern "C" {
#[doc = "Returns true if current frame is a last one\n\n # Arguments\n\n* `instance` - IconAnimation instance\n\n # Returns\n\ntrue if last frame"]
pub fn icon_animation_is_last_frame(instance: *const IconAnimation) -> bool;
}
pub const Color_ColorWhite: Color = 0;
pub const Color_ColorBlack: Color = 1;
pub const Color_ColorXOR: Color = 2;
#[doc = "Color enumeration"]
pub type Color = core::ffi::c_uchar;
pub const Font_FontPrimary: Font = 0;
pub const Font_FontSecondary: Font = 1;
pub const Font_FontKeyboard: Font = 2;
pub const Font_FontBigNumbers: Font = 3;
pub const Font_FontTotalNumber: Font = 4;
#[doc = "Fonts enumeration"]
pub type Font = core::ffi::c_uchar;
pub const Align_AlignLeft: Align = 0;
pub const Align_AlignRight: Align = 1;
pub const Align_AlignTop: Align = 2;
pub const Align_AlignBottom: Align = 3;
pub const Align_AlignCenter: Align = 4;
#[doc = "Alignment enumeration"]
pub type Align = core::ffi::c_uchar;
pub const CanvasOrientation_CanvasOrientationHorizontal: CanvasOrientation = 0;
pub const CanvasOrientation_CanvasOrientationHorizontalFlip: CanvasOrientation = 1;
pub const CanvasOrientation_CanvasOrientationVertical: CanvasOrientation = 2;
pub const CanvasOrientation_CanvasOrientationVerticalFlip: CanvasOrientation = 3;
#[doc = "Canvas Orientation"]
pub type CanvasOrientation = core::ffi::c_uchar;
pub const CanvasDirection_CanvasDirectionLeftToRight: CanvasDirection = 0;
pub const CanvasDirection_CanvasDirectionTopToBottom: CanvasDirection = 1;
pub const CanvasDirection_CanvasDirectionRightToLeft: CanvasDirection = 2;
pub const CanvasDirection_CanvasDirectionBottomToTop: CanvasDirection = 3;
#[doc = "Font Direction"]
pub type CanvasDirection = core::ffi::c_uchar;
#[doc = "Font parameters"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CanvasFontParameters {
pub leading_default: u8,
pub leading_min: u8,
pub height: u8,
pub descender: u8,
}
#[test]
fn bindgen_test_layout_CanvasFontParameters() {
const UNINIT: ::core::mem::MaybeUninit<CanvasFontParameters> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<CanvasFontParameters>(),
4usize,
concat!("Size of: ", stringify!(CanvasFontParameters))
);
assert_eq!(
::core::mem::align_of::<CanvasFontParameters>(),
1usize,
concat!("Alignment of ", stringify!(CanvasFontParameters))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).leading_default) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(CanvasFontParameters),
"::",
stringify!(leading_default)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).leading_min) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(CanvasFontParameters),
"::",
stringify!(leading_min)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(CanvasFontParameters),
"::",
stringify!(height)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).descender) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(CanvasFontParameters),
"::",
stringify!(descender)
)
);
}
pub const IconRotation_IconRotation0: IconRotation = 0;
pub const IconRotation_IconRotation90: IconRotation = 1;
pub const IconRotation_IconRotation180: IconRotation = 2;
pub const IconRotation_IconRotation270: IconRotation = 3;
#[doc = "Icon rotation"]
pub type IconRotation = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Canvas {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Reset canvas drawing tools configuration\n\n # Arguments\n\n* `canvas` - Canvas instance"]
pub fn canvas_reset(canvas: *mut Canvas);
}
extern "C" {
#[doc = "Commit canvas. Send buffer to display\n\n # Arguments\n\n* `canvas` - Canvas instance"]
pub fn canvas_commit(canvas: *mut Canvas);
}
extern "C" {
#[doc = "Get Canvas width\n\n # Arguments\n\n* `canvas` - Canvas instance\n\n # Returns\n\nwidth in pixels."]
pub fn canvas_width(canvas: *const Canvas) -> usize;
}
extern "C" {
#[doc = "Get Canvas height\n\n # Arguments\n\n* `canvas` - Canvas instance\n\n # Returns\n\nheight in pixels."]
pub fn canvas_height(canvas: *const Canvas) -> usize;
}
extern "C" {
#[doc = "Get current font height\n\n # Arguments\n\n* `canvas` - Canvas instance\n\n # Returns\n\nheight in pixels."]
pub fn canvas_current_font_height(canvas: *const Canvas) -> usize;
}
extern "C" {
#[doc = "Get font parameters\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `font` - Font\n\n # Returns\n\npointer to CanvasFontParameters structure"]
pub fn canvas_get_font_params(canvas: *const Canvas, font: Font)
-> *const CanvasFontParameters;
}
extern "C" {
#[doc = "Clear canvas\n\n # Arguments\n\n* `canvas` - Canvas instance"]
pub fn canvas_clear(canvas: *mut Canvas);
}
extern "C" {
#[doc = "Set drawing color\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `color` - Color"]
pub fn canvas_set_color(canvas: *mut Canvas, color: Color);
}
extern "C" {
#[doc = "Set font swap Argument String Rotation Description\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `dir` - Direction font"]
pub fn canvas_set_font_direction(canvas: *mut Canvas, dir: CanvasDirection);
}
extern "C" {
#[doc = "Invert drawing color\n\n # Arguments\n\n* `canvas` - Canvas instance"]
pub fn canvas_invert_color(canvas: *mut Canvas);
}
extern "C" {
#[doc = "Set drawing font\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `font` - Font"]
pub fn canvas_set_font(canvas: *mut Canvas, font: Font);
}
extern "C" {
#[doc = "Set custom drawing font\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `font` - Pointer to u8g2 const uint8_t* font array"]
pub fn canvas_set_custom_u8g2_font(canvas: *mut Canvas, font: *const u8);
}
extern "C" {
#[doc = "Draw string at position of baseline defined by x, y.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - anchor point x coordinate\n * `y` - anchor point y coordinate\n * `str` - C-string"]
pub fn canvas_draw_str(canvas: *mut Canvas, x: i32, y: i32, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Draw aligned string defined by x, y.\n\n Align calculated from position of baseline, string width and ascent (height\n of the glyphs above the baseline)\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - anchor point x coordinate\n * `y` - anchor point y coordinate\n * `horizontal` - horizontal alignment\n * `vertical` - vertical alignment\n * `str` - C-string"]
pub fn canvas_draw_str_aligned(
canvas: *mut Canvas,
x: i32,
y: i32,
horizontal: Align,
vertical: Align,
str_: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Get string width\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `str` - C-string\n\n # Returns\n\nwidth in pixels."]
pub fn canvas_string_width(canvas: *mut Canvas, str_: *const core::ffi::c_char) -> u16;
}
extern "C" {
#[doc = "Get glyph width\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `symbol` (direction in) - character\n\n # Returns\n\nwidth in pixels"]
pub fn canvas_glyph_width(canvas: *mut Canvas, symbol: u16) -> usize;
}
extern "C" {
#[doc = "Draw bitmap picture at position defined by x,y.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - width of bitmap\n * `height` - height of bitmap\n * `compressed_bitmap_data` - compressed bitmap data"]
pub fn canvas_draw_bitmap(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
compressed_bitmap_data: *const u8,
);
}
extern "C" {
#[doc = "Draw icon at position defined by x,y with rotation and flip.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `icon` - Icon instance\n * `rotation` - IconRotation"]
pub fn canvas_draw_icon_ex(
canvas: *mut Canvas,
x: i32,
y: i32,
icon: *const Icon,
rotation: IconRotation,
);
}
extern "C" {
#[doc = "Draw animation at position defined by x,y.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `icon_animation` - IconAnimation instance"]
pub fn canvas_draw_icon_animation(
canvas: *mut Canvas,
x: i32,
y: i32,
icon_animation: *mut IconAnimation,
);
}
extern "C" {
#[doc = "Draw icon at position defined by x,y.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `icon` - Icon instance"]
pub fn canvas_draw_icon(canvas: *mut Canvas, x: i32, y: i32, icon: *const Icon);
}
extern "C" {
#[doc = "Draw XBM bitmap\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` (direction in) - bitmap width\n * `height` (direction in) - bitmap height\n * `bitmap` - pointer to XBM bitmap data"]
pub fn canvas_draw_xbm(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
bitmap: *const u8,
);
}
extern "C" {
#[doc = "Draw dot at x,y\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate"]
pub fn canvas_draw_dot(canvas: *mut Canvas, x: i32, y: i32);
}
extern "C" {
#[doc = "Draw box of width, height at x,y\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - box width\n * `height` - box height"]
pub fn canvas_draw_box(canvas: *mut Canvas, x: i32, y: i32, width: usize, height: usize);
}
extern "C" {
#[doc = "Draw frame of width, height at x,y\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - frame width\n * `height` - frame height"]
pub fn canvas_draw_frame(canvas: *mut Canvas, x: i32, y: i32, width: usize, height: usize);
}
extern "C" {
#[doc = "Draw line from x1,y1 to x2,y2\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x1` - x1 coordinate\n * `y1` - y1 coordinate\n * `x2` - x2 coordinate\n * `y2` - y2 coordinate"]
pub fn canvas_draw_line(canvas: *mut Canvas, x1: i32, y1: i32, x2: i32, y2: i32);
}
extern "C" {
#[doc = "Draw circle at x,y with radius r\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `radius` - radius"]
pub fn canvas_draw_circle(canvas: *mut Canvas, x: i32, y: i32, radius: usize);
}
extern "C" {
#[doc = "Draw disc at x,y with radius r\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `radius` - radius"]
pub fn canvas_draw_disc(canvas: *mut Canvas, x: i32, y: i32, radius: usize);
}
extern "C" {
#[doc = "Draw triangle with given base and height lengths and their intersection\n coordinate\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate of base and height intersection\n * `y` - y coordinate of base and height intersection\n * `base` - length of triangle side\n * `height` - length of triangle height\n * `dir` - CanvasDirection triangle orientation"]
pub fn canvas_draw_triangle(
canvas: *mut Canvas,
x: i32,
y: i32,
base: usize,
height: usize,
dir: CanvasDirection,
);
}
extern "C" {
#[doc = "Draw glyph\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `ch` - character"]
pub fn canvas_draw_glyph(canvas: *mut Canvas, x: i32, y: i32, ch: u16);
}
extern "C" {
#[doc = "Set transparency mode\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `alpha` - transparency mode"]
pub fn canvas_set_bitmap_mode(canvas: *mut Canvas, alpha: bool);
}
extern "C" {
#[doc = "Draw rounded-corner frame of width, height at x,y, with round value radius\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - frame width\n * `height` - frame height\n * `radius` - frame corner radius"]
pub fn canvas_draw_rframe(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
radius: usize,
);
}
extern "C" {
#[doc = "Draw rounded-corner box of width, height at x,y, with round value raduis\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - box width\n * `height` - box height\n * `radius` - box corner radius"]
pub fn canvas_draw_rbox(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
radius: usize,
);
}
#[doc = "< Press event, emitted after debounce"]
pub const InputType_InputTypePress: InputType = 0;
#[doc = "< Release event, emitted after debounce"]
pub const InputType_InputTypeRelease: InputType = 1;
#[doc = "< Short event, emitted after InputTypeRelease done within INPUT_LONG_PRESS interval"]
pub const InputType_InputTypeShort: InputType = 2;
#[doc = "< Long event, emitted after INPUT_LONG_PRESS_COUNTS interval, asynchronous to InputTypeRelease"]
pub const InputType_InputTypeLong: InputType = 3;
#[doc = "< Repeat event, emitted with INPUT_LONG_PRESS_COUNTS period after InputTypeLong event"]
pub const InputType_InputTypeRepeat: InputType = 4;
#[doc = "< Special value for exceptional"]
pub const InputType_InputTypeMAX: InputType = 5;
#[doc = "Input Types\n Some of them are physical events and some logical"]
pub type InputType = core::ffi::c_uchar;
#[doc = "Input Event, dispatches with FuriPubSub"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct InputEvent {
pub __bindgen_anon_1: InputEvent__bindgen_ty_1,
pub key: InputKey,
pub type_: InputType,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union InputEvent__bindgen_ty_1 {
pub sequence: u32,
pub __bindgen_anon_1: InputEvent__bindgen_ty_1__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InputEvent__bindgen_ty_1__bindgen_ty_1 {
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[test]
fn bindgen_test_layout_InputEvent__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(
::core::mem::size_of::<InputEvent__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(InputEvent__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<InputEvent__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(InputEvent__bindgen_ty_1__bindgen_ty_1)
)
);
}
impl InputEvent__bindgen_ty_1__bindgen_ty_1 {
#[inline]
pub fn sequence_source(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
}
#[inline]
pub fn set_sequence_source(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 2u8, val as u64)
}
}
#[inline]
pub fn sequence_counter(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 30u8) as u32) }
}
#[inline]
pub fn set_sequence_counter(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_1.set(2usize, 30u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
sequence_source: u8,
sequence_counter: u32,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 2u8, {
let sequence_source: u8 = unsafe { ::core::mem::transmute(sequence_source) };
sequence_source as u64
});
__bindgen_bitfield_unit.set(2usize, 30u8, {
let sequence_counter: u32 = unsafe { ::core::mem::transmute(sequence_counter) };
sequence_counter as u64
});
__bindgen_bitfield_unit
}
}
#[test]
fn bindgen_test_layout_InputEvent__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<InputEvent__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<InputEvent__bindgen_ty_1>(),
4usize,
concat!("Size of: ", stringify!(InputEvent__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<InputEvent__bindgen_ty_1>(),
4usize,
concat!("Alignment of ", stringify!(InputEvent__bindgen_ty_1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sequence) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(InputEvent__bindgen_ty_1),
"::",
stringify!(sequence)
)
);
}
#[test]
fn bindgen_test_layout_InputEvent() {
const UNINIT: ::core::mem::MaybeUninit<InputEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<InputEvent>(),
8usize,
concat!("Size of: ", stringify!(InputEvent))
);
assert_eq!(
::core::mem::align_of::<InputEvent>(),
4usize,
concat!("Alignment of ", stringify!(InputEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(InputEvent),
"::",
stringify!(key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(InputEvent),
"::",
stringify!(type_)
)
);
}
extern "C" {
#[doc = "Get human readable input key name\n # Arguments\n\n* `key` - - InputKey\n # Returns\n\nstring"]
pub fn input_get_key_name(key: InputKey) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get human readable input type name\n # Arguments\n\n* `type` - - InputType\n # Returns\n\nstring"]
pub fn input_get_type_name(type_: InputType) -> *const core::ffi::c_char;
}
pub const ViewOrientation_ViewOrientationHorizontal: ViewOrientation = 0;
pub const ViewOrientation_ViewOrientationHorizontalFlip: ViewOrientation = 1;
pub const ViewOrientation_ViewOrientationVertical: ViewOrientation = 2;
pub const ViewOrientation_ViewOrientationVerticalFlip: ViewOrientation = 3;
pub type ViewOrientation = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct View {
_unused: [u8; 0],
}
#[doc = "View Draw callback\n # Arguments\n\n* `canvas` - pointer to canvas\n * `model` - pointer to model\n called from GUI thread"]
pub type ViewDrawCallback = ::core::option::Option<
unsafe extern "C" fn(canvas: *mut Canvas, model: *mut core::ffi::c_void),
>;
#[doc = "View Input callback\n # Arguments\n\n* `event` - pointer to input event data\n * `context` - pointer to context\n # Returns\n\ntrue if event handled, false if event ignored\n called from GUI thread"]
pub type ViewInputCallback = ::core::option::Option<
unsafe extern "C" fn(event: *mut InputEvent, context: *mut core::ffi::c_void) -> bool,
>;
#[doc = "View Custom callback\n # Arguments\n\n* `event` - number of custom event\n * `context` - pointer to context\n # Returns\n\ntrue if event handled, false if event ignored"]
pub type ViewCustomCallback = ::core::option::Option<
unsafe extern "C" fn(event: u32, context: *mut core::ffi::c_void) -> bool,
>;
#[doc = "View navigation callback\n # Arguments\n\n* `context` - pointer to context\n # Returns\n\nnext view id\n called from GUI thread"]
pub type ViewNavigationCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void) -> u32>;
#[doc = "View callback\n # Arguments\n\n* `context` - pointer to context\n called from GUI thread"]
pub type ViewCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "View Update Callback Called upon model change, need to be propagated to GUI\n throw ViewPort update\n # Arguments\n\n* `view` - pointer to view\n * `context` - pointer to context\n called from GUI thread"]
pub type ViewUpdateCallback =
::core::option::Option<unsafe extern "C" fn(view: *mut View, context: *mut core::ffi::c_void)>;
#[doc = "Model is not allocated"]
pub const ViewModelType_ViewModelTypeNone: ViewModelType = 0;
#[doc = "Model consist of atomic types and/or partial update is not critical for rendering.\n Lock free."]
pub const ViewModelType_ViewModelTypeLockFree: ViewModelType = 1;
#[doc = "Model access is guarded with mutex.\n Locking gui thread."]
pub const ViewModelType_ViewModelTypeLocking: ViewModelType = 2;
#[doc = "View model types"]
pub type ViewModelType = core::ffi::c_uchar;
extern "C" {
#[doc = "Allocate and init View\n # Returns\n\nView instance"]
pub fn view_alloc() -> *mut View;
}
extern "C" {
#[doc = "Free View\n\n # Arguments\n\n* `view` - instance"]
pub fn view_free(view: *mut View);
}
extern "C" {
#[doc = "Tie IconAnimation with View\n\n # Arguments\n\n* `view` - View instance\n * `icon_animation` - IconAnimation instance"]
pub fn view_tie_icon_animation(view: *mut View, icon_animation: *mut IconAnimation);
}
extern "C" {
#[doc = "Set View Draw callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - draw callback"]
pub fn view_set_draw_callback(view: *mut View, callback: ViewDrawCallback);
}
extern "C" {
#[doc = "Set View Input callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - input callback"]
pub fn view_set_input_callback(view: *mut View, callback: ViewInputCallback);
}
extern "C" {
#[doc = "Set View Custom callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - input callback"]
pub fn view_set_custom_callback(view: *mut View, callback: ViewCustomCallback);
}
extern "C" {
#[doc = "Set Navigation Previous callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - input callback"]
pub fn view_set_previous_callback(view: *mut View, callback: ViewNavigationCallback);
}
extern "C" {
#[doc = "Set Enter callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - callback"]
pub fn view_set_enter_callback(view: *mut View, callback: ViewCallback);
}
extern "C" {
#[doc = "Set Exit callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - callback"]
pub fn view_set_exit_callback(view: *mut View, callback: ViewCallback);
}
extern "C" {
#[doc = "Set Update callback\n\n # Arguments\n\n* `view` - View instance\n * `callback` - callback"]
pub fn view_set_update_callback(view: *mut View, callback: ViewUpdateCallback);
}
extern "C" {
#[doc = "Set View Draw callback\n\n # Arguments\n\n* `view` - View instance\n * `context` - context for callbacks"]
pub fn view_set_update_callback_context(view: *mut View, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set View Draw callback\n\n # Arguments\n\n* `view` - View instance\n * `context` - context for callbacks"]
pub fn view_set_context(view: *mut View, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set View Orientation\n\n # Arguments\n\n* `view` - View instance\n * `orientation` - either vertical or horizontal"]
pub fn view_set_orientation(view: *mut View, orientation: ViewOrientation);
}
extern "C" {
#[doc = "Allocate view model.\n\n # Arguments\n\n* `view` - View instance\n * `type` - View Model Type\n * `size` - size"]
pub fn view_allocate_model(view: *mut View, type_: ViewModelType, size: usize);
}
extern "C" {
#[doc = "Free view model data memory.\n\n # Arguments\n\n* `view` - View instance"]
pub fn view_free_model(view: *mut View);
}
extern "C" {
#[doc = "Get view model data\n\n # Arguments\n\n* `view` - View instance\n\n # Returns\n\npointer to model data\n Don't forget to commit model changes"]
pub fn view_get_model(view: *mut View) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Commit view model\n\n # Arguments\n\n* `view` - View instance\n * `update` - true if you want to emit view update, false otherwise"]
pub fn view_commit_model(view: *mut View, update: bool);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FileBrowser {
_unused: [u8; 0],
}
pub type FileBrowserCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub type FileBrowserLoadItemCallback = ::core::option::Option<
unsafe extern "C" fn(
path: *mut FuriString,
context: *mut core::ffi::c_void,
icon: *mut *mut u8,
item_name: *mut FuriString,
) -> bool,
>;
extern "C" {
pub fn file_browser_alloc(result_path: *mut FuriString) -> *mut FileBrowser;
}
extern "C" {
pub fn file_browser_free(browser: *mut FileBrowser);
}
extern "C" {
pub fn file_browser_get_view(browser: *mut FileBrowser) -> *mut View;
}
extern "C" {
pub fn file_browser_configure(
browser: *mut FileBrowser,
extension: *const core::ffi::c_char,
base_path: *const core::ffi::c_char,
skip_assets: bool,
hide_dot_files: bool,
file_icon: *const Icon,
hide_ext: bool,
);
}
extern "C" {
pub fn file_browser_start(browser: *mut FileBrowser, path: *mut FuriString);
}
extern "C" {
pub fn file_browser_stop(browser: *mut FileBrowser);
}
extern "C" {
pub fn file_browser_set_callback(
browser: *mut FileBrowser,
callback: FileBrowserCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn file_browser_set_item_callback(
browser: *mut FileBrowser,
callback: FileBrowserLoadItemCallback,
context: *mut core::ffi::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DialogsApp {
_unused: [u8; 0],
}
#[doc = "File browser dialog extra options.\n This can be default-initialized using {dialog_file_browser_set_basic_options}.\n # Arguments\n\n* `extension` - file extension to be offered for selection\n * `base_path` - root folder path for navigation with back key\n * `skip_assets` - true - do not show assets folders\n * `hide_dot_files` - true - hide dot files\n * `icon` - file icon pointer, NULL for default icon\n * `hide_ext` - true - hide extensions for files\n * `item_loader_callback` - callback function for providing custom icon & entry name\n * `hide_ext` - callback context"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DialogsFileBrowserOptions {
pub extension: *const core::ffi::c_char,
pub base_path: *const core::ffi::c_char,
pub skip_assets: bool,
pub hide_dot_files: bool,
pub icon: *const Icon,
pub hide_ext: bool,
pub item_loader_callback: FileBrowserLoadItemCallback,
pub item_loader_context: *mut core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_DialogsFileBrowserOptions() {
const UNINIT: ::core::mem::MaybeUninit<DialogsFileBrowserOptions> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<DialogsFileBrowserOptions>(),
28usize,
concat!("Size of: ", stringify!(DialogsFileBrowserOptions))
);
assert_eq!(
::core::mem::align_of::<DialogsFileBrowserOptions>(),
4usize,
concat!("Alignment of ", stringify!(DialogsFileBrowserOptions))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).extension) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(extension)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base_path) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(base_path)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).skip_assets) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(skip_assets)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hide_dot_files) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(hide_dot_files)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).icon) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(icon)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hide_ext) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(hide_ext)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).item_loader_callback) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(item_loader_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).item_loader_context) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(DialogsFileBrowserOptions),
"::",
stringify!(item_loader_context)
)
);
}
extern "C" {
#[doc = "Initialize file browser dialog options and set default values.\n This is guaranteed to initialize all fields\n so it is safe to pass pointer to uninitialized {options}\n and assume that the data behind it becomes fully initialized after the call.\n # Arguments\n\n* `options` - pointer to options structure\n * `extension` - file extension to filter\n * `icon` - file icon pointer, NULL for default icon"]
pub fn dialog_file_browser_set_basic_options(
options: *mut DialogsFileBrowserOptions,
extension: *const core::ffi::c_char,
icon: *const Icon,
);
}
extern "C" {
#[doc = "Shows and processes the file browser dialog\n # Arguments\n\n* `context` - api pointer\n * `result_path` - selected file path string pointer\n * `path` - preselected file path string pointer\n * `options` - file browser dialog extra options, may be null\n # Returns\n\nbool whether a file was selected"]
pub fn dialog_file_browser_show(
context: *mut DialogsApp,
result_path: *mut FuriString,
path: *mut FuriString,
options: *const DialogsFileBrowserOptions,
) -> bool;
}
pub const DialogMessageButton_DialogMessageButtonBack: DialogMessageButton = 0;
pub const DialogMessageButton_DialogMessageButtonLeft: DialogMessageButton = 1;
pub const DialogMessageButton_DialogMessageButtonCenter: DialogMessageButton = 2;
pub const DialogMessageButton_DialogMessageButtonRight: DialogMessageButton = 3;
#[doc = "Message result type"]
pub type DialogMessageButton = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DialogMessage {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and fill message\n # Returns\n\nDialogMessage*"]
pub fn dialog_message_alloc() -> *mut DialogMessage;
}
extern "C" {
#[doc = "Free message struct\n # Arguments\n\n* `message` - message pointer"]
pub fn dialog_message_free(message: *mut DialogMessage);
}
extern "C" {
#[doc = "Set message text\n # Arguments\n\n* `message` - message pointer\n * `text` - text, can be NULL if you don't want to display the text\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal alignment\n * `vertical` - vertical alignment"]
pub fn dialog_message_set_text(
message: *mut DialogMessage,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set message header\n # Arguments\n\n* `message` - message pointer\n * `text` - text, can be NULL if you don't want to display the header\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal alignment\n * `vertical` - vertical alignment"]
pub fn dialog_message_set_header(
message: *mut DialogMessage,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set message icon\n # Arguments\n\n* `message` - message pointer\n * `icon` - icon pointer, can be NULL if you don't want to display the icon\n * `x` - x position\n * `y` - y position"]
pub fn dialog_message_set_icon(message: *mut DialogMessage, icon: *const Icon, x: u8, y: u8);
}
extern "C" {
#[doc = "Set message buttons text, button text can be NULL if you don't want to display and process some buttons\n # Arguments\n\n* `message` - message pointer\n * `left` - left button text, can be NULL if you don't want to display the left button\n * `center` - center button text, can be NULL if you don't want to display the center button\n * `right` - right button text, can be NULL if you don't want to display the right button"]
pub fn dialog_message_set_buttons(
message: *mut DialogMessage,
left: *const core::ffi::c_char,
center: *const core::ffi::c_char,
right: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Show message from filled struct\n # Arguments\n\n* `context` - api pointer\n * `message` - message struct pointer to be shown\n # Returns\n\nDialogMessageButton type"]
pub fn dialog_message_show(
context: *mut DialogsApp,
message: *const DialogMessage,
) -> DialogMessageButton;
}
extern "C" {
#[doc = "Show SD error message (with question sign)\n # Arguments\n\n* `context` -\n * `error_text` -"]
pub fn dialog_message_show_storage_error(
context: *mut DialogsApp,
error_text: *const core::ffi::c_char,
);
}
pub const DolphinApp_DolphinAppSubGhz: DolphinApp = 0;
pub const DolphinApp_DolphinAppRfid: DolphinApp = 1;
pub const DolphinApp_DolphinAppNfc: DolphinApp = 2;
pub const DolphinApp_DolphinAppIr: DolphinApp = 3;
pub const DolphinApp_DolphinAppIbutton: DolphinApp = 4;
pub const DolphinApp_DolphinAppBadusb: DolphinApp = 5;
pub const DolphinApp_DolphinAppPlugin: DolphinApp = 6;
pub const DolphinApp_DolphinAppMAX: DolphinApp = 7;
pub type DolphinApp = core::ffi::c_uchar;
pub const DolphinDeed_DolphinDeedSubGhzReceiverInfo: DolphinDeed = 0;
pub const DolphinDeed_DolphinDeedSubGhzSave: DolphinDeed = 1;
pub const DolphinDeed_DolphinDeedSubGhzRawRec: DolphinDeed = 2;
pub const DolphinDeed_DolphinDeedSubGhzAddManually: DolphinDeed = 3;
pub const DolphinDeed_DolphinDeedSubGhzSend: DolphinDeed = 4;
pub const DolphinDeed_DolphinDeedSubGhzFrequencyAnalyzer: DolphinDeed = 5;
pub const DolphinDeed_DolphinDeedRfidRead: DolphinDeed = 6;
pub const DolphinDeed_DolphinDeedRfidReadSuccess: DolphinDeed = 7;
pub const DolphinDeed_DolphinDeedRfidSave: DolphinDeed = 8;
pub const DolphinDeed_DolphinDeedRfidEmulate: DolphinDeed = 9;
pub const DolphinDeed_DolphinDeedRfidAdd: DolphinDeed = 10;
pub const DolphinDeed_DolphinDeedNfcRead: DolphinDeed = 11;
pub const DolphinDeed_DolphinDeedNfcReadSuccess: DolphinDeed = 12;
pub const DolphinDeed_DolphinDeedNfcSave: DolphinDeed = 13;
pub const DolphinDeed_DolphinDeedNfcDetectReader: DolphinDeed = 14;
pub const DolphinDeed_DolphinDeedNfcEmulate: DolphinDeed = 15;
pub const DolphinDeed_DolphinDeedNfcMfcAdd: DolphinDeed = 16;
pub const DolphinDeed_DolphinDeedNfcAddSave: DolphinDeed = 17;
pub const DolphinDeed_DolphinDeedNfcAddEmulate: DolphinDeed = 18;
pub const DolphinDeed_DolphinDeedIrSend: DolphinDeed = 19;
pub const DolphinDeed_DolphinDeedIrLearnSuccess: DolphinDeed = 20;
pub const DolphinDeed_DolphinDeedIrSave: DolphinDeed = 21;
pub const DolphinDeed_DolphinDeedIbuttonRead: DolphinDeed = 22;
pub const DolphinDeed_DolphinDeedIbuttonReadSuccess: DolphinDeed = 23;
pub const DolphinDeed_DolphinDeedIbuttonSave: DolphinDeed = 24;
pub const DolphinDeed_DolphinDeedIbuttonEmulate: DolphinDeed = 25;
pub const DolphinDeed_DolphinDeedIbuttonAdd: DolphinDeed = 26;
pub const DolphinDeed_DolphinDeedBadUsbPlayScript: DolphinDeed = 27;
pub const DolphinDeed_DolphinDeedU2fAuthorized: DolphinDeed = 28;
pub const DolphinDeed_DolphinDeedGpioUartBridge: DolphinDeed = 29;
pub const DolphinDeed_DolphinDeedPluginStart: DolphinDeed = 30;
pub const DolphinDeed_DolphinDeedPluginGameStart: DolphinDeed = 31;
pub const DolphinDeed_DolphinDeedPluginGameWin: DolphinDeed = 32;
pub const DolphinDeed_DolphinDeedMAX: DolphinDeed = 33;
pub const DolphinDeed_DolphinDeedTestLeft: DolphinDeed = 34;
pub const DolphinDeed_DolphinDeedTestRight: DolphinDeed = 35;
pub type DolphinDeed = core::ffi::c_uchar;
extern "C" {
pub fn dolphin_deed_get_app(deed: DolphinDeed) -> DolphinApp;
}
extern "C" {
pub fn dolphin_deed_get_app_limit(app: DolphinApp) -> u8;
}
extern "C" {
pub fn dolphin_deed_get_weight(deed: DolphinDeed) -> u8;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Dolphin {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DolphinStats {
pub icounter: u32,
pub butthurt: u32,
pub timestamp: u64,
pub level: u8,
pub level_up_is_pending: bool,
}
#[test]
fn bindgen_test_layout_DolphinStats() {
const UNINIT: ::core::mem::MaybeUninit<DolphinStats> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<DolphinStats>(),
24usize,
concat!("Size of: ", stringify!(DolphinStats))
);
assert_eq!(
::core::mem::align_of::<DolphinStats>(),
8usize,
concat!("Alignment of ", stringify!(DolphinStats))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).icounter) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(DolphinStats),
"::",
stringify!(icounter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).butthurt) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(DolphinStats),
"::",
stringify!(butthurt)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(DolphinStats),
"::",
stringify!(timestamp)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).level) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(DolphinStats),
"::",
stringify!(level)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).level_up_is_pending) as usize - ptr as usize },
17usize,
concat!(
"Offset of field: ",
stringify!(DolphinStats),
"::",
stringify!(level_up_is_pending)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DolphinSettings {
pub happy_mode: bool,
}
#[test]
fn bindgen_test_layout_DolphinSettings() {
const UNINIT: ::core::mem::MaybeUninit<DolphinSettings> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<DolphinSettings>(),
1usize,
concat!("Size of: ", stringify!(DolphinSettings))
);
assert_eq!(
::core::mem::align_of::<DolphinSettings>(),
1usize,
concat!("Alignment of ", stringify!(DolphinSettings))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).happy_mode) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(DolphinSettings),
"::",
stringify!(happy_mode)
)
);
}
extern "C" {
#[doc = "Deed complete notification. Call it on deed completion.\n See dolphin_deed.h for available deeds. In futures it will become part of assets.\n Thread safe, async"]
pub fn dolphin_deed(deed: DolphinDeed);
}
extern "C" {
pub fn dolphin_get_settings(dolphin: *mut Dolphin, settings: *mut DolphinSettings);
}
extern "C" {
pub fn dolphin_set_settings(dolphin: *mut Dolphin, settings: *mut DolphinSettings);
}
extern "C" {
#[doc = "Retrieve dolphin stats\n Thread safe, blocking"]
pub fn dolphin_stats(dolphin: *mut Dolphin) -> DolphinStats;
}
extern "C" {
#[doc = "Flush dolphin queue and save state\n Thread safe, blocking"]
pub fn dolphin_flush(dolphin: *mut Dolphin);
}
extern "C" {
pub fn dolphin_upgrade_level(dolphin: *mut Dolphin);
}
extern "C" {
pub fn dolphin_get_pubsub(dolphin: *mut Dolphin) -> *mut FuriPubSub;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Expansion {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Enable support for expansion modules.\n\n Calling this function will load user settings and enable\n expansion module support on the serial port specified in said settings.\n\n If expansion module support was disabled in settings, this function\n does nothing.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the Expansion instance."]
pub fn expansion_enable(instance: *mut Expansion);
}
extern "C" {
#[doc = "Disable support for expansion modules.\n\n Calling this function will cease all communications with the\n expansion module (if any), release the serial handle and\n reset the respective pins to the default state.\n\n > **Note:** Applications requiring serial port access MUST call\n this function BEFORE calling furi_hal_serial_control_acquire().\n Similarly, an expansion_enable() call MUST be made right AFTER\n a call to furi_hal_serial_control_release() to ensure that\n the user settings are properly restored.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the Expansion instance."]
pub fn expansion_disable(instance: *mut Expansion);
}
extern "C" {
#[doc = "Enable support for expansion modules on designated serial port.\n\n Only one serial port can be used to communicate with an expansion\n module at a time.\n\n Calling this function when expansion module support is already enabled\n will first disable the previous setting, then enable the current one.\n\n This function does not respect user settings for expansion modules,\n so calling it might leave the system in inconsistent state. Avoid using it\n unless absolutely necessary.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the Expansion instance.\n * `serial_id` (direction in) - numerical identifier of the serial."]
pub fn expansion_set_listen_serial(instance: *mut Expansion, serial_id: FuriHalSerialId);
}
extern "C" {
#[doc = "Draw progress bar.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - progress bar position on X axis\n * `y` - progress bar position on Y axis\n * `width` - progress bar width\n * `progress` - progress (0.0 - 1.0)"]
pub fn elements_progress_bar(canvas: *mut Canvas, x: i32, y: i32, width: usize, progress: f32);
}
extern "C" {
#[doc = "Draw progress bar with text.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - progress bar position on X axis\n * `y` - progress bar position on Y axis\n * `width` - progress bar width\n * `progress` - progress (0.0 - 1.0)\n * `text` - text to draw"]
pub fn elements_progress_bar_with_text(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
progress: f32,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Draw scrollbar on canvas at specific position.\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - scrollbar position on X axis\n * `y` - scrollbar position on Y axis\n * `height` - scrollbar height\n * `pos` - current element\n * `total` - total elements"]
pub fn elements_scrollbar_pos(
canvas: *mut Canvas,
x: i32,
y: i32,
height: usize,
pos: usize,
total: usize,
);
}
extern "C" {
#[doc = "Draw scrollbar on canvas.\n > **Note:** width 3px, height equal to canvas height\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `pos` - current element of total elements\n * `total` - total elements"]
pub fn elements_scrollbar(canvas: *mut Canvas, pos: usize, total: usize);
}
extern "C" {
#[doc = "Draw rounded frame\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x,` - y top left corner coordinates\n * `width,` - height frame width and height"]
pub fn elements_frame(canvas: *mut Canvas, x: i32, y: i32, width: usize, height: usize);
}
extern "C" {
#[doc = "Draw button in left corner\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `str` - button text"]
pub fn elements_button_left(canvas: *mut Canvas, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Draw button in right corner\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `str` - button text"]
pub fn elements_button_right(canvas: *mut Canvas, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "This function draws a button in the top left corner of the canvas with icon and string.\n\n The design and layout of the button is defined within this function.\n\n # Arguments\n\n* `canvas` (direction in) - This is a pointer to the `Canvas` structure where the button will be drawn.\n * `str` (direction in) - This is a pointer to the character string that will be drawn within the button.\n"]
pub fn elements_button_up(canvas: *mut Canvas, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "This function draws a button in the top right corner of the canvas with icon and string.\n\n The design and layout of the button is defined within this function.\n\n # Arguments\n\n* `canvas` (direction in) - This is a pointer to the `Canvas` structure where the button will be drawn.\n * `str` (direction in) - This is a pointer to the character string that will be drawn within the button.\n"]
pub fn elements_button_down(canvas: *mut Canvas, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Draw button in center\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `str` - button text"]
pub fn elements_button_center(canvas: *mut Canvas, str_: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Draw aligned multiline text\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x,` - y coordinates based on align param\n * `horizontal,` - vertical alignment of multiline text\n * `text` - string (possible multiline)"]
pub fn elements_multiline_text_aligned(
canvas: *mut Canvas,
x: i32,
y: i32,
horizontal: Align,
vertical: Align,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Draw multiline text\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - top left corner coordinates\n * `y` - top left corner coordinates\n * `text` - string (possible multiline)"]
pub fn elements_multiline_text(
canvas: *mut Canvas,
x: i32,
y: i32,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Draw framed multiline text\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - top left corner coordinates\n * `y` - top left corner coordinates\n * `text` - string (possible multiline)"]
pub fn elements_multiline_text_framed(
canvas: *mut Canvas,
x: i32,
y: i32,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Draw slightly rounded frame\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - top left corner coordinates\n * `y` - top left corner coordinates\n * `width` - width of frame\n * `height` - height of frame"]
pub fn elements_slightly_rounded_frame(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
);
}
extern "C" {
#[doc = "Draw slightly rounded box\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - top left corner coordinates\n * `y` - top left corner coordinates\n * `width` - height of box\n * `height` - height of box"]
pub fn elements_slightly_rounded_box(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
);
}
extern "C" {
#[doc = "Draw bold rounded frame\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - top left corner coordinates\n * `y` - top left corner coordinates\n * `width` - width of frame\n * `height` - height of frame"]
pub fn elements_bold_rounded_frame(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
);
}
extern "C" {
#[doc = "Draw bubble frame for text\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - left x coordinates\n * `y` - top y coordinate\n * `width` - bubble width\n * `height` - bubble height"]
pub fn elements_bubble(canvas: *mut Canvas, x: i32, y: i32, width: usize, height: usize);
}
extern "C" {
#[doc = "Draw bubble frame for text with corner\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - left x coordinates\n * `y` - top y coordinate\n * `text` - text to display\n * `horizontal` - horizontal aligning\n * `vertical` - aligning"]
pub fn elements_bubble_str(
canvas: *mut Canvas,
x: i32,
y: i32,
text: *const core::ffi::c_char,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Trim string buffer to fit width in pixels\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `string` - string to trim\n * `width` - max width"]
pub fn elements_string_fit_width(canvas: *mut Canvas, string: *mut FuriString, width: usize);
}
extern "C" {
#[doc = "Draw scrollable text line\n\n # Arguments\n\n* `canvas` - The canvas\n * `x` (direction in) - X coordinate\n * `y` (direction in) - Y coordinate\n * `width` (direction in) - The width\n * `string` - The string\n * `scroll` (direction in) - The scroll counter: 0 - no scroll, any other number - scroll. Just count up, everything else will be calculated on the inside.\n * `ellipsis` (direction in) - The ellipsis flag: true to add ellipse"]
pub fn elements_scrollable_text_line(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
string: *mut FuriString,
scroll: usize,
ellipsis: bool,
);
}
extern "C" {
#[doc = "Draw text box element\n\n # Arguments\n\n* `canvas` - Canvas instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - width to fit text\n * `height` - height to fit text\n * `horizontal` - Align instance\n * `vertical` - Align instance\n * `text` (direction in) - Formatted text. The following formats are available:\n \"text- bold font is used\n \"text- monospaced font is used\n \"text- white text on black background\n * `strip_to_dots` - Strip text to ... if does not fit to width"]
pub fn elements_text_box(
canvas: *mut Canvas,
x: i32,
y: i32,
width: usize,
height: usize,
horizontal: Align,
vertical: Align,
text: *const core::ffi::c_char,
strip_to_dots: bool,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ViewPort {
_unused: [u8; 0],
}
pub const ViewPortOrientation_ViewPortOrientationHorizontal: ViewPortOrientation = 0;
pub const ViewPortOrientation_ViewPortOrientationHorizontalFlip: ViewPortOrientation = 1;
pub const ViewPortOrientation_ViewPortOrientationVertical: ViewPortOrientation = 2;
pub const ViewPortOrientation_ViewPortOrientationVerticalFlip: ViewPortOrientation = 3;
#[doc = "< Special value, don't use it"]
pub const ViewPortOrientation_ViewPortOrientationMAX: ViewPortOrientation = 4;
pub type ViewPortOrientation = core::ffi::c_uchar;
#[doc = "ViewPort Draw callback\n called from GUI thread"]
pub type ViewPortDrawCallback = ::core::option::Option<
unsafe extern "C" fn(canvas: *mut Canvas, context: *mut core::ffi::c_void),
>;
#[doc = "ViewPort Input callback\n called from GUI thread"]
pub type ViewPortInputCallback = ::core::option::Option<
unsafe extern "C" fn(event: *mut InputEvent, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "ViewPort allocator\n\n always returns view_port or stops system if not enough memory.\n\n # Returns\n\nViewPort instance"]
pub fn view_port_alloc() -> *mut ViewPort;
}
extern "C" {
#[doc = "ViewPort deallocator\n\n Ensure that view_port was unregistered in GUI system before use.\n\n # Arguments\n\n* `view_port` - ViewPort instance"]
pub fn view_port_free(view_port: *mut ViewPort);
}
extern "C" {
#[doc = "Set view_port width.\n\n Will be used to limit canvas drawing area and autolayout feature.\n\n # Arguments\n\n* `view_port` - ViewPort instance\n * `width` - wanted width, 0 - auto."]
pub fn view_port_set_width(view_port: *mut ViewPort, width: u8);
}
extern "C" {
pub fn view_port_get_width(view_port: *const ViewPort) -> u8;
}
extern "C" {
#[doc = "Set view_port height.\n\n Will be used to limit canvas drawing area and autolayout feature.\n\n # Arguments\n\n* `view_port` - ViewPort instance\n * `height` - wanted height, 0 - auto."]
pub fn view_port_set_height(view_port: *mut ViewPort, height: u8);
}
extern "C" {
pub fn view_port_get_height(view_port: *const ViewPort) -> u8;
}
extern "C" {
#[doc = "Enable or disable view_port rendering.\n\n # Arguments\n\n* `view_port` - ViewPort instance\n * `enabled` - Indicates if enabled\n automatically dispatches update event"]
pub fn view_port_enabled_set(view_port: *mut ViewPort, enabled: bool);
}
extern "C" {
pub fn view_port_is_enabled(view_port: *const ViewPort) -> bool;
}
extern "C" {
#[doc = "ViewPort event callbacks\n\n # Arguments\n\n* `view_port` - ViewPort instance\n * `callback` - appropriate callback function\n * `context` - context to pass to callback"]
pub fn view_port_draw_callback_set(
view_port: *mut ViewPort,
callback: ViewPortDrawCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn view_port_input_callback_set(
view_port: *mut ViewPort,
callback: ViewPortInputCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Emit update signal to GUI system.\n\n Rendering will happen later after GUI system process signal.\n\n # Arguments\n\n* `view_port` - ViewPort instance"]
pub fn view_port_update(view_port: *mut ViewPort);
}
extern "C" {
#[doc = "Set ViewPort orientation.\n\n # Arguments\n\n* `view_port` - ViewPort instance\n * `orientation` - display orientation, horizontal or vertical."]
pub fn view_port_set_orientation(view_port: *mut ViewPort, orientation: ViewPortOrientation);
}
extern "C" {
pub fn view_port_get_orientation(view_port: *const ViewPort) -> ViewPortOrientation;
}
#[doc = "< Desktop layer for internal use. Like fullscreen but with status bar"]
pub const GuiLayer_GuiLayerDesktop: GuiLayer = 0;
#[doc = "< Window layer, status bar is shown"]
pub const GuiLayer_GuiLayerWindow: GuiLayer = 1;
#[doc = "< Status bar left-side layer, auto-layout"]
pub const GuiLayer_GuiLayerStatusBarLeft: GuiLayer = 2;
#[doc = "< Status bar right-side layer, auto-layout"]
pub const GuiLayer_GuiLayerStatusBarRight: GuiLayer = 3;
#[doc = "< Fullscreen layer, no status bar"]
pub const GuiLayer_GuiLayerFullscreen: GuiLayer = 4;
#[doc = "< Don't use or move, special value"]
pub const GuiLayer_GuiLayerMAX: GuiLayer = 5;
#[doc = "Gui layers"]
pub type GuiLayer = core::ffi::c_uchar;
#[doc = "Gui Canvas Commit Callback"]
pub type GuiCanvasCommitCallback = ::core::option::Option<
unsafe extern "C" fn(
data: *mut u8,
size: usize,
orientation: CanvasOrientation,
context: *mut core::ffi::c_void,
),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Gui {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Add view_port to view_port tree\n\n > thread safe\n\n # Arguments\n\n* `gui` - Gui instance\n * `view_port` - ViewPort instance\n * `layer` (direction in) - GuiLayer where to place view_port"]
pub fn gui_add_view_port(gui: *mut Gui, view_port: *mut ViewPort, layer: GuiLayer);
}
extern "C" {
#[doc = "Remove view_port from rendering tree\n\n > thread safe\n\n # Arguments\n\n* `gui` - Gui instance\n * `view_port` - ViewPort instance"]
pub fn gui_remove_view_port(gui: *mut Gui, view_port: *mut ViewPort);
}
extern "C" {
#[doc = "Send ViewPort to the front\n\n Places selected ViewPort to the top of the drawing stack\n\n # Arguments\n\n* `gui` - Gui instance\n * `view_port` - ViewPort instance"]
pub fn gui_view_port_send_to_front(gui: *mut Gui, view_port: *mut ViewPort);
}
extern "C" {
#[doc = "Add gui canvas commit callback\n\n This callback will be called upon Canvas commit Callback dispatched from GUI\n thread and is time critical\n\n # Arguments\n\n* `gui` - Gui instance\n * `callback` - GuiCanvasCommitCallback\n * `context` - GuiCanvasCommitCallback context"]
pub fn gui_add_framebuffer_callback(
gui: *mut Gui,
callback: GuiCanvasCommitCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Remove gui canvas commit callback\n\n # Arguments\n\n* `gui` - Gui instance\n * `callback` - GuiCanvasCommitCallback\n * `context` - GuiCanvasCommitCallback context"]
pub fn gui_remove_framebuffer_callback(
gui: *mut Gui,
callback: GuiCanvasCommitCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get gui canvas frame buffer size\n *\n # Arguments\n\n* `gui` - Gui instance\n # Returns\n\nsize_t size of frame buffer in bytes"]
pub fn gui_get_framebuffer_size(gui: *const Gui) -> usize;
}
extern "C" {
#[doc = "Set lockdown mode\n\n When lockdown mode is enabled, only GuiLayerDesktop is shown.\n This feature prevents services from showing sensitive information when flipper is locked.\n\n # Arguments\n\n* `gui` - Gui instance\n * `lockdown` - bool, true if enabled"]
pub fn gui_set_lockdown(gui: *mut Gui, lockdown: bool);
}
extern "C" {
#[doc = "Acquire Direct Draw lock and get Canvas instance\n\n This method return Canvas instance for use in monopoly mode. Direct draw lock\n disables input and draw call dispatch functions in GUI service. No other\n applications or services will be able to draw until gui_direct_draw_release\n call.\n\n # Arguments\n\n* `gui` - The graphical user interface\n\n # Returns\n\nCanvas instance"]
pub fn gui_direct_draw_acquire(gui: *mut Gui) -> *mut Canvas;
}
extern "C" {
#[doc = "Release Direct Draw Lock\n\n Release Direct Draw Lock, enables Input and Draw call processing. Canvas\n acquired in gui_direct_draw_acquire will become invalid after this call.\n\n # Arguments\n\n* `gui` - Gui instance"]
pub fn gui_direct_draw_release(gui: *mut Gui);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Icon {
pub width: u16,
pub height: u16,
pub frame_count: u8,
pub frame_rate: u8,
pub frames: *const *const u8,
}
#[test]
fn bindgen_test_layout_Icon() {
const UNINIT: ::core::mem::MaybeUninit<Icon> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Icon>(),
12usize,
concat!("Size of: ", stringify!(Icon))
);
assert_eq!(
::core::mem::align_of::<Icon>(),
4usize,
concat!("Alignment of ", stringify!(Icon))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Icon),
"::",
stringify!(width)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(Icon),
"::",
stringify!(height)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frame_count) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(Icon),
"::",
stringify!(frame_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frame_rate) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(Icon),
"::",
stringify!(frame_rate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frames) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(Icon),
"::",
stringify!(frames)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ButtonMenu {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ButtonMenuItem {
_unused: [u8; 0],
}
#[doc = "Callback for any button menu actions"]
pub type ButtonMenuItemCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, index: i32, type_: InputType),
>;
pub const ButtonMenuItemType_ButtonMenuItemTypeCommon: ButtonMenuItemType = 0;
pub const ButtonMenuItemType_ButtonMenuItemTypeControl: ButtonMenuItemType = 1;
#[doc = "Type of button. Difference in drawing buttons."]
pub type ButtonMenuItemType = core::ffi::c_uchar;
extern "C" {
#[doc = "Get button menu view\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn button_menu_get_view(button_menu: *mut ButtonMenu) -> *mut View;
}
extern "C" {
#[doc = "Clean button menu\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance"]
pub fn button_menu_reset(button_menu: *mut ButtonMenu);
}
extern "C" {
#[doc = "Add item to button menu instance\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance\n * `label` - text inside new button\n * `index` - value to distinct between buttons inside\n ButtonMenuItemCallback\n * `callback` - The callback\n * `type` - type of button to create. Differ by button\n drawing. Control buttons have no frames, and\n have more squared borders.\n * `callback_context` - The callback context\n\n # Returns\n\npointer to just-created item"]
pub fn button_menu_add_item(
button_menu: *mut ButtonMenu,
label: *const core::ffi::c_char,
index: i32,
callback: ButtonMenuItemCallback,
type_: ButtonMenuItemType,
callback_context: *mut core::ffi::c_void,
) -> *mut ButtonMenuItem;
}
extern "C" {
#[doc = "Allocate and initialize new instance of ButtonMenu model\n\n # Returns\n\njust-created ButtonMenu model"]
pub fn button_menu_alloc() -> *mut ButtonMenu;
}
extern "C" {
#[doc = "Free ButtonMenu element\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance"]
pub fn button_menu_free(button_menu: *mut ButtonMenu);
}
extern "C" {
#[doc = "Set ButtonMenu header on top of canvas\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance\n * `header` - header on the top of button menu"]
pub fn button_menu_set_header(button_menu: *mut ButtonMenu, header: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set selected item\n\n # Arguments\n\n* `button_menu` - ButtonMenu instance\n * `index` - index of ButtonMenu to be selected"]
pub fn button_menu_set_selected_item(button_menu: *mut ButtonMenu, index: u32);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ButtonPanel {
_unused: [u8; 0],
}
#[doc = "Callback type to call for handling selecting button_panel items"]
pub type ButtonItemCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, index: u32)>;
extern "C" {
#[doc = "Allocate new button_panel module.\n\n # Returns\n\nButtonPanel instance"]
pub fn button_panel_alloc() -> *mut ButtonPanel;
}
extern "C" {
#[doc = "Free button_panel module.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance"]
pub fn button_panel_free(button_panel: *mut ButtonPanel);
}
extern "C" {
#[doc = "Free items from button_panel module. Preallocated matrix stays unchanged.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance"]
pub fn button_panel_reset(button_panel: *mut ButtonPanel);
}
extern "C" {
#[doc = "Reserve space for adding items.\n\n One does not simply use button_panel_add_item() without this function. It\n should be allocated space for it first.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance\n * `reserve_x` - number of columns in button_panel\n * `reserve_y` - number of rows in button_panel"]
pub fn button_panel_reserve(button_panel: *mut ButtonPanel, reserve_x: usize, reserve_y: usize);
}
extern "C" {
#[doc = "Add item to button_panel module.\n\n Have to set element in bounds of allocated size by X and by Y.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance\n * `index` - value to pass to callback\n * `matrix_place_x` - coordinates by x-axis on virtual grid, it\n is only used for navigation\n * `matrix_place_y` - coordinates by y-axis on virtual grid, it\n is only used for naviagation\n * `x` - x-coordinate to draw icon on\n * `y` - y-coordinate to draw icon on\n * `icon_name` - name of the icon to draw\n * `icon_name_selected` - name of the icon to draw when current\n element is selected\n * `callback` - function to call when specific element is\n selected (pressed Ok on selected item)\n * `callback_context` - context to pass to callback"]
pub fn button_panel_add_item(
button_panel: *mut ButtonPanel,
index: u32,
matrix_place_x: u16,
matrix_place_y: u16,
x: u16,
y: u16,
icon_name: *const Icon,
icon_name_selected: *const Icon,
callback: ButtonItemCallback,
callback_context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get button_panel view.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance\n\n # Returns\n\nacquired view"]
pub fn button_panel_get_view(button_panel: *mut ButtonPanel) -> *mut View;
}
extern "C" {
#[doc = "Add label to button_panel module.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance\n * `x` - x-coordinate to place label\n * `y` - y-coordinate to place label\n * `font` - font to write label with\n * `label_str` - string label to write"]
pub fn button_panel_add_label(
button_panel: *mut ButtonPanel,
x: u16,
y: u16,
font: Font,
label_str: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Add a non-button icon to button_panel module.\n\n # Arguments\n\n* `button_panel` - ButtonPanel instance\n * `x` - x-coordinate to place icon\n * `y` - y-coordinate to place icon\n * `icon_name` - name of the icon to draw"]
pub fn button_panel_add_icon(
button_panel: *mut ButtonPanel,
x: u16,
y: u16,
icon_name: *const Icon,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ByteInput {
_unused: [u8; 0],
}
#[doc = "callback that is executed on save button press"]
pub type ByteInputCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "callback that is executed when byte buffer is changed"]
pub type ByteChangedCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Allocate and initialize byte input. This byte input is used to enter bytes.\n\n # Returns\n\nByteInput instance pointer"]
pub fn byte_input_alloc() -> *mut ByteInput;
}
extern "C" {
#[doc = "Deinitialize and free byte input\n\n # Arguments\n\n* `byte_input` - Byte input instance"]
pub fn byte_input_free(byte_input: *mut ByteInput);
}
extern "C" {
#[doc = "Get byte input view\n\n # Arguments\n\n* `byte_input` - byte input instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn byte_input_get_view(byte_input: *mut ByteInput) -> *mut View;
}
extern "C" {
#[doc = "Set byte input result callback\n\n # Arguments\n\n* `byte_input` - byte input instance\n * `input_callback` - input callback fn\n * `changed_callback` - changed callback fn\n * `callback_context` - callback context\n * `bytes` - buffer to use\n * `bytes_count` - buffer length"]
pub fn byte_input_set_result_callback(
byte_input: *mut ByteInput,
input_callback: ByteInputCallback,
changed_callback: ByteChangedCallback,
callback_context: *mut core::ffi::c_void,
bytes: *mut u8,
bytes_count: u8,
);
}
extern "C" {
#[doc = "Set byte input header text\n\n # Arguments\n\n* `byte_input` - byte input instance\n * `text` - text to be shown"]
pub fn byte_input_set_header_text(byte_input: *mut ByteInput, text: *const core::ffi::c_char);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DialogEx {
_unused: [u8; 0],
}
pub const DialogExResult_DialogExResultLeft: DialogExResult = 0;
pub const DialogExResult_DialogExResultCenter: DialogExResult = 1;
pub const DialogExResult_DialogExResultRight: DialogExResult = 2;
pub const DialogExResult_DialogExPressLeft: DialogExResult = 3;
pub const DialogExResult_DialogExPressCenter: DialogExResult = 4;
pub const DialogExResult_DialogExPressRight: DialogExResult = 5;
pub const DialogExResult_DialogExReleaseLeft: DialogExResult = 6;
pub const DialogExResult_DialogExReleaseCenter: DialogExResult = 7;
pub const DialogExResult_DialogExReleaseRight: DialogExResult = 8;
#[doc = "DialogEx result"]
pub type DialogExResult = core::ffi::c_uchar;
#[doc = "DialogEx result callback type\n comes from GUI thread"]
pub type DialogExResultCallback = ::core::option::Option<
unsafe extern "C" fn(result: DialogExResult, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Allocate and initialize dialog\n\n This dialog used to ask simple questions\n\n # Returns\n\nDialogEx instance"]
pub fn dialog_ex_alloc() -> *mut DialogEx;
}
extern "C" {
#[doc = "Deinitialize and free dialog\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance"]
pub fn dialog_ex_free(dialog_ex: *mut DialogEx);
}
extern "C" {
#[doc = "Get dialog view\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn dialog_ex_get_view(dialog_ex: *mut DialogEx) -> *mut View;
}
extern "C" {
#[doc = "Set dialog result callback\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `callback` - result callback function"]
pub fn dialog_ex_set_result_callback(
dialog_ex: *mut DialogEx,
callback: DialogExResultCallback,
);
}
extern "C" {
#[doc = "Set dialog context\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `context` - context pointer, will be passed to result callback"]
pub fn dialog_ex_set_context(dialog_ex: *mut DialogEx, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set dialog header text\n\n If text is null, dialog header will not be rendered\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `text` - text to be shown, can be multiline\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal text alignment\n * `vertical` - vertical text alignment"]
pub fn dialog_ex_set_header(
dialog_ex: *mut DialogEx,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set dialog text\n\n If text is null, dialog text will not be rendered\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `text` - text to be shown, can be multiline\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal text alignment\n * `vertical` - vertical text alignment"]
pub fn dialog_ex_set_text(
dialog_ex: *mut DialogEx,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set dialog icon\n\n If x or y is negative, dialog icon will not be rendered\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `x` - x position\n * `y` - y position\n * `icon` - The icon"]
pub fn dialog_ex_set_icon(dialog_ex: *mut DialogEx, x: u8, y: u8, icon: *const Icon);
}
extern "C" {
#[doc = "Set left button text\n\n If text is null, left button will not be rendered and processed\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `text` - text to be shown"]
pub fn dialog_ex_set_left_button_text(dialog_ex: *mut DialogEx, text: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set center button text\n\n If text is null, center button will not be rendered and processed\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `text` - text to be shown"]
pub fn dialog_ex_set_center_button_text(
dialog_ex: *mut DialogEx,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Set right button text\n\n If text is null, right button will not be rendered and processed\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance\n * `text` - text to be shown"]
pub fn dialog_ex_set_right_button_text(
dialog_ex: *mut DialogEx,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Clean dialog\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance"]
pub fn dialog_ex_reset(dialog_ex: *mut DialogEx);
}
extern "C" {
#[doc = "Enable press/release events\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance"]
pub fn dialog_ex_enable_extended_events(dialog_ex: *mut DialogEx);
}
extern "C" {
#[doc = "Disable press/release events\n\n # Arguments\n\n* `dialog_ex` - DialogEx instance"]
pub fn dialog_ex_disable_extended_events(dialog_ex: *mut DialogEx);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct EmptyScreen {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and initialize empty screen\n\n This empty screen used to ask simple questions like Yes/\n\n # Returns\n\nEmptyScreen instance"]
pub fn empty_screen_alloc() -> *mut EmptyScreen;
}
extern "C" {
#[doc = "Deinitialize and free empty screen\n\n # Arguments\n\n* `empty_screen` - Empty screen instance"]
pub fn empty_screen_free(empty_screen: *mut EmptyScreen);
}
extern "C" {
#[doc = "Get empty screen view\n\n # Arguments\n\n* `empty_screen` - Empty screen instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn empty_screen_get_view(empty_screen: *mut EmptyScreen) -> *mut View;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BrowserWorker {
_unused: [u8; 0],
}
pub type BrowserWorkerFolderOpenCallback = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
item_cnt: u32,
file_idx: i32,
is_root: bool,
),
>;
pub type BrowserWorkerListLoadCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, list_load_offset: u32),
>;
pub type BrowserWorkerListItemCallback = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
item_path: *mut FuriString,
is_folder: bool,
is_last: bool,
),
>;
pub type BrowserWorkerLongLoadCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
pub fn file_browser_worker_alloc(
path: *mut FuriString,
base_path: *const core::ffi::c_char,
ext_filter: *const core::ffi::c_char,
skip_assets: bool,
hide_dot_files: bool,
) -> *mut BrowserWorker;
}
extern "C" {
pub fn file_browser_worker_free(browser: *mut BrowserWorker);
}
extern "C" {
pub fn file_browser_worker_set_callback_context(
browser: *mut BrowserWorker,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn file_browser_worker_set_folder_callback(
browser: *mut BrowserWorker,
cb: BrowserWorkerFolderOpenCallback,
);
}
extern "C" {
pub fn file_browser_worker_set_list_callback(
browser: *mut BrowserWorker,
cb: BrowserWorkerListLoadCallback,
);
}
extern "C" {
pub fn file_browser_worker_set_item_callback(
browser: *mut BrowserWorker,
cb: BrowserWorkerListItemCallback,
);
}
extern "C" {
pub fn file_browser_worker_set_long_load_callback(
browser: *mut BrowserWorker,
cb: BrowserWorkerLongLoadCallback,
);
}
extern "C" {
pub fn file_browser_worker_set_config(
browser: *mut BrowserWorker,
path: *mut FuriString,
ext_filter: *const core::ffi::c_char,
skip_assets: bool,
hide_dot_files: bool,
);
}
extern "C" {
pub fn file_browser_worker_folder_enter(
browser: *mut BrowserWorker,
path: *mut FuriString,
item_idx: i32,
);
}
extern "C" {
pub fn file_browser_worker_is_in_start_folder(browser: *mut BrowserWorker) -> bool;
}
extern "C" {
pub fn file_browser_worker_folder_exit(browser: *mut BrowserWorker);
}
extern "C" {
pub fn file_browser_worker_folder_refresh(browser: *mut BrowserWorker, item_idx: i32);
}
extern "C" {
pub fn file_browser_worker_load(browser: *mut BrowserWorker, offset: u32, count: u32);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Loading {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and initialize\n\n This View used to show system is doing some processing\n\n # Returns\n\nLoading View instance"]
pub fn loading_alloc() -> *mut Loading;
}
extern "C" {
#[doc = "Deinitialize and free Loading View\n\n # Arguments\n\n* `instance` - Loading instance"]
pub fn loading_free(instance: *mut Loading);
}
extern "C" {
#[doc = "Get Loading view\n\n # Arguments\n\n* `instance` - Loading instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn loading_get_view(instance: *mut Loading) -> *mut View;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Menu {
_unused: [u8; 0],
}
#[doc = "Menu Item Callback"]
pub type MenuItemCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, index: u32)>;
extern "C" {
#[doc = "Menu allocation and initialization\n\n # Returns\n\nMenu instance"]
pub fn menu_alloc() -> *mut Menu;
}
extern "C" {
#[doc = "Free menu\n\n # Arguments\n\n* `menu` - Menu instance"]
pub fn menu_free(menu: *mut Menu);
}
extern "C" {
#[doc = "Get Menu view\n\n # Arguments\n\n* `menu` - Menu instance\n\n # Returns\n\nView instance"]
pub fn menu_get_view(menu: *mut Menu) -> *mut View;
}
extern "C" {
#[doc = "Add item to menu\n\n # Arguments\n\n* `menu` - Menu instance\n * `label` - menu item string label\n * `icon` - IconAnimation instance\n * `index` - menu item index\n * `callback` - MenuItemCallback instance\n * `context` - pointer to context"]
pub fn menu_add_item(
menu: *mut Menu,
label: *const core::ffi::c_char,
icon: *const Icon,
index: u32,
callback: MenuItemCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Clean menu\n > **Note:** this function does not free menu instance\n\n # Arguments\n\n* `menu` - Menu instance"]
pub fn menu_reset(menu: *mut Menu);
}
extern "C" {
#[doc = "Set current menu item\n\n # Arguments\n\n* `menu` - Menu instance\n * `index` - The index"]
pub fn menu_set_selected_item(menu: *mut Menu, index: u32);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NumberInput {
_unused: [u8; 0],
}
#[doc = "Callback to be called on save button press"]
pub type NumberInputCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, number: i32)>;
extern "C" {
#[doc = "Allocate and initialize Number input.\n\n This Number input is used to enter Numbers (Integers).\n\n # Returns\n\nNumberInput instance pointer"]
pub fn number_input_alloc() -> *mut NumberInput;
}
extern "C" {
#[doc = "Deinitialize and free byte input\n\n # Arguments\n\n* `number_input` - Number input instance"]
pub fn number_input_free(number_input: *mut NumberInput);
}
extern "C" {
#[doc = "Get byte input view\n\n # Arguments\n\n* `number_input` - byte input instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn number_input_get_view(number_input: *mut NumberInput) -> *mut View;
}
extern "C" {
#[doc = "Set byte input result callback\n\n # Arguments\n\n* `number_input` - byte input instance\n * `input_callback` - input callback fn\n * `callback_context` - callback context\n * `current_number` (direction in) - The current number\n * `min_value` - Min number value\n * `max_value` - Max number value"]
pub fn number_input_set_result_callback(
number_input: *mut NumberInput,
input_callback: NumberInputCallback,
callback_context: *mut core::ffi::c_void,
current_number: i32,
min_value: i32,
max_value: i32,
);
}
extern "C" {
#[doc = "Set byte input header text\n\n # Arguments\n\n* `number_input` - byte input instance\n * `text` - text to be shown"]
pub fn number_input_set_header_text(
number_input: *mut NumberInput,
text: *const core::ffi::c_char,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Popup {
_unused: [u8; 0],
}
#[doc = "Popup result callback type\n comes from GUI thread"]
pub type PopupCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Allocate and initialize popup\n\n This popup used to ask simple questions like Yes/\n\n # Returns\n\nPopup instance"]
pub fn popup_alloc() -> *mut Popup;
}
extern "C" {
#[doc = "Deinitialize and free popup\n\n # Arguments\n\n* `popup` - Popup instance"]
pub fn popup_free(popup: *mut Popup);
}
extern "C" {
#[doc = "Get popup view\n\n # Arguments\n\n* `popup` - Popup instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn popup_get_view(popup: *mut Popup) -> *mut View;
}
extern "C" {
#[doc = "Set popup header text\n\n # Arguments\n\n* `popup` - Popup instance\n * `callback` - PopupCallback"]
pub fn popup_set_callback(popup: *mut Popup, callback: PopupCallback);
}
extern "C" {
#[doc = "Set popup context\n\n # Arguments\n\n* `popup` - Popup instance\n * `context` - context pointer, will be passed to result callback"]
pub fn popup_set_context(popup: *mut Popup, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set popup header text\n\n If text is null, popup header will not be rendered\n\n # Arguments\n\n* `popup` - Popup instance\n * `text` - text to be shown, can be multiline\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal alignment\n * `vertical` - vertical alignment"]
pub fn popup_set_header(
popup: *mut Popup,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set popup text\n\n If text is null, popup text will not be rendered\n\n # Arguments\n\n* `popup` - Popup instance\n * `text` - text to be shown, can be multiline\n * `x` - x position\n * `y` - y position\n * `horizontal` - horizontal alignment\n * `vertical` - vertical alignment"]
pub fn popup_set_text(
popup: *mut Popup,
text: *const core::ffi::c_char,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
);
}
extern "C" {
#[doc = "Set popup icon\n\n If icon position is negative, popup icon will not be rendered\n\n # Arguments\n\n* `popup` - Popup instance\n * `x` - x position\n * `y` - y position\n * `icon` - pointer to Icon data"]
pub fn popup_set_icon(popup: *mut Popup, x: u8, y: u8, icon: *const Icon);
}
extern "C" {
#[doc = "Set popup timeout\n\n # Arguments\n\n* `popup` - Popup instance\n * `timeout_in_ms` - popup timeout value in milliseconds"]
pub fn popup_set_timeout(popup: *mut Popup, timeout_in_ms: u32);
}
extern "C" {
#[doc = "Enable popup timeout\n\n # Arguments\n\n* `popup` - Popup instance"]
pub fn popup_enable_timeout(popup: *mut Popup);
}
extern "C" {
#[doc = "Disable popup timeout\n\n # Arguments\n\n* `popup` - Popup instance"]
pub fn popup_disable_timeout(popup: *mut Popup);
}
extern "C" {
#[doc = "Reset popup instance state\n\n # Arguments\n\n* `popup` - Popup instance"]
pub fn popup_reset(popup: *mut Popup);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Submenu {
_unused: [u8; 0],
}
pub type SubmenuItemCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, index: u32)>;
extern "C" {
#[doc = "Allocate and initialize submenu\n\n This submenu is used to select one option\n\n # Returns\n\nSubmenu instance"]
pub fn submenu_alloc() -> *mut Submenu;
}
extern "C" {
#[doc = "Deinitialize and free submenu\n\n # Arguments\n\n* `submenu` - Submenu instance"]
pub fn submenu_free(submenu: *mut Submenu);
}
extern "C" {
#[doc = "Get submenu view\n\n # Arguments\n\n* `submenu` - Submenu instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn submenu_get_view(submenu: *mut Submenu) -> *mut View;
}
extern "C" {
#[doc = "Add item to submenu\n\n # Arguments\n\n* `submenu` - Submenu instance\n * `label` - menu item label\n * `index` - menu item index, used for callback, may be\n the same with other items\n * `callback` - menu item callback\n * `callback_context` - menu item callback context"]
pub fn submenu_add_item(
submenu: *mut Submenu,
label: *const core::ffi::c_char,
index: u32,
callback: SubmenuItemCallback,
callback_context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Change label of an existing item\n\n # Arguments\n\n* `submenu` - Submenu instance\n * `index` - The index of the item\n * `label` - The new label"]
pub fn submenu_change_item_label(
submenu: *mut Submenu,
index: u32,
label: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Remove all items from submenu\n\n # Arguments\n\n* `submenu` - Submenu instance"]
pub fn submenu_reset(submenu: *mut Submenu);
}
extern "C" {
#[doc = "Get submenu selected item index\n\n # Arguments\n\n* `submenu` - Submenu instance\n\n # Returns\n\nIndex of the selected item"]
pub fn submenu_get_selected_item(submenu: *mut Submenu) -> u32;
}
extern "C" {
#[doc = "Set submenu selected item by index\n\n # Arguments\n\n* `submenu` - Submenu instance\n * `index` - The index of the selected item"]
pub fn submenu_set_selected_item(submenu: *mut Submenu, index: u32);
}
extern "C" {
#[doc = "Set optional header for submenu\n\n # Arguments\n\n* `submenu` - Submenu instance\n * `header` - header to set"]
pub fn submenu_set_header(submenu: *mut Submenu, header: *const core::ffi::c_char);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TextBox {
_unused: [u8; 0],
}
pub const TextBoxFont_TextBoxFontText: TextBoxFont = 0;
pub const TextBoxFont_TextBoxFontHex: TextBoxFont = 1;
pub type TextBoxFont = core::ffi::c_uchar;
pub const TextBoxFocus_TextBoxFocusStart: TextBoxFocus = 0;
pub const TextBoxFocus_TextBoxFocusEnd: TextBoxFocus = 1;
pub type TextBoxFocus = core::ffi::c_uchar;
extern "C" {
#[doc = "Allocate and initialize text_box\n\n # Returns\n\nTextBox instance"]
pub fn text_box_alloc() -> *mut TextBox;
}
extern "C" {
#[doc = "Deinitialize and free text_box\n\n # Arguments\n\n* `text_box` - text_box instance"]
pub fn text_box_free(text_box: *mut TextBox);
}
extern "C" {
#[doc = "Get text_box view\n\n # Arguments\n\n* `text_box` - TextBox instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn text_box_get_view(text_box: *mut TextBox) -> *mut View;
}
extern "C" {
#[doc = "Clean text_box\n\n # Arguments\n\n* `text_box` - TextBox instance"]
pub fn text_box_reset(text_box: *mut TextBox);
}
extern "C" {
#[doc = "Set text for text_box\n\n # Arguments\n\n* `text_box` - TextBox instance\n * `text` - text to set"]
pub fn text_box_set_text(text_box: *mut TextBox, text: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Set TextBox font\n\n # Arguments\n\n* `text_box` - TextBox instance\n * `font` - TextBoxFont instance"]
pub fn text_box_set_font(text_box: *mut TextBox, font: TextBoxFont);
}
extern "C" {
#[doc = "Set TextBox focus\n > **Note:** Use to display from start or from end\n\n # Arguments\n\n* `text_box` - TextBox instance\n * `focus` - TextBoxFocus instance"]
pub fn text_box_set_focus(text_box: *mut TextBox, focus: TextBoxFocus);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ValidatorIsFile {
_unused: [u8; 0],
}
extern "C" {
pub fn validator_is_file_alloc_init(
app_path_folder: *const core::ffi::c_char,
app_extension: *const core::ffi::c_char,
current_name: *const core::ffi::c_char,
) -> *mut ValidatorIsFile;
}
extern "C" {
pub fn validator_is_file_free(instance: *mut ValidatorIsFile);
}
extern "C" {
pub fn validator_is_file_callback(
text: *const core::ffi::c_char,
error: *mut FuriString,
context: *mut core::ffi::c_void,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TextInput {
_unused: [u8; 0],
}
pub type TextInputCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub type TextInputValidatorCallback = ::core::option::Option<
unsafe extern "C" fn(
text: *const core::ffi::c_char,
error: *mut FuriString,
context: *mut core::ffi::c_void,
) -> bool,
>;
extern "C" {
#[doc = "Allocate and initialize text input\n\n This text input is used to enter string\n\n # Returns\n\nTextInput instance"]
pub fn text_input_alloc() -> *mut TextInput;
}
extern "C" {
#[doc = "Deinitialize and free text input\n\n # Arguments\n\n* `text_input` - TextInput instance"]
pub fn text_input_free(text_input: *mut TextInput);
}
extern "C" {
#[doc = "Clean text input view Note: this function does not free memory\n\n # Arguments\n\n* `text_input` - Text input instance"]
pub fn text_input_reset(text_input: *mut TextInput);
}
extern "C" {
#[doc = "Get text input view\n\n # Arguments\n\n* `text_input` - TextInput instance\n\n # Returns\n\nView instance that can be used for embedding"]
pub fn text_input_get_view(text_input: *mut TextInput) -> *mut View;
}
extern "C" {
#[doc = "Set text input result callback\n\n # Arguments\n\n* `text_input` - TextInput instance\n * `callback` - callback fn\n * `callback_context` - callback context\n * `text_buffer` - pointer to YOUR text buffer, that we going\n to modify\n * `text_buffer_size` - YOUR text buffer size in bytes. Max string\n length will be text_buffer_size-1.\n * `clear_default_text` - clear text from text_buffer on first OK\n event"]
pub fn text_input_set_result_callback(
text_input: *mut TextInput,
callback: TextInputCallback,
callback_context: *mut core::ffi::c_void,
text_buffer: *mut core::ffi::c_char,
text_buffer_size: usize,
clear_default_text: bool,
);
}
extern "C" {
pub fn text_input_set_validator(
text_input: *mut TextInput,
callback: TextInputValidatorCallback,
callback_context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn text_input_get_validator_callback(
text_input: *mut TextInput,
) -> TextInputValidatorCallback;
}
extern "C" {
pub fn text_input_get_validator_callback_context(
text_input: *mut TextInput,
) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Set text input header text\n\n # Arguments\n\n* `text_input` - TextInput instance\n * `text` - text to be shown"]
pub fn text_input_set_header_text(text_input: *mut TextInput, text: *const core::ffi::c_char);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct VariableItemList {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct VariableItem {
_unused: [u8; 0],
}
pub type VariableItemChangeCallback =
::core::option::Option<unsafe extern "C" fn(item: *mut VariableItem)>;
pub type VariableItemListEnterCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, index: u32)>;
extern "C" {
#[doc = "Allocate and initialize VariableItemList\n\n # Returns\n\nVariableItemList*"]
pub fn variable_item_list_alloc() -> *mut VariableItemList;
}
extern "C" {
#[doc = "Deinitialize and free VariableItemList\n\n # Arguments\n\n* `variable_item_list` - VariableItemList instance"]
pub fn variable_item_list_free(variable_item_list: *mut VariableItemList);
}
extern "C" {
#[doc = "Clear all elements from list\n\n # Arguments\n\n* `variable_item_list` - VariableItemList instance"]
pub fn variable_item_list_reset(variable_item_list: *mut VariableItemList);
}
extern "C" {
#[doc = "Get VariableItemList View instance\n\n # Arguments\n\n* `variable_item_list` - VariableItemList instance\n\n # Returns\n\nView instance"]
pub fn variable_item_list_get_view(variable_item_list: *mut VariableItemList) -> *mut View;
}
extern "C" {
#[doc = "Add item to VariableItemList\n\n # Arguments\n\n* `variable_item_list` - VariableItemList instance\n * `label` - item name\n * `values_count` - item values count\n * `change_callback` - called on value change in gui\n * `context` - item context\n\n # Returns\n\nVariableItem* item instance"]
pub fn variable_item_list_add(
variable_item_list: *mut VariableItemList,
label: *const core::ffi::c_char,
values_count: u8,
change_callback: VariableItemChangeCallback,
context: *mut core::ffi::c_void,
) -> *mut VariableItem;
}
extern "C" {
#[doc = "Set enter callback\n\n # Arguments\n\n* `variable_item_list` - VariableItemList instance\n * `callback` - VariableItemListEnterCallback instance\n * `context` - pointer to context"]
pub fn variable_item_list_set_enter_callback(
variable_item_list: *mut VariableItemList,
callback: VariableItemListEnterCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn variable_item_list_set_selected_item(
variable_item_list: *mut VariableItemList,
index: u8,
);
}
extern "C" {
pub fn variable_item_list_get_selected_item_index(
variable_item_list: *mut VariableItemList,
) -> u8;
}
extern "C" {
#[doc = "Set item current selected index\n\n # Arguments\n\n* `item` - VariableItem* instance\n * `current_value_index` - The current value index"]
pub fn variable_item_set_current_value_index(item: *mut VariableItem, current_value_index: u8);
}
extern "C" {
#[doc = "Set number of values for item\n\n # Arguments\n\n* `item` - VariableItem* instance\n * `values_count` - The new values count"]
pub fn variable_item_set_values_count(item: *mut VariableItem, values_count: u8);
}
extern "C" {
#[doc = "Set item current selected text\n\n # Arguments\n\n* `item` - VariableItem* instance\n * `current_value_text` - The current value text"]
pub fn variable_item_set_current_value_text(
item: *mut VariableItem,
current_value_text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Get item current selected index\n\n # Arguments\n\n* `item` - VariableItem* instance\n\n # Returns\n\nuint8_t current selected index"]
pub fn variable_item_get_current_value_index(item: *mut VariableItem) -> u8;
}
extern "C" {
#[doc = "Get item context\n\n # Arguments\n\n* `item` - VariableItem* instance\n\n # Returns\n\nvoid* item context"]
pub fn variable_item_get_context(item: *mut VariableItem) -> *mut core::ffi::c_void;
}
pub const GuiButtonType_GuiButtonTypeLeft: GuiButtonType = 0;
pub const GuiButtonType_GuiButtonTypeCenter: GuiButtonType = 1;
pub const GuiButtonType_GuiButtonTypeRight: GuiButtonType = 2;
pub type GuiButtonType = core::ffi::c_uchar;
pub type ButtonCallback = ::core::option::Option<
unsafe extern "C" fn(result: GuiButtonType, type_: InputType, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Widget {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate Widget that holds Widget Elements\n\n # Returns\n\nWidget instance"]
pub fn widget_alloc() -> *mut Widget;
}
extern "C" {
#[doc = "Free Widget\n > **Note:** this function free allocated Widget Elements\n\n # Arguments\n\n* `widget` - Widget instance"]
pub fn widget_free(widget: *mut Widget);
}
extern "C" {
#[doc = "Reset Widget\n\n # Arguments\n\n* `widget` - Widget instance"]
pub fn widget_reset(widget: *mut Widget);
}
extern "C" {
#[doc = "Get Widget view\n\n # Arguments\n\n* `widget` - Widget instance\n\n # Returns\n\nView instance"]
pub fn widget_get_view(widget: *mut Widget) -> *mut View;
}
extern "C" {
#[doc = "Add Multi String Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `horizontal` - Align instance\n * `vertical` - Align instance\n * `font` - Font instance\n * `text` (direction in) - The text"]
pub fn widget_add_string_multiline_element(
widget: *mut Widget,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
font: Font,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Add String Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `horizontal` - Align instance\n * `vertical` - Align instance\n * `font` - Font instance\n * `text` (direction in) - The text"]
pub fn widget_add_string_element(
widget: *mut Widget,
x: u8,
y: u8,
horizontal: Align,
vertical: Align,
font: Font,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Add Text Box Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - width to fit text\n * `height` - height to fit text\n * `horizontal` - Align instance\n * `vertical` - Align instance\n * `text` (direction in) - Formatted text. The following formats are available:\n \"text- bold font is used\n \"text- monospaced font is used\n \"text- white text on black background\n * `strip_to_dots` - Strip text to ... if does not fit to width"]
pub fn widget_add_text_box_element(
widget: *mut Widget,
x: u8,
y: u8,
width: u8,
height: u8,
horizontal: Align,
vertical: Align,
text: *const core::ffi::c_char,
strip_to_dots: bool,
);
}
extern "C" {
#[doc = "Add Text Scroll Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - x coordinate\n * `y` - y coordinate\n * `width` - width to fit text\n * `height` - height to fit text\n * `text` (direction in) - Formatted text. Default format: align left, Secondary font.\n The following formats are available:\n \"text\" - sets bold font before until next 'symbol\n \"text- sets monospaced font before until next 'symbol\n \"text\" - sets center horizontal align until the next 'symbol\n \"text\" - sets right horizontal align until the next 'symbol"]
pub fn widget_add_text_scroll_element(
widget: *mut Widget,
x: u8,
y: u8,
width: u8,
height: u8,
text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Add Button Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `button_type` - GuiButtonType instance\n * `text` - text on allocated button\n * `callback` - ButtonCallback instance\n * `context` - pointer to context"]
pub fn widget_add_button_element(
widget: *mut Widget,
button_type: GuiButtonType,
text: *const core::ffi::c_char,
callback: ButtonCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Add Icon Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - top left x coordinate\n * `y` - top left y coordinate\n * `icon` - Icon instance"]
pub fn widget_add_icon_element(widget: *mut Widget, x: u8, y: u8, icon: *const Icon);
}
extern "C" {
#[doc = "Add Frame Element\n\n # Arguments\n\n* `widget` - Widget instance\n * `x` - top left x coordinate\n * `y` - top left y coordinate\n * `width` - frame width\n * `height` - frame height\n * `radius` - frame radius"]
pub fn widget_add_frame_element(
widget: *mut Widget,
x: u8,
y: u8,
width: u8,
height: u8,
radius: u8,
);
}
pub const SceneManagerEventType_SceneManagerEventTypeCustom: SceneManagerEventType = 0;
pub const SceneManagerEventType_SceneManagerEventTypeBack: SceneManagerEventType = 1;
pub const SceneManagerEventType_SceneManagerEventTypeTick: SceneManagerEventType = 2;
#[doc = "Scene Manager events type"]
pub type SceneManagerEventType = core::ffi::c_uchar;
#[doc = "Scene Manager event"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SceneManagerEvent {
pub type_: SceneManagerEventType,
pub event: u32,
}
#[test]
fn bindgen_test_layout_SceneManagerEvent() {
const UNINIT: ::core::mem::MaybeUninit<SceneManagerEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SceneManagerEvent>(),
8usize,
concat!("Size of: ", stringify!(SceneManagerEvent))
);
assert_eq!(
::core::mem::align_of::<SceneManagerEvent>(),
4usize,
concat!("Alignment of ", stringify!(SceneManagerEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).event) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerEvent),
"::",
stringify!(event)
)
);
}
#[doc = "Prototype for Scene on_enter handler"]
pub type AppSceneOnEnterCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Prototype for Scene on_event handler"]
pub type AppSceneOnEventCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, event: SceneManagerEvent) -> bool,
>;
#[doc = "Prototype for Scene on_exit handler"]
pub type AppSceneOnExitCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Scene Manager configuration structure\n Contains array of Scene handlers"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SceneManagerHandlers {
pub on_enter_handlers: *const AppSceneOnEnterCallback,
pub on_event_handlers: *const AppSceneOnEventCallback,
pub on_exit_handlers: *const AppSceneOnExitCallback,
pub scene_num: u32,
}
#[test]
fn bindgen_test_layout_SceneManagerHandlers() {
const UNINIT: ::core::mem::MaybeUninit<SceneManagerHandlers> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SceneManagerHandlers>(),
16usize,
concat!("Size of: ", stringify!(SceneManagerHandlers))
);
assert_eq!(
::core::mem::align_of::<SceneManagerHandlers>(),
4usize,
concat!("Alignment of ", stringify!(SceneManagerHandlers))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).on_enter_handlers) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerHandlers),
"::",
stringify!(on_enter_handlers)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).on_event_handlers) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerHandlers),
"::",
stringify!(on_event_handlers)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).on_exit_handlers) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerHandlers),
"::",
stringify!(on_exit_handlers)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).scene_num) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SceneManagerHandlers),
"::",
stringify!(scene_num)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SceneManager {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Set Scene state\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_id` - Scene ID\n * `state` - Scene new state"]
pub fn scene_manager_set_scene_state(
scene_manager: *mut SceneManager,
scene_id: u32,
state: u32,
);
}
extern "C" {
#[doc = "Get Scene state\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_id` - Scene ID\n\n # Returns\n\nScene state"]
pub fn scene_manager_get_scene_state(scene_manager: *const SceneManager, scene_id: u32) -> u32;
}
extern "C" {
#[doc = "Scene Manager allocation and configuration\n\n Scene Manager allocates all scenes internally\n\n # Arguments\n\n* `app_scene_handlers` - SceneManagerHandlers instance\n * `context` - context to be set on Scene handlers calls\n\n # Returns\n\nSceneManager instance"]
pub fn scene_manager_alloc(
app_scene_handlers: *const SceneManagerHandlers,
context: *mut core::ffi::c_void,
) -> *mut SceneManager;
}
extern "C" {
#[doc = "Free Scene Manager with allocated Scenes\n\n # Arguments\n\n* `scene_manager` - SceneManager instance"]
pub fn scene_manager_free(scene_manager: *mut SceneManager);
}
extern "C" {
#[doc = "Custom event handler\n\n Calls Scene event handler with Custom event parameter\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `custom_event` - Custom event code\n\n # Returns\n\ntrue if event was consumed, false otherwise"]
pub fn scene_manager_handle_custom_event(
scene_manager: *mut SceneManager,
custom_event: u32,
) -> bool;
}
extern "C" {
#[doc = "Back event handler\n\n Calls Scene event handler with Back event parameter\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n\n # Returns\n\ntrue if event was consumed, false otherwise"]
pub fn scene_manager_handle_back_event(scene_manager: *mut SceneManager) -> bool;
}
extern "C" {
#[doc = "Tick event handler\n\n Calls Scene event handler with Tick event parameter\n\n # Arguments\n\n* `scene_manager` - SceneManager instance"]
pub fn scene_manager_handle_tick_event(scene_manager: *mut SceneManager);
}
extern "C" {
#[doc = "Add and run next Scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `next_scene_id` - next Scene ID"]
pub fn scene_manager_next_scene(scene_manager: *mut SceneManager, next_scene_id: u32);
}
extern "C" {
#[doc = "Run previous Scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n\n # Returns\n\ntrue if previous scene was found, false otherwise"]
pub fn scene_manager_previous_scene(scene_manager: *mut SceneManager) -> bool;
}
extern "C" {
#[doc = "Search previous Scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_id` - Scene ID\n\n # Returns\n\ntrue if previous scene was found, false otherwise"]
pub fn scene_manager_has_previous_scene(
scene_manager: *const SceneManager,
scene_id: u32,
) -> bool;
}
extern "C" {
#[doc = "Search and switch to previous Scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_id` - Scene ID\n\n # Returns\n\ntrue if previous scene was found, false otherwise"]
pub fn scene_manager_search_and_switch_to_previous_scene(
scene_manager: *mut SceneManager,
scene_id: u32,
) -> bool;
}
extern "C" {
#[doc = "Search and switch to previous Scene, multiple choice\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_ids` - Array of scene IDs\n * `scene_ids_size` - Array of scene IDs size\n\n # Returns\n\ntrue if one of previous scenes was found, false otherwise"]
pub fn scene_manager_search_and_switch_to_previous_scene_one_of(
scene_manager: *mut SceneManager,
scene_ids: *const u32,
scene_ids_size: usize,
) -> bool;
}
extern "C" {
#[doc = "Clear Scene stack and switch to another Scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance\n * `scene_id` - Scene ID\n\n # Returns\n\ntrue if previous scene was found, false otherwise"]
pub fn scene_manager_search_and_switch_to_another_scene(
scene_manager: *mut SceneManager,
scene_id: u32,
) -> bool;
}
extern "C" {
#[doc = "Exit from current scene\n\n # Arguments\n\n* `scene_manager` - SceneManager instance"]
pub fn scene_manager_stop(scene_manager: *mut SceneManager);
}
#[doc = "< Desktop layer: fullscreen with status bar on top of it. For internal usage."]
pub const ViewDispatcherType_ViewDispatcherTypeDesktop: ViewDispatcherType = 0;
#[doc = "< Window layer: with status bar"]
pub const ViewDispatcherType_ViewDispatcherTypeWindow: ViewDispatcherType = 1;
#[doc = "< Fullscreen layer: without status bar"]
pub const ViewDispatcherType_ViewDispatcherTypeFullscreen: ViewDispatcherType = 2;
#[doc = "ViewDispatcher view_port placement"]
pub type ViewDispatcherType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ViewDispatcher {
_unused: [u8; 0],
}
#[doc = "Prototype for custom event callback"]
pub type ViewDispatcherCustomEventCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, event: u32) -> bool,
>;
#[doc = "Prototype for navigation event callback"]
pub type ViewDispatcherNavigationEventCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void) -> bool>;
#[doc = "Prototype for tick event callback"]
pub type ViewDispatcherTickEventCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Allocate ViewDispatcher instance\n\n # Returns\n\npointer to ViewDispatcher instance"]
pub fn view_dispatcher_alloc() -> *mut ViewDispatcher;
}
extern "C" {
#[doc = "Free ViewDispatcher instance\n\n All added views MUST be removed using view_dispatcher_remove_view()\n before calling this function.\n\n # Arguments\n\n* `view_dispatcher` - pointer to ViewDispatcher"]
pub fn view_dispatcher_free(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Enable queue support\n\n > **Deprecated** Do NOT use in new code and remove all calls to it from existing code.\n The queue support is now always enabled during construction. If no queue support\n is required, consider using ViewHolder instead.\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance"]
pub fn view_dispatcher_enable_queue(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Send custom event\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `event` (direction in) - The event"]
pub fn view_dispatcher_send_custom_event(view_dispatcher: *mut ViewDispatcher, event: u32);
}
extern "C" {
#[doc = "Set custom event handler\n\n Called on Custom Event, if it is not consumed by view\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `callback` - ViewDispatcherCustomEventCallback instance"]
pub fn view_dispatcher_set_custom_event_callback(
view_dispatcher: *mut ViewDispatcher,
callback: ViewDispatcherCustomEventCallback,
);
}
extern "C" {
#[doc = "Set navigation event handler\n\n Called on Input Short Back Event, if it is not consumed by view\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `callback` - ViewDispatcherNavigationEventCallback instance"]
pub fn view_dispatcher_set_navigation_event_callback(
view_dispatcher: *mut ViewDispatcher,
callback: ViewDispatcherNavigationEventCallback,
);
}
extern "C" {
#[doc = "Set tick event handler\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `callback` - ViewDispatcherTickEventCallback\n * `tick_period` - callback call period"]
pub fn view_dispatcher_set_tick_event_callback(
view_dispatcher: *mut ViewDispatcher,
callback: ViewDispatcherTickEventCallback,
tick_period: u32,
);
}
extern "C" {
#[doc = "Set event callback context\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `context` - pointer to context"]
pub fn view_dispatcher_set_event_callback_context(
view_dispatcher: *mut ViewDispatcher,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Get event_loop instance\n\n Use the return value to connect additional supported primitives (message queues, timers, etc)\n to this ViewDispatcher instance's event loop.\n\n Do NOT call furi_event_loop_run() on the returned instance, it is done internally\n in the view_dispatcher_run() call.\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n\n # Returns\n\nThe event_loop instance."]
pub fn view_dispatcher_get_event_loop(
view_dispatcher: *mut ViewDispatcher,
) -> *mut FuriEventLoop;
}
extern "C" {
#[doc = "Run ViewDispatcher\n\n This function will start the event loop and block until view_dispatcher_stop() is called\n or the current thread receives a FuriSignalExit signal.\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance"]
pub fn view_dispatcher_run(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Stop ViewDispatcher\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance"]
pub fn view_dispatcher_stop(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Add view to ViewDispatcher\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `view_id` - View id to register\n * `view` - View instance"]
pub fn view_dispatcher_add_view(
view_dispatcher: *mut ViewDispatcher,
view_id: u32,
view: *mut View,
);
}
extern "C" {
#[doc = "Remove view from ViewDispatcher\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `view_id` - View id to remove"]
pub fn view_dispatcher_remove_view(view_dispatcher: *mut ViewDispatcher, view_id: u32);
}
extern "C" {
#[doc = "Switch to View\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `view_id` - View id to register\n switching may be delayed till input events complementarity\n reached"]
pub fn view_dispatcher_switch_to_view(view_dispatcher: *mut ViewDispatcher, view_id: u32);
}
extern "C" {
#[doc = "Send ViewPort of this ViewDispatcher instance to front\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance"]
pub fn view_dispatcher_send_to_front(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Send ViewPort of this ViewDispatcher instance to back\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance"]
pub fn view_dispatcher_send_to_back(view_dispatcher: *mut ViewDispatcher);
}
extern "C" {
#[doc = "Attach ViewDispatcher to GUI\n\n # Arguments\n\n* `view_dispatcher` - ViewDispatcher instance\n * `gui` - GUI instance to attach to\n * `type` (direction in) - The type"]
pub fn view_dispatcher_attach_to_gui(
view_dispatcher: *mut ViewDispatcher,
gui: *mut Gui,
type_: ViewDispatcherType,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ViewHolder {
_unused: [u8; 0],
}
#[doc = "Free callback type"]
pub type FreeCallback =
::core::option::Option<unsafe extern "C" fn(free_context: *mut core::ffi::c_void)>;
#[doc = "Back callback type\n\n Will be called from the GUI thread"]
pub type BackCallback =
::core::option::Option<unsafe extern "C" fn(back_context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Allocate ViewHolder\n # Returns\n\npointer to ViewHolder instance"]
pub fn view_holder_alloc() -> *mut ViewHolder;
}
extern "C" {
#[doc = "Free ViewHolder and call Free callback\n\n The current view must be unset prior to freeing a ViewHolder instance.\n\n # Arguments\n\n* `view_holder` - pointer to ViewHolder"]
pub fn view_holder_free(view_holder: *mut ViewHolder);
}
extern "C" {
#[doc = "Set view for ViewHolder\n\n Pass NULL as the view parameter to unset the current view.\n\n # Arguments\n\n* `view_holder` - ViewHolder instance\n * `view` - View instance"]
pub fn view_holder_set_view(view_holder: *mut ViewHolder, view: *mut View);
}
extern "C" {
#[doc = "Set Free callback\n\n # Arguments\n\n* `view_holder` - ViewHolder instance\n * `free_callback` - callback pointer\n * `free_context` - callback context"]
pub fn view_holder_set_free_callback(
view_holder: *mut ViewHolder,
free_callback: FreeCallback,
free_context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Free callback context getter.\n\n Useful if your Free callback is a module destructor, so you can get an instance of the module using this method.\n\n # Arguments\n\n* `view_holder` - ViewHolder instance\n # Returns\n\nvoid* free callback context"]
pub fn view_holder_get_free_context(view_holder: *mut ViewHolder) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Set the back key callback.\n\n The callback function will be called if the user has pressed the Back key\n and the current view did not handle this event.\n\n # Arguments\n\n* `view_holder` - ViewHolder instance\n * `back_callback` - pointer to the callback function\n * `back_context` - pointer to a user-specific object, can be NULL"]
pub fn view_holder_set_back_callback(
view_holder: *mut ViewHolder,
back_callback: BackCallback,
back_context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Attach ViewHolder to GUI\n\n # Arguments\n\n* `view_holder` - ViewHolder instance\n * `gui` - GUI instance to attach to"]
pub fn view_holder_attach_to_gui(view_holder: *mut ViewHolder, gui: *mut Gui);
}
extern "C" {
#[doc = "View Update Handler\n\n # Arguments\n\n* `view` - View Instance\n * `context` - ViewHolder instance"]
pub fn view_holder_update(view: *mut View, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Send ViewPort of this ViewHolder instance to front\n\n # Arguments\n\n* `view_holder` - ViewHolder instance"]
pub fn view_holder_send_to_front(view_holder: *mut ViewHolder);
}
extern "C" {
#[doc = "Send ViewPort of this ViewHolder instance to back\n\n # Arguments\n\n* `view_holder` - ViewHolder instance"]
pub fn view_holder_send_to_back(view_holder: *mut ViewHolder);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ViewStack {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and init ViewStack\n\n # Returns\n\nViewStack instance"]
pub fn view_stack_alloc() -> *mut ViewStack;
}
extern "C" {
#[doc = "Free ViewStack instance\n\n # Arguments\n\n* `view_stack` - instance"]
pub fn view_stack_free(view_stack: *mut ViewStack);
}
extern "C" {
#[doc = "Get View of ViewStack.\n Should this View to any view manager such as\n ViewDispatcher or ViewHolder.\n\n # Arguments\n\n* `view_stack` - instance"]
pub fn view_stack_get_view(view_stack: *mut ViewStack) -> *mut View;
}
extern "C" {
#[doc = "Add View to ViewStack.\n Adds View on top of ViewStack.\n\n # Arguments\n\n* `view_stack` - instance\n * `view` - view to add"]
pub fn view_stack_add_view(view_stack: *mut ViewStack, view: *mut View);
}
extern "C" {
#[doc = "Remove any View in ViewStack.\n If no View to remove found - ignore.\n\n # Arguments\n\n* `view_stack` - instance\n * `view` - view to remove"]
pub fn view_stack_remove_view(view_stack: *mut ViewStack, view: *mut View);
}
extern "C" {
pub static firmware_api_interface: *const ElfApiInterface;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Loader {
_unused: [u8; 0],
}
pub const LoaderStatus_LoaderStatusOk: LoaderStatus = 0;
pub const LoaderStatus_LoaderStatusErrorAppStarted: LoaderStatus = 1;
pub const LoaderStatus_LoaderStatusErrorUnknownApp: LoaderStatus = 2;
pub const LoaderStatus_LoaderStatusErrorInternal: LoaderStatus = 3;
pub type LoaderStatus = core::ffi::c_uchar;
extern "C" {
#[doc = "Start application\n # Arguments\n\n* `instance` (direction in) - loader instance\n * `name` (direction in) - application name or id\n * `args` (direction in) - application arguments\n * `error_message` (direction out) - detailed error message, can be NULL\n # Returns\n\nLoaderStatus"]
pub fn loader_start(
instance: *mut Loader,
name: *const core::ffi::c_char,
args: *const core::ffi::c_char,
error_message: *mut FuriString,
) -> LoaderStatus;
}
extern "C" {
#[doc = "Start application with GUI error message\n # Arguments\n\n* `instance` (direction in) - loader instance\n * `name` (direction in) - application name or id\n * `args` (direction in) - application arguments\n # Returns\n\nLoaderStatus"]
pub fn loader_start_with_gui_error(
loader: *mut Loader,
name: *const core::ffi::c_char,
args: *const core::ffi::c_char,
) -> LoaderStatus;
}
extern "C" {
#[doc = "Start application detached with GUI error message\n # Arguments\n\n* `instance` (direction in) - loader instance\n * `name` (direction in) - application name or id\n * `args` (direction in) - application arguments"]
pub fn loader_start_detached_with_gui_error(
loader: *mut Loader,
name: *const core::ffi::c_char,
args: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Lock application start\n # Arguments\n\n* `instance` (direction in) - loader instance\n # Returns\n\ntrue on success"]
pub fn loader_lock(instance: *mut Loader) -> bool;
}
extern "C" {
#[doc = "Unlock application start\n # Arguments\n\n* `instance` (direction in) - loader instance"]
pub fn loader_unlock(instance: *mut Loader);
}
extern "C" {
#[doc = "Check if loader is locked\n # Arguments\n\n* `instance` (direction in) - loader instance\n # Returns\n\ntrue if locked"]
pub fn loader_is_locked(instance: *mut Loader) -> bool;
}
extern "C" {
#[doc = "Show loader menu\n # Arguments\n\n* `instance` (direction in) - loader instance"]
pub fn loader_show_menu(instance: *mut Loader);
}
extern "C" {
#[doc = "Get loader pubsub\n # Arguments\n\n* `instance` (direction in) - loader instance\n # Returns\n\nFuriPubSub*"]
pub fn loader_get_pubsub(instance: *mut Loader) -> *mut FuriPubSub;
}
extern "C" {
#[doc = "Send a signal to the currently running application\n\n # Arguments\n\n* `instance` (direction in) - pointer to the loader instance\n * `signal` (direction in) - signal value to be sent\n * `arg` (direction in, out) - optional argument (can be of any value, including NULL)\n\n # Returns\n\ntrue if the signal was handled by the application, false otherwise"]
pub fn loader_signal(instance: *mut Loader, signal: u32, arg: *mut core::ffi::c_void) -> bool;
}
extern "C" {
#[doc = "Get the name of the currently running application\n\n # Arguments\n\n* `instance` (direction in) - pointer to the loader instance\n * `name` (direction in, out) - pointer to the string to contain the name (must be allocated)\n # Returns\n\ntrue if it was possible to get an application name, false otherwise"]
pub fn loader_get_application_name(instance: *mut Loader, name: *mut FuriString) -> bool;
}
#[doc = "< Metric measurement units"]
pub const LocaleMeasurementUnits_LocaleMeasurementUnitsMetric: LocaleMeasurementUnits = 0;
#[doc = "< Imperial measurement units"]
pub const LocaleMeasurementUnits_LocaleMeasurementUnitsImperial: LocaleMeasurementUnits = 1;
pub type LocaleMeasurementUnits = core::ffi::c_uchar;
#[doc = "< 24-hour format"]
pub const LocaleTimeFormat_LocaleTimeFormat24h: LocaleTimeFormat = 0;
#[doc = "< 12-hour format"]
pub const LocaleTimeFormat_LocaleTimeFormat12h: LocaleTimeFormat = 1;
pub type LocaleTimeFormat = core::ffi::c_uchar;
#[doc = "< Day/Month/Year"]
pub const LocaleDateFormat_LocaleDateFormatDMY: LocaleDateFormat = 0;
#[doc = "< Month/Day/Year"]
pub const LocaleDateFormat_LocaleDateFormatMDY: LocaleDateFormat = 1;
#[doc = "< Year/Month/Day"]
pub const LocaleDateFormat_LocaleDateFormatYMD: LocaleDateFormat = 2;
pub type LocaleDateFormat = core::ffi::c_uchar;
extern "C" {
#[doc = "Get Locale measurement units\n\n # Returns\n\nThe locale measurement units."]
pub fn locale_get_measurement_unit() -> LocaleMeasurementUnits;
}
extern "C" {
#[doc = "Set locale measurement units\n\n # Arguments\n\n* `format` (direction in) - The locale measurements units"]
pub fn locale_set_measurement_unit(format: LocaleMeasurementUnits);
}
extern "C" {
#[doc = "Convert Fahrenheit to Celsius\n\n # Arguments\n\n* `temp_f` (direction in) - The Temperature in Fahrenheit\n\n # Returns\n\nThe Temperature in Celsius"]
pub fn locale_fahrenheit_to_celsius(temp_f: f32) -> f32;
}
extern "C" {
#[doc = "Convert Celsius to Fahrenheit\n\n # Arguments\n\n* `temp_c` (direction in) - The Temperature in Celsius\n\n # Returns\n\nThe Temperature in Fahrenheit"]
pub fn locale_celsius_to_fahrenheit(temp_c: f32) -> f32;
}
extern "C" {
#[doc = "Get Locale time format\n\n # Returns\n\nThe locale time format."]
pub fn locale_get_time_format() -> LocaleTimeFormat;
}
extern "C" {
#[doc = "Set Locale Time Format\n\n # Arguments\n\n* `format` (direction in) - The Locale Time Format"]
pub fn locale_set_time_format(format: LocaleTimeFormat);
}
extern "C" {
#[doc = "Format time to furi string\n\n # Arguments\n\n* `out_str` (direction out) - The FuriString to store formatted time\n * `datetime` (direction in) - Pointer to the datetime\n * `format` (direction in) - The Locale Time Format\n * `show_seconds` (direction in) - The show seconds flag"]
pub fn locale_format_time(
out_str: *mut FuriString,
datetime: *const DateTime,
format: LocaleTimeFormat,
show_seconds: bool,
);
}
extern "C" {
#[doc = "Get Locale DateFormat\n\n # Returns\n\nThe Locale DateFormat."]
pub fn locale_get_date_format() -> LocaleDateFormat;
}
extern "C" {
#[doc = "Set Locale DateFormat\n\n # Arguments\n\n* `format` (direction in) - The Locale DateFormat"]
pub fn locale_set_date_format(format: LocaleDateFormat);
}
extern "C" {
#[doc = "Format date to furi string\n\n # Arguments\n\n* `out_str` (direction out) - The FuriString to store formatted date\n * `datetime` (direction in) - Pointer to the datetime\n * `format` (direction in) - The format\n * `separator` (direction in) - The separator"]
pub fn locale_format_date(
out_str: *mut FuriString,
datetime: *const DateTime,
format: LocaleDateFormat,
separator: *const core::ffi::c_char,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationApp {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataSound {
pub frequency: f32,
pub volume: f32,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataSound() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataSound> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataSound>(),
8usize,
concat!("Size of: ", stringify!(NotificationMessageDataSound))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataSound>(),
4usize,
concat!("Alignment of ", stringify!(NotificationMessageDataSound))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frequency) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataSound),
"::",
stringify!(frequency)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).volume) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataSound),
"::",
stringify!(volume)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataLed {
pub value: u8,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataLed() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataLed> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataLed>(),
1usize,
concat!("Size of: ", stringify!(NotificationMessageDataLed))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataLed>(),
1usize,
concat!("Alignment of ", stringify!(NotificationMessageDataLed))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataLed),
"::",
stringify!(value)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataVibro {
pub on: bool,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataVibro() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataVibro> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataVibro>(),
1usize,
concat!("Size of: ", stringify!(NotificationMessageDataVibro))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataVibro>(),
1usize,
concat!("Alignment of ", stringify!(NotificationMessageDataVibro))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).on) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataVibro),
"::",
stringify!(on)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataDelay {
pub length: u32,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataDelay() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataDelay> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataDelay>(),
4usize,
concat!("Size of: ", stringify!(NotificationMessageDataDelay))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataDelay>(),
4usize,
concat!("Alignment of ", stringify!(NotificationMessageDataDelay))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataDelay),
"::",
stringify!(length)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataForcedSettings {
pub speaker_volume: f32,
pub vibro: bool,
pub display_brightness: f32,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataForcedSettings() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataForcedSettings> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataForcedSettings>(),
12usize,
concat!(
"Size of: ",
stringify!(NotificationMessageDataForcedSettings)
)
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataForcedSettings>(),
4usize,
concat!(
"Alignment of ",
stringify!(NotificationMessageDataForcedSettings)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).speaker_volume) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataForcedSettings),
"::",
stringify!(speaker_volume)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataForcedSettings),
"::",
stringify!(vibro)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).display_brightness) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataForcedSettings),
"::",
stringify!(display_brightness)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NotificationMessageDataLedBlink {
pub on_time: u16,
pub period: u16,
pub color: Light,
}
#[test]
fn bindgen_test_layout_NotificationMessageDataLedBlink() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageDataLedBlink> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageDataLedBlink>(),
6usize,
concat!("Size of: ", stringify!(NotificationMessageDataLedBlink))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageDataLedBlink>(),
2usize,
concat!("Alignment of ", stringify!(NotificationMessageDataLedBlink))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).on_time) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataLedBlink),
"::",
stringify!(on_time)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).period) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataLedBlink),
"::",
stringify!(period)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).color) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageDataLedBlink),
"::",
stringify!(color)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union NotificationMessageData {
pub sound: NotificationMessageDataSound,
pub led: NotificationMessageDataLed,
pub led_blink: NotificationMessageDataLedBlink,
pub vibro: NotificationMessageDataVibro,
pub delay: NotificationMessageDataDelay,
pub forced_settings: NotificationMessageDataForcedSettings,
}
#[test]
fn bindgen_test_layout_NotificationMessageData() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessageData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessageData>(),
12usize,
concat!("Size of: ", stringify!(NotificationMessageData))
);
assert_eq!(
::core::mem::align_of::<NotificationMessageData>(),
4usize,
concat!("Alignment of ", stringify!(NotificationMessageData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sound) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(sound)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).led) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(led)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).led_blink) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(led_blink)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(vibro)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).delay) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(delay)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).forced_settings) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessageData),
"::",
stringify!(forced_settings)
)
);
}
pub const NotificationMessageType_NotificationMessageTypeVibro: NotificationMessageType = 0;
pub const NotificationMessageType_NotificationMessageTypeSoundOn: NotificationMessageType = 1;
pub const NotificationMessageType_NotificationMessageTypeSoundOff: NotificationMessageType = 2;
pub const NotificationMessageType_NotificationMessageTypeLedRed: NotificationMessageType = 3;
pub const NotificationMessageType_NotificationMessageTypeLedGreen: NotificationMessageType = 4;
pub const NotificationMessageType_NotificationMessageTypeLedBlue: NotificationMessageType = 5;
pub const NotificationMessageType_NotificationMessageTypeLedBlinkStart: NotificationMessageType = 6;
pub const NotificationMessageType_NotificationMessageTypeLedBlinkStop: NotificationMessageType = 7;
pub const NotificationMessageType_NotificationMessageTypeLedBlinkColor: NotificationMessageType = 8;
pub const NotificationMessageType_NotificationMessageTypeDelay: NotificationMessageType = 9;
pub const NotificationMessageType_NotificationMessageTypeLedDisplayBacklight:
NotificationMessageType = 10;
pub const NotificationMessageType_NotificationMessageTypeLedDisplayBacklightEnforceOn:
NotificationMessageType = 11;
pub const NotificationMessageType_NotificationMessageTypeLedDisplayBacklightEnforceAuto:
NotificationMessageType = 12;
pub const NotificationMessageType_NotificationMessageTypeDoNotReset: NotificationMessageType = 13;
pub const NotificationMessageType_NotificationMessageTypeForceSpeakerVolumeSetting:
NotificationMessageType = 14;
pub const NotificationMessageType_NotificationMessageTypeForceVibroSetting:
NotificationMessageType = 15;
pub const NotificationMessageType_NotificationMessageTypeForceDisplayBrightnessSetting:
NotificationMessageType = 16;
pub const NotificationMessageType_NotificationMessageTypeLedBrightnessSettingApply:
NotificationMessageType = 17;
pub const NotificationMessageType_NotificationMessageTypeLcdContrastUpdate:
NotificationMessageType = 18;
pub type NotificationMessageType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct NotificationMessage {
pub type_: NotificationMessageType,
pub data: NotificationMessageData,
}
#[test]
fn bindgen_test_layout_NotificationMessage() {
const UNINIT: ::core::mem::MaybeUninit<NotificationMessage> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NotificationMessage>(),
16usize,
concat!("Size of: ", stringify!(NotificationMessage))
);
assert_eq!(
::core::mem::align_of::<NotificationMessage>(),
4usize,
concat!("Alignment of ", stringify!(NotificationMessage))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessage),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NotificationMessage),
"::",
stringify!(data)
)
);
}
pub type NotificationSequence = [*const NotificationMessage; 0usize];
extern "C" {
pub fn notification_message(app: *mut NotificationApp, sequence: *const NotificationSequence);
}
extern "C" {
pub fn notification_message_block(
app: *mut NotificationApp,
sequence: *const NotificationSequence,
);
}
extern "C" {
#[doc = "Send internal (apply to permanent layer) notification message. Think twice before use.\n\n # Arguments\n\n* `app` - notification record content\n * `sequence` - notification sequence"]
pub fn notification_internal_message(
app: *mut NotificationApp,
sequence: *const NotificationSequence,
);
}
extern "C" {
#[doc = "Send internal (apply to permanent layer) notification message and wait for notification end. Think twice before use.\n\n # Arguments\n\n* `app` - notification record content\n * `sequence` - notification sequence"]
pub fn notification_internal_message_block(
app: *mut NotificationApp,
sequence: *const NotificationSequence,
);
}
extern "C" {
pub static message_click: NotificationMessage;
}
extern "C" {
pub static message_note_c0: NotificationMessage;
}
extern "C" {
pub static message_note_cs0: NotificationMessage;
}
extern "C" {
pub static message_note_d0: NotificationMessage;
}
extern "C" {
pub static message_note_ds0: NotificationMessage;
}
extern "C" {
pub static message_note_e0: NotificationMessage;
}
extern "C" {
pub static message_note_f0: NotificationMessage;
}
extern "C" {
pub static message_note_fs0: NotificationMessage;
}
extern "C" {
pub static message_note_g0: NotificationMessage;
}
extern "C" {
pub static message_note_gs0: NotificationMessage;
}
extern "C" {
pub static message_note_a0: NotificationMessage;
}
extern "C" {
pub static message_note_as0: NotificationMessage;
}
extern "C" {
pub static message_note_b0: NotificationMessage;
}
extern "C" {
pub static message_note_c1: NotificationMessage;
}
extern "C" {
pub static message_note_cs1: NotificationMessage;
}
extern "C" {
pub static message_note_d1: NotificationMessage;
}
extern "C" {
pub static message_note_ds1: NotificationMessage;
}
extern "C" {
pub static message_note_e1: NotificationMessage;
}
extern "C" {
pub static message_note_f1: NotificationMessage;
}
extern "C" {
pub static message_note_fs1: NotificationMessage;
}
extern "C" {
pub static message_note_g1: NotificationMessage;
}
extern "C" {
pub static message_note_gs1: NotificationMessage;
}
extern "C" {
pub static message_note_a1: NotificationMessage;
}
extern "C" {
pub static message_note_as1: NotificationMessage;
}
extern "C" {
pub static message_note_b1: NotificationMessage;
}
extern "C" {
pub static message_note_c2: NotificationMessage;
}
extern "C" {
pub static message_note_cs2: NotificationMessage;
}
extern "C" {
pub static message_note_d2: NotificationMessage;
}
extern "C" {
pub static message_note_ds2: NotificationMessage;
}
extern "C" {
pub static message_note_e2: NotificationMessage;
}
extern "C" {
pub static message_note_f2: NotificationMessage;
}
extern "C" {
pub static message_note_fs2: NotificationMessage;
}
extern "C" {
pub static message_note_g2: NotificationMessage;
}
extern "C" {
pub static message_note_gs2: NotificationMessage;
}
extern "C" {
pub static message_note_a2: NotificationMessage;
}
extern "C" {
pub static message_note_as2: NotificationMessage;
}
extern "C" {
pub static message_note_b2: NotificationMessage;
}
extern "C" {
pub static message_note_c3: NotificationMessage;
}
extern "C" {
pub static message_note_cs3: NotificationMessage;
}
extern "C" {
pub static message_note_d3: NotificationMessage;
}
extern "C" {
pub static message_note_ds3: NotificationMessage;
}
extern "C" {
pub static message_note_e3: NotificationMessage;
}
extern "C" {
pub static message_note_f3: NotificationMessage;
}
extern "C" {
pub static message_note_fs3: NotificationMessage;
}
extern "C" {
pub static message_note_g3: NotificationMessage;
}
extern "C" {
pub static message_note_gs3: NotificationMessage;
}
extern "C" {
pub static message_note_a3: NotificationMessage;
}
extern "C" {
pub static message_note_as3: NotificationMessage;
}
extern "C" {
pub static message_note_b3: NotificationMessage;
}
extern "C" {
pub static message_note_c4: NotificationMessage;
}
extern "C" {
pub static message_note_cs4: NotificationMessage;
}
extern "C" {
pub static message_note_d4: NotificationMessage;
}
extern "C" {
pub static message_note_ds4: NotificationMessage;
}
extern "C" {
pub static message_note_e4: NotificationMessage;
}
extern "C" {
pub static message_note_f4: NotificationMessage;
}
extern "C" {
pub static message_note_fs4: NotificationMessage;
}
extern "C" {
pub static message_note_g4: NotificationMessage;
}
extern "C" {
pub static message_note_gs4: NotificationMessage;
}
extern "C" {
pub static message_note_a4: NotificationMessage;
}
extern "C" {
pub static message_note_as4: NotificationMessage;
}
extern "C" {
pub static message_note_b4: NotificationMessage;
}
extern "C" {
pub static message_note_c5: NotificationMessage;
}
extern "C" {
pub static message_note_cs5: NotificationMessage;
}
extern "C" {
pub static message_note_d5: NotificationMessage;
}
extern "C" {
pub static message_note_ds5: NotificationMessage;
}
extern "C" {
pub static message_note_e5: NotificationMessage;
}
extern "C" {
pub static message_note_f5: NotificationMessage;
}
extern "C" {
pub static message_note_fs5: NotificationMessage;
}
extern "C" {
pub static message_note_g5: NotificationMessage;
}
extern "C" {
pub static message_note_gs5: NotificationMessage;
}
extern "C" {
pub static message_note_a5: NotificationMessage;
}
extern "C" {
pub static message_note_as5: NotificationMessage;
}
extern "C" {
pub static message_note_b5: NotificationMessage;
}
extern "C" {
pub static message_note_c6: NotificationMessage;
}
extern "C" {
pub static message_note_cs6: NotificationMessage;
}
extern "C" {
pub static message_note_d6: NotificationMessage;
}
extern "C" {
pub static message_note_ds6: NotificationMessage;
}
extern "C" {
pub static message_note_e6: NotificationMessage;
}
extern "C" {
pub static message_note_f6: NotificationMessage;
}
extern "C" {
pub static message_note_fs6: NotificationMessage;
}
extern "C" {
pub static message_note_g6: NotificationMessage;
}
extern "C" {
pub static message_note_gs6: NotificationMessage;
}
extern "C" {
pub static message_note_a6: NotificationMessage;
}
extern "C" {
pub static message_note_as6: NotificationMessage;
}
extern "C" {
pub static message_note_b6: NotificationMessage;
}
extern "C" {
pub static message_note_c7: NotificationMessage;
}
extern "C" {
pub static message_note_cs7: NotificationMessage;
}
extern "C" {
pub static message_note_d7: NotificationMessage;
}
extern "C" {
pub static message_note_ds7: NotificationMessage;
}
extern "C" {
pub static message_note_e7: NotificationMessage;
}
extern "C" {
pub static message_note_f7: NotificationMessage;
}
extern "C" {
pub static message_note_fs7: NotificationMessage;
}
extern "C" {
pub static message_note_g7: NotificationMessage;
}
extern "C" {
pub static message_note_gs7: NotificationMessage;
}
extern "C" {
pub static message_note_a7: NotificationMessage;
}
extern "C" {
pub static message_note_as7: NotificationMessage;
}
extern "C" {
pub static message_note_b7: NotificationMessage;
}
extern "C" {
pub static message_note_c8: NotificationMessage;
}
extern "C" {
pub static message_note_cs8: NotificationMessage;
}
extern "C" {
pub static message_note_d8: NotificationMessage;
}
extern "C" {
pub static message_note_ds8: NotificationMessage;
}
extern "C" {
pub static message_note_e8: NotificationMessage;
}
extern "C" {
pub static message_note_f8: NotificationMessage;
}
extern "C" {
pub static message_note_fs8: NotificationMessage;
}
extern "C" {
pub static message_note_g8: NotificationMessage;
}
extern "C" {
pub static message_note_gs8: NotificationMessage;
}
extern "C" {
pub static message_note_a8: NotificationMessage;
}
extern "C" {
pub static message_note_as8: NotificationMessage;
}
extern "C" {
pub static message_note_b8: NotificationMessage;
}
extern "C" {
#[doc = "Messages"]
pub static message_display_backlight_on: NotificationMessage;
}
extern "C" {
pub static message_display_backlight_off: NotificationMessage;
}
extern "C" {
pub static message_display_backlight_enforce_on: NotificationMessage;
}
extern "C" {
pub static message_display_backlight_enforce_auto: NotificationMessage;
}
extern "C" {
pub static message_red_255: NotificationMessage;
}
extern "C" {
pub static message_green_255: NotificationMessage;
}
extern "C" {
pub static message_blue_255: NotificationMessage;
}
extern "C" {
pub static message_red_0: NotificationMessage;
}
extern "C" {
pub static message_green_0: NotificationMessage;
}
extern "C" {
pub static message_blue_0: NotificationMessage;
}
extern "C" {
pub static message_blink_start_10: NotificationMessage;
}
extern "C" {
pub static message_blink_start_100: NotificationMessage;
}
extern "C" {
pub static message_blink_stop: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_red: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_green: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_blue: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_cyan: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_magenta: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_yellow: NotificationMessage;
}
extern "C" {
pub static message_blink_set_color_white: NotificationMessage;
}
extern "C" {
pub static message_delay_1: NotificationMessage;
}
extern "C" {
pub static message_delay_10: NotificationMessage;
}
extern "C" {
pub static message_delay_25: NotificationMessage;
}
extern "C" {
pub static message_delay_50: NotificationMessage;
}
extern "C" {
pub static message_delay_100: NotificationMessage;
}
extern "C" {
pub static message_delay_250: NotificationMessage;
}
extern "C" {
pub static message_delay_500: NotificationMessage;
}
extern "C" {
pub static message_delay_1000: NotificationMessage;
}
extern "C" {
pub static message_sound_off: NotificationMessage;
}
extern "C" {
pub static message_vibro_on: NotificationMessage;
}
extern "C" {
pub static message_vibro_off: NotificationMessage;
}
extern "C" {
pub static message_do_not_reset: NotificationMessage;
}
extern "C" {
pub static message_force_speaker_volume_setting_1f: NotificationMessage;
}
extern "C" {
pub static message_force_vibro_setting_on: NotificationMessage;
}
extern "C" {
pub static message_force_vibro_setting_off: NotificationMessage;
}
extern "C" {
pub static message_force_display_brightness_setting_1f: NotificationMessage;
}
extern "C" {
pub static message_lcd_contrast_update: NotificationMessage;
}
extern "C" {
#[doc = "Message sequences"]
pub static sequence_reset_red: NotificationSequence;
}
extern "C" {
pub static sequence_reset_green: NotificationSequence;
}
extern "C" {
pub static sequence_reset_blue: NotificationSequence;
}
extern "C" {
pub static sequence_reset_rgb: NotificationSequence;
}
extern "C" {
pub static sequence_reset_display: NotificationSequence;
}
extern "C" {
pub static sequence_reset_sound: NotificationSequence;
}
extern "C" {
pub static sequence_reset_vibro: NotificationSequence;
}
extern "C" {
pub static sequence_set_vibro_on: NotificationSequence;
}
extern "C" {
#[doc = "Display: backlight wakeup"]
pub static sequence_display_backlight_on: NotificationSequence;
}
extern "C" {
#[doc = "Display: backlight force off"]
pub static sequence_display_backlight_off: NotificationSequence;
}
extern "C" {
#[doc = "Display: backlight force off after a delay of 1000ms"]
pub static sequence_display_backlight_off_delay_1000: NotificationSequence;
}
extern "C" {
#[doc = "Display: backlight always on lock"]
pub static sequence_display_backlight_enforce_on: NotificationSequence;
}
extern "C" {
#[doc = "Display: backlight always on unlock"]
pub static sequence_display_backlight_enforce_auto: NotificationSequence;
}
extern "C" {
pub static sequence_charging: NotificationSequence;
}
extern "C" {
pub static sequence_charged: NotificationSequence;
}
extern "C" {
pub static sequence_not_charging: NotificationSequence;
}
extern "C" {
pub static sequence_set_only_red_255: NotificationSequence;
}
extern "C" {
pub static sequence_set_only_green_255: NotificationSequence;
}
extern "C" {
pub static sequence_set_only_blue_255: NotificationSequence;
}
extern "C" {
pub static sequence_set_red_255: NotificationSequence;
}
extern "C" {
pub static sequence_set_green_255: NotificationSequence;
}
extern "C" {
pub static sequence_set_blue_255: NotificationSequence;
}
extern "C" {
pub static sequence_solid_yellow: NotificationSequence;
}
extern "C" {
pub static sequence_blink_blue_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_red_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_green_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_yellow_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_cyan_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_magenta_10: NotificationSequence;
}
extern "C" {
pub static sequence_blink_red_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_green_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_blue_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_yellow_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_cyan_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_magenta_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_white_100: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_blue: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_red: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_green: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_yellow: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_cyan: NotificationSequence;
}
extern "C" {
pub static sequence_blink_start_magenta: NotificationSequence;
}
extern "C" {
pub static sequence_blink_stop: NotificationSequence;
}
extern "C" {
pub static sequence_single_vibro: NotificationSequence;
}
extern "C" {
pub static sequence_double_vibro: NotificationSequence;
}
extern "C" {
pub static sequence_success: NotificationSequence;
}
extern "C" {
pub static sequence_semi_success: NotificationSequence;
}
extern "C" {
pub static sequence_error: NotificationSequence;
}
extern "C" {
pub static sequence_audiovisual_alert: NotificationSequence;
}
extern "C" {
pub static sequence_lcd_contrast_update: NotificationSequence;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Power {
_unused: [u8; 0],
}
pub const PowerBootMode_PowerBootModeNormal: PowerBootMode = 0;
pub const PowerBootMode_PowerBootModeDfu: PowerBootMode = 1;
pub const PowerBootMode_PowerBootModeUpdateStart: PowerBootMode = 2;
pub type PowerBootMode = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct PowerInfo {
pub gauge_is_ok: bool,
pub is_charging: bool,
pub is_shutdown_requested: bool,
pub current_charger: f32,
pub current_gauge: f32,
pub voltage_battery_charge_limit: f32,
pub voltage_charger: f32,
pub voltage_gauge: f32,
pub voltage_vbus: f32,
pub capacity_remaining: u32,
pub capacity_full: u32,
pub temperature_charger: f32,
pub temperature_gauge: f32,
pub charge: u8,
pub health: u8,
}
#[test]
fn bindgen_test_layout_PowerInfo() {
const UNINIT: ::core::mem::MaybeUninit<PowerInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<PowerInfo>(),
48usize,
concat!("Size of: ", stringify!(PowerInfo))
);
assert_eq!(
::core::mem::align_of::<PowerInfo>(),
4usize,
concat!("Alignment of ", stringify!(PowerInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).gauge_is_ok) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(gauge_is_ok)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_charging) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(is_charging)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_shutdown_requested) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(is_shutdown_requested)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).current_charger) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(current_charger)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).current_gauge) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(current_gauge)
)
);
assert_eq!(
unsafe {
::core::ptr::addr_of!((*ptr).voltage_battery_charge_limit) as usize - ptr as usize
},
12usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(voltage_battery_charge_limit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).voltage_charger) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(voltage_charger)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).voltage_gauge) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(voltage_gauge)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).voltage_vbus) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(voltage_vbus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).capacity_remaining) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(capacity_remaining)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).capacity_full) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(capacity_full)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).temperature_charger) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(temperature_charger)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).temperature_gauge) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(temperature_gauge)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).charge) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(charge)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).health) as usize - ptr as usize },
45usize,
concat!(
"Offset of field: ",
stringify!(PowerInfo),
"::",
stringify!(health)
)
);
}
extern "C" {
#[doc = "Power off device"]
pub fn power_off(power: *mut Power);
}
extern "C" {
#[doc = "Reboot device\n\n # Arguments\n\n* `mode` - PowerBootMode"]
pub fn power_reboot(power: *mut Power, mode: PowerBootMode);
}
extern "C" {
#[doc = "Get power info\n\n # Arguments\n\n* `power` - Power instance\n * `info` - PowerInfo instance"]
pub fn power_get_info(power: *mut Power, info: *mut PowerInfo);
}
extern "C" {
#[doc = "Get power event pubsub handler\n\n # Arguments\n\n* `power` - Power instance\n\n # Returns\n\nFuriPubSub instance"]
pub fn power_get_pubsub(power: *mut Power) -> *mut FuriPubSub;
}
extern "C" {
#[doc = "Check battery health\n\n # Returns\n\ntrue if battery is healthy"]
pub fn power_is_battery_healthy(power: *mut Power) -> bool;
}
extern "C" {
#[doc = "Enable or disable battery low level notification message\n\n # Arguments\n\n* `power` - Power instance\n * `enable` - true - enable, false - disable"]
pub fn power_enable_low_battery_level_notification(power: *mut Power, enable: bool);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Rpc {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RpcSession {
_unused: [u8; 0],
}
#[doc = "Callback to send to client any data (e.g. response to command)"]
pub type RpcSendBytesCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, bytes: *mut u8, bytes_len: usize),
>;
#[doc = "Callback to notify client that buffer is empty"]
pub type RpcBufferIsEmptyCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Callback to notify transport layer that close_session command\n is received. Any other actions lays on transport layer.\n No destruction or session close performed."]
pub type RpcSessionClosedCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Callback to notify transport layer that session was closed\n and all operations were finished"]
pub type RpcSessionTerminatedCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub const RpcOwner_RpcOwnerUnknown: RpcOwner = 0;
pub const RpcOwner_RpcOwnerBle: RpcOwner = 1;
pub const RpcOwner_RpcOwnerUsb: RpcOwner = 2;
pub const RpcOwner_RpcOwnerUart: RpcOwner = 3;
pub const RpcOwner_RpcOwnerCount: RpcOwner = 4;
#[doc = "RPC owner"]
pub type RpcOwner = core::ffi::c_uchar;
extern "C" {
#[doc = "Get RPC session owner\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n # Returns\n\nsession owner"]
pub fn rpc_session_get_owner(session: *mut RpcSession) -> RpcOwner;
}
extern "C" {
#[doc = "Open RPC session\n\n USAGE:\n 1) rpc_session_open();\n 2) rpc_session_set_context();\n 3) rpc_session_set_send_bytes_callback();\n 4) rpc_session_set_close_callback();\n 5) while(1) {\n rpc_session_feed();\n }\n 6) rpc_session_close();\n\n\n # Arguments\n\n* `rpc` - instance\n * `owner` - owner of session\n # Returns\n\npointer to RpcSession descriptor, or\n NULL if RPC is busy and can't open session now"]
pub fn rpc_session_open(rpc: *mut Rpc, owner: RpcOwner) -> *mut RpcSession;
}
extern "C" {
#[doc = "Close RPC session\n It is guaranteed that no callbacks will be called\n as soon as session is closed. So no need in setting\n callbacks to NULL after session close.\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor"]
pub fn rpc_session_close(session: *mut RpcSession);
}
extern "C" {
#[doc = "Set session context for callbacks to pass\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `context` - context to pass to callbacks"]
pub fn rpc_session_set_context(session: *mut RpcSession, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Set callback to send bytes to client\n WARN: It's forbidden to call RPC API within RpcSendBytesCallback\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `callback` - callback to send bytes to client (can be NULL)"]
pub fn rpc_session_set_send_bytes_callback(
session: *mut RpcSession,
callback: RpcSendBytesCallback,
);
}
extern "C" {
#[doc = "Set callback to notify that buffer is empty\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `callback` - callback to notify client that buffer is empty (can be NULL)\n * `context` - context to pass to callback"]
pub fn rpc_session_set_buffer_is_empty_callback(
session: *mut RpcSession,
callback: RpcBufferIsEmptyCallback,
);
}
extern "C" {
#[doc = "Set callback to be called when RPC command to close session is received\n WARN: It's forbidden to call RPC API within RpcSessionClosedCallback\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `callback` - callback to inform about RPC close session command (can be NULL)"]
pub fn rpc_session_set_close_callback(
session: *mut RpcSession,
callback: RpcSessionClosedCallback,
);
}
extern "C" {
#[doc = "Set callback to be called when RPC session is closed\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `callback` - callback to inform about RPC session state"]
pub fn rpc_session_set_terminated_callback(
session: *mut RpcSession,
callback: RpcSessionTerminatedCallback,
);
}
extern "C" {
#[doc = "Give bytes to RPC service to decode them and perform command\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n * `buffer` - buffer to provide to RPC service\n * `size` - size of buffer\n * `timeout` - max timeout to wait till all buffer will be consumed\n\n # Returns\n\nactually consumed bytes"]
pub fn rpc_session_feed(
session: *mut RpcSession,
buffer: *const u8,
size: usize,
timeout: u32,
) -> usize;
}
extern "C" {
#[doc = "Get available size of RPC buffer\n\n # Arguments\n\n* `session` - pointer to RpcSession descriptor\n\n # Returns\n\nbytes available in buffer"]
pub fn rpc_session_get_available_size(session: *mut RpcSession) -> usize;
}
#[doc = "< No data is provided by the event."]
pub const RpcAppSystemEventDataType_RpcAppSystemEventDataTypeNone: RpcAppSystemEventDataType = 0;
#[doc = "< Event data contains a zero-terminated string."]
pub const RpcAppSystemEventDataType_RpcAppSystemEventDataTypeString: RpcAppSystemEventDataType = 1;
#[doc = "< Event data contains a signed 32-bit integer."]
pub const RpcAppSystemEventDataType_RpcAppSystemEventDataTypeInt32: RpcAppSystemEventDataType = 2;
#[doc = "< Event data contains zero or more bytes."]
pub const RpcAppSystemEventDataType_RpcAppSystemEventDataTypeBytes: RpcAppSystemEventDataType = 3;
#[doc = "Enumeration of possible event data types."]
pub type RpcAppSystemEventDataType = core::ffi::c_uchar;
#[doc = "Event data structure, containing the type and associated data.\n\n All below fields except for type are valid only if the respective type is set."]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct RpcAppSystemEventData {
#[doc = "< Type of the data. The meaning of other fields depends on this one."]
pub type_: RpcAppSystemEventDataType,
pub __bindgen_anon_1: RpcAppSystemEventData__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union RpcAppSystemEventData__bindgen_ty_1 {
#[doc = "< Pointer to a zero-terminated character string."]
pub string: *const core::ffi::c_char,
#[doc = "< Signed 32-bit integer value."]
pub i32_: i32,
#[doc = "< Byte array of arbitrary length."]
pub bytes: RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1 {
#[doc = "< Pointer to the byte array data."]
pub ptr: *const u8,
#[doc = "< Size of the byte array, in bytes."]
pub size: usize,
}
#[test]
fn bindgen_test_layout_RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1>(),
8usize,
concat!(
"Size of: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(ptr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(size)
)
);
}
#[test]
fn bindgen_test_layout_RpcAppSystemEventData__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<RpcAppSystemEventData__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<RpcAppSystemEventData__bindgen_ty_1>(),
8usize,
concat!("Size of: ", stringify!(RpcAppSystemEventData__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<RpcAppSystemEventData__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(RpcAppSystemEventData__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).string) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1),
"::",
stringify!(string)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1),
"::",
stringify!(i32_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bytes) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData__bindgen_ty_1),
"::",
stringify!(bytes)
)
);
}
#[test]
fn bindgen_test_layout_RpcAppSystemEventData() {
const UNINIT: ::core::mem::MaybeUninit<RpcAppSystemEventData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<RpcAppSystemEventData>(),
12usize,
concat!("Size of: ", stringify!(RpcAppSystemEventData))
);
assert_eq!(
::core::mem::align_of::<RpcAppSystemEventData>(),
4usize,
concat!("Alignment of ", stringify!(RpcAppSystemEventData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEventData),
"::",
stringify!(type_)
)
);
}
#[doc = "Denotes an invalid state.\n\n An event of this type shall never be passed into the callback."]
pub const RpcAppSystemEventType_RpcAppEventTypeInvalid: RpcAppSystemEventType = 0;
#[doc = "The client side has closed the session.\n\n After receiving this event, the RPC context is no more valid."]
pub const RpcAppSystemEventType_RpcAppEventTypeSessionClose: RpcAppSystemEventType = 1;
#[doc = "The client has requested the application to exit.\n\n The application must exit after receiving this command."]
pub const RpcAppSystemEventType_RpcAppEventTypeAppExit: RpcAppSystemEventType = 2;
#[doc = "The client has requested the application to load a file.\n\n This command's meaning is application-specific, i.e. the application might or\n might not require additional commands after loading a file to do anything useful."]
pub const RpcAppSystemEventType_RpcAppEventTypeLoadFile: RpcAppSystemEventType = 3;
#[doc = "The client has informed the application that a button has been pressed.\n\n This command's meaning is application-specific, e.g. to select a part of the\n previously loaded file or to invoke a particular function within the application."]
pub const RpcAppSystemEventType_RpcAppEventTypeButtonPress: RpcAppSystemEventType = 4;
#[doc = "The client has informed the application that a button has been released.\n\n This command's meaning is application-specific, e.g. to cease\n all activities to be conducted while a button is being pressed."]
pub const RpcAppSystemEventType_RpcAppEventTypeButtonRelease: RpcAppSystemEventType = 5;
#[doc = "The client has sent a byte array of arbitrary size.\n\n This command's purpose is bi-directional exchange of arbitrary raw data.\n Useful for implementing higher-level protocols while using the RPC as a transport layer."]
pub const RpcAppSystemEventType_RpcAppEventTypeDataExchange: RpcAppSystemEventType = 6;
#[doc = "Enumeration of possible event types."]
pub type RpcAppSystemEventType = core::ffi::c_uchar;
#[doc = "RPC application subsystem event structure."]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct RpcAppSystemEvent {
#[doc = "< Type of the event."]
pub type_: RpcAppSystemEventType,
#[doc = "< Data associated with the event."]
pub data: RpcAppSystemEventData,
}
#[test]
fn bindgen_test_layout_RpcAppSystemEvent() {
const UNINIT: ::core::mem::MaybeUninit<RpcAppSystemEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<RpcAppSystemEvent>(),
16usize,
concat!("Size of: ", stringify!(RpcAppSystemEvent))
);
assert_eq!(
::core::mem::align_of::<RpcAppSystemEvent>(),
4usize,
concat!("Alignment of ", stringify!(RpcAppSystemEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(RpcAppSystemEvent),
"::",
stringify!(data)
)
);
}
#[doc = "Callback function type.\n\n A function of this type must be passed to rpc_system_app_set_callback() by the user code.\n\n The event pointer is valid ONLY inside the callback function.\n\n # Arguments\n\n* `event` (direction in) - pointer to the event object. Valid only inside the callback function.\n * `context` (direction in, out) - pointer to the user-defined context object."]
pub type RpcAppSystemCallback = ::core::option::Option<
unsafe extern "C" fn(event: *const RpcAppSystemEvent, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RpcAppSystem {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Set the callback function for use by an RpcAppSystem instance.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be configured.\n * `callback` (direction in) - pointer to the function to be called upon message reception.\n * `context` (direction in, out) - pointer to the user-defined context object. Will be passed to the callback."]
pub fn rpc_system_app_set_callback(
rpc_app: *mut RpcAppSystem,
callback: RpcAppSystemCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Send a notification that an RpcAppSystem instance has been started and is ready.\n\n Call this function once right after acquiring an RPC context and setting the callback.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be used."]
pub fn rpc_system_app_send_started(rpc_app: *mut RpcAppSystem);
}
extern "C" {
#[doc = "Send a notification that the application using an RpcAppSystem instance is about to exit.\n\n Call this function when the application is about to exit (usually in the *_free() function).\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be used."]
pub fn rpc_system_app_send_exited(rpc_app: *mut RpcAppSystem);
}
extern "C" {
#[doc = "Send a confirmation that the application using an RpcAppSystem instance has handled the event.\n\n An explicit confirmation is required for the following event types:\n - RpcAppEventTypeAppExit\n - RpcAppEventTypeLoadFile\n - RpcAppEventTypeButtonPress\n - RpcAppEventTypeButtonRelease\n - RpcAppEventTypeDataExchange\n\n Not confirming these events will result in a client-side timeout.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be used.\n * `result` (direction in) - whether the command was successfully handled or not (true for success)."]
pub fn rpc_system_app_confirm(rpc_app: *mut RpcAppSystem, result: bool);
}
extern "C" {
#[doc = "Set the error code stored in an RpcAppSystem instance.\n\n The error code can be retrieved by the client at any time by using the GetError request.\n The error code value has no meaning within the subsystem, i.e. it is only passed through to the client.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be modified.\n * `error_code` (direction in) - arbitrary error code to be set."]
pub fn rpc_system_app_set_error_code(rpc_app: *mut RpcAppSystem, error_code: u32);
}
extern "C" {
#[doc = "Set the error text stored in an RpcAppSystem instance.\n\n The error text can be retrieved by the client at any time by using the GetError request.\n The text has no meaning within the subsystem, i.e. it is only passed through to the client.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be modified.\n * `error_text` (direction in) - Pointer to a zero-terminated string containing the error text."]
pub fn rpc_system_app_set_error_text(
rpc_app: *mut RpcAppSystem,
error_text: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Reset the error code and text stored in an RpcAppSystem instance.\n\n Resets the error code to 0 and error text to \"\" (empty string).\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be reset."]
pub fn rpc_system_app_error_reset(rpc_app: *mut RpcAppSystem);
}
extern "C" {
#[doc = "Send a byte array of arbitrary data to the client using an RpcAppSystem instance.\n\n # Arguments\n\n* `rpc_app` (direction in, out) - pointer to the instance to be used.\n * `data` (direction in) - pointer to the data buffer to be sent.\n * `data_size` (direction in) - size of the data buffer, in bytes."]
pub fn rpc_system_app_exchange_data(
rpc_app: *mut RpcAppSystem,
data: *const u8,
data_size: usize,
);
}
pub const BitLibParity_BitLibParityEven: BitLibParity = 0;
pub const BitLibParity_BitLibParityOdd: BitLibParity = 1;
pub const BitLibParity_BitLibParityAlways0: BitLibParity = 2;
pub const BitLibParity_BitLibParityAlways1: BitLibParity = 3;
pub type BitLibParity = core::ffi::c_uchar;
extern "C" {
#[doc = "Push a bit into a byte array.\n # Arguments\n\n* `data` - array to push bit into\n * `data_size` - array size\n * `bit` - bit to push"]
pub fn bit_lib_push_bit(data: *mut u8, data_size: usize, bit: bool);
}
extern "C" {
#[doc = "Set a bit in a byte array.\n # Arguments\n\n* `data` - array to set bit in\n * `position` - The position of the bit to set.\n * `bit` - bit value to set"]
pub fn bit_lib_set_bit(data: *mut u8, position: usize, bit: bool);
}
extern "C" {
#[doc = "Set the bit at the given position to the given value.\n # Arguments\n\n* `data` - The data to set the bit in.\n * `position` - The position of the bit to set.\n * `byte` - The data to set the bit to.\n * `length` - The length of the data."]
pub fn bit_lib_set_bits(data: *mut u8, position: usize, byte: u8, length: u8);
}
extern "C" {
#[doc = "Get the bit of a byte.\n # Arguments\n\n* `data` - The byte to get the bits from.\n * `position` - The position of the bit.\n # Returns\n\nThe bit."]
pub fn bit_lib_get_bit(data: *const u8, position: usize) -> bool;
}
extern "C" {
#[doc = "Get the bits of a data, as uint8_t.\n # Arguments\n\n* `data` - The data to get the bits from.\n * `position` - The position of the first bit.\n * `length` - The length of the bits.\n # Returns\n\nThe bits."]
pub fn bit_lib_get_bits(data: *const u8, position: usize, length: u8) -> u8;
}
extern "C" {
#[doc = "Get the bits of a data, as uint16_t.\n # Arguments\n\n* `data` - The data to get the bits from.\n * `position` - The position of the first bit.\n * `length` - The length of the bits.\n # Returns\n\nThe bits."]
pub fn bit_lib_get_bits_16(data: *const u8, position: usize, length: u8) -> u16;
}
extern "C" {
#[doc = "Get the bits of a data, as uint32_t.\n # Arguments\n\n* `data` - The data to get the bits from.\n * `position` - The position of the first bit.\n * `length` - The length of the bits.\n # Returns\n\nThe bits."]
pub fn bit_lib_get_bits_32(data: *const u8, position: usize, length: u8) -> u32;
}
extern "C" {
#[doc = "Get the bits of a data, as uint64_t.\n # Arguments\n\n* `data` - The data to get the bits from.\n * `position` - The position of the first bit.\n * `length` - The length of the bits.\n # Returns\n\nThe bits."]
pub fn bit_lib_get_bits_64(data: *const u8, position: usize, length: u8) -> u64;
}
extern "C" {
#[doc = "Test parity of given bits\n # Arguments\n\n* `bits` - Bits to test parity of\n * `parity` - Parity to test against\n # Returns\n\ntrue if parity is correct, false otherwise"]
pub fn bit_lib_test_parity_32(bits: u32, parity: BitLibParity) -> bool;
}
extern "C" {
#[doc = "Test parity of bit array, check parity for every parity_length block from start\n\n # Arguments\n\n* `data` - Bit array\n * `position` - Start position\n * `length` - Bit count\n * `parity` - Parity to test against\n * `parity_length` - Parity block length\n # Returns\n\ntrue\n false"]
pub fn bit_lib_test_parity(
data: *const u8,
position: usize,
length: u8,
parity: BitLibParity,
parity_length: u8,
) -> bool;
}
extern "C" {
#[doc = "Add parity to bit array\n\n # Arguments\n\n* `data` - Source bit array\n * `position` - Start position\n * `dest` - Destination bit array\n * `dest_position` - Destination position\n * `source_length` - Source bit count\n * `parity_length` - Parity block length\n * `parity` - Parity to test against\n # Returns\n\nsize_t"]
pub fn bit_lib_add_parity(
data: *const u8,
position: usize,
dest: *mut u8,
dest_position: usize,
source_length: u8,
parity_length: u8,
parity: BitLibParity,
) -> usize;
}
extern "C" {
#[doc = "Remove bit every n in array and shift array left. Useful to remove parity.\n\n # Arguments\n\n* `data` - Bit array\n * `position` - Start position\n * `length` - Bit count\n * `n` - every n bit will be removed\n # Returns\n\nsize_t"]
pub fn bit_lib_remove_bit_every_nth(data: *mut u8, position: usize, length: u8, n: u8)
-> usize;
}
extern "C" {
#[doc = "Copy bits from source to destination.\n\n # Arguments\n\n* `data` - destination array\n * `position` - position in destination array\n * `length` - length of bits to copy\n * `source` - source array\n * `source_position` - position in source array"]
pub fn bit_lib_copy_bits(
data: *mut u8,
position: usize,
length: usize,
source: *const u8,
source_position: usize,
);
}
extern "C" {
#[doc = "Reverse bits in bit array\n\n # Arguments\n\n* `data` - Bit array\n * `position` - start position\n * `length` - length of bits to reverse"]
pub fn bit_lib_reverse_bits(data: *mut u8, position: usize, length: u8);
}
extern "C" {
#[doc = "Count 1 bits in data\n\n # Arguments\n\n* `data` -\n # Returns\n\nuint8_t set bit count"]
pub fn bit_lib_get_bit_count(data: u32) -> u8;
}
extern "C" {
#[doc = "Print data as bit array\n\n # Arguments\n\n* `data` -\n * `length` -"]
pub fn bit_lib_print_bits(data: *const u8, length: usize);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BitLibRegion {
pub mark: core::ffi::c_char,
pub start: usize,
pub length: usize,
}
#[test]
fn bindgen_test_layout_BitLibRegion() {
const UNINIT: ::core::mem::MaybeUninit<BitLibRegion> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BitLibRegion>(),
12usize,
concat!("Size of: ", stringify!(BitLibRegion))
);
assert_eq!(
::core::mem::align_of::<BitLibRegion>(),
4usize,
concat!("Alignment of ", stringify!(BitLibRegion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mark) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BitLibRegion),
"::",
stringify!(mark)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BitLibRegion),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(BitLibRegion),
"::",
stringify!(length)
)
);
}
extern "C" {
#[doc = "Print data as bit array and mark regions. Regions needs to be sorted by start position.\n\n # Arguments\n\n* `regions` -\n * `region_count` -\n * `data` -\n * `length` -"]
pub fn bit_lib_print_regions(
regions: *const BitLibRegion,
region_count: usize,
data: *const u8,
length: usize,
);
}
extern "C" {
#[doc = "Reverse bits in uint16_t, faster than generic bit_lib_reverse_bits.\n\n # Arguments\n\n* `data` -\n # Returns\n\nuint16_t"]
pub fn bit_lib_reverse_16_fast(data: u16) -> u16;
}
extern "C" {
#[doc = "Reverse bits in uint8_t, faster than generic bit_lib_reverse_bits.\n\n # Arguments\n\n* `byte` - Byte\n # Returns\n\nuint8_t the reversed byte"]
pub fn bit_lib_reverse_8_fast(byte: u8) -> u8;
}
extern "C" {
#[doc = "Slow, but generic CRC8 implementation\n\n # Arguments\n\n* `data` -\n * `data_size` -\n * `polynom` - CRC polynom\n * `init` - init value\n * `ref_in` - true if the right bit is older\n * `ref_out` - true to reverse output\n * `xor_out` - xor output with this value\n # Returns\n\nuint8_t"]
pub fn bit_lib_crc8(
data: *const u8,
data_size: usize,
polynom: u8,
init: u8,
ref_in: bool,
ref_out: bool,
xor_out: u8,
) -> u16;
}
extern "C" {
#[doc = "Slow, but generic CRC16 implementation\n\n # Arguments\n\n* `data` -\n * `data_size` -\n * `polynom` - CRC polynom\n * `init` - init value\n * `ref_in` - true if the right bit is older\n * `ref_out` - true to reverse output\n * `xor_out` - xor output with this value\n # Returns\n\nuint16_t"]
pub fn bit_lib_crc16(
data: *const u8,
data_size: usize,
polynom: u16,
init: u16,
ref_in: bool,
ref_out: bool,
xor_out: u16,
) -> u16;
}
extern "C" {
#[doc = "Convert number to bytes in big endian order\n\n # Arguments\n\n* `src` - number to convert\n * `len` - max used bytes count\n * `dest` - destination\n # Returns\n\nvoid"]
pub fn bit_lib_num_to_bytes_be(src: u64, len: u8, dest: *mut u8);
}
extern "C" {
#[doc = "Convert number to bytes in little endian order\n\n # Arguments\n\n* `src` - number to convert\n * `len` - max used bytes count\n * `dest` - destination\n # Returns\n\nvoid"]
pub fn bit_lib_num_to_bytes_le(src: u64, len: u8, dest: *mut u8);
}
extern "C" {
#[doc = "Convert bytes to number in big endian order\n\n # Arguments\n\n* `src` - byte array\n * `len` - max used bytes count\n # Returns\n\nuint64_t"]
pub fn bit_lib_bytes_to_num_be(src: *const u8, len: u8) -> u64;
}
extern "C" {
#[doc = "Convert bytes to number in little endian order\n\n # Arguments\n\n* `src` - byte array\n * `len` - max used bytes count\n # Returns\n\nuint64_t"]
pub fn bit_lib_bytes_to_num_le(src: *const u8, len: u8) -> u64;
}
extern "C" {
#[doc = "Convert bytes in binary-coded decimal encoding to number\n\n # Arguments\n\n* `src` - byte array\n * `len` - max used bytes count\n * `is_bcd` - will be true if all processed bytes is BCD encoded (no A-F nibbles)\n # Returns\n\nuint64_t"]
pub fn bit_lib_bytes_to_num_bcd(src: *const u8, len: u8, is_bcd: *mut bool) -> u64;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DigitalSignal {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Append one period to the end of the DigitalSignal instance.\n\n # Arguments\n\n* `signal` (direction in, out) - pointer to a the instance to append to.\n * `ticks` (direction in) - the period length, in 10 picosecond units."]
pub fn digital_signal_add_period(signal: *mut DigitalSignal, ticks: u32);
}
extern "C" {
#[doc = "Append one period to the end of the DigitalSignal instance, with the level specified.\n\n If the level is the same as the last level contained in the instance, then it is extened\n by the given ticks value. Otherwise, the behaviour is identical to digital_signal_add_period().\n\n Example 1: add tc with HIGH level\n ```\n before:\n ... ------+\n ta | tb\n +-------\n after:\n ... ------+ +-------\n ta | tb | tc\n +------+\n ```\n Example 2: add tc with LOW level\n ```\n before:\n ... ------+\n ta | tb\n +-------\n after:\n ... ------+\n ta | tb + tc\n +--------------\n ```\n\n # Arguments\n\n* `signal` (direction in, out) - pointer to the instance to append to.\n * `ticks` (direction in) - the period length, in 10 picosecond units.\n * `level` (direction in) - the level to be set during the period."]
pub fn digital_signal_add_period_with_level(
signal: *mut DigitalSignal,
ticks: u32,
level: bool,
);
}
extern "C" {
#[doc = "Get the current start level contained in the DigitalSignal instance.\n\n If not explicitly set with digital_signal_set_start_level(), it defaults to false.\n\n # Arguments\n\n* `signal` (direction in) - pointer to the instance to be queried.\n # Returns\n\nthe start level value."]
pub fn digital_signal_get_start_level(signal: *const DigitalSignal) -> bool;
}
extern "C" {
#[doc = "Set the start level contained in the DigitalSignal instance.\n\n # Arguments\n\n* `signal` (direction in, out) - pointer to the instance to be modified.\n * `level` (direction in) - signal level to be set as the start level."]
pub fn digital_signal_set_start_level(signal: *mut DigitalSignal, level: bool);
}
extern "C" {
#[doc = "Get the number of periods currently stored in a DigitalSignal instance.\n\n # Arguments\n\n* `signal` (direction in) - pointer to the instance to be queried.\n # Returns\n\nthe number of periods stored in the instance."]
pub fn digital_signal_get_size(signal: *const DigitalSignal) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DigitalSequence {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Register a signal within a DigitalSequence instance by its index.\n\n This function must be called for each signal to be used in the sequence. The DigitalSequence\n instance does not own the signals, therefore, their lifetime must be no less than the instance's.\n\n The user is responsible for creation and deletion of DigitalSignal instances and\n also for keeping track of their respective indices.\n\n # Arguments\n\n* `sequence` (direction in, out) - pointer to the instance to be modified.\n * `signal_index` (direction in) - index to register the signal under (must be less than 32).\n * `signal` (direction in) - pointer to the DigitalSignal instance to be registered."]
pub fn digital_sequence_register_signal(
sequence: *mut DigitalSequence,
signal_index: u8,
signal: *const DigitalSignal,
);
}
extern "C" {
#[doc = "Append a signal index to a DigitalSequence instance.\n\n The signal under the index must be registered beforehand by calling digital_sequence_set_signal().\n\n # Arguments\n\n* `sequence` (direction in, out) - pointer to the instance to be modified.\n * `signal_index` (direction in) - signal index to be appended to the sequence (must be less than 32)."]
pub fn digital_sequence_add_signal(sequence: *mut DigitalSequence, signal_index: u8);
}
extern "C" {
#[doc = "Transmit the sequence contained in the DigitalSequence instance.\n\n Must contain at least one registered signal and one signal index.\n\n NOTE: The current implementation will properly initialise the GPIO provided during construction,\n but it is the caller's responsibility to reconfigure it back before reusing for other purposes.\n This is due to performance reasons.\n\n # Arguments\n\n* `sequence` (direction in) - pointer to the sequence to be transmitted."]
pub fn digital_sequence_transmit(sequence: *mut DigitalSequence);
}
extern "C" {
#[doc = "Read register\n\n # Arguments\n\n* `handle` - - pointer t FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `val` - - pointer to the variable to store the read value"]
pub fn st25r3916_read_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, val: *mut u8);
}
extern "C" {
#[doc = "Read multiple registers\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg_start` - - start register address\n * `values` - - pointer to the buffer to store the read values\n * `length` - - number of registers to read"]
pub fn st25r3916_read_burst_regs(
handle: *mut FuriHalSpiBusHandle,
reg_start: u8,
values: *mut u8,
length: u8,
);
}
extern "C" {
#[doc = "Write register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `val` - - value to write"]
pub fn st25r3916_write_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, val: u8);
}
extern "C" {
#[doc = "Write multiple registers\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg_start` - - start register address\n * `values` - - pointer to buffer to write\n * `length` - - number of registers to write"]
pub fn st25r3916_write_burst_regs(
handle: *mut FuriHalSpiBusHandle,
reg_start: u8,
values: *const u8,
length: u8,
);
}
extern "C" {
#[doc = "Write fifo register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `buff` - - buffer to write to FIFO\n * `length` - - number of bytes to write"]
pub fn st25r3916_reg_write_fifo(
handle: *mut FuriHalSpiBusHandle,
buff: *const u8,
length: usize,
);
}
extern "C" {
#[doc = "Read fifo register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `buff` - - buffer to store the read values\n * `length` - - number of bytes to read"]
pub fn st25r3916_reg_read_fifo(handle: *mut FuriHalSpiBusHandle, buff: *mut u8, length: usize);
}
extern "C" {
#[doc = "Write PTA memory register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `values` - - pointer to buffer to write\n * `length` - - number of bytes to write"]
pub fn st25r3916_write_pta_mem(
handle: *mut FuriHalSpiBusHandle,
values: *const u8,
length: usize,
);
}
extern "C" {
#[doc = "Read PTA memory register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `values` - - buffer to store the read values\n * `length` - - number of bytes to read"]
pub fn st25r3916_read_pta_mem(handle: *mut FuriHalSpiBusHandle, values: *mut u8, length: usize);
}
extern "C" {
#[doc = "Write PTF memory register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `values` - - pointer to buffer to write\n * `length` - - number of bytes to write"]
pub fn st25r3916_write_ptf_mem(
handle: *mut FuriHalSpiBusHandle,
values: *const u8,
length: usize,
);
}
extern "C" {
#[doc = "Read PTTSN memory register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `values` - - pointer to buffer to write\n * `length` - - number of bytes to write"]
pub fn st25r3916_write_pttsn_mem(
handle: *mut FuriHalSpiBusHandle,
values: *mut u8,
length: usize,
);
}
extern "C" {
#[doc = "Send Direct command\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `cmd` - - direct command"]
pub fn st25r3916_direct_cmd(handle: *mut FuriHalSpiBusHandle, cmd: u8);
}
extern "C" {
#[doc = "Read test register\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `val` - - pointer to the variable to store the read value"]
pub fn st25r3916_read_test_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, val: *mut u8);
}
extern "C" {
#[doc = "Write test register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `val` - - value to write"]
pub fn st25r3916_write_test_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, val: u8);
}
extern "C" {
#[doc = "Clear register bits\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `clr_mask` - - bit mask to clear"]
pub fn st25r3916_clear_reg_bits(handle: *mut FuriHalSpiBusHandle, reg: u8, clr_mask: u8);
}
extern "C" {
#[doc = "Set register bits\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `set_mask` - - bit mask to set"]
pub fn st25r3916_set_reg_bits(handle: *mut FuriHalSpiBusHandle, reg: u8, set_mask: u8);
}
extern "C" {
#[doc = "Change register bits\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `mask` - - bit mask to change\n * `value` - - new register value to write"]
pub fn st25r3916_change_reg_bits(
handle: *mut FuriHalSpiBusHandle,
reg: u8,
mask: u8,
value: u8,
);
}
extern "C" {
#[doc = "Modify register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `clr_mask` - - bit mask to clear\n * `set_mask` - - bit mask to set"]
pub fn st25r3916_modify_reg(
handle: *mut FuriHalSpiBusHandle,
reg: u8,
clr_mask: u8,
set_mask: u8,
);
}
extern "C" {
#[doc = "Change test register bits\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `mask` - - bit mask to change\n * `value` - - new register value to write"]
pub fn st25r3916_change_test_reg_bits(
handle: *mut FuriHalSpiBusHandle,
reg: u8,
mask: u8,
value: u8,
);
}
extern "C" {
#[doc = "Check register\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `reg` - - register address\n * `mask` - - bit mask to check\n * `val` - - expected register value\n\n # Returns\n\ntrue if register value matches the expected value, false otherwise"]
pub fn st25r3916_check_reg(
handle: *mut FuriHalSpiBusHandle,
reg: u8,
mask: u8,
val: u8,
) -> bool;
}
extern "C" {
#[doc = "Mask st25r3916 interrupts\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `mask` - - mask of interrupts to be disabled"]
pub fn st25r3916_mask_irq(handle: *mut FuriHalSpiBusHandle, mask: u32);
}
extern "C" {
#[doc = "Get st25r3916 interrupts\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n\n # Returns\n\nreceived interrupts"]
pub fn st25r3916_get_irq(handle: *mut FuriHalSpiBusHandle) -> u32;
}
extern "C" {
#[doc = "Write FIFO\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `buff` - - buffer to write to FIFO\n * `bits` - - number of bits to write"]
pub fn st25r3916_write_fifo(handle: *mut FuriHalSpiBusHandle, buff: *const u8, bits: usize);
}
extern "C" {
#[doc = "Read FIFO\n\n # Arguments\n\n* `handle` - - pointer to FuriHalSpiBusHandle instance\n * `buff` - - buffer to read from FIFO\n * `buff_size` - - buffer size n bytes\n * `buff_bits` - - pointer to number of bits read\n\n # Returns\n\ntrue if read success, false otherwise"]
pub fn st25r3916_read_fifo(
handle: *mut FuriHalSpiBusHandle,
buff: *mut u8,
buff_size: usize,
buff_bits: *mut usize,
) -> bool;
}
extern "C" {
#[doc = "Resolver for API entries using a pre-sorted table with hashes\n # Arguments\n\n* `interface` - pointer to HashtableApiInterface\n * `hash` - gnu hash of function name\n * `address` - output for function address\n # Returns\n\ntrue if the table contains a function"]
pub fn elf_resolve_from_hashtable(
interface: *const ElfApiInterface,
hash: u32,
address: *mut Elf32_Addr,
) -> bool;
}
extern "C" {
pub fn elf_symbolname_hash(s: *const core::ffi::c_char) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CompositeApiResolver {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate composite API resolver\n # Returns\n\nCompositeApiResolver* instance"]
pub fn composite_api_resolver_alloc() -> *mut CompositeApiResolver;
}
extern "C" {
#[doc = "Free composite API resolver\n # Arguments\n\n* `resolver` - Instance"]
pub fn composite_api_resolver_free(resolver: *mut CompositeApiResolver);
}
extern "C" {
#[doc = "Add API resolver to composite resolver\n # Arguments\n\n* `resolver` - Instance\n * `interface` - API resolver"]
pub fn composite_api_resolver_add(
resolver: *mut CompositeApiResolver,
interface: *const ElfApiInterface,
);
}
extern "C" {
#[doc = "Get API interface from composite resolver\n # Arguments\n\n* `resolver` - Instance\n # Returns\n\nAPI interface"]
pub fn composite_api_resolver_get(
resolver: *mut CompositeApiResolver,
) -> *const ElfApiInterface;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct PluginManager {
_unused: [u8; 0],
}
pub const PluginManagerError_PluginManagerErrorNone: PluginManagerError = 0;
pub const PluginManagerError_PluginManagerErrorLoaderError: PluginManagerError = 1;
pub const PluginManagerError_PluginManagerErrorApplicationIdMismatch: PluginManagerError = 2;
pub const PluginManagerError_PluginManagerErrorAPIVersionMismatch: PluginManagerError = 3;
pub type PluginManagerError = core::ffi::c_uchar;
extern "C" {
#[doc = "Allocates new PluginManager\n # Arguments\n\n* `application_id` - Application ID filter - only plugins with matching ID will be loaded\n * `api_version` - Application API version filter - only plugins with matching API version\n * `api_interface` - Application API interface - used to resolve plugins' API imports\n If plugin uses private application's API, use CompoundApiInterface\n # Returns\n\nnew PluginManager instance"]
pub fn plugin_manager_alloc(
application_id: *const core::ffi::c_char,
api_version: u32,
api_interface: *const ElfApiInterface,
) -> *mut PluginManager;
}
extern "C" {
#[doc = "Frees PluginManager\n # Arguments\n\n* `manager` - PluginManager instance"]
pub fn plugin_manager_free(manager: *mut PluginManager);
}
extern "C" {
#[doc = "Loads single plugin by full path\n # Arguments\n\n* `manager` - PluginManager instance\n * `path` - Path to plugin\n # Returns\n\nError code"]
pub fn plugin_manager_load_single(
manager: *mut PluginManager,
path: *const core::ffi::c_char,
) -> PluginManagerError;
}
extern "C" {
#[doc = "Loads all plugins from specified directory\n # Arguments\n\n* `manager` - PluginManager instance\n * `path` - Path to directory\n # Returns\n\nError code"]
pub fn plugin_manager_load_all(
manager: *mut PluginManager,
path: *const core::ffi::c_char,
) -> PluginManagerError;
}
extern "C" {
#[doc = "Returns number of loaded plugins\n # Arguments\n\n* `manager` - PluginManager instance\n # Returns\n\nNumber of loaded plugins"]
pub fn plugin_manager_get_count(manager: *mut PluginManager) -> u32;
}
extern "C" {
#[doc = "Returns plugin descriptor by index\n # Arguments\n\n* `manager` - PluginManager instance\n * `index` - Plugin index\n # Returns\n\nPlugin descriptor"]
pub fn plugin_manager_get(
manager: *mut PluginManager,
index: u32,
) -> *const FlipperAppPluginDescriptor;
}
extern "C" {
#[doc = "Returns plugin entry point by index\n # Arguments\n\n* `manager` - PluginManager instance\n * `index` - Plugin index\n # Returns\n\nPlugin entry point"]
pub fn plugin_manager_get_ep(
manager: *mut PluginManager,
index: u32,
) -> *const core::ffi::c_void;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FlipperFormat {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate FlipperFormat as string.\n\n # Returns\n\nFlipperFormat* pointer to a FlipperFormat instance"]
pub fn flipper_format_string_alloc() -> *mut FlipperFormat;
}
extern "C" {
#[doc = "Allocate FlipperFormat as file.\n\n # Arguments\n\n* `storage` - The storage\n\n # Returns\n\nFlipperFormat* pointer to a FlipperFormat instance"]
pub fn flipper_format_file_alloc(storage: *mut Storage) -> *mut FlipperFormat;
}
extern "C" {
#[doc = "Allocate FlipperFormat as file, buffered mode.\n\n # Arguments\n\n* `storage` - The storage\n\n # Returns\n\nFlipperFormat* pointer to a FlipperFormat instance"]
pub fn flipper_format_buffered_file_alloc(storage: *mut Storage) -> *mut FlipperFormat;
}
extern "C" {
#[doc = "Open existing file. Use only if FlipperFormat allocated as a file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_file_open_existing(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open existing file, buffered mode. Use only if FlipperFormat allocated as a\n buffered file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_buffered_file_open_existing(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open existing file for writing and add values to the end of file. Use only if\n FlipperFormat allocated as a file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_file_open_append(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open file. Creates a new file, or deletes the contents of the file if it\n already exists. Use only if FlipperFormat allocated as a file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_file_open_always(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open file. Creates a new file, or deletes the contents of the file if it\n already exists, buffered mode. Use only if FlipperFormat allocated as a\n buffered file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_buffered_file_open_always(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open file. Creates a new file, fails if file already exists. Use only if\n FlipperFormat allocated as a file.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `path` - File path\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_file_open_new(
flipper_format: *mut FlipperFormat,
path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Closes the file, use only if FlipperFormat allocated as a file.\n\n # Arguments\n\n* `flipper_format` - The flipper format\n\n # Returns\n\ntrue\n false"]
pub fn flipper_format_file_close(flipper_format: *mut FlipperFormat) -> bool;
}
extern "C" {
#[doc = "Closes the file, use only if FlipperFormat allocated as a buffered file.\n\n # Arguments\n\n* `flipper_format` - The flipper format\n\n # Returns\n\ntrue\n false"]
pub fn flipper_format_buffered_file_close(flipper_format: *mut FlipperFormat) -> bool;
}
extern "C" {
#[doc = "Free FlipperFormat.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance"]
pub fn flipper_format_free(flipper_format: *mut FlipperFormat);
}
extern "C" {
#[doc = "Set FlipperFormat mode.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `strict_mode` - True obligates not to skip valid fields. False by\n default."]
pub fn flipper_format_set_strict_mode(flipper_format: *mut FlipperFormat, strict_mode: bool);
}
extern "C" {
#[doc = "Rewind the RW pointer.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_rewind(flipper_format: *mut FlipperFormat) -> bool;
}
extern "C" {
#[doc = "Move the RW pointer at the end. Can be useful if you want to add some data\n after reading.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_seek_to_end(flipper_format: *mut FlipperFormat) -> bool;
}
extern "C" {
#[doc = "Check if the key exists.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n\n # Returns\n\ntrue key exists\n false key is not exists"]
pub fn flipper_format_key_exist(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Read the header (file type and version).\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `filetype` - File type string\n * `version` - Version Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_header(
flipper_format: *mut FlipperFormat,
filetype: *mut FuriString,
version: *mut u32,
) -> bool;
}
extern "C" {
#[doc = "Write the header (file type and version).\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `filetype` - File type string\n * `version` - Version Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_header(
flipper_format: *mut FlipperFormat,
filetype: *mut FuriString,
version: u32,
) -> bool;
}
extern "C" {
#[doc = "Write the header (file type and version). Plain C string version.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `filetype` - File type string\n * `version` - Version Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_header_cstr(
flipper_format: *mut FlipperFormat,
filetype: *const core::ffi::c_char,
version: u32,
) -> bool;
}
extern "C" {
#[doc = "Get the count of values by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - The key\n * `count` - The count\n\n # Returns\n\nbool"]
pub fn flipper_format_get_value_count(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
count: *mut u32,
) -> bool;
}
extern "C" {
#[doc = "Read a string by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_string(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Write key and string\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_string(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Write key and string. Plain C string version.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_string_cstr(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Read array of uint64 in hex format by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_hex_uint64(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut u64,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of uint64 in hex format\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_hex_uint64(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u64,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Read array of uint32 by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_uint32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut u32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of uint32\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_uint32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Read array of int32 by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_int32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut i32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of int32\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_int32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const i32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Read array of bool by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_bool(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut bool,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of bool\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_bool(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const bool,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Read array of float by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_float(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut f32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of float\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_float(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const f32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Read array of hex-formatted bytes by key\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_read_hex(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut u8,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write key and array of hex-formatted bytes\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` - Values count\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_hex(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u8,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Write comment\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `data` - Comment text\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_comment(
flipper_format: *mut FlipperFormat,
data: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Write comment. Plain C string version.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `data` - Comment text\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_write_comment_cstr(
flipper_format: *mut FlipperFormat,
data: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Removes the first matching key and its value. Sets the RW pointer to a\n position of deleted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_delete_key(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a string value. Sets the RW\n pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_string(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a string value. Plain C\n version. Sets the RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_string_cstr(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a uint32 array value. Sets the\n RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_uint32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a int32 array value. Sets the\n RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_int32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const i32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a bool array value. Sets the\n RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_bool(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const bool,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a float array value. Sets the\n RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_float(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const f32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to an array of hex-formatted\n bytes. Sets the RW pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_update_hex(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u8,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a string value, or adds the\n key and value if the key did not exist. Sets the RW pointer to a position at\n the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_string(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a string value, or adds the\n key and value if the key did not exist. Plain C version. Sets the RW pointer\n to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_string_cstr(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a uint32 array value, or adds\n the key and value if the key did not exist. Sets the RW pointer to a position\n at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_uint32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a int32 array value, or adds\n the key and value if the key did not exist. Sets the RW pointer to a position\n at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_int32(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const i32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a bool array value, or adds\n the key and value if the key did not exist. Sets the RW pointer to a position\n at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_bool(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const bool,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to a float array value, or adds\n the key and value if the key did not exist. Sets the RW pointer to a position\n at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_float(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const f32,
data_size: u16,
) -> bool;
}
extern "C" {
#[doc = "Updates the value of the first matching key to an array of hex-formatted\n bytes, or adds the key and value if the key did not exist. Sets the RW\n pointer to a position at the end of inserted data.\n\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `key` - Key\n * `data` - Value\n * `data_size` (direction in) - The data size\n\n # Returns\n\nTrue on success"]
pub fn flipper_format_insert_or_update_hex(
flipper_format: *mut FlipperFormat,
key: *const core::ffi::c_char,
data: *const u8,
data_size: u16,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Stream {
_unused: [u8; 0],
}
pub const StreamOffset_StreamOffsetFromCurrent: StreamOffset = 0;
pub const StreamOffset_StreamOffsetFromStart: StreamOffset = 1;
pub const StreamOffset_StreamOffsetFromEnd: StreamOffset = 2;
pub type StreamOffset = core::ffi::c_uchar;
pub const StreamDirection_StreamDirectionForward: StreamDirection = 0;
pub const StreamDirection_StreamDirectionBackward: StreamDirection = 1;
pub type StreamDirection = core::ffi::c_uchar;
pub type StreamWriteCB = ::core::option::Option<
unsafe extern "C" fn(stream: *mut Stream, context: *const core::ffi::c_void) -> bool,
>;
extern "C" {
#[doc = "Free Stream\n # Arguments\n\n* `stream` - Stream instance"]
pub fn stream_free(stream: *mut Stream);
}
extern "C" {
#[doc = "Clean (empty) Stream\n # Arguments\n\n* `stream` - Stream instance"]
pub fn stream_clean(stream: *mut Stream);
}
extern "C" {
#[doc = "Indicates that the RW pointer is at the end of the stream\n # Arguments\n\n* `stream` - Stream instance\n # Returns\n\ntrue if RW pointer is at the end of the stream\n false if RW pointer is not at the end of the stream"]
pub fn stream_eof(stream: *mut Stream) -> bool;
}
extern "C" {
#[doc = "Moves the RW pointer.\n # Arguments\n\n* `stream` - Stream instance\n * `offset` - how much to move the pointer\n * `offset_type` - starting from what\n # Returns\n\ntrue\n false"]
pub fn stream_seek(stream: *mut Stream, offset: i32, offset_type: StreamOffset) -> bool;
}
extern "C" {
#[doc = "Seek to next occurrence of the character\n\n # Arguments\n\n* `stream` - Pointer to the stream instance\n * `c` (direction in) - The Character\n * `direction` (direction in) - The Direction\n\n # Returns\n\ntrue on success"]
pub fn stream_seek_to_char(
stream: *mut Stream,
c: core::ffi::c_char,
direction: StreamDirection,
) -> bool;
}
extern "C" {
#[doc = "Gets the value of the RW pointer\n # Arguments\n\n* `stream` - Stream instance\n # Returns\n\nsize_t value of the RW pointer"]
pub fn stream_tell(stream: *mut Stream) -> usize;
}
extern "C" {
#[doc = "Gets the size of the stream\n # Arguments\n\n* `stream` - Stream instance\n # Returns\n\nsize_t size of the stream"]
pub fn stream_size(stream: *mut Stream) -> usize;
}
extern "C" {
#[doc = "Write N bytes to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `data` - data to write\n * `size` - size of data to be written\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write(stream: *mut Stream, data: *const u8, size: usize) -> usize;
}
extern "C" {
#[doc = "Read N bytes from stream\n # Arguments\n\n* `stream` - Stream instance\n * `data` - data to be read\n * `count` - size of data to be read\n # Returns\n\nsize_t how many bytes was read"]
pub fn stream_read(stream: *mut Stream, data: *mut u8, count: usize) -> usize;
}
extern "C" {
#[doc = "Delete N chars from the stream and write data by calling write_callback(context)\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `write_callback` - write callback\n * `context` - write callback context\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert(
stream: *mut Stream,
delete_size: usize,
write_callback: StreamWriteCB,
context: *const core::ffi::c_void,
) -> bool;
}
extern "C" {
#[doc = "Read line from a stream (supports LF and CRLF line endings)\n # Arguments\n\n* `stream` -\n * `str_result` -\n # Returns\n\ntrue if line length is not zero\n false otherwise"]
pub fn stream_read_line(stream: *mut Stream, str_result: *mut FuriString) -> bool;
}
extern "C" {
#[doc = "Moves the RW pointer to the start\n # Arguments\n\n* `stream` - Stream instance"]
pub fn stream_rewind(stream: *mut Stream) -> bool;
}
extern "C" {
#[doc = "Write char to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `c` - char value\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write_char(stream: *mut Stream, c: core::ffi::c_char) -> usize;
}
extern "C" {
#[doc = "Write string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `string` - string value\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write_string(stream: *mut Stream, string: *mut FuriString) -> usize;
}
extern "C" {
#[doc = "Write const char* to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `string` - c-string value\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write_cstring(stream: *mut Stream, string: *const core::ffi::c_char) -> usize;
}
extern "C" {
#[doc = "Write formatted string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `format` -\n * `...` -\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write_format(stream: *mut Stream, format: *const core::ffi::c_char, ...)
-> usize;
}
extern "C" {
#[doc = "Write formatted string to the stream, va_list version\n # Arguments\n\n* `stream` - Stream instance\n * `format` -\n * `args` -\n # Returns\n\nsize_t how many bytes was written"]
pub fn stream_write_vaformat(
stream: *mut Stream,
format: *const core::ffi::c_char,
args: va_list,
) -> usize;
}
extern "C" {
#[doc = "Insert N chars to the stream, starting at the current pointer.\n Data will be inserted, not overwritten, so the stream will be increased in size.\n # Arguments\n\n* `stream` - Stream instance\n * `data` - data to be inserted\n * `size` - size of data to be inserted\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert(stream: *mut Stream, data: *const u8, size: usize) -> bool;
}
extern "C" {
#[doc = "Insert char to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `c` - char value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert_char(stream: *mut Stream, c: core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Insert string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `string` - string value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert_string(stream: *mut Stream, string: *mut FuriString) -> bool;
}
extern "C" {
#[doc = "Insert const char* to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `string` - c-string value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert_cstring(stream: *mut Stream, string: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Insert formatted string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `format` -\n * `...` -\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert_format(stream: *mut Stream, format: *const core::ffi::c_char, ...)
-> bool;
}
extern "C" {
#[doc = "Insert formatted string to the stream, va_list version\n # Arguments\n\n* `stream` - Stream instance\n * `format` -\n * `args` -\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_insert_vaformat(
stream: *mut Stream,
format: *const core::ffi::c_char,
args: va_list,
) -> bool;
}
extern "C" {
#[doc = "Delete N chars from the stream and insert char to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `c` - char value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert_char(
stream: *mut Stream,
delete_size: usize,
c: core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Delete N chars from the stream and insert string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `string` - string value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert_string(
stream: *mut Stream,
delete_size: usize,
string: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Delete N chars from the stream and insert const char* to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `string` - c-string value\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert_cstring(
stream: *mut Stream,
delete_size: usize,
string: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Delete N chars from the stream and insert formatted string to the stream\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `format` -\n * `...` -\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert_format(
stream: *mut Stream,
delete_size: usize,
format: *const core::ffi::c_char,
...
) -> bool;
}
extern "C" {
#[doc = "Delete N chars from the stream and insert formatted string to the stream, va_list version\n # Arguments\n\n* `stream` - Stream instance\n * `delete_size` - size of data to be deleted\n * `format` -\n * `args` -\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete_and_insert_vaformat(
stream: *mut Stream,
delete_size: usize,
format: *const core::ffi::c_char,
args: va_list,
) -> bool;
}
extern "C" {
#[doc = "Remove N chars from the stream, starting at the current pointer.\n The size may be larger than stream size, the stream will be cleared from current RW pointer to the end.\n # Arguments\n\n* `stream` - Stream instance\n * `size` - how many chars need to be deleted\n # Returns\n\ntrue if the operation was successful\n false on error"]
pub fn stream_delete(stream: *mut Stream, size: usize) -> bool;
}
extern "C" {
#[doc = "Copy data from one stream to another. Data will be copied from current RW pointer and to current RW pointer.\n # Arguments\n\n* `stream_from` -\n * `stream_to` -\n * `size` -\n # Returns\n\nsize_t"]
pub fn stream_copy(stream_from: *mut Stream, stream_to: *mut Stream, size: usize) -> usize;
}
extern "C" {
#[doc = "Copy data from one stream to another. Data will be copied from start of one stream and to start of other stream.\n # Arguments\n\n* `stream_from` -\n * `stream_to` -\n # Returns\n\nsize_t"]
pub fn stream_copy_full(stream_from: *mut Stream, stream_to: *mut Stream) -> usize;
}
extern "C" {
#[doc = "Splits one stream into two others. The original stream will remain untouched.\n # Arguments\n\n* `stream` -\n * `stream_left` -\n * `stream_right` -\n # Returns\n\ntrue\n false"]
pub fn stream_split(
stream: *mut Stream,
stream_left: *mut Stream,
stream_right: *mut Stream,
) -> bool;
}
extern "C" {
#[doc = "Loads data to the stream from a file. Data will be loaded to the current RW pointer. RW pointer will be moved to the end of the stream.\n # Arguments\n\n* `stream` - Stream instance\n * `storage` -\n * `path` -\n # Returns\n\nsize_t"]
pub fn stream_load_from_file(
stream: *mut Stream,
storage: *mut Storage,
path: *const core::ffi::c_char,
) -> usize;
}
extern "C" {
#[doc = "Writes data from a stream to a file. Data will be saved starting from the current RW pointer. RW pointer will be moved to the end of the stream.\n # Arguments\n\n* `stream` - Stream instance\n * `storage` -\n * `path` -\n * `mode` -\n # Returns\n\nsize_t"]
pub fn stream_save_to_file(
stream: *mut Stream,
storage: *mut Storage,
path: *const core::ffi::c_char,
mode: FS_OpenMode,
) -> usize;
}
extern "C" {
#[doc = "Dump stream inner data (size, RW position, content)\n # Arguments\n\n* `stream` - Stream instance"]
pub fn stream_dump_data(stream: *mut Stream);
}
extern "C" {
#[doc = "Returns the underlying stream instance.\n Use only if you know what you are doing.\n # Arguments\n\n* `flipper_format` -\n # Returns\n\nStream*"]
pub fn flipper_format_get_raw_stream(flipper_format: *mut FlipperFormat) -> *mut Stream;
}
pub const FlipperStreamValue_FlipperStreamValueIgnore: FlipperStreamValue = 0;
pub const FlipperStreamValue_FlipperStreamValueStr: FlipperStreamValue = 1;
pub const FlipperStreamValue_FlipperStreamValueHex: FlipperStreamValue = 2;
pub const FlipperStreamValue_FlipperStreamValueFloat: FlipperStreamValue = 3;
pub const FlipperStreamValue_FlipperStreamValueInt32: FlipperStreamValue = 4;
pub const FlipperStreamValue_FlipperStreamValueUint32: FlipperStreamValue = 5;
pub const FlipperStreamValue_FlipperStreamValueHexUint64: FlipperStreamValue = 6;
pub const FlipperStreamValue_FlipperStreamValueBool: FlipperStreamValue = 7;
pub type FlipperStreamValue = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FlipperStreamWriteData {
pub key: *const core::ffi::c_char,
pub type_: FlipperStreamValue,
pub data: *const core::ffi::c_void,
pub data_size: usize,
}
#[test]
fn bindgen_test_layout_FlipperStreamWriteData() {
const UNINIT: ::core::mem::MaybeUninit<FlipperStreamWriteData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FlipperStreamWriteData>(),
16usize,
concat!("Size of: ", stringify!(FlipperStreamWriteData))
);
assert_eq!(
::core::mem::align_of::<FlipperStreamWriteData>(),
4usize,
concat!("Alignment of ", stringify!(FlipperStreamWriteData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FlipperStreamWriteData),
"::",
stringify!(key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(FlipperStreamWriteData),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FlipperStreamWriteData),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_size) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(FlipperStreamWriteData),
"::",
stringify!(data_size)
)
);
}
extern "C" {
#[doc = "Writes a key/value pair to the stream.\n # Arguments\n\n* `stream` -\n * `write_data` -\n # Returns\n\ntrue\n false"]
pub fn flipper_format_stream_write_value_line(
stream: *mut Stream,
write_data: *mut FlipperStreamWriteData,
) -> bool;
}
extern "C" {
#[doc = "Reads a value by key from a stream.\n # Arguments\n\n* `stream` -\n * `key` -\n * `type` -\n * `_data` -\n * `data_size` -\n * `strict_mode` -\n # Returns\n\ntrue\n false"]
pub fn flipper_format_stream_read_value_line(
stream: *mut Stream,
key: *const core::ffi::c_char,
type_: FlipperStreamValue,
_data: *mut core::ffi::c_void,
data_size: usize,
strict_mode: bool,
) -> bool;
}
extern "C" {
#[doc = "Get the count of values by key from a stream.\n # Arguments\n\n* `stream` -\n * `key` -\n * `count` -\n * `strict_mode` -\n # Returns\n\ntrue\n false"]
pub fn flipper_format_stream_get_value_count(
stream: *mut Stream,
key: *const core::ffi::c_char,
count: *mut u32,
strict_mode: bool,
) -> bool;
}
extern "C" {
#[doc = "Removes a key and the corresponding value string from the stream and inserts a new key/value pair.\n # Arguments\n\n* `stream` -\n * `write_data` -\n * `strict_mode` -\n # Returns\n\ntrue\n false"]
pub fn flipper_format_stream_delete_key_and_write(
stream: *mut Stream,
write_data: *mut FlipperStreamWriteData,
strict_mode: bool,
) -> bool;
}
extern "C" {
#[doc = "Writes a comment string to the stream.\n # Arguments\n\n* `stream` -\n * `data` -\n # Returns\n\ntrue\n false"]
pub fn flipper_format_stream_write_comment_cstr(
stream: *mut Stream,
data: *const core::ffi::c_char,
) -> bool;
}
pub type iButtonProtocolId = i32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iButtonEditableData {
pub ptr: *mut u8,
pub size: usize,
}
#[test]
fn bindgen_test_layout_iButtonEditableData() {
const UNINIT: ::core::mem::MaybeUninit<iButtonEditableData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<iButtonEditableData>(),
8usize,
concat!("Size of: ", stringify!(iButtonEditableData))
);
assert_eq!(
::core::mem::align_of::<iButtonEditableData>(),
4usize,
concat!("Alignment of ", stringify!(iButtonEditableData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(iButtonEditableData),
"::",
stringify!(ptr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(iButtonEditableData),
"::",
stringify!(size)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iButtonKey {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate a key object\n # Arguments\n\n* `[in]` - data_size maximum data size held by the key\n # Returns\n\npointer to the key object"]
pub fn ibutton_key_alloc(data_size: usize) -> *mut iButtonKey;
}
extern "C" {
#[doc = "Destroy the key object, free resources\n # Arguments\n\n* `[in]` - key pointer to the key object"]
pub fn ibutton_key_free(key: *mut iButtonKey);
}
extern "C" {
#[doc = "Get the protocol id held by the key\n # Arguments\n\n* `[in]` - key pointer to the key object\n # Returns\n\nprotocol id held by the key"]
pub fn ibutton_key_get_protocol_id(key: *const iButtonKey) -> iButtonProtocolId;
}
extern "C" {
#[doc = "Set the protocol id held by the key\n # Arguments\n\n* `[in]` - key pointer to the key object\n * `[in]` - protocol_id new protocol id"]
pub fn ibutton_key_set_protocol_id(key: *mut iButtonKey, protocol_id: iButtonProtocolId);
}
extern "C" {
#[doc = "Reset the protocol id and data held by the key\n # Arguments\n\n* `[in]` - key pointer to the key object"]
pub fn ibutton_key_reset(key: *mut iButtonKey);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iButtonProtocols {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate an iButtonProtocols object\n # Returns\n\npointer to an iButtonProtocols object"]
pub fn ibutton_protocols_alloc() -> *mut iButtonProtocols;
}
extern "C" {
#[doc = "Destroy an iButtonProtocols object, free resources\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object"]
pub fn ibutton_protocols_free(protocols: *mut iButtonProtocols);
}
extern "C" {
#[doc = "Get the total number of available protocols"]
pub fn ibutton_protocols_get_protocol_count() -> u32;
}
extern "C" {
#[doc = "Get maximum data size out of all protocols available\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n # Returns\n\nmaximum data size in bytes"]
pub fn ibutton_protocols_get_max_data_size(protocols: *mut iButtonProtocols) -> usize;
}
extern "C" {
#[doc = "Get the protocol id based on its name\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - name pointer to a string containing the name\n # Returns\n\nprotocol id on success on iButtonProtocolIdInvalid on failure"]
pub fn ibutton_protocols_get_id_by_name(
protocols: *mut iButtonProtocols,
name: *const core::ffi::c_char,
) -> iButtonProtocolId;
}
extern "C" {
#[doc = "Get the manufacturer name based on the protocol id\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - id id of the protocol in question\n # Returns\n\npointer to a statically allocated string with manufacturer name"]
pub fn ibutton_protocols_get_manufacturer(
protocols: *mut iButtonProtocols,
id: iButtonProtocolId,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get the protocol name based on the protocol id\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - id id of the protocol in question\n # Returns\n\npointer to a statically allocated string with protocol name"]
pub fn ibutton_protocols_get_name(
protocols: *mut iButtonProtocols,
id: iButtonProtocolId,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get protocol features bitmask by protocol id\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - id id of the protocol in question"]
pub fn ibutton_protocols_get_features(
protocols: *mut iButtonProtocols,
id: iButtonProtocolId,
) -> u32;
}
extern "C" {
#[doc = "Read a physical device (a key or an emulator)\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[out]` - key pointer to the key to read into (must be allocated before)\n # Returns\n\ntrue on success, false on failure"]
pub fn ibutton_protocols_read(protocols: *mut iButtonProtocols, key: *mut iButtonKey) -> bool;
}
extern "C" {
#[doc = "Write the key to a blank\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be written\n # Returns\n\ntrue on success, false on failure"]
pub fn ibutton_protocols_write_id(
protocols: *mut iButtonProtocols,
key: *mut iButtonKey,
) -> bool;
}
extern "C" {
#[doc = "Write the key to another one of the same type\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be written\n # Returns\n\ntrue on success, false on failure"]
pub fn ibutton_protocols_write_copy(
protocols: *mut iButtonProtocols,
key: *mut iButtonKey,
) -> bool;
}
extern "C" {
#[doc = "Start emulating the key\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be emulated"]
pub fn ibutton_protocols_emulate_start(protocols: *mut iButtonProtocols, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Stop emulating the key\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be emulated"]
pub fn ibutton_protocols_emulate_stop(protocols: *mut iButtonProtocols, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Save the key data to a file.\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be saved\n * `[in]` - file_name full absolute path to the file name\n # Returns\n\ntrue on success, false on failure"]
pub fn ibutton_protocols_save(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
file_name: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Load the key from a file.\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[out]` - key pointer to the key to load into (must be allocated before)\n * `[in]` - file_name full absolute path to the file name\n # Returns\n\ntrue on success, false on failure"]
pub fn ibutton_protocols_load(
protocols: *mut iButtonProtocols,
key: *mut iButtonKey,
file_name: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Format a string containing defice UID\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be rendered\n * `[out]` - result pointer to the FuriString instance (must be initialized)"]
pub fn ibutton_protocols_render_uid(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
result: *mut FuriString,
);
}
extern "C" {
#[doc = "Format a string containing device full data\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be rendered\n * `[out]` - result pointer to the FuriString instance (must be initialized)"]
pub fn ibutton_protocols_render_data(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
result: *mut FuriString,
);
}
extern "C" {
#[doc = "Format a string containing device brief data\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be rendered\n * `[out]` - result pointer to the FuriString instance (must be initialized)"]
pub fn ibutton_protocols_render_brief_data(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
result: *mut FuriString,
);
}
extern "C" {
#[doc = "Format a string containing error message (for invalid keys)\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be rendered\n * `[out]` - result pointer to the FuriString instance (must be initialized)"]
pub fn ibutton_protocols_render_error(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
result: *mut FuriString,
);
}
extern "C" {
#[doc = "Check whether the key data is valid\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be checked\n # Returns\n\ntrue if data is valid, false otherwise"]
pub fn ibutton_protocols_is_valid(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
) -> bool;
}
extern "C" {
#[doc = "Get a pointer to the key's editable data (for in-place editing)\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in]` - key pointer to the key to be checked\n * `[out]` - editable pointer to a structure to contain the editable data"]
pub fn ibutton_protocols_get_editable_data(
protocols: *mut iButtonProtocols,
key: *const iButtonKey,
editable: *mut iButtonEditableData,
);
}
extern "C" {
#[doc = "Make all necessary internal adjustments after editing the key\n # Arguments\n\n* `[in]` - protocols pointer to an iButtonProtocols object\n * `[in,out]` - key pointer to the key to be adjusted"]
pub fn ibutton_protocols_apply_edits(protocols: *mut iButtonProtocols, key: *const iButtonKey);
}
pub const iButtonWorkerWriteResult_iButtonWorkerWriteOK: iButtonWorkerWriteResult = 0;
pub const iButtonWorkerWriteResult_iButtonWorkerWriteSameKey: iButtonWorkerWriteResult = 1;
pub const iButtonWorkerWriteResult_iButtonWorkerWriteNoDetect: iButtonWorkerWriteResult = 2;
pub const iButtonWorkerWriteResult_iButtonWorkerWriteCannotWrite: iButtonWorkerWriteResult = 3;
pub type iButtonWorkerWriteResult = core::ffi::c_uchar;
pub type iButtonWorkerReadCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub type iButtonWorkerWriteCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, result: iButtonWorkerWriteResult),
>;
pub type iButtonWorkerEmulateCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, emulated: bool)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iButtonWorker {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate ibutton worker\n # Returns\n\niButtonWorker*"]
pub fn ibutton_worker_alloc(protocols: *mut iButtonProtocols) -> *mut iButtonWorker;
}
extern "C" {
#[doc = "Free ibutton worker\n # Arguments\n\n* `worker` -"]
pub fn ibutton_worker_free(worker: *mut iButtonWorker);
}
extern "C" {
#[doc = "Start ibutton worker thread\n # Arguments\n\n* `worker` -"]
pub fn ibutton_worker_start_thread(worker: *mut iButtonWorker);
}
extern "C" {
#[doc = "Stop ibutton worker thread\n # Arguments\n\n* `worker` -"]
pub fn ibutton_worker_stop_thread(worker: *mut iButtonWorker);
}
extern "C" {
#[doc = "Set \"read success\" callback\n # Arguments\n\n* `worker` -\n * `callback` -\n * `context` -"]
pub fn ibutton_worker_read_set_callback(
worker: *mut iButtonWorker,
callback: iButtonWorkerReadCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start read mode\n # Arguments\n\n* `worker` -\n * `key` -"]
pub fn ibutton_worker_read_start(worker: *mut iButtonWorker, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Set \"write event\" callback\n # Arguments\n\n* `worker` -\n * `callback` -\n * `context` -"]
pub fn ibutton_worker_write_set_callback(
worker: *mut iButtonWorker,
callback: iButtonWorkerWriteCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start write blank mode\n # Arguments\n\n* `worker` -\n * `key` -"]
pub fn ibutton_worker_write_id_start(worker: *mut iButtonWorker, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Start write copy mode\n # Arguments\n\n* `worker` -\n * `key` -"]
pub fn ibutton_worker_write_copy_start(worker: *mut iButtonWorker, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Set \"emulate success\" callback\n # Arguments\n\n* `worker` -\n * `callback` -\n * `context` -"]
pub fn ibutton_worker_emulate_set_callback(
worker: *mut iButtonWorker,
callback: iButtonWorkerEmulateCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start emulate mode\n # Arguments\n\n* `worker` -\n * `key` -"]
pub fn ibutton_worker_emulate_start(worker: *mut iButtonWorker, key: *mut iButtonKey);
}
extern "C" {
#[doc = "Stop all modes\n # Arguments\n\n* `worker` -"]
pub fn ibutton_worker_stop(worker: *mut iButtonWorker);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InfraredDecoderHandler {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InfraredEncoderHandler {
_unused: [u8; 0],
}
pub const InfraredProtocol_InfraredProtocolUnknown: InfraredProtocol = -1;
pub const InfraredProtocol_InfraredProtocolNEC: InfraredProtocol = 0;
pub const InfraredProtocol_InfraredProtocolNECext: InfraredProtocol = 1;
pub const InfraredProtocol_InfraredProtocolNEC42: InfraredProtocol = 2;
pub const InfraredProtocol_InfraredProtocolNEC42ext: InfraredProtocol = 3;
pub const InfraredProtocol_InfraredProtocolSamsung32: InfraredProtocol = 4;
pub const InfraredProtocol_InfraredProtocolRC6: InfraredProtocol = 5;
pub const InfraredProtocol_InfraredProtocolRC5: InfraredProtocol = 6;
pub const InfraredProtocol_InfraredProtocolRC5X: InfraredProtocol = 7;
pub const InfraredProtocol_InfraredProtocolSIRC: InfraredProtocol = 8;
pub const InfraredProtocol_InfraredProtocolSIRC15: InfraredProtocol = 9;
pub const InfraredProtocol_InfraredProtocolSIRC20: InfraredProtocol = 10;
pub const InfraredProtocol_InfraredProtocolKaseikyo: InfraredProtocol = 11;
pub const InfraredProtocol_InfraredProtocolRCA: InfraredProtocol = 12;
pub const InfraredProtocol_InfraredProtocolPioneer: InfraredProtocol = 13;
pub const InfraredProtocol_InfraredProtocolMAX: InfraredProtocol = 14;
pub type InfraredProtocol = core::ffi::c_schar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InfraredMessage {
pub protocol: InfraredProtocol,
pub address: u32,
pub command: u32,
pub repeat: bool,
}
#[test]
fn bindgen_test_layout_InfraredMessage() {
const UNINIT: ::core::mem::MaybeUninit<InfraredMessage> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<InfraredMessage>(),
16usize,
concat!("Size of: ", stringify!(InfraredMessage))
);
assert_eq!(
::core::mem::align_of::<InfraredMessage>(),
4usize,
concat!("Alignment of ", stringify!(InfraredMessage))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(InfraredMessage),
"::",
stringify!(protocol)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).address) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(InfraredMessage),
"::",
stringify!(address)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).command) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(InfraredMessage),
"::",
stringify!(command)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).repeat) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(InfraredMessage),
"::",
stringify!(repeat)
)
);
}
pub const InfraredStatus_InfraredStatusError: InfraredStatus = 0;
pub const InfraredStatus_InfraredStatusOk: InfraredStatus = 1;
pub const InfraredStatus_InfraredStatusDone: InfraredStatus = 2;
pub const InfraredStatus_InfraredStatusReady: InfraredStatus = 3;
pub type InfraredStatus = core::ffi::c_uchar;
extern "C" {
#[doc = "Initialize decoder.\n\n # Returns\n\nreturns pointer to INFRARED decoder handler if success, otherwise - error."]
pub fn infrared_alloc_decoder() -> *mut InfraredDecoderHandler;
}
extern "C" {
#[doc = "Provide to decoder next timing.\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED decoders. Should be acquired with `infrared_alloc_decoder().`\n * `level` (direction in) - - high(true) or low(false) level of input signal to analyze.\n it should alternate every call, otherwise it is an error case,\n and decoder resets its state and start decoding from the start.\n * `duration` (direction in) - - duration of steady high/low input signal.\n # Returns\n\nif message is ready, returns pointer to decoded message, returns NULL.\n Note: ownership of returned ptr belongs to handler. So pointer is valid\n up to next infrared_free_decoder(), infrared_reset_decoder(),\n infrared_decode(), infrared_check_decoder_ready() calls."]
pub fn infrared_decode(
handler: *mut InfraredDecoderHandler,
level: bool,
duration: u32,
) -> *const InfraredMessage;
}
extern "C" {
#[doc = "Check whether decoder is ready.\n Functionality is quite similar to infrared_decode(), but with no timing providing.\n Some protocols (e.g. Sony SIRC) has variable payload length, which means we\n can't recognize end of message right after receiving last bit. That's why\n application should call to infrared_check_decoder_ready() after some timeout to\n retrieve decoded message, if so.\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED decoders. Should be acquired with `infrared_alloc_decoder().`\n # Returns\n\nif message is ready, returns pointer to decoded message, returns NULL.\n Note: ownership of returned ptr belongs to handler. So pointer is valid\n up to next infrared_free_decoder(), infrared_reset_decoder(),\n infrared_decode(), infrared_check_decoder_ready() calls."]
pub fn infrared_check_decoder_ready(
handler: *mut InfraredDecoderHandler,
) -> *const InfraredMessage;
}
extern "C" {
#[doc = "Deinitialize decoder and free allocated memory.\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED decoders. Should be acquired with `infrared_alloc_decoder().`"]
pub fn infrared_free_decoder(handler: *mut InfraredDecoderHandler);
}
extern "C" {
#[doc = "Reset INFRARED decoder.\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED decoders. Should be acquired with `infrared_alloc_decoder().`"]
pub fn infrared_reset_decoder(handler: *mut InfraredDecoderHandler);
}
extern "C" {
#[doc = "Get protocol name by protocol enum.\n\n # Arguments\n\n* `protocol` (direction in) - - protocol identifier.\n # Returns\n\nstring to protocol name."]
pub fn infrared_get_protocol_name(protocol: InfraredProtocol) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get protocol enum by protocol name.\n\n # Arguments\n\n* `protocol_name` (direction in) - - string to protocol name.\n # Returns\n\nprotocol identifier."]
pub fn infrared_get_protocol_by_name(
protocol_name: *const core::ffi::c_char,
) -> InfraredProtocol;
}
extern "C" {
#[doc = "Get address length by protocol enum.\n\n # Arguments\n\n* `protocol` (direction in) - - protocol identifier.\n # Returns\n\nlength of address in bits."]
pub fn infrared_get_protocol_address_length(protocol: InfraredProtocol) -> u8;
}
extern "C" {
#[doc = "Get command length by protocol enum.\n\n # Arguments\n\n* `protocol` (direction in) - - protocol identifier.\n # Returns\n\nlength of command in bits."]
pub fn infrared_get_protocol_command_length(protocol: InfraredProtocol) -> u8;
}
extern "C" {
#[doc = "Checks whether protocol valid.\n\n # Arguments\n\n* `protocol` (direction in) - - protocol identifier.\n # Returns\n\ntrue if protocol is valid, false otherwise."]
pub fn infrared_is_protocol_valid(protocol: InfraredProtocol) -> bool;
}
extern "C" {
#[doc = "Allocate INFRARED encoder.\n\n # Returns\n\nencoder handler."]
pub fn infrared_alloc_encoder() -> *mut InfraredEncoderHandler;
}
extern "C" {
#[doc = "Free encoder handler previously allocated with `infrared_alloc_encoder().`\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED encoder. Should be acquired with `infrared_alloc_encoder().`"]
pub fn infrared_free_encoder(handler: *mut InfraredEncoderHandler);
}
extern "C" {
#[doc = "Encode previously set INFRARED message.\n Usage:\n 1) alloc with `infrared_alloc_encoder()`\n 2) set message to encode with `infrared_reset_encoder()`\n 3) call for `infrared_encode()` to continuously get one at a time timings.\n 4) when `infrared_encode()` returns InfraredStatusDone, it means new message is fully encoded.\n 5) to encode additional timings, just continue calling `infrared_encode().`\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED encoder. Should be acquired with `infrared_alloc_encoder().`\n * `duration` (direction out) - - encoded timing.\n * `level` (direction out) - - encoded level.\n\n # Returns\n\nstatus of encode operation."]
pub fn infrared_encode(
handler: *mut InfraredEncoderHandler,
duration: *mut u32,
level: *mut bool,
) -> InfraredStatus;
}
extern "C" {
#[doc = "Reset INFRARED encoder and set new message to encode. If it's not called after receiveing\n InfraredStatusDone in `infrared_encode(),` encoder will encode repeat messages\n till the end of time.\n\n # Arguments\n\n* `handler` (direction in) - - handler to INFRARED encoder. Should be acquired with `infrared_alloc_encoder().`\n * `message` (direction in) - - message to encode."]
pub fn infrared_reset_encoder(
handler: *mut InfraredEncoderHandler,
message: *const InfraredMessage,
);
}
extern "C" {
#[doc = "Get PWM frequency value for selected protocol\n\n # Arguments\n\n* `protocol` (direction in) - - protocol to get from PWM frequency\n\n # Returns\n\nfrequency"]
pub fn infrared_get_protocol_frequency(protocol: InfraredProtocol) -> u32;
}
extern "C" {
#[doc = "Get PWM duty cycle value for selected protocol\n\n # Arguments\n\n* `protocol` (direction in) - - protocol to get from PWM duty cycle\n\n # Returns\n\nduty cycle"]
pub fn infrared_get_protocol_duty_cycle(protocol: InfraredProtocol) -> f32;
}
extern "C" {
#[doc = "Get the minimum count of signal repeats for the selected protocol\n\n # Arguments\n\n* `protocol` (direction in) - - protocol to get the repeat count from\n\n # Returns\n\nrepeat count"]
pub fn infrared_get_protocol_min_repeat_count(protocol: InfraredProtocol) -> usize;
}
pub const FuriHalInfraredTxPin_FuriHalInfraredTxPinInternal: FuriHalInfraredTxPin = 0;
pub const FuriHalInfraredTxPin_FuriHalInfraredTxPinExtPA7: FuriHalInfraredTxPin = 1;
pub const FuriHalInfraredTxPin_FuriHalInfraredTxPinMax: FuriHalInfraredTxPin = 2;
pub type FuriHalInfraredTxPin = core::ffi::c_uchar;
#[doc = "< New data obtained"]
pub const FuriHalInfraredTxGetDataState_FuriHalInfraredTxGetDataStateOk:
FuriHalInfraredTxGetDataState = 0;
#[doc = "< New data obtained, and this is end of package"]
pub const FuriHalInfraredTxGetDataState_FuriHalInfraredTxGetDataStateDone:
FuriHalInfraredTxGetDataState = 1;
#[doc = "< New data obtained, and this is end of package and no more data available"]
pub const FuriHalInfraredTxGetDataState_FuriHalInfraredTxGetDataStateLastDone:
FuriHalInfraredTxGetDataState = 2;
pub type FuriHalInfraredTxGetDataState = core::ffi::c_uchar;
#[doc = "Callback type for providing data to INFRARED DMA TX system. It is called every tim"]
pub type FuriHalInfraredTxGetDataISRCallback = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
duration: *mut u32,
level: *mut bool,
) -> FuriHalInfraredTxGetDataState,
>;
#[doc = "Callback type called every time signal is sent by DMA to Timer.\n\n Actually, it means there are 2 timings left to send for this signal, which is\n almost end. Don't use this callback to stop transmission, as far as there are\n next signal is charged for transmission by DMA."]
pub type FuriHalInfraredTxSignalSentISRCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Signature of callback function for receiving continuous INFRARED rx signal.\n\n # Arguments\n\n* `ctx` (direction in) - context to pass to callback\n * `level` (direction in) - level of input INFRARED rx signal\n * `duration` (direction in) - duration of continuous rx signal level in us"]
pub type FuriHalInfraredRxCaptureCallback = ::core::option::Option<
unsafe extern "C" fn(ctx: *mut core::ffi::c_void, level: bool, duration: u32),
>;
#[doc = "Signature of callback function for reaching silence timeout on INFRARED port.\n\n # Arguments\n\n* `ctx` (direction in) - context to pass to callback"]
pub type FuriHalInfraredRxTimeoutCallback =
::core::option::Option<unsafe extern "C" fn(ctx: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Initialize INFRARED RX timer to receive interrupts.\n\n It provides interrupts for every RX-signal edge changing with its duration."]
pub fn furi_hal_infrared_async_rx_start();
}
extern "C" {
#[doc = "Deinitialize INFRARED RX interrupt."]
pub fn furi_hal_infrared_async_rx_stop();
}
extern "C" {
#[doc = "Setup hal for receiving silence timeout.\n\n Should be used with 'furi_hal_infrared_timeout_irq_set_callback()'.\n\n # Arguments\n\n* `timeout_us` (direction in) - time to wait for silence on INFRARED port before\n generating IRQ."]
pub fn furi_hal_infrared_async_rx_set_timeout(timeout_us: u32);
}
extern "C" {
#[doc = "Setup callback for previously initialized INFRARED RX interrupt.\n\n # Arguments\n\n* `callback` (direction in) - callback to call when RX signal edge changing occurs\n * `ctx` (direction in) - context for callback"]
pub fn furi_hal_infrared_async_rx_set_capture_isr_callback(
callback: FuriHalInfraredRxCaptureCallback,
ctx: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Setup callback for reaching silence timeout on INFRARED port.\n\n Should setup hal with 'furi_hal_infrared_setup_rx_timeout_irq()' first.\n\n # Arguments\n\n* `callback` (direction in) - callback for silence timeout\n * `ctx` (direction in) - context to pass to callback"]
pub fn furi_hal_infrared_async_rx_set_timeout_isr_callback(
callback: FuriHalInfraredRxTimeoutCallback,
ctx: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Check if INFRARED is in use now.\n\n # Returns\n\ntrue if INFRARED is busy, false otherwise."]
pub fn furi_hal_infrared_is_busy() -> bool;
}
extern "C" {
#[doc = "Set callback providing new data.\n\n This function has to be called before furi_hal_infrared_async_tx_start().\n\n # Arguments\n\n* `callback` (direction in) - function to provide new data\n * `context` (direction in) - context for callback"]
pub fn furi_hal_infrared_async_tx_set_data_isr_callback(
callback: FuriHalInfraredTxGetDataISRCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start IR asynchronous transmission.\n\n It can be stopped by 2 reasons:\n 1. implicit call for furi_hal_infrared_async_tx_stop()\n 2. callback can provide FuriHalInfraredTxGetDataStateLastDone response which\n means no more data available for transmission.\n\n Any func (furi_hal_infrared_async_tx_stop() or\n furi_hal_infrared_async_tx_wait_termination()) has to be called to wait end of\n transmission and free resources.\n\n # Arguments\n\n* `freq` (direction in) - frequency for PWM\n * `duty_cycle` (direction in) - duty cycle for PWM"]
pub fn furi_hal_infrared_async_tx_start(freq: u32, duty_cycle: f32);
}
extern "C" {
#[doc = "Stop IR asynchronous transmission and free resources.\n\n Transmission will stop as soon as transmission reaches end of package\n (FuriHalInfraredTxGetDataStateDone or FuriHalInfraredTxGetDataStateLastDone)."]
pub fn furi_hal_infrared_async_tx_stop();
}
extern "C" {
#[doc = "Wait for end of IR asynchronous transmission and free resources.\n\n Transmission will stop as soon as transmission reaches end of transmission\n (FuriHalInfraredTxGetDataStateLastDone)."]
pub fn furi_hal_infrared_async_tx_wait_termination();
}
extern "C" {
#[doc = "Set callback for end of signal transmission\n\n # Arguments\n\n* `callback` (direction in) - function to call when signal is sent\n * `context` (direction in) - context for callback"]
pub fn furi_hal_infrared_async_tx_set_signal_sent_isr_callback(
callback: FuriHalInfraredTxSignalSentISRCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Detect which pin has an external IR module connected.\n\n External IR modules are detected by enabling a weak pull-up\n on supported pins and testing whether the input is still low.\n\n This method works best on modules that employ a FET with a\n strong pull-down or a BJT for driving IR LEDs.\n\n The module MUST pull the input voltage down to at least 0.9V\n or lower in order for it to be detected.\n\n If no module has been detected, FuriHalInfraredTxPinInternal is returned.\n\n # Returns\n\nnumeric identifier of the first pin with a module detected."]
pub fn furi_hal_infrared_detect_tx_output() -> FuriHalInfraredTxPin;
}
extern "C" {
#[doc = "Set which pin will be used to transmit infrared signals.\n\n # Arguments\n\n* `tx_pin` (direction in) - pin to be used for signal transmission."]
pub fn furi_hal_infrared_set_tx_output(tx_pin: FuriHalInfraredTxPin);
}
extern "C" {
#[doc = "Send message over INFRARED.\n\n # Arguments\n\n* `message` (direction in) - - message to send.\n * `times` (direction in) - - number of times message should be sent."]
pub fn infrared_send(message: *const InfraredMessage, times: core::ffi::c_int);
}
extern "C" {
#[doc = "Send raw data through infrared port.\n\n # Arguments\n\n* `timings` (direction in) - - array of timings to send.\n * `timings_cnt` (direction in) - - timings array size.\n * `start_from_mark` (direction in) - - true if timings starts from mark,\n otherwise from space"]
pub fn infrared_send_raw(timings: *const u32, timings_cnt: u32, start_from_mark: bool);
}
extern "C" {
#[doc = "Send raw data through infrared port, with additional settings.\n\n # Arguments\n\n* `timings` (direction in) - - array of timings to send.\n * `timings_cnt` (direction in) - - timings array size.\n * `start_from_mark` (direction in) - - true if timings starts from mark,\n otherwise from space\n * `duty_cycle` (direction in) - - duty cycle to generate on PWM\n * `frequency` (direction in) - - frequency to generate on PWM"]
pub fn infrared_send_raw_ext(
timings: *const u32,
timings_cnt: u32,
start_from_mark: bool,
frequency: u32,
duty_cycle: f32,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InfraredWorker {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InfraredWorkerSignal {
_unused: [u8; 0],
}
pub const InfraredWorkerGetSignalResponse_InfraredWorkerGetSignalResponseNew:
InfraredWorkerGetSignalResponse = 0;
#[doc = "Signal, provided by callback is new and encoder should be reseted"]
pub const InfraredWorkerGetSignalResponse_InfraredWorkerGetSignalResponseSame:
InfraredWorkerGetSignalResponse = 1;
#[doc = "Signal, provided by callback is same. No encoder resetting."]
pub const InfraredWorkerGetSignalResponse_InfraredWorkerGetSignalResponseStop:
InfraredWorkerGetSignalResponse = 2;
pub type InfraredWorkerGetSignalResponse = core::ffi::c_uchar;
#[doc = "Callback type for providing next signal to send. Should be used with\n infrared_worker_make_decoded_signal() or infrared_worker_make_raw_signal()"]
pub type InfraredWorkerGetSignalCallback = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
instance: *mut InfraredWorker,
) -> InfraredWorkerGetSignalResponse,
>;
#[doc = "Callback type for 'message is sent' event"]
pub type InfraredWorkerMessageSentCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[doc = "Callback type to call by InfraredWorker thread when new signal is received"]
pub type InfraredWorkerReceivedSignalCallback = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
received_signal: *mut InfraredWorkerSignal,
),
>;
extern "C" {
#[doc = "Allocate InfraredWorker\n\n # Returns\n\njust created instance of InfraredWorker"]
pub fn infrared_worker_alloc() -> *mut InfraredWorker;
}
extern "C" {
#[doc = "Free InfraredWorker\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance"]
pub fn infrared_worker_free(instance: *mut InfraredWorker);
}
extern "C" {
#[doc = "Start InfraredWorker thread, initialise furi_hal, prepare all work.\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance"]
pub fn infrared_worker_rx_start(instance: *mut InfraredWorker);
}
extern "C" {
#[doc = "Stop InfraredWorker thread, deinitialize furi_hal.\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance"]
pub fn infrared_worker_rx_stop(instance: *mut InfraredWorker);
}
extern "C" {
#[doc = "Set received data callback InfraredWorker\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance\n * `context` (direction in) - - context to pass to callbacks\n * `callback` (direction in) - - InfraredWorkerReceivedSignalCallback callback"]
pub fn infrared_worker_rx_set_received_signal_callback(
instance: *mut InfraredWorker,
callback: InfraredWorkerReceivedSignalCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Enable blinking on receiving any signal on IR port.\n\n # Arguments\n\n* `instance` (direction in) - - instance of InfraredWorker\n * `enable` (direction in) - - true if you want to enable blinking\n false otherwise"]
pub fn infrared_worker_rx_enable_blink_on_receiving(
instance: *mut InfraredWorker,
enable: bool,
);
}
extern "C" {
#[doc = "Enable decoding of received infrared signals.\n\n # Arguments\n\n* `instance` (direction in) - - instance of InfraredWorker\n * `enable` (direction in) - - true if you want to enable decoding\n false otherwise"]
pub fn infrared_worker_rx_enable_signal_decoding(instance: *mut InfraredWorker, enable: bool);
}
extern "C" {
#[doc = "Clarify is received signal either decoded or raw\n\n # Arguments\n\n* `signal` (direction in) - - received signal\n # Returns\n\ntrue if signal is decoded, false if signal is raw"]
pub fn infrared_worker_signal_is_decoded(signal: *const InfraredWorkerSignal) -> bool;
}
extern "C" {
#[doc = "Start transmitting signal. Callback InfraredWorkerGetSignalCallback should be\n set before this function is called, as it calls for it to fill buffer before\n starting transmission.\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance"]
pub fn infrared_worker_tx_start(instance: *mut InfraredWorker);
}
extern "C" {
#[doc = "Stop transmitting signal. Waits for end of current signal and stops transmission.\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance"]
pub fn infrared_worker_tx_stop(instance: *mut InfraredWorker);
}
extern "C" {
#[doc = "Set callback for providing next signal to send\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance\n * `context` (direction in) - - context to pass to callbacks\n * `callback` (direction in) - - InfraredWorkerGetSignalCallback callback"]
pub fn infrared_worker_tx_set_get_signal_callback(
instance: *mut InfraredWorker,
callback: InfraredWorkerGetSignalCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Set callback for end of signal transmitting\n\n # Arguments\n\n* `instance` (direction in) - - InfraredWorker instance\n * `context` (direction in) - - context to pass to callbacks\n * `callback` (direction in) - - InfraredWorkerMessageSentCallback callback"]
pub fn infrared_worker_tx_set_signal_sent_callback(
instance: *mut InfraredWorker,
callback: InfraredWorkerMessageSentCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Callback to pass to infrared_worker_tx_set_get_signal_callback() if signal\n is steady and will not be changed between infrared_worker start and stop.\n Before starting transmission, desired steady signal must be set with\n infrared_worker_set_decoded_signal() or infrared_worker_set_raw_signal().\n\n This function should not be called directly.\n\n # Arguments\n\n* `context` (direction in) - - context\n * `instance` (direction out) - - InfraredWorker instance"]
pub fn infrared_worker_tx_get_signal_steady_callback(
context: *mut core::ffi::c_void,
instance: *mut InfraredWorker,
) -> InfraredWorkerGetSignalResponse;
}
extern "C" {
#[doc = "Acquire raw signal from interface struct 'InfraredWorkerSignal'.\n First, you have to ensure that signal is raw.\n\n # Arguments\n\n* `signal` (direction in) - - received signal\n * `timings` (direction out) - - pointer to array of timings\n * `timings_cnt` (direction out) - - pointer to amount of timings"]
pub fn infrared_worker_get_raw_signal(
signal: *const InfraredWorkerSignal,
timings: *mut *const u32,
timings_cnt: *mut usize,
);
}
extern "C" {
#[doc = "Acquire decoded message from interface struct 'InfraredWorkerSignal'.\n First, you have to ensure that signal is decoded.\n\n # Arguments\n\n* `signal` (direction in) - - received signal\n # Returns\n\ndecoded INFRARED message"]
pub fn infrared_worker_get_decoded_signal(
signal: *const InfraredWorkerSignal,
) -> *const InfraredMessage;
}
extern "C" {
#[doc = "Set current decoded signal for InfraredWorker instance\n\n # Arguments\n\n* `instance` (direction out) - - InfraredWorker instance\n * `message` (direction in) - - decoded signal"]
pub fn infrared_worker_set_decoded_signal(
instance: *mut InfraredWorker,
message: *const InfraredMessage,
);
}
extern "C" {
#[doc = "Set current raw signal for InfraredWorker instance\n\n # Arguments\n\n* `instance` (direction out) - - InfraredWorker instance\n * `timings` (direction in) - - array of raw timings\n * `timings_cnt` (direction in) - - size of array of raw timings\n * `frequency` (direction in) - - carrier frequency in Hertz\n * `duty_cycle` (direction in) - - carrier duty cycle (0.0 - 1.0)"]
pub fn infrared_worker_set_raw_signal(
instance: *mut InfraredWorker,
timings: *const u32,
timings_cnt: usize,
frequency: u32,
duty_cycle: f32,
);
}
pub type ProtocolAlloc = ::core::option::Option<unsafe extern "C" fn() -> *mut core::ffi::c_void>;
pub type ProtocolFree =
::core::option::Option<unsafe extern "C" fn(protocol: *mut core::ffi::c_void)>;
pub type ProtocolGetData =
::core::option::Option<unsafe extern "C" fn(protocol: *mut core::ffi::c_void) -> *mut u8>;
pub type ProtocolDecoderStart =
::core::option::Option<unsafe extern "C" fn(protocol: *mut core::ffi::c_void)>;
pub type ProtocolDecoderFeed = ::core::option::Option<
unsafe extern "C" fn(protocol: *mut core::ffi::c_void, level: bool, duration: u32) -> bool,
>;
pub type ProtocolEncoderStart =
::core::option::Option<unsafe extern "C" fn(protocol: *mut core::ffi::c_void) -> bool>;
pub type ProtocolEncoderYield =
::core::option::Option<unsafe extern "C" fn(protocol: *mut core::ffi::c_void) -> LevelDuration>;
pub type ProtocolRenderData = ::core::option::Option<
unsafe extern "C" fn(protocol: *mut core::ffi::c_void, result: *mut FuriString),
>;
pub type ProtocolWriteData = ::core::option::Option<
unsafe extern "C" fn(protocol: *mut core::ffi::c_void, data: *mut core::ffi::c_void) -> bool,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ProtocolDecoder {
pub start: ProtocolDecoderStart,
pub feed: ProtocolDecoderFeed,
}
#[test]
fn bindgen_test_layout_ProtocolDecoder() {
const UNINIT: ::core::mem::MaybeUninit<ProtocolDecoder> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ProtocolDecoder>(),
8usize,
concat!("Size of: ", stringify!(ProtocolDecoder))
);
assert_eq!(
::core::mem::align_of::<ProtocolDecoder>(),
4usize,
concat!("Alignment of ", stringify!(ProtocolDecoder))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ProtocolDecoder),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).feed) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ProtocolDecoder),
"::",
stringify!(feed)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ProtocolEncoder {
pub start: ProtocolEncoderStart,
pub yield_: ProtocolEncoderYield,
}
#[test]
fn bindgen_test_layout_ProtocolEncoder() {
const UNINIT: ::core::mem::MaybeUninit<ProtocolEncoder> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ProtocolEncoder>(),
8usize,
concat!("Size of: ", stringify!(ProtocolEncoder))
);
assert_eq!(
::core::mem::align_of::<ProtocolEncoder>(),
4usize,
concat!("Alignment of ", stringify!(ProtocolEncoder))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ProtocolEncoder),
"::",
stringify!(start)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).yield_) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ProtocolEncoder),
"::",
stringify!(yield_)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ProtocolBase {
pub data_size: usize,
pub name: *const core::ffi::c_char,
pub manufacturer: *const core::ffi::c_char,
pub features: u32,
pub validate_count: u8,
pub alloc: ProtocolAlloc,
pub free: ProtocolFree,
pub get_data: ProtocolGetData,
pub decoder: ProtocolDecoder,
pub encoder: ProtocolEncoder,
pub render_uid: ProtocolRenderData,
pub render_data: ProtocolRenderData,
pub render_brief_data: ProtocolRenderData,
pub write_data: ProtocolWriteData,
}
#[test]
fn bindgen_test_layout_ProtocolBase() {
const UNINIT: ::core::mem::MaybeUninit<ProtocolBase> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ProtocolBase>(),
64usize,
concat!("Size of: ", stringify!(ProtocolBase))
);
assert_eq!(
::core::mem::align_of::<ProtocolBase>(),
4usize,
concat!("Alignment of ", stringify!(ProtocolBase))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_size) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(data_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).manufacturer) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(manufacturer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).features) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(features)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).validate_count) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(validate_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(alloc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).free) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_data) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(get_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).decoder) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(decoder)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).encoder) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(encoder)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).render_uid) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(render_uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).render_data) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(render_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).render_brief_data) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(render_brief_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).write_data) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(ProtocolBase),
"::",
stringify!(write_data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ProtocolDict {
_unused: [u8; 0],
}
pub type ProtocolId = i32;
extern "C" {
pub fn protocol_dict_alloc(
protocols: *mut *const ProtocolBase,
protocol_count: usize,
) -> *mut ProtocolDict;
}
extern "C" {
pub fn protocol_dict_free(dict: *mut ProtocolDict);
}
extern "C" {
pub fn protocol_dict_set_data(
dict: *mut ProtocolDict,
protocol_index: usize,
data: *const u8,
data_size: usize,
);
}
extern "C" {
pub fn protocol_dict_get_data(
dict: *mut ProtocolDict,
protocol_index: usize,
data: *mut u8,
data_size: usize,
);
}
extern "C" {
pub fn protocol_dict_get_data_size(dict: *mut ProtocolDict, protocol_index: usize) -> usize;
}
extern "C" {
pub fn protocol_dict_get_max_data_size(dict: *mut ProtocolDict) -> usize;
}
extern "C" {
pub fn protocol_dict_get_name(
dict: *mut ProtocolDict,
protocol_index: usize,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn protocol_dict_get_manufacturer(
dict: *mut ProtocolDict,
protocol_index: usize,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn protocol_dict_decoders_start(dict: *mut ProtocolDict);
}
extern "C" {
pub fn protocol_dict_get_features(dict: *mut ProtocolDict, protocol_index: usize) -> u32;
}
extern "C" {
pub fn protocol_dict_decoders_feed(
dict: *mut ProtocolDict,
level: bool,
duration: u32,
) -> ProtocolId;
}
extern "C" {
pub fn protocol_dict_decoders_feed_by_feature(
dict: *mut ProtocolDict,
feature: u32,
level: bool,
duration: u32,
) -> ProtocolId;
}
extern "C" {
pub fn protocol_dict_decoders_feed_by_id(
dict: *mut ProtocolDict,
protocol_index: usize,
level: bool,
duration: u32,
) -> ProtocolId;
}
extern "C" {
pub fn protocol_dict_encoder_start(dict: *mut ProtocolDict, protocol_index: usize) -> bool;
}
extern "C" {
pub fn protocol_dict_encoder_yield(
dict: *mut ProtocolDict,
protocol_index: usize,
) -> LevelDuration;
}
extern "C" {
pub fn protocol_dict_render_uid(
dict: *mut ProtocolDict,
result: *mut FuriString,
protocol_index: usize,
);
}
extern "C" {
pub fn protocol_dict_render_data(
dict: *mut ProtocolDict,
result: *mut FuriString,
protocol_index: usize,
);
}
extern "C" {
pub fn protocol_dict_render_brief_data(
dict: *mut ProtocolDict,
result: *mut FuriString,
protocol_index: usize,
);
}
extern "C" {
pub fn protocol_dict_get_validate_count(dict: *mut ProtocolDict, protocol_index: usize) -> u32;
}
extern "C" {
pub fn protocol_dict_get_protocol_by_name(
dict: *mut ProtocolDict,
name: *const core::ffi::c_char,
) -> ProtocolId;
}
extern "C" {
pub fn protocol_dict_get_write_data(
dict: *mut ProtocolDict,
protocol_index: usize,
data: *mut core::ffi::c_void,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LFRFIDT5577 {
pub block: [u32; 8usize],
pub blocks_to_write: u32,
pub mask: u8,
}
#[test]
fn bindgen_test_layout_LFRFIDT5577() {
const UNINIT: ::core::mem::MaybeUninit<LFRFIDT5577> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LFRFIDT5577>(),
40usize,
concat!("Size of: ", stringify!(LFRFIDT5577))
);
assert_eq!(
::core::mem::align_of::<LFRFIDT5577>(),
4usize,
concat!("Alignment of ", stringify!(LFRFIDT5577))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LFRFIDT5577),
"::",
stringify!(block)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks_to_write) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(LFRFIDT5577),
"::",
stringify!(blocks_to_write)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mask) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(LFRFIDT5577),
"::",
stringify!(mask)
)
);
}
extern "C" {
#[doc = "Write T5577 tag data to tag\n\n # Arguments\n\n* `data` -"]
pub fn t5577_write(data: *mut LFRFIDT5577);
}
extern "C" {
pub fn t5577_write_with_pass(data: *mut LFRFIDT5577, password: u32);
}
extern "C" {
pub fn t5577_write_with_mask(data: *mut LFRFIDT5577, page: u8, with_pass: bool, password: u32);
}
pub const LFRFIDProtocol_LFRFIDProtocolEM4100: LFRFIDProtocol = 0;
pub const LFRFIDProtocol_LFRFIDProtocolEM410032: LFRFIDProtocol = 1;
pub const LFRFIDProtocol_LFRFIDProtocolEM410016: LFRFIDProtocol = 2;
pub const LFRFIDProtocol_LFRFIDProtocolElectra: LFRFIDProtocol = 3;
pub const LFRFIDProtocol_LFRFIDProtocolH10301: LFRFIDProtocol = 4;
pub const LFRFIDProtocol_LFRFIDProtocolIdteck: LFRFIDProtocol = 5;
pub const LFRFIDProtocol_LFRFIDProtocolIndala26: LFRFIDProtocol = 6;
pub const LFRFIDProtocol_LFRFIDProtocolIOProxXSF: LFRFIDProtocol = 7;
pub const LFRFIDProtocol_LFRFIDProtocolAwid: LFRFIDProtocol = 8;
pub const LFRFIDProtocol_LFRFIDProtocolFDXA: LFRFIDProtocol = 9;
pub const LFRFIDProtocol_LFRFIDProtocolFDXB: LFRFIDProtocol = 10;
pub const LFRFIDProtocol_LFRFIDProtocolHidGeneric: LFRFIDProtocol = 11;
pub const LFRFIDProtocol_LFRFIDProtocolHidExGeneric: LFRFIDProtocol = 12;
pub const LFRFIDProtocol_LFRFIDProtocolPyramid: LFRFIDProtocol = 13;
pub const LFRFIDProtocol_LFRFIDProtocolViking: LFRFIDProtocol = 14;
pub const LFRFIDProtocol_LFRFIDProtocolJablotron: LFRFIDProtocol = 15;
pub const LFRFIDProtocol_LFRFIDProtocolParadox: LFRFIDProtocol = 16;
pub const LFRFIDProtocol_LFRFIDProtocolPACStanley: LFRFIDProtocol = 17;
pub const LFRFIDProtocol_LFRFIDProtocolKeri: LFRFIDProtocol = 18;
pub const LFRFIDProtocol_LFRFIDProtocolGallagher: LFRFIDProtocol = 19;
pub const LFRFIDProtocol_LFRFIDProtocolNexwatch: LFRFIDProtocol = 20;
pub const LFRFIDProtocol_LFRFIDProtocolSecurakey: LFRFIDProtocol = 21;
pub const LFRFIDProtocol_LFRFIDProtocolGProxII: LFRFIDProtocol = 22;
pub const LFRFIDProtocol_LFRFIDProtocolMax: LFRFIDProtocol = 23;
pub type LFRFIDProtocol = core::ffi::c_uchar;
extern "C" {
pub static mut lfrfid_protocols: [*const ProtocolBase; 0usize];
}
extern "C" {
#[doc = "Save protocol from dictionary to file\n\n # Arguments\n\n* `dict` -\n * `protocol` -\n * `filename` -\n # Returns\n\ntrue\n false"]
pub fn lfrfid_dict_file_save(
dict: *mut ProtocolDict,
protocol: ProtocolId,
filename: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Load protocol from file to dictionary\n\n # Arguments\n\n* `dict` -\n * `filename` -\n # Returns\n\nProtocolId"]
pub fn lfrfid_dict_file_load(
dict: *mut ProtocolDict,
filename: *const core::ffi::c_char,
) -> ProtocolId;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LFRFIDRawFile {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate a new LFRFIDRawFile instance\n\n # Arguments\n\n* `storage` -\n # Returns\n\nLFRFIDRawFile*"]
pub fn lfrfid_raw_file_alloc(storage: *mut Storage) -> *mut LFRFIDRawFile;
}
extern "C" {
#[doc = "Free a LFRFIDRawFile instance\n\n # Arguments\n\n* `file` -"]
pub fn lfrfid_raw_file_free(file: *mut LFRFIDRawFile);
}
extern "C" {
#[doc = "Open RAW file for writing\n\n # Arguments\n\n* `file` -\n * `file_path` -\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_open_write(
file: *mut LFRFIDRawFile,
file_path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Open RAW file for reading\n # Arguments\n\n* `file` -\n * `file_path` -\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_open_read(
file: *mut LFRFIDRawFile,
file_path: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Write RAW file header\n\n # Arguments\n\n* `file` -\n * `frequency` -\n * `duty_cycle` -\n * `max_buffer_size` -\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_write_header(
file: *mut LFRFIDRawFile,
frequency: f32,
duty_cycle: f32,
max_buffer_size: u32,
) -> bool;
}
extern "C" {
#[doc = "Write data to RAW file\n\n # Arguments\n\n* `file` -\n * `buffer_data` -\n * `buffer_size` -\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_write_buffer(
file: *mut LFRFIDRawFile,
buffer_data: *mut u8,
buffer_size: usize,
) -> bool;
}
extern "C" {
#[doc = "Read RAW file header\n\n # Arguments\n\n* `file` -\n * `frequency` -\n * `duty_cycle` -\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_read_header(
file: *mut LFRFIDRawFile,
frequency: *mut f32,
duty_cycle: *mut f32,
) -> bool;
}
extern "C" {
#[doc = "Read varint-encoded pair from RAW file\n\n # Arguments\n\n* `file` -\n * `duration` -\n * `pulse` -\n * `pass_end` - file was wrapped around, can be NULL\n # Returns\n\nbool"]
pub fn lfrfid_raw_file_read_pair(
file: *mut LFRFIDRawFile,
duration: *mut u32,
pulse: *mut u32,
pass_end: *mut bool,
) -> bool;
}
pub const LFRFIDWorkerWriteResult_LFRFIDWorkerWriteOK: LFRFIDWorkerWriteResult = 0;
pub const LFRFIDWorkerWriteResult_LFRFIDWorkerWriteProtocolCannotBeWritten:
LFRFIDWorkerWriteResult = 1;
pub const LFRFIDWorkerWriteResult_LFRFIDWorkerWriteFobCannotBeWritten: LFRFIDWorkerWriteResult = 2;
pub const LFRFIDWorkerWriteResult_LFRFIDWorkerWriteTooLongToWrite: LFRFIDWorkerWriteResult = 3;
pub type LFRFIDWorkerWriteResult = core::ffi::c_uchar;
pub const LFRFIDWorkerReadType_LFRFIDWorkerReadTypeAuto: LFRFIDWorkerReadType = 0;
pub const LFRFIDWorkerReadType_LFRFIDWorkerReadTypeASKOnly: LFRFIDWorkerReadType = 1;
pub const LFRFIDWorkerReadType_LFRFIDWorkerReadTypePSKOnly: LFRFIDWorkerReadType = 2;
pub type LFRFIDWorkerReadType = core::ffi::c_uchar;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadSenseStart: LFRFIDWorkerReadResult = 0;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadSenseEnd: LFRFIDWorkerReadResult = 1;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadSenseCardStart: LFRFIDWorkerReadResult = 2;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadSenseCardEnd: LFRFIDWorkerReadResult = 3;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadStartASK: LFRFIDWorkerReadResult = 4;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadStartPSK: LFRFIDWorkerReadResult = 5;
pub const LFRFIDWorkerReadResult_LFRFIDWorkerReadDone: LFRFIDWorkerReadResult = 6;
pub type LFRFIDWorkerReadResult = core::ffi::c_uchar;
pub const LFRFIDWorkerReadRawResult_LFRFIDWorkerReadRawFileError: LFRFIDWorkerReadRawResult = 0;
pub const LFRFIDWorkerReadRawResult_LFRFIDWorkerReadRawOverrun: LFRFIDWorkerReadRawResult = 1;
pub type LFRFIDWorkerReadRawResult = core::ffi::c_uchar;
pub const LFRFIDWorkerEmulateRawResult_LFRFIDWorkerEmulateRawFileError:
LFRFIDWorkerEmulateRawResult = 0;
pub const LFRFIDWorkerEmulateRawResult_LFRFIDWorkerEmulateRawOverrun: LFRFIDWorkerEmulateRawResult =
1;
pub type LFRFIDWorkerEmulateRawResult = core::ffi::c_uchar;
pub type LFRFIDWorkerReadCallback = ::core::option::Option<
unsafe extern "C" fn(
result: LFRFIDWorkerReadResult,
protocol: ProtocolId,
context: *mut core::ffi::c_void,
),
>;
pub type LFRFIDWorkerWriteCallback = ::core::option::Option<
unsafe extern "C" fn(result: LFRFIDWorkerWriteResult, context: *mut core::ffi::c_void),
>;
pub type LFRFIDWorkerReadRawCallback = ::core::option::Option<
unsafe extern "C" fn(result: LFRFIDWorkerReadRawResult, context: *mut core::ffi::c_void),
>;
pub type LFRFIDWorkerEmulateRawCallback = ::core::option::Option<
unsafe extern "C" fn(result: LFRFIDWorkerEmulateRawResult, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LFRFIDWorker {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate LF-RFID worker\n # Returns\n\nLFRFIDWorker*"]
pub fn lfrfid_worker_alloc(dict: *mut ProtocolDict) -> *mut LFRFIDWorker;
}
extern "C" {
#[doc = "Free LF-RFID worker\n\n # Arguments\n\n* `worker` - The worker"]
pub fn lfrfid_worker_free(worker: *mut LFRFIDWorker);
}
extern "C" {
#[doc = "Start LF-RFID worker thread\n\n # Arguments\n\n* `worker` - The worker"]
pub fn lfrfid_worker_start_thread(worker: *mut LFRFIDWorker);
}
extern "C" {
#[doc = "Stop LF-RFID worker thread\n\n # Arguments\n\n* `worker` - The worker"]
pub fn lfrfid_worker_stop_thread(worker: *mut LFRFIDWorker);
}
extern "C" {
#[doc = "Start read mode\n\n # Arguments\n\n* `worker` - The worker\n * `type` - The type\n * `callback` - The callback\n * `context` - The context"]
pub fn lfrfid_worker_read_start(
worker: *mut LFRFIDWorker,
type_: LFRFIDWorkerReadType,
callback: LFRFIDWorkerReadCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start write mode\n\n # Arguments\n\n* `worker` - The worker\n * `protocol` - The protocol\n * `callback` - The callback\n * `context` - The context"]
pub fn lfrfid_worker_write_start(
worker: *mut LFRFIDWorker,
protocol: LFRFIDProtocol,
callback: LFRFIDWorkerWriteCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start emulate mode\n\n # Arguments\n\n* `worker` - The worker\n * `protocol` (direction in) - The protocol"]
pub fn lfrfid_worker_emulate_start(worker: *mut LFRFIDWorker, protocol: LFRFIDProtocol);
}
extern "C" {
#[doc = "Start raw read mode\n\n # Arguments\n\n* `worker` - The worker\n * `filename` - The filename\n * `type` - The type\n * `callback` - The callback\n * `context` - The context"]
pub fn lfrfid_worker_read_raw_start(
worker: *mut LFRFIDWorker,
filename: *const core::ffi::c_char,
type_: LFRFIDWorkerReadType,
callback: LFRFIDWorkerReadRawCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Emulate raw read mode\n\n # Arguments\n\n* `worker` - The worker\n * `filename` - The filename\n * `callback` - The callback\n * `context` - The context"]
pub fn lfrfid_worker_emulate_raw_start(
worker: *mut LFRFIDWorker,
filename: *const core::ffi::c_char,
callback: LFRFIDWorkerEmulateRawCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop all modes\n\n # Arguments\n\n* `worker` - The worker"]
pub fn lfrfid_worker_stop(worker: *mut LFRFIDWorker);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LFRFIDRawWorker {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate a new LFRFIDRawWorker instance\n\n # Returns\n\nLFRFIDRawWorker*"]
pub fn lfrfid_raw_worker_alloc() -> *mut LFRFIDRawWorker;
}
extern "C" {
#[doc = "Free a LFRFIDRawWorker instance\n\n # Arguments\n\n* `worker` - LFRFIDRawWorker instance"]
pub fn lfrfid_raw_worker_free(worker: *mut LFRFIDRawWorker);
}
extern "C" {
#[doc = "Start reading\n\n # Arguments\n\n* `worker` - LFRFIDRawWorker instance\n * `file_path` - path where file will be saved\n * `frequency` - HW frequency\n * `duty_cycle` - HW duty cycle\n * `callback` - callback for read event\n * `context` - context for callback"]
pub fn lfrfid_raw_worker_start_read(
worker: *mut LFRFIDRawWorker,
file_path: *const core::ffi::c_char,
frequency: f32,
duty_cycle: f32,
callback: LFRFIDWorkerReadRawCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start emulate\n\n # Arguments\n\n* `worker` - LFRFIDRawWorker instance\n * `file_path` - path to file that will be emulated\n * `callback` - callback for emulate event\n * `context` - context for callback"]
pub fn lfrfid_raw_worker_start_emulate(
worker: *mut LFRFIDRawWorker,
file_path: *const core::ffi::c_char,
callback: LFRFIDWorkerEmulateRawCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop worker\n\n # Arguments\n\n* `worker` -"]
pub fn lfrfid_raw_worker_stop(worker: *mut LFRFIDRawWorker);
}
#[doc = "Line Coding Structure"]
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct usb_cdc_line_coding {
#[doc = "<Data terminal rate, in bits per second."]
pub dwDTERate: u32,
#[doc = "<Stop bits."]
pub bCharFormat: u8,
#[doc = "<Parity."]
pub bParityType: u8,
#[doc = "<Data bits (5,6,7,8 or 16)."]
pub bDataBits: u8,
}
#[test]
fn bindgen_test_layout_usb_cdc_line_coding() {
const UNINIT: ::core::mem::MaybeUninit<usb_cdc_line_coding> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<usb_cdc_line_coding>(),
7usize,
concat!("Size of: ", stringify!(usb_cdc_line_coding))
);
assert_eq!(
::core::mem::align_of::<usb_cdc_line_coding>(),
1usize,
concat!("Alignment of ", stringify!(usb_cdc_line_coding))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dwDTERate) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(usb_cdc_line_coding),
"::",
stringify!(dwDTERate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bCharFormat) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(usb_cdc_line_coding),
"::",
stringify!(bCharFormat)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bParityType) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(usb_cdc_line_coding),
"::",
stringify!(bParityType)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bDataBits) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(usb_cdc_line_coding),
"::",
stringify!(bDataBits)
)
);
}
#[doc = "Triple-DES context structure\n\n DES/3DES are considered weak ciphers and their use constitutes a\n security risk. We recommend considering stronger ciphers\n instead."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mbedtls_des3_context {
#[doc = "< 3DES subkeys"]
pub private_sk: [u32; 96usize],
}
#[test]
fn bindgen_test_layout_mbedtls_des3_context() {
const UNINIT: ::core::mem::MaybeUninit<mbedtls_des3_context> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<mbedtls_des3_context>(),
384usize,
concat!("Size of: ", stringify!(mbedtls_des3_context))
);
assert_eq!(
::core::mem::align_of::<mbedtls_des3_context>(),
4usize,
concat!("Alignment of ", stringify!(mbedtls_des3_context))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).private_sk) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(mbedtls_des3_context),
"::",
stringify!(private_sk)
)
);
}
pub type mjs_val_t = u64;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mjs {
_unused: [u8; 0],
}
pub const mjs_err_MJS_OK: mjs_err = 0;
pub const mjs_err_MJS_SYNTAX_ERROR: mjs_err = 1;
pub const mjs_err_MJS_REFERENCE_ERROR: mjs_err = 2;
pub const mjs_err_MJS_TYPE_ERROR: mjs_err = 3;
pub const mjs_err_MJS_OUT_OF_MEMORY: mjs_err = 4;
pub const mjs_err_MJS_INTERNAL_ERROR: mjs_err = 5;
pub const mjs_err_MJS_NOT_IMPLEMENTED_ERROR: mjs_err = 6;
pub const mjs_err_MJS_FILE_READ_ERROR: mjs_err = 7;
pub const mjs_err_MJS_BAD_ARGS_ERROR: mjs_err = 8;
pub const mjs_err_MJS_NEED_EXIT: mjs_err = 9;
pub const mjs_err_MJS_ERRS_CNT: mjs_err = 10;
pub type mjs_err = core::ffi::c_uchar;
pub use self::mjs_err as mjs_err_t;
pub type mjs_flags_poller_t = ::core::option::Option<unsafe extern "C" fn(mjs: *mut mjs)>;
extern "C" {
pub fn mjs_create(context: *mut core::ffi::c_void) -> *mut mjs;
}
extern "C" {
pub fn mjs_destroy(mjs: *mut mjs);
}
extern "C" {
pub fn mjs_get_global(mjs: *mut mjs) -> mjs_val_t;
}
extern "C" {
pub fn mjs_own(mjs: *mut mjs, v: *mut mjs_val_t);
}
extern "C" {
pub fn mjs_disown(mjs: *mut mjs, v: *mut mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_set_errorf(
mjs: *mut mjs,
err: mjs_err_t,
fmt: *const core::ffi::c_char,
...
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_exit(mjs: *mut mjs);
}
extern "C" {
pub fn mjs_set_exec_flags_poller(mjs: *mut mjs, poller: mjs_flags_poller_t);
}
extern "C" {
pub fn mjs_get_context(mjs: *mut mjs) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn mjs_prepend_errorf(
mjs: *mut mjs,
err: mjs_err_t,
fmt: *const core::ffi::c_char,
...
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_strerror(mjs: *mut mjs, err: mjs_err) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mjs_get_stack_trace(mjs: *mut mjs) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mjs_nargs(mjs: *mut mjs) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_arg(mjs: *mut mjs, n: core::ffi::c_int) -> mjs_val_t;
}
extern "C" {
pub fn mjs_return(mjs: *mut mjs, v: mjs_val_t);
}
extern "C" {
pub fn mjs_is_array_buf(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_is_data_view(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_is_typed_array(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_array_buf(
mjs: *mut mjs,
data: *mut core::ffi::c_char,
buf_len: usize,
) -> mjs_val_t;
}
extern "C" {
pub fn mjs_array_buf_get_ptr(
mjs: *mut mjs,
buf: mjs_val_t,
bytelen: *mut usize,
) -> *mut core::ffi::c_char;
}
extern "C" {
pub fn mjs_dataview_get_buf(mjs: *mut mjs, obj: mjs_val_t) -> mjs_val_t;
}
extern "C" {
pub fn mjs_mk_array(mjs: *mut mjs) -> mjs_val_t;
}
extern "C" {
pub fn mjs_array_length(mjs: *mut mjs, arr: mjs_val_t) -> core::ffi::c_ulong;
}
extern "C" {
pub fn mjs_array_push(mjs: *mut mjs, arr: mjs_val_t, v: mjs_val_t) -> mjs_err_t;
}
extern "C" {
pub fn mjs_array_get(arg1: *mut mjs, arr: mjs_val_t, index: core::ffi::c_ulong) -> mjs_val_t;
}
extern "C" {
pub fn mjs_array_set(
mjs: *mut mjs,
arr: mjs_val_t,
index: core::ffi::c_ulong,
v: mjs_val_t,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_is_array(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_array_del(mjs: *mut mjs, arr: mjs_val_t, index: core::ffi::c_ulong);
}
extern "C" {
pub fn mjs_exec(
arg1: *mut mjs,
src: *const core::ffi::c_char,
res: *mut mjs_val_t,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_exec_file(
mjs: *mut mjs,
path: *const core::ffi::c_char,
res: *mut mjs_val_t,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_apply(
mjs: *mut mjs,
res: *mut mjs_val_t,
func: mjs_val_t,
this_val: mjs_val_t,
nargs: core::ffi::c_int,
args: *mut mjs_val_t,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_call(
mjs: *mut mjs,
res: *mut mjs_val_t,
func: mjs_val_t,
this_val: mjs_val_t,
nargs: core::ffi::c_int,
...
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_get_this(mjs: *mut mjs) -> mjs_val_t;
}
pub type mjs_ffi_resolver_t = ::core::option::Option<
unsafe extern "C" fn(
handle: *mut core::ffi::c_void,
symbol: *const core::ffi::c_char,
) -> *mut core::ffi::c_void,
>;
extern "C" {
pub fn mjs_set_ffi_resolver(
mjs: *mut mjs,
dlsym: mjs_ffi_resolver_t,
handle: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn mjs_ffi_resolve(
mjs: *mut mjs,
symbol: *const core::ffi::c_char,
) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn mjs_is_object(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_is_object_based(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_object(mjs: *mut mjs) -> mjs_val_t;
}
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_INVALID: mjs_struct_field_type = 0;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_STRUCT: mjs_struct_field_type = 1;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_STRUCT_PTR: mjs_struct_field_type = 2;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_INT: mjs_struct_field_type = 3;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_BOOL: mjs_struct_field_type = 4;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_DOUBLE: mjs_struct_field_type = 5;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_FLOAT: mjs_struct_field_type = 6;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_CHAR_PTR: mjs_struct_field_type = 7;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_VOID_PTR: mjs_struct_field_type = 8;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_MG_STR_PTR: mjs_struct_field_type = 9;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_MG_STR: mjs_struct_field_type = 10;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_DATA: mjs_struct_field_type = 11;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_INT8: mjs_struct_field_type = 12;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_INT16: mjs_struct_field_type = 13;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_UINT8: mjs_struct_field_type = 14;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_UINT16: mjs_struct_field_type = 15;
pub const mjs_struct_field_type_MJS_STRUCT_FIELD_TYPE_CUSTOM: mjs_struct_field_type = 16;
pub type mjs_struct_field_type = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mjs_c_struct_member {
pub name: *const core::ffi::c_char,
pub offset: core::ffi::c_int,
pub type_: mjs_struct_field_type,
pub arg: *const core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_mjs_c_struct_member() {
const UNINIT: ::core::mem::MaybeUninit<mjs_c_struct_member> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<mjs_c_struct_member>(),
16usize,
concat!("Size of: ", stringify!(mjs_c_struct_member))
);
assert_eq!(
::core::mem::align_of::<mjs_c_struct_member>(),
4usize,
concat!("Alignment of ", stringify!(mjs_c_struct_member))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(mjs_c_struct_member),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).offset) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(mjs_c_struct_member),
"::",
stringify!(offset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(mjs_c_struct_member),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).arg) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(mjs_c_struct_member),
"::",
stringify!(arg)
)
);
}
extern "C" {
pub fn mjs_struct_to_obj(
mjs: *mut mjs,
base: *const core::ffi::c_void,
members: *const mjs_c_struct_member,
) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get(
mjs: *mut mjs,
obj: mjs_val_t,
name: *const core::ffi::c_char,
name_len: usize,
) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get_v(mjs: *mut mjs, obj: mjs_val_t, name: mjs_val_t) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get_v_proto(mjs: *mut mjs, obj: mjs_val_t, key: mjs_val_t) -> mjs_val_t;
}
extern "C" {
pub fn mjs_set(
mjs: *mut mjs,
obj: mjs_val_t,
name: *const core::ffi::c_char,
len: usize,
val: mjs_val_t,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_set_v(mjs: *mut mjs, obj: mjs_val_t, name: mjs_val_t, val: mjs_val_t) -> mjs_err_t;
}
extern "C" {
pub fn mjs_del(
mjs: *mut mjs,
obj: mjs_val_t,
name: *const core::ffi::c_char,
len: usize,
) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_next(mjs: *mut mjs, obj: mjs_val_t, iterator: *mut mjs_val_t) -> mjs_val_t;
}
pub type mjs_func_ptr_t = ::core::option::Option<unsafe extern "C" fn()>;
extern "C" {
pub fn mjs_mk_null() -> mjs_val_t;
}
extern "C" {
pub fn mjs_is_null(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_undefined() -> mjs_val_t;
}
extern "C" {
pub fn mjs_is_undefined(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_number(mjs: *mut mjs, num: f64) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get_double(mjs: *mut mjs, v: mjs_val_t) -> f64;
}
extern "C" {
pub fn mjs_get_int(mjs: *mut mjs, v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_get_int32(mjs: *mut mjs, v: mjs_val_t) -> i32;
}
extern "C" {
pub fn mjs_is_number(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_foreign(mjs: *mut mjs, ptr: *mut core::ffi::c_void) -> mjs_val_t;
}
extern "C" {
pub fn mjs_mk_foreign_func(mjs: *mut mjs, fn_: mjs_func_ptr_t) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get_ptr(mjs: *mut mjs, v: mjs_val_t) -> *mut core::ffi::c_void;
}
extern "C" {
pub fn mjs_is_foreign(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_boolean(mjs: *mut mjs, v: core::ffi::c_int) -> mjs_val_t;
}
extern "C" {
pub fn mjs_get_bool(mjs: *mut mjs, v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_is_boolean(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_function(mjs: *mut mjs, off: usize) -> mjs_val_t;
}
extern "C" {
pub fn mjs_is_function(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_mk_string(
mjs: *mut mjs,
str_: *const core::ffi::c_char,
len: usize,
copy: core::ffi::c_int,
) -> mjs_val_t;
}
extern "C" {
pub fn mjs_is_string(v: mjs_val_t) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_get_string(
mjs: *mut mjs,
v: *mut mjs_val_t,
len: *mut usize,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mjs_get_cstring(mjs: *mut mjs, v: *mut mjs_val_t) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mjs_strcmp(
mjs: *mut mjs,
a: *mut mjs_val_t,
b: *const core::ffi::c_char,
len: usize,
) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_typeof(v: mjs_val_t) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mjs_sprintf(v: mjs_val_t, mjs: *mut mjs, buf: *mut core::ffi::c_char, buflen: usize);
}
extern "C" {
pub fn mjs_get_lineno_by_offset(mjs: *mut mjs, offset: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_get_offset_by_call_frame_num(
mjs: *mut mjs,
cf_num: core::ffi::c_int,
) -> core::ffi::c_int;
}
extern "C" {
pub fn mjs_to_string(
mjs: *mut mjs,
v: *mut mjs_val_t,
p: *mut *mut core::ffi::c_char,
sizep: *mut usize,
need_free: *mut core::ffi::c_int,
) -> mjs_err_t;
}
extern "C" {
pub fn mjs_to_boolean_v(mjs: *mut mjs, v: mjs_val_t) -> mjs_val_t;
}
extern "C" {
pub fn mjs_is_truthy(mjs: *mut mjs, v: mjs_val_t) -> core::ffi::c_int;
}
pub type pb_type_t = uint_least8_t;
pub type pb_size_t = uint_least16_t;
pub type pb_byte_t = uint_least8_t;
pub type pb_istream_t = pb_istream_s;
pub type pb_ostream_t = pb_ostream_s;
pub type pb_field_iter_t = pb_field_iter_s;
pub type pb_msgdesc_t = pb_msgdesc_s;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pb_msgdesc_s {
pub field_info: *const u32,
pub submsg_info: *const *const pb_msgdesc_t,
pub default_value: *const pb_byte_t,
pub field_callback: ::core::option::Option<
unsafe extern "C" fn(
istream: *mut pb_istream_t,
ostream: *mut pb_ostream_t,
field: *const pb_field_iter_t,
) -> bool,
>,
pub field_count: pb_size_t,
pub required_field_count: pb_size_t,
pub largest_tag: pb_size_t,
}
#[test]
fn bindgen_test_layout_pb_msgdesc_s() {
const UNINIT: ::core::mem::MaybeUninit<pb_msgdesc_s> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<pb_msgdesc_s>(),
24usize,
concat!("Size of: ", stringify!(pb_msgdesc_s))
);
assert_eq!(
::core::mem::align_of::<pb_msgdesc_s>(),
4usize,
concat!("Alignment of ", stringify!(pb_msgdesc_s))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).field_info) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(field_info)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).submsg_info) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(submsg_info)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).default_value) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(default_value)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).field_callback) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(field_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).field_count) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(field_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).required_field_count) as usize - ptr as usize },
18usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(required_field_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).largest_tag) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(pb_msgdesc_s),
"::",
stringify!(largest_tag)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pb_field_iter_s {
pub descriptor: *const pb_msgdesc_t,
pub message: *mut core::ffi::c_void,
pub index: pb_size_t,
pub field_info_index: pb_size_t,
pub required_field_index: pb_size_t,
pub submessage_index: pb_size_t,
pub tag: pb_size_t,
pub data_size: pb_size_t,
pub array_size: pb_size_t,
pub type_: pb_type_t,
pub pField: *mut core::ffi::c_void,
pub pData: *mut core::ffi::c_void,
pub pSize: *mut core::ffi::c_void,
pub submsg_desc: *const pb_msgdesc_t,
}
#[test]
fn bindgen_test_layout_pb_field_iter_s() {
const UNINIT: ::core::mem::MaybeUninit<pb_field_iter_s> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<pb_field_iter_s>(),
40usize,
concat!("Size of: ", stringify!(pb_field_iter_s))
);
assert_eq!(
::core::mem::align_of::<pb_field_iter_s>(),
4usize,
concat!("Alignment of ", stringify!(pb_field_iter_s))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).descriptor) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(descriptor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).message) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(message)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).index) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(index)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).field_info_index) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(field_info_index)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).required_field_index) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(required_field_index)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).submessage_index) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(submessage_index)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tag) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(tag)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_size) as usize - ptr as usize },
18usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(data_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).array_size) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(array_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
22usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pField) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(pField)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pData) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(pData)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pSize) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(pSize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).submsg_desc) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(pb_field_iter_s),
"::",
stringify!(submsg_desc)
)
);
}
pub type pb_field_t = pb_field_iter_t;
extern "C" {
pub fn pb_default_field_callback(
istream: *mut pb_istream_t,
ostream: *mut pb_ostream_t,
field: *const pb_field_t,
) -> bool;
}
pub const pb_wire_type_t_PB_WT_VARINT: pb_wire_type_t = 0;
pub const pb_wire_type_t_PB_WT_64BIT: pb_wire_type_t = 1;
pub const pb_wire_type_t_PB_WT_STRING: pb_wire_type_t = 2;
pub const pb_wire_type_t_PB_WT_32BIT: pb_wire_type_t = 5;
pub const pb_wire_type_t_PB_WT_PACKED: pb_wire_type_t = 255;
pub type pb_wire_type_t = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pb_istream_s {
pub callback: ::core::option::Option<
unsafe extern "C" fn(stream: *mut pb_istream_t, buf: *mut pb_byte_t, count: usize) -> bool,
>,
pub state: *mut core::ffi::c_void,
pub bytes_left: usize,
pub errmsg: *const core::ffi::c_char,
}
#[test]
fn bindgen_test_layout_pb_istream_s() {
const UNINIT: ::core::mem::MaybeUninit<pb_istream_s> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<pb_istream_s>(),
16usize,
concat!("Size of: ", stringify!(pb_istream_s))
);
assert_eq!(
::core::mem::align_of::<pb_istream_s>(),
4usize,
concat!("Alignment of ", stringify!(pb_istream_s))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pb_istream_s),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).state) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(pb_istream_s),
"::",
stringify!(state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bytes_left) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pb_istream_s),
"::",
stringify!(bytes_left)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).errmsg) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(pb_istream_s),
"::",
stringify!(errmsg)
)
);
}
extern "C" {
pub fn pb_decode(
stream: *mut pb_istream_t,
fields: *const pb_msgdesc_t,
dest_struct: *mut core::ffi::c_void,
) -> bool;
}
extern "C" {
pub fn pb_decode_ex(
stream: *mut pb_istream_t,
fields: *const pb_msgdesc_t,
dest_struct: *mut core::ffi::c_void,
flags: core::ffi::c_uint,
) -> bool;
}
extern "C" {
pub fn pb_release(fields: *const pb_msgdesc_t, dest_struct: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Functions for manipulating streams *"]
pub fn pb_istream_from_buffer(buf: *const pb_byte_t, msglen: usize) -> pb_istream_t;
}
extern "C" {
pub fn pb_read(stream: *mut pb_istream_t, buf: *mut pb_byte_t, count: usize) -> bool;
}
extern "C" {
#[doc = "Helper functions for writing field callbacks *"]
pub fn pb_decode_tag(
stream: *mut pb_istream_t,
wire_type: *mut pb_wire_type_t,
tag: *mut u32,
eof: *mut bool,
) -> bool;
}
extern "C" {
pub fn pb_skip_field(stream: *mut pb_istream_t, wire_type: pb_wire_type_t) -> bool;
}
extern "C" {
pub fn pb_decode_varint(stream: *mut pb_istream_t, dest: *mut u64) -> bool;
}
extern "C" {
pub fn pb_decode_varint32(stream: *mut pb_istream_t, dest: *mut u32) -> bool;
}
extern "C" {
pub fn pb_decode_bool(stream: *mut pb_istream_t, dest: *mut bool) -> bool;
}
extern "C" {
pub fn pb_decode_svarint(stream: *mut pb_istream_t, dest: *mut i64) -> bool;
}
extern "C" {
pub fn pb_decode_fixed32(stream: *mut pb_istream_t, dest: *mut core::ffi::c_void) -> bool;
}
extern "C" {
pub fn pb_decode_fixed64(stream: *mut pb_istream_t, dest: *mut core::ffi::c_void) -> bool;
}
extern "C" {
pub fn pb_make_string_substream(
stream: *mut pb_istream_t,
substream: *mut pb_istream_t,
) -> bool;
}
extern "C" {
pub fn pb_close_string_substream(
stream: *mut pb_istream_t,
substream: *mut pb_istream_t,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pb_ostream_s {
pub callback: ::core::option::Option<
unsafe extern "C" fn(
stream: *mut pb_ostream_t,
buf: *const pb_byte_t,
count: usize,
) -> bool,
>,
pub state: *mut core::ffi::c_void,
pub max_size: usize,
pub bytes_written: usize,
pub errmsg: *const core::ffi::c_char,
}
#[test]
fn bindgen_test_layout_pb_ostream_s() {
const UNINIT: ::core::mem::MaybeUninit<pb_ostream_s> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<pb_ostream_s>(),
20usize,
concat!("Size of: ", stringify!(pb_ostream_s))
);
assert_eq!(
::core::mem::align_of::<pb_ostream_s>(),
4usize,
concat!("Alignment of ", stringify!(pb_ostream_s))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pb_ostream_s),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).state) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(pb_ostream_s),
"::",
stringify!(state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pb_ostream_s),
"::",
stringify!(max_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bytes_written) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(pb_ostream_s),
"::",
stringify!(bytes_written)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).errmsg) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(pb_ostream_s),
"::",
stringify!(errmsg)
)
);
}
extern "C" {
pub fn pb_encode(
stream: *mut pb_ostream_t,
fields: *const pb_msgdesc_t,
src_struct: *const core::ffi::c_void,
) -> bool;
}
extern "C" {
pub fn pb_encode_ex(
stream: *mut pb_ostream_t,
fields: *const pb_msgdesc_t,
src_struct: *const core::ffi::c_void,
flags: core::ffi::c_uint,
) -> bool;
}
extern "C" {
pub fn pb_get_encoded_size(
size: *mut usize,
fields: *const pb_msgdesc_t,
src_struct: *const core::ffi::c_void,
) -> bool;
}
extern "C" {
#[doc = "Functions for manipulating streams *"]
pub fn pb_ostream_from_buffer(buf: *mut pb_byte_t, bufsize: usize) -> pb_ostream_t;
}
extern "C" {
pub fn pb_write(stream: *mut pb_ostream_t, buf: *const pb_byte_t, count: usize) -> bool;
}
extern "C" {
#[doc = "Helper functions for writing field callbacks *"]
pub fn pb_encode_tag_for_field(
stream: *mut pb_ostream_t,
field: *const pb_field_iter_t,
) -> bool;
}
extern "C" {
pub fn pb_encode_tag(
stream: *mut pb_ostream_t,
wiretype: pb_wire_type_t,
field_number: u32,
) -> bool;
}
extern "C" {
pub fn pb_encode_varint(stream: *mut pb_ostream_t, value: u64) -> bool;
}
extern "C" {
pub fn pb_encode_svarint(stream: *mut pb_ostream_t, value: i64) -> bool;
}
extern "C" {
pub fn pb_encode_string(
stream: *mut pb_ostream_t,
buffer: *const pb_byte_t,
size: usize,
) -> bool;
}
extern "C" {
pub fn pb_encode_fixed32(stream: *mut pb_ostream_t, value: *const core::ffi::c_void) -> bool;
}
extern "C" {
pub fn pb_encode_fixed64(stream: *mut pb_ostream_t, value: *const core::ffi::c_void) -> bool;
}
extern "C" {
pub fn pb_encode_submessage(
stream: *mut pb_ostream_t,
fields: *const pb_msgdesc_t,
src_struct: *const core::ffi::c_void,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BitBuffer {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate a BitBuffer instance.\n\n # Arguments\n\n* `[in]` - capacity_bytes maximum buffer capacity, in bytes\n # Returns\n\npointer to the allocated BitBuffer instance"]
pub fn bit_buffer_alloc(capacity_bytes: usize) -> *mut BitBuffer;
}
extern "C" {
#[doc = "Delete a BitBuffer instance.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance"]
pub fn bit_buffer_free(buf: *mut BitBuffer);
}
extern "C" {
#[doc = "Clear all data from a BitBuffer instance.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance"]
pub fn bit_buffer_reset(buf: *mut BitBuffer);
}
extern "C" {
#[doc = "Copy another BitBuffer instance's contents to this one, replacing\n all of the original data.\n The destination capacity must be no less than the source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - other pointer to a BitBuffer instance to copy from\n > **Note:** "]
pub fn bit_buffer_copy(buf: *mut BitBuffer, other: *const BitBuffer);
}
extern "C" {
#[doc = "Copy all BitBuffer instance's contents to this one, starting from start_index,\n replacing all of the original data.\n The destination capacity must be no less than the source data size\n counting from start_index.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - other pointer to a BitBuffer instance to copy from\n * `[in]` - start_index index to begin copying source data from"]
pub fn bit_buffer_copy_right(buf: *mut BitBuffer, other: *const BitBuffer, start_index: usize);
}
extern "C" {
#[doc = "Copy all BitBuffer instance's contents to this one, ending with end_index,\n replacing all of the original data.\n The destination capacity must be no less than the source data size\n counting to end_index.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - other pointer to a BitBuffer instance to copy from\n * `[in]` - end_index index to end copying source data at"]
pub fn bit_buffer_copy_left(buf: *mut BitBuffer, other: *const BitBuffer, end_index: usize);
}
extern "C" {
#[doc = "Copy a byte array to a BitBuffer instance, replacing all of the original data.\n The destination capacity must be no less than the source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - data pointer to the byte array to be copied\n * `[in]` - size_bytes size of the data to be copied, in bytes"]
pub fn bit_buffer_copy_bytes(buf: *mut BitBuffer, data: *const u8, size_bytes: usize);
}
extern "C" {
#[doc = "Copy a byte array to a BitBuffer instance, replacing all of the original data.\n The destination capacity must be no less than the source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - data pointer to the byte array to be copied\n * `[in]` - size_bits size of the data to be copied, in bits"]
pub fn bit_buffer_copy_bits(buf: *mut BitBuffer, data: *const u8, size_bits: usize);
}
extern "C" {
#[doc = "Copy a byte with parity array to a BitBuffer instance, replacing all of the original data.\n The destination capacity must be no less than the source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to copy into\n * `[in]` - data pointer to the byte array to be copied\n * `[in]` - size_bitss size of the data to be copied, in bits"]
pub fn bit_buffer_copy_bytes_with_parity(
buf: *mut BitBuffer,
data: *const u8,
size_bits: usize,
);
}
extern "C" {
#[doc = "Write a BitBuffer instance's entire contents to an arbitrary memory location.\n The destination memory must be allocated. Additionally, the destination\n capacity must be no less than the source data size.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to write from\n * `[out]` - dest pointer to the destination memory location\n * `[in]` - size_bytes maximum destination data size, in bytes"]
pub fn bit_buffer_write_bytes(
buf: *const BitBuffer,
dest: *mut core::ffi::c_void,
size_bytes: usize,
);
}
extern "C" {
#[doc = "Write a BitBuffer instance's entire contents to an arbitrary memory location.\n Additionally, place a parity bit after each byte.\n The destination memory must be allocated. Additionally, the destination\n capacity must be no less than the source data size plus parity.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to write from\n * `[out]` - dest pointer to the destination memory location\n * `[in]` - size_bytes maximum destination data size, in bytes\n * `[out]` - bits_written actual number of bits writen, in bits"]
pub fn bit_buffer_write_bytes_with_parity(
buf: *const BitBuffer,
dest: *mut core::ffi::c_void,
size_bytes: usize,
bits_written: *mut usize,
);
}
extern "C" {
#[doc = "Write a slice of BitBuffer instance's contents to an arbitrary memory location.\n The destination memory must be allocated. Additionally, the destination\n capacity must be no less than the requested slice size.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to write from\n * `[out]` - dest pointer to the destination memory location\n * `[in]` - start_index index to begin copying source data from\n * `[in]` - size_bytes data slice size, in bytes"]
pub fn bit_buffer_write_bytes_mid(
buf: *const BitBuffer,
dest: *mut core::ffi::c_void,
start_index: usize,
size_bytes: usize,
);
}
extern "C" {
#[doc = "Check whether a BitBuffer instance contains a partial byte (i.e. the bit count\n is not divisible by 8).\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be checked\n # Returns\n\ntrue if the instance contains a partial byte, false otherwise"]
pub fn bit_buffer_has_partial_byte(buf: *const BitBuffer) -> bool;
}
extern "C" {
#[doc = "Check whether a BitBuffer instance's contents start with the designated byte.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be checked\n * `[in]` - byte byte value to be checked against\n # Returns\n\ntrue if data starts with designated byte, false otherwise"]
pub fn bit_buffer_starts_with_byte(buf: *const BitBuffer, byte: u8) -> bool;
}
extern "C" {
#[doc = "Get a BitBuffer instance's capacity (i.e. the maximum possible amount of data), in bytes.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n # Returns\n\ncapacity, in bytes"]
pub fn bit_buffer_get_capacity_bytes(buf: *const BitBuffer) -> usize;
}
extern "C" {
#[doc = "Get a BitBuffer instance's data size (i.e. the amount of stored data), in bits.\n Might be not divisible by 8 (see bit_buffer_is_partial_byte).\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n # Returns\n\ndata size, in bits."]
pub fn bit_buffer_get_size(buf: *const BitBuffer) -> usize;
}
extern "C" {
#[doc = "Get a BitBuffer instance's data size (i.e. the amount of stored data), in bytes.\n If a partial byte is present, it is also counted.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n # Returns\n\ndata size, in bytes."]
pub fn bit_buffer_get_size_bytes(buf: *const BitBuffer) -> usize;
}
extern "C" {
#[doc = "Get a byte value at a specified index in a BitBuffer instance.\n The index must be valid (i.e. less than the instance's data size in bytes).\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n * `[in]` - index index of the byte in question"]
pub fn bit_buffer_get_byte(buf: *const BitBuffer, index: usize) -> u8;
}
extern "C" {
#[doc = "Get a byte value starting from the specified bit index in a BitBuffer instance.\n The resulting byte might correspond to a single byte (if the index is a multiple\n of 8), or two overlapping bytes combined.\n The index must be valid (i.e. less than the instance's data size in bits).\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n * `[in]` - index bit index of the byte in question"]
pub fn bit_buffer_get_byte_from_bit(buf: *const BitBuffer, index_bits: usize) -> u8;
}
extern "C" {
#[doc = "Get the pointer to a BitBuffer instance's underlying data.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n # Returns\n\npointer to the underlying data"]
pub fn bit_buffer_get_data(buf: *const BitBuffer) -> *const u8;
}
extern "C" {
#[doc = "Get the pointer to a BitBuffer instance's underlying data.\n\n # Arguments\n\n* `[in]` - buf pointer to a BitBuffer instance to be queried\n # Returns\n\npointer to the underlying data"]
pub fn bit_buffer_get_parity(buf: *const BitBuffer) -> *const u8;
}
extern "C" {
#[doc = "Set byte value at a specified index in a BitBuffer instance.\n The index must be valid (i.e. less than the instance's data size in bytes).\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be modified\n * `[in]` - index index of the byte in question\n * `[in]` - byte byte value to be set at index"]
pub fn bit_buffer_set_byte(buf: *mut BitBuffer, index: usize, byte: u8);
}
extern "C" {
#[doc = "Set byte and parity bit value at a specified index in a BitBuffer instance.\n The index must be valid (i.e. less than the instance's data size in bytes).\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be modified\n * `[in]` - index index of the byte in question\n * `[in]` - byte byte value to be set at index\n * `[in]` - parity parity bit value to be set at index"]
pub fn bit_buffer_set_byte_with_parity(
buff: *mut BitBuffer,
index: usize,
byte: u8,
parity: bool,
);
}
extern "C" {
#[doc = "Resize a BitBuffer instance to a new size, in bits.\n May cause bugs. Use only if absolutely necessary.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be resized\n * `[in]` - new_size the new size of the buffer, in bits"]
pub fn bit_buffer_set_size(buf: *mut BitBuffer, new_size: usize);
}
extern "C" {
#[doc = "Resize a BitBuffer instance to a new size, in bytes.\n May cause bugs. Use only if absolutely necessary.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be resized\n * `[in]` - new_size_bytes the new size of the buffer, in bytes"]
pub fn bit_buffer_set_size_bytes(buf: *mut BitBuffer, new_size_bytes: usize);
}
extern "C" {
#[doc = "Append all BitBuffer's instance contents to this one. The destination capacity\n must be no less than its original data size plus source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be appended to\n * `[in]` - other pointer to a BitBuffer instance to be appended"]
pub fn bit_buffer_append(buf: *mut BitBuffer, other: *const BitBuffer);
}
extern "C" {
#[doc = "Append a BitBuffer's instance contents to this one, starting from start_index.\n The destination capacity must be no less than the source data size\n counting from start_index.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be appended to\n * `[in]` - other pointer to a BitBuffer instance to be appended\n * `[in]` - start_index index to begin copying source data from"]
pub fn bit_buffer_append_right(
buf: *mut BitBuffer,
other: *const BitBuffer,
start_index: usize,
);
}
extern "C" {
#[doc = "Append a byte to a BitBuffer instance.\n The destination capacity must be no less its original data size plus one.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be appended to\n * `[in]` - byte byte value to be appended"]
pub fn bit_buffer_append_byte(buf: *mut BitBuffer, byte: u8);
}
extern "C" {
#[doc = "Append a byte array to a BitBuffer instance.\n The destination capacity must be no less its original data size plus source data size.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be appended to\n * `[in]` - data pointer to the byte array to be appended\n * `[in]` - size_bytes size of the data to be appended, in bytes"]
pub fn bit_buffer_append_bytes(buf: *mut BitBuffer, data: *const u8, size_bytes: usize);
}
extern "C" {
#[doc = "Append a bit to a BitBuffer instance.\n The destination capacity must be sufficient to accomodate the additional bit.\n\n # Arguments\n\n* `[in,out]` - buf pointer to a BitBuffer instance to be appended to\n * `[in]` - bit bit value to be appended"]
pub fn bit_buffer_append_bit(buf: *mut BitBuffer, bit: bool);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Crypto1 {
pub odd: u32,
pub even: u32,
}
#[test]
fn bindgen_test_layout_Crypto1() {
const UNINIT: ::core::mem::MaybeUninit<Crypto1> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Crypto1>(),
8usize,
concat!("Size of: ", stringify!(Crypto1))
);
assert_eq!(
::core::mem::align_of::<Crypto1>(),
4usize,
concat!("Alignment of ", stringify!(Crypto1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).odd) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Crypto1),
"::",
stringify!(odd)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).even) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(Crypto1),
"::",
stringify!(even)
)
);
}
extern "C" {
pub fn crypto1_alloc() -> *mut Crypto1;
}
extern "C" {
pub fn crypto1_free(instance: *mut Crypto1);
}
extern "C" {
pub fn crypto1_reset(crypto1: *mut Crypto1);
}
extern "C" {
pub fn crypto1_init(crypto1: *mut Crypto1, key: u64);
}
extern "C" {
pub fn crypto1_bit(crypto1: *mut Crypto1, in_: u8, is_encrypted: core::ffi::c_int) -> u8;
}
extern "C" {
pub fn crypto1_byte(crypto1: *mut Crypto1, in_: u8, is_encrypted: core::ffi::c_int) -> u8;
}
extern "C" {
pub fn crypto1_word(crypto1: *mut Crypto1, in_: u32, is_encrypted: core::ffi::c_int) -> u32;
}
extern "C" {
pub fn crypto1_decrypt(crypto: *mut Crypto1, buff: *const BitBuffer, out: *mut BitBuffer);
}
extern "C" {
pub fn crypto1_encrypt(
crypto: *mut Crypto1,
keystream: *mut u8,
buff: *const BitBuffer,
out: *mut BitBuffer,
);
}
extern "C" {
pub fn crypto1_encrypt_reader_nonce(
crypto: *mut Crypto1,
key: u64,
cuid: u32,
nt: *mut u8,
nr: *mut u8,
out: *mut BitBuffer,
is_nested: bool,
);
}
extern "C" {
pub fn prng_successor(x: u32, n: u32) -> u32;
}
pub const Iso13239CrcType_Iso13239CrcTypeDefault: Iso13239CrcType = 0;
pub const Iso13239CrcType_Iso13239CrcTypePicopass: Iso13239CrcType = 1;
pub type Iso13239CrcType = core::ffi::c_uchar;
extern "C" {
pub fn iso13239_crc_append(type_: Iso13239CrcType, buf: *mut BitBuffer);
}
extern "C" {
pub fn iso13239_crc_check(type_: Iso13239CrcType, buf: *const BitBuffer) -> bool;
}
extern "C" {
pub fn iso13239_crc_trim(buf: *mut BitBuffer);
}
pub const Iso14443CrcType_Iso14443CrcTypeA: Iso14443CrcType = 0;
pub const Iso14443CrcType_Iso14443CrcTypeB: Iso14443CrcType = 1;
pub type Iso14443CrcType = core::ffi::c_uchar;
extern "C" {
pub fn iso14443_crc_append(type_: Iso14443CrcType, buf: *mut BitBuffer);
}
extern "C" {
pub fn iso14443_crc_check(type_: Iso14443CrcType, buf: *const BitBuffer) -> bool;
}
extern "C" {
pub fn iso14443_crc_trim(buf: *mut BitBuffer);
}
#[doc = "< Display full(verbose) name."]
pub const NfcDeviceNameType_NfcDeviceNameTypeFull: NfcDeviceNameType = 0;
#[doc = "< Display shortened name."]
pub const NfcDeviceNameType_NfcDeviceNameTypeShort: NfcDeviceNameType = 1;
#[doc = "Verbosity level of the displayed NFC device name."]
pub type NfcDeviceNameType = core::ffi::c_uchar;
#[doc = "Generic opaque type for protocol-specific NFC device data."]
pub type NfcDeviceData = core::ffi::c_void;
pub const NfcProtocol_NfcProtocolIso14443_3a: NfcProtocol = 0;
pub const NfcProtocol_NfcProtocolIso14443_3b: NfcProtocol = 1;
pub const NfcProtocol_NfcProtocolIso14443_4a: NfcProtocol = 2;
pub const NfcProtocol_NfcProtocolIso14443_4b: NfcProtocol = 3;
pub const NfcProtocol_NfcProtocolIso15693_3: NfcProtocol = 4;
pub const NfcProtocol_NfcProtocolFelica: NfcProtocol = 5;
pub const NfcProtocol_NfcProtocolMfUltralight: NfcProtocol = 6;
pub const NfcProtocol_NfcProtocolMfClassic: NfcProtocol = 7;
pub const NfcProtocol_NfcProtocolMfPlus: NfcProtocol = 8;
pub const NfcProtocol_NfcProtocolMfDesfire: NfcProtocol = 9;
pub const NfcProtocol_NfcProtocolSlix: NfcProtocol = 10;
pub const NfcProtocol_NfcProtocolSt25tb: NfcProtocol = 11;
#[doc = "< Special value representing the number of available protocols."]
pub const NfcProtocol_NfcProtocolNum: NfcProtocol = 12;
#[doc = "< Special value representing an invalid state."]
pub const NfcProtocol_NfcProtocolInvalid: NfcProtocol = 13;
#[doc = "Enumeration of all available NFC protocols.\n\n When implementing a new protocol, add its identifier before the\n NfcProtocolNum entry."]
pub type NfcProtocol = core::ffi::c_uchar;
extern "C" {
#[doc = "Get the immediate parent of a specific protocol.\n\n # Arguments\n\n* `protocol` (direction in) - identifier of the protocol in question.\n # Returns\n\nparent protocol identifier if it has one, or NfcProtocolInvalid otherwise."]
pub fn nfc_protocol_get_parent(protocol: NfcProtocol) -> NfcProtocol;
}
extern "C" {
#[doc = "Determine if a specific protocol has a parent on an arbitrary level.\n\n Unlike nfc_protocol_get_parent(), this function will traverse the full protocol hierarchy\n and check each parent node for the matching protocol type.\n\n # Arguments\n\n* `protocol` (direction in) - identifier of the protocol in question.\n * `parent_protocol` (direction in) - identifier of the parent protocol in question.\n # Returns\n\ntrue if the parent of given type exists, false otherwise."]
pub fn nfc_protocol_has_parent(protocol: NfcProtocol, parent_protocol: NfcProtocol) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcDevice {
_unused: [u8; 0],
}
#[doc = "Loading callback function signature.\n\n A function with such signature can be set as a callback to indicate\n the completion (or a failure) of nfc_device_load() and nfc_device_save() functions.\n\n This facility is commonly used to control GUI elements, such as progress dialogs.\n\n # Arguments\n\n* `context` (direction in) - user-defined context that was passed in nfc_device_set_loading_callback().\n * `state` (direction in) - true if the data was loaded successfully, false otherwise."]
pub type NfcLoadingCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, state: bool)>;
extern "C" {
#[doc = "Allocate an NfcDevice instance.\n\n A newly created instance does not hold any data and thus is considered invalid. The most common\n use case would be to set its data by calling nfc_device_set_data() right afterwards.\n\n # Returns\n\npointer to the allocated instance."]
pub fn nfc_device_alloc() -> *mut NfcDevice;
}
extern "C" {
#[doc = "Delete an NfcDevice instance.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be deleted."]
pub fn nfc_device_free(instance: *mut NfcDevice);
}
extern "C" {
#[doc = "Clear an NfcDevice instance.\n\n All data contained in the instance will be deleted and the instance itself will become invalid\n as if it was just allocated.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be cleared."]
pub fn nfc_device_clear(instance: *mut NfcDevice);
}
extern "C" {
#[doc = "Reset an NfcDevice instance.\n\n The data contained in the instance will be reset according to the protocol-defined procedure.\n Unlike the nfc_device_clear() function, the instance will remain valid.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be reset."]
pub fn nfc_device_reset(instance: *mut NfcDevice);
}
extern "C" {
#[doc = "Get the protocol identifier from an NfcDevice instance.\n\n If the instance is invalid, the return value will be NfcProtocolInvalid.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n # Returns\n\nprotocol identifier contained in the instance."]
pub fn nfc_device_get_protocol(instance: *const NfcDevice) -> NfcProtocol;
}
extern "C" {
#[doc = "Get the protocol-specific data from an NfcDevice instance.\n\n The protocol parameter's behaviour is a bit tricky. The function will check\n whether there is such a protocol somewhere in the protocol hierarchy and return\n the data exactly from that level.\n\n Example: Call nfc_device_get_data() on an instance with Mf DESFire protocol.\n The protocol hierarchy will look like the following:\n\n `Mf DESFire --> ISO14443-4A --> ISO14443-3A`\n\n Thus, the following values of the protocol parameter are valid:\n\n * NfcProtocolIso14443_3a\n * NfcProtocolIso14443_4a\n * NfcProtocolMfDesfire\n\n and passing them to the call would result in the respective data being returned.\n\n However, supplying a protocol identifier which is not in the hierarchy will\n result in a crash. This is to improve type safety.\n\n # Arguments\n\n* `instance` - pointer to the instance to be queried\n * `protocol` - protocol identifier of the data to be retrieved.\n # Returns\n\npointer to the instance's data."]
pub fn nfc_device_get_data(
instance: *const NfcDevice,
protocol: NfcProtocol,
) -> *const NfcDeviceData;
}
extern "C" {
#[doc = "Get the protocol name by its identifier.\n\n This function does not require an instance as its return result depends only\n the protocol identifier.\n\n # Arguments\n\n* `protocol` (direction in) - numeric identifier of the protocol in question.\n # Returns\n\npointer to a statically allocated string containing the protocol name."]
pub fn nfc_device_get_protocol_name(protocol: NfcProtocol) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get the name of an NfcDevice instance.\n\n The return value may change depending on the instance's internal state and the name_type parameter.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n * `name_type` (direction in) - type of the name to be displayed.\n # Returns\n\npointer to a statically allocated string containing the device name."]
pub fn nfc_device_get_name(
instance: *const NfcDevice,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Get the unique identifier (UID) of an NfcDevice instance.\n\n The UID length is protocol-dependent. Additionally, a particular protocol might support\n several UID lengths.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n * `uid_len` (direction out) - pointer to the variable to contain the UID length.\n # Returns\n\npointer to the byte array containing the instance's UID."]
pub fn nfc_device_get_uid(instance: *const NfcDevice, uid_len: *mut usize) -> *const u8;
}
extern "C" {
#[doc = "Set the unique identifier (UID) of an NfcDevice instance.\n\n The UID length must be supported by the instance's protocol.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `uid` (direction in) - pointer to the byte array containing the new UID.\n * `uid_len` (direction in) - length of the UID.\n # Returns\n\ntrue if the UID was valid and set, false otherwise."]
pub fn nfc_device_set_uid(instance: *mut NfcDevice, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
#[doc = "Set the data and protocol of an NfcDevice instance.\n\n Any data previously contained in the instance will be deleted.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `protocol` (direction in) - numeric identifier of the data's protocol.\n * `protocol_data` (direction in) - pointer to the protocol-specific data."]
pub fn nfc_device_set_data(
instance: *mut NfcDevice,
protocol: NfcProtocol,
protocol_data: *const NfcDeviceData,
);
}
extern "C" {
#[doc = "Copy (export) the data contained in an NfcDevice instance to an outside NfcDeviceData instance.\n\n This function does the inverse of nfc_device_set_data().\n\n The protocol identifier passed as the protocol parameter MUST match the one\n stored in the instance, otherwise a crash will occur.\n This is to improve type safety.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be copied from.\n * `protocol` (direction in) - numeric identifier of the instance's protocol.\n * `protocol_data` (direction out) - pointer to the destination data."]
pub fn nfc_device_copy_data(
instance: *const NfcDevice,
protocol: NfcProtocol,
protocol_data: *mut NfcDeviceData,
);
}
extern "C" {
#[doc = "Check whether an NfcDevice instance holds certain data.\n\n This function's behaviour is similar to nfc_device_is_equal(), with the difference\n that it takes NfcProtocol and NfcDeviceData* instead of the second NfcDevice*.\n\n The following code snippets [1] and [2] are equivalent:\n\n [1]\n ```c\n bool is_equal = nfc_device_is_equal(device1, device2);\n ```\n [2]\n ```c\n NfcProtocol protocol = nfc_device_get_protocol(device2);\n const NfcDeviceData* data = nfc_device_get_data(device2, protocol);\n bool is_equal = nfc_device_is_equal_data(device1, protocol, data);\n ```\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be compared.\n * `protocol` (direction in) - protocol identifier of the data to be compared.\n * `protocol_data` (direction in) - pointer to the NFC device data to be compared.\n # Returns\n\ntrue if the instance is of the right type and the data matches, false otherwise."]
pub fn nfc_device_is_equal_data(
instance: *const NfcDevice,
protocol: NfcProtocol,
protocol_data: *const NfcDeviceData,
) -> bool;
}
extern "C" {
#[doc = "Compare two NfcDevice instances to determine whether they are equal.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the first instance to be compared.\n * `other` (direction in) - pointer to the second instance to be compared.\n # Returns\n\ntrue if both instances are considered equal, false otherwise."]
pub fn nfc_device_is_equal(instance: *const NfcDevice, other: *const NfcDevice) -> bool;
}
extern "C" {
#[doc = "Set the loading callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `callback` (direction in) - pointer to a function to be called when the load operation completes.\n * `context` (direction in) - pointer to a user-specific context (will be passed to the callback)."]
pub fn nfc_device_set_loading_callback(
instance: *mut NfcDevice,
callback: NfcLoadingCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Save NFC device data form an NfcDevice instance to a file.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be saved.\n * `path` (direction in) - pointer to a character string with a full file path.\n # Returns\n\ntrue if the data was successfully saved, false otherwise."]
pub fn nfc_device_save(instance: *mut NfcDevice, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Load NFC device data to an NfcDevice instance from a file.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be loaded into.\n * `path` (direction in) - pointer to a character string with a full file path.\n # Returns\n\ntrue if the data was successfully loaded, false otherwise."]
pub fn nfc_device_load(instance: *mut NfcDevice, path: *const core::ffi::c_char) -> bool;
}
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfUltralight: NfcDataGeneratorType = 0;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfUltralightEV1_11: NfcDataGeneratorType = 1;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfUltralightEV1_H11: NfcDataGeneratorType = 2;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfUltralightEV1_21: NfcDataGeneratorType = 3;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfUltralightEV1_H21: NfcDataGeneratorType = 4;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAG203: NfcDataGeneratorType = 5;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAG213: NfcDataGeneratorType = 6;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAG215: NfcDataGeneratorType = 7;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAG216: NfcDataGeneratorType = 8;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAGI2C1k: NfcDataGeneratorType = 9;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAGI2C2k: NfcDataGeneratorType = 10;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAGI2CPlus1k: NfcDataGeneratorType = 11;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNTAGI2CPlus2k: NfcDataGeneratorType = 12;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfClassicMini: NfcDataGeneratorType = 13;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfClassic1k_4b: NfcDataGeneratorType = 14;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfClassic1k_7b: NfcDataGeneratorType = 15;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfClassic4k_4b: NfcDataGeneratorType = 16;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeMfClassic4k_7b: NfcDataGeneratorType = 17;
pub const NfcDataGeneratorType_NfcDataGeneratorTypeNum: NfcDataGeneratorType = 18;
pub type NfcDataGeneratorType = core::ffi::c_uchar;
extern "C" {
pub fn nfc_data_generator_get_name(type_: NfcDataGeneratorType) -> *const core::ffi::c_char;
}
extern "C" {
pub fn nfc_data_generator_fill_data(type_: NfcDataGeneratorType, nfc_device: *mut NfcDevice);
}
extern "C" {
pub fn nfc_util_even_parity32(data: u32) -> u8;
}
extern "C" {
pub fn nfc_util_odd_parity8(data: u8) -> u8;
}
extern "C" {
pub fn nfc_util_odd_parity(src: *const u8, dst: *mut u8, len: u8);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Nfc {
_unused: [u8; 0],
}
#[doc = "< User code explicitly aborted the current operation."]
pub const NfcEventType_NfcEventTypeUserAbort: NfcEventType = 0;
#[doc = "< Reader's field was detected by the NFC hardware."]
pub const NfcEventType_NfcEventTypeFieldOn: NfcEventType = 1;
#[doc = "< Reader's field was lost."]
pub const NfcEventType_NfcEventTypeFieldOff: NfcEventType = 2;
#[doc = "< Data transmission has started."]
pub const NfcEventType_NfcEventTypeTxStart: NfcEventType = 3;
#[doc = "< Data transmission has ended."]
pub const NfcEventType_NfcEventTypeTxEnd: NfcEventType = 4;
#[doc = "< Data reception has started."]
pub const NfcEventType_NfcEventTypeRxStart: NfcEventType = 5;
#[doc = "< Data reception has ended."]
pub const NfcEventType_NfcEventTypeRxEnd: NfcEventType = 6;
#[doc = "< The listener has been activated by the reader."]
pub const NfcEventType_NfcEventTypeListenerActivated: NfcEventType = 7;
#[doc = "< The card has been activated by the poller."]
pub const NfcEventType_NfcEventTypePollerReady: NfcEventType = 8;
#[doc = "Enumeration of possible Nfc event types.\n\n Not all technologies implement all events (this is due to hardware limitations)."]
pub type NfcEventType = core::ffi::c_uchar;
#[doc = "Nfc event data structure."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcEventData {
#[doc = "< Pointer to the received data buffer."]
pub buffer: *mut BitBuffer,
}
#[test]
fn bindgen_test_layout_NfcEventData() {
const UNINIT: ::core::mem::MaybeUninit<NfcEventData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcEventData>(),
4usize,
concat!("Size of: ", stringify!(NfcEventData))
);
assert_eq!(
::core::mem::align_of::<NfcEventData>(),
4usize,
concat!("Alignment of ", stringify!(NfcEventData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcEventData),
"::",
stringify!(buffer)
)
);
}
#[doc = "Nfc event structure.\n\n Upon emission of an event, an instance of this struct will be passed to the callback."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcEvent {
#[doc = "< Type of the emitted event."]
pub type_: NfcEventType,
#[doc = "< Event-specific data."]
pub data: NfcEventData,
}
#[test]
fn bindgen_test_layout_NfcEvent() {
const UNINIT: ::core::mem::MaybeUninit<NfcEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcEvent>(),
8usize,
concat!("Size of: ", stringify!(NfcEvent))
);
assert_eq!(
::core::mem::align_of::<NfcEvent>(),
4usize,
concat!("Alignment of ", stringify!(NfcEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NfcEvent),
"::",
stringify!(data)
)
);
}
#[doc = "< Continue operation normally."]
pub const NfcCommand_NfcCommandContinue: NfcCommand = 0;
#[doc = "< Reset the current state."]
pub const NfcCommand_NfcCommandReset: NfcCommand = 1;
#[doc = "< Stop the current operation."]
pub const NfcCommand_NfcCommandStop: NfcCommand = 2;
#[doc = "< Switch Nfc hardware to low-power mode."]
pub const NfcCommand_NfcCommandSleep: NfcCommand = 3;
#[doc = "Enumeration of possible Nfc commands.\n\n The event callback must return one of these to determine the next action."]
pub type NfcCommand = core::ffi::c_uchar;
#[doc = "Nfc event callback type.\n\n A function of this type must be passed as the callback parameter upon start of a an Nfc instance.\n\n # Arguments\n\n* `[in]` - event Nfc event, passed by value, complete with protocol type and data.\n * `[in,out]` - context pointer to the user-specific context (set when starting an Nfc instance).\n # Returns\n\ncommand which the event producer must execute."]
pub type NfcEventCallback = ::core::option::Option<
unsafe extern "C" fn(event: NfcEvent, context: *mut core::ffi::c_void) -> NfcCommand,
>;
#[doc = "< Configure the Nfc instance as a poller."]
pub const NfcMode_NfcModePoller: NfcMode = 0;
#[doc = "< Configure the Nfc instance as a listener."]
pub const NfcMode_NfcModeListener: NfcMode = 1;
#[doc = "< Operating mode count. Internal use."]
pub const NfcMode_NfcModeNum: NfcMode = 2;
#[doc = "Enumeration of possible operating modes.\n\n Not all technologies implement the listener operating mode."]
pub type NfcMode = core::ffi::c_uchar;
#[doc = "< Configure the Nfc instance to use the ISO14443-3A technology."]
pub const NfcTech_NfcTechIso14443a: NfcTech = 0;
#[doc = "< Configure the Nfc instance to use the ISO14443-3B technology."]
pub const NfcTech_NfcTechIso14443b: NfcTech = 1;
#[doc = "< Configure the Nfc instance to use the ISO15693 technology."]
pub const NfcTech_NfcTechIso15693: NfcTech = 2;
#[doc = "< Configure the Nfc instance to use the FeliCa technology."]
pub const NfcTech_NfcTechFelica: NfcTech = 3;
#[doc = "< Technologies count. Internal use."]
pub const NfcTech_NfcTechNum: NfcTech = 4;
#[doc = "Enumeration of available technologies."]
pub type NfcTech = core::ffi::c_uchar;
#[doc = "< No error has occurred."]
pub const NfcError_NfcErrorNone: NfcError = 0;
#[doc = "< An unknown error has occured on the lower level."]
pub const NfcError_NfcErrorInternal: NfcError = 1;
#[doc = "< Operation is taking too long (e.g. card does not respond)."]
pub const NfcError_NfcErrorTimeout: NfcError = 2;
#[doc = "< An incomplete data frame has been received."]
pub const NfcError_NfcErrorIncompleteFrame: NfcError = 3;
#[doc = "< Data has not been parsed due to wrong/unknown format."]
pub const NfcError_NfcErrorDataFormat: NfcError = 4;
#[doc = "Enumeration of possible Nfc error codes."]
pub type NfcError = core::ffi::c_uchar;
extern "C" {
#[doc = "Allocate an Nfc instance.\n\n Will exclusively take over the NFC HAL until deleted.\n\n # Returns\n\npointer to the allocated Nfc instance."]
pub fn nfc_alloc() -> *mut Nfc;
}
extern "C" {
#[doc = "Delete an Nfc instance.\n\n Will release the NFC HAL lock, making it available for use by others.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be deleted."]
pub fn nfc_free(instance: *mut Nfc);
}
extern "C" {
#[doc = "Configure the Nfc instance to work in a particular mode.\n\n Not all technologies implement the listener operating mode.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be configured.\n * `mode` (direction in) - required operating mode.\n * `tech` (direction in) - required technology configuration."]
pub fn nfc_config(instance: *mut Nfc, mode: NfcMode, tech: NfcTech);
}
extern "C" {
#[doc = "Set poller frame delay time.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `fdt_poll_fc` (direction in) - frame delay time, in carrier cycles."]
pub fn nfc_set_fdt_poll_fc(instance: *mut Nfc, fdt_poll_fc: u32);
}
extern "C" {
#[doc = "Set listener frame delay time.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `fdt_listen_fc` (direction in) - frame delay time, in carrier cycles."]
pub fn nfc_set_fdt_listen_fc(instance: *mut Nfc, fdt_listen_fc: u32);
}
extern "C" {
#[doc = "Set mask receive time.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `mask_rx_time_fc` (direction in) - mask receive time, in carrier cycles."]
pub fn nfc_set_mask_receive_time_fc(instance: *mut Nfc, mask_rx_time_fc: u32);
}
extern "C" {
#[doc = "Set frame delay time.\n\n Frame delay time is the minimum time between two consecutive poll frames.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `fdt_poll_poll_us` (direction in) - frame delay time, in microseconds."]
pub fn nfc_set_fdt_poll_poll_us(instance: *mut Nfc, fdt_poll_poll_us: u32);
}
extern "C" {
#[doc = "Set guard time.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be modified.\n * `guard_time_us` (direction in) - guard time, in microseconds."]
pub fn nfc_set_guard_time_us(instance: *mut Nfc, guard_time_us: u32);
}
extern "C" {
#[doc = "Start the Nfc instance.\n\n The instance must be configured to work with a specific technology\n in a specific operating mode with a nfc_config() call before starting.\n\n Once started, the user code will be receiving events through the provided\n callback which must handle them according to the logic required.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be started.\n * `callback` (direction in) - pointer to a user-defined callback function which will receive events.\n * `context` (direction in) - pointer to a user-specific context (will be passed to the callback)."]
pub fn nfc_start(
instance: *mut Nfc,
callback: NfcEventCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop Nfc instance.\n\n The instance can only be stopped if it is running.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be stopped."]
pub fn nfc_stop(instance: *mut Nfc);
}
extern "C" {
#[doc = "Transmit and receive a data frame in poller mode.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n The data being transmitted and received may be either bit- or byte-oriented.\n It shall not contain any technology-specific sequences as start or stop bits\n and/or other special symbols, as this is handled on the underlying HAL level.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_poller_trx(
instance: *mut Nfc,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> NfcError;
}
extern "C" {
#[doc = "Transmit a data frame in listener mode.\n\n Used to transmit a response to the reader request in listener mode.\n\n The data being transmitted may be either bit- or byte-oriented.\n It shall not contain any technology-specific sequences as start or stop bits\n and/or other special symbols, as this is handled on the underlying HAL level.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_listener_tx(instance: *mut Nfc, tx_buffer: *const BitBuffer) -> NfcError;
}
pub const NfcIso14443aShortFrame_NfcIso14443aShortFrameSensReq: NfcIso14443aShortFrame = 0;
pub const NfcIso14443aShortFrame_NfcIso14443aShortFrameAllReqa: NfcIso14443aShortFrame = 1;
#[doc = "Enumeration of possible ISO14443-3A short frame types."]
pub type NfcIso14443aShortFrame = core::ffi::c_uchar;
extern "C" {
#[doc = "Transmit an ISO14443-3A short frame and receive the response in poller mode.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `frame` (direction in) - type of short frame to be sent.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso14443a_poller_trx_short_frame(
instance: *mut Nfc,
frame: NfcIso14443aShortFrame,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> NfcError;
}
extern "C" {
#[doc = "Transmit an ISO14443-3A SDD frame and receive the response in poller mode.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso14443a_poller_trx_sdd_frame(
instance: *mut Nfc,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> NfcError;
}
extern "C" {
#[doc = "Transmit an ISO14443-3A data frame with custom parity bits and receive the response in poller mode.\n\n Same as nfc_poller_trx(), but uses the parity bits provided by the user code\n instead of calculating them automatically.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso14443a_poller_trx_custom_parity(
instance: *mut Nfc,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> NfcError;
}
extern "C" {
#[doc = "Transmit an ISO14443-3A frame with custom parity bits in listener mode.\n\n Same as nfc_listener_tx(), but uses the parity bits provided by the user code\n instead of calculating them automatically.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso14443a_listener_tx_custom_parity(
instance: *mut Nfc,
tx_buffer: *const BitBuffer,
) -> NfcError;
}
extern "C" {
#[doc = "Set ISO14443-3A collision resolution parameters in listener mode.\n\n Configures the NFC hardware for automatic collision resolution.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be configured.\n * `uid` (direction in) - pointer to a byte array containing the UID.\n * `uid_len` (direction in) - UID length in bytes (must be supported by the protocol).\n * `atqa` (direction in) - ATQA byte value.\n * `sak` (direction in) - SAK byte value.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso14443a_listener_set_col_res_data(
instance: *mut Nfc,
uid: *mut u8,
uid_len: u8,
atqa: *mut u8,
sak: u8,
) -> NfcError;
}
extern "C" {
#[doc = "Set FeliCa collision resolution parameters in listener mode.\n\n Configures the NFC hardware for automatic collision resolution.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be configured.\n * `idm` (direction in) - pointer to a byte array containing the IDm.\n * `idm_len` (direction in) - IDm length in bytes.\n * `pmm` (direction in) - pointer to a byte array containing the PMm.\n * `pmm_len` (direction in) - PMm length in bytes.\n * `sys_code` (direction in) - System code from SYS_C block\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_felica_listener_set_sensf_res_data(
instance: *mut Nfc,
idm: *const u8,
idm_len: u8,
pmm: *const u8,
pmm_len: u8,
sys_code: u16,
) -> NfcError;
}
extern "C" {
#[doc = "Send ISO15693 Start of Frame pattern in listener mode\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be configured.\n # Returns\n\nNfcErrorNone on success, any other error code on failure."]
pub fn nfc_iso15693_listener_tx_sof(instance: *mut Nfc) -> NfcError;
}
#[doc = "Generic Nfc instance type.\n\n Must be cast to a concrete type before use.\n Depending on the context, a pointer of this type\n may point to an object of the following types:\n - Nfc type,\n - Concrete poller type,\n - Concrete listener type."]
pub type NfcGenericInstance = core::ffi::c_void;
#[doc = "Generic Nfc event data type.\n\n Must be cast to a concrete type before use.\n Usually, it will be the protocol-specific event type."]
pub type NfcGenericEventData = core::ffi::c_void;
#[doc = "Generic Nfc event type.\n\n A generic Nfc event contains a protocol identifier, can be used to determine\n the remaing fields' type.\n\n If the value of the protocol field is NfcProtocolInvalid, then it means that\n the event was emitted from an Nfc instance, otherwise it originated from\n a concrete poller or listener instance.\n\n The event_data field is protocol-specific and should be cast to the appropriate type before use."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcGenericEvent {
#[doc = "< Protocol identifier of the instance that produced the event."]
pub protocol: NfcProtocol,
#[doc = "< Pointer to the protocol-specific instance that produced the event."]
pub instance: *mut NfcGenericInstance,
#[doc = "< Pointer to the protocol-specific event."]
pub event_data: *mut NfcGenericEventData,
}
#[test]
fn bindgen_test_layout_NfcGenericEvent() {
const UNINIT: ::core::mem::MaybeUninit<NfcGenericEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcGenericEvent>(),
12usize,
concat!("Size of: ", stringify!(NfcGenericEvent))
);
assert_eq!(
::core::mem::align_of::<NfcGenericEvent>(),
4usize,
concat!("Alignment of ", stringify!(NfcGenericEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcGenericEvent),
"::",
stringify!(protocol)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).instance) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NfcGenericEvent),
"::",
stringify!(instance)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).event_data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(NfcGenericEvent),
"::",
stringify!(event_data)
)
);
}
#[doc = "Generic Nfc event callback type.\n\n A function of this type must be passed as the callback parameter upon start\n of a poller, listener or Nfc instance.\n\n # Arguments\n\n* `[in]` - event Nfc generic event, passed by value, complete with protocol type and data.\n * `[in,out]` - context pointer to the user-specific context (set when starting a poller/listener instance).\n # Returns\n\nthe command which the event producer must execute."]
pub type NfcGenericCallback = ::core::option::Option<
unsafe extern "C" fn(event: NfcGenericEvent, context: *mut core::ffi::c_void) -> NfcCommand,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcListener {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate an NfcListener instance.\n\n # Arguments\n\n* `nfc` (direction in) - pointer to an Nfc instance.\n * `protocol` (direction in) - identifier of the protocol to be used.\n * `data` (direction in) - pointer to the data to use during emulation.\n # Returns\n\npointer to an allocated instance.\n\n [`nfc.h`]"]
pub fn nfc_listener_alloc(
nfc: *mut Nfc,
protocol: NfcProtocol,
data: *const NfcDeviceData,
) -> *mut NfcListener;
}
extern "C" {
#[doc = "Delete an NfcListener instance.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be deleted."]
pub fn nfc_listener_free(instance: *mut NfcListener);
}
extern "C" {
#[doc = "Start an NfcListener instance.\n\n The callback logic is protocol-specific, so it cannot be described here in detail.\n However, the callback return value ALWAYS determines what the listener should do next:\n to continue whatever it was doing prior to the callback run or to stop.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be started.\n * `callback` (direction in) - pointer to a user-defined callback function which will receive events.\n * `context` (direction in) - pointer to a user-specific context (will be passed to the callback)."]
pub fn nfc_listener_start(
instance: *mut NfcListener,
callback: NfcGenericCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop an NfcListener instance.\n\n The emulation process can be stopped explicitly (the other way is via the callback return value).\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be stopped."]
pub fn nfc_listener_stop(instance: *mut NfcListener);
}
extern "C" {
#[doc = "Get the protocol identifier an NfcListener instance was created with.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n # Returns\n\nidentifier of the protocol used by the instance."]
pub fn nfc_listener_get_protocol(instance: *const NfcListener) -> NfcProtocol;
}
extern "C" {
#[doc = "Get the data that was that was provided for emulation.\n\n The protocol identifier passed as the protocol parameter MUST match the one\n stored in the instance, otherwise a crash will occur.\n This is to improve type safety.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n * `protocol` (direction in) - assumed protocol identifier of the data to be retrieved.\n # Returns\n\npointer to the NFC device data."]
pub fn nfc_listener_get_data(
instance: *const NfcListener,
protocol: NfcProtocol,
) -> *const NfcDeviceData;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcPoller {
_unused: [u8; 0],
}
#[doc = "Extended generic Nfc event type.\n\n An extended generic Nfc event contains protocol poller and it's parent protocol event data.\n If protocol has no parent, then events are produced by Nfc instance.\n\n The parent_event_data field is protocol-specific and should be cast to the appropriate type before use."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcGenericEventEx {
#[doc = "< Pointer to the protocol poller."]
pub poller: *mut NfcGenericInstance,
#[doc = "< Pointer to the protocol's parent poller event data."]
pub parent_event_data: *mut NfcGenericEventData,
}
#[test]
fn bindgen_test_layout_NfcGenericEventEx() {
const UNINIT: ::core::mem::MaybeUninit<NfcGenericEventEx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcGenericEventEx>(),
8usize,
concat!("Size of: ", stringify!(NfcGenericEventEx))
);
assert_eq!(
::core::mem::align_of::<NfcGenericEventEx>(),
4usize,
concat!("Alignment of ", stringify!(NfcGenericEventEx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).poller) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcGenericEventEx),
"::",
stringify!(poller)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).parent_event_data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NfcGenericEventEx),
"::",
stringify!(parent_event_data)
)
);
}
#[doc = "Extended generic Nfc event callback type.\n\n A function of this type must be passed as the callback parameter upon extended start of a poller.\n\n # Arguments\n\n* `[in]` - event Nfc extended generic event, passed by value, complete with protocol type and data.\n * `[in,out]` - context pointer to the user-specific context (set when starting a poller/listener instance).\n # Returns\n\nthe command which the event producer must execute."]
pub type NfcGenericCallbackEx = ::core::option::Option<
unsafe extern "C" fn(event: NfcGenericEventEx, context: *mut core::ffi::c_void) -> NfcCommand,
>;
extern "C" {
#[doc = "Allocate an NfcPoller instance.\n\n # Arguments\n\n* `nfc` (direction in) - pointer to an Nfc instance.\n * `protocol` (direction in) - identifier of the protocol to be used.\n # Returns\n\npointer to an allocated instance.\n\n [`nfc.h`]"]
pub fn nfc_poller_alloc(nfc: *mut Nfc, protocol: NfcProtocol) -> *mut NfcPoller;
}
extern "C" {
#[doc = "Delete an NfcPoller instance.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be deleted."]
pub fn nfc_poller_free(instance: *mut NfcPoller);
}
extern "C" {
#[doc = "Start an NfcPoller instance.\n\n The callback logic is protocol-specific, so it cannot be described here in detail.\n However, the callback return value ALWAYS determines what the poller should do next:\n to continue whatever it was doing prior to the callback run or to stop.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be started.\n * `callback` (direction in) - pointer to a user-defined callback function which will receive events.\n * `context` (direction in) - pointer to a user-specific context (will be passed to the callback)."]
pub fn nfc_poller_start(
instance: *mut NfcPoller,
callback: NfcGenericCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Start an NfcPoller instance in extended mode.\n\n When nfc poller is started in extended mode, callback will be called with parent protocol events\n and protocol instance. This mode enables to make custom poller state machines.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be started.\n * `callback` (direction in) - pointer to a user-defined callback function which will receive events.\n * `context` (direction in) - pointer to a user-specific context (will be passed to the callback)."]
pub fn nfc_poller_start_ex(
instance: *mut NfcPoller,
callback: NfcGenericCallbackEx,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop an NfcPoller instance.\n\n The reading process can be stopped explicitly (the other way is via the callback return value).\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be stopped."]
pub fn nfc_poller_stop(instance: *mut NfcPoller);
}
extern "C" {
#[doc = "Detect whether there is a card supporting a particular protocol in the vicinity.\n\n The behaviour of this function is protocol-defined, in general, it will do whatever is\n necessary to determine whether a card supporting the current protocol is in the vicinity\n and whether it is functioning normally.\n\n It is used automatically inside NfcScanner, so there is usually no need\n to call it explicitly.\n\n [`nfc_scanner.h`]\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to perform the detection with.\n # Returns\n\ntrue if a supported card was detected, false otherwise."]
pub fn nfc_poller_detect(instance: *mut NfcPoller) -> bool;
}
extern "C" {
#[doc = "Get the protocol identifier an NfcPoller instance was created with.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n # Returns\n\nidentifier of the protocol used by the instance."]
pub fn nfc_poller_get_protocol(instance: *const NfcPoller) -> NfcProtocol;
}
extern "C" {
#[doc = "Get the data that was that was gathered during the reading process.\n\n # Arguments\n\n* `instance` (direction in) - pointer to the instance to be queried.\n # Returns\n\npointer to the NFC device data."]
pub fn nfc_poller_get_data(instance: *const NfcPoller) -> *const NfcDeviceData;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcScanner {
_unused: [u8; 0],
}
#[doc = "< One or more protocols have been detected."]
pub const NfcScannerEventType_NfcScannerEventTypeDetected: NfcScannerEventType = 0;
#[doc = "Event type passed to the user callback."]
pub type NfcScannerEventType = core::ffi::c_uchar;
#[doc = "Event data passed to the user callback."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcScannerEventData {
#[doc = "< Number of detected protocols (one or more)."]
pub protocol_num: usize,
#[doc = "< Pointer to the array of detected protocol identifiers."]
pub protocols: *mut NfcProtocol,
}
#[test]
fn bindgen_test_layout_NfcScannerEventData() {
const UNINIT: ::core::mem::MaybeUninit<NfcScannerEventData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcScannerEventData>(),
8usize,
concat!("Size of: ", stringify!(NfcScannerEventData))
);
assert_eq!(
::core::mem::align_of::<NfcScannerEventData>(),
4usize,
concat!("Alignment of ", stringify!(NfcScannerEventData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol_num) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcScannerEventData),
"::",
stringify!(protocol_num)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocols) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NfcScannerEventData),
"::",
stringify!(protocols)
)
);
}
#[doc = "Event passed to the user callback."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NfcScannerEvent {
#[doc = "< Type of event. Determines how the data must be handled."]
pub type_: NfcScannerEventType,
#[doc = "< Event-specific data. Handled accordingly to the even type."]
pub data: NfcScannerEventData,
}
#[test]
fn bindgen_test_layout_NfcScannerEvent() {
const UNINIT: ::core::mem::MaybeUninit<NfcScannerEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<NfcScannerEvent>(),
12usize,
concat!("Size of: ", stringify!(NfcScannerEvent))
);
assert_eq!(
::core::mem::align_of::<NfcScannerEvent>(),
4usize,
concat!("Alignment of ", stringify!(NfcScannerEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NfcScannerEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(NfcScannerEvent),
"::",
stringify!(data)
)
);
}
#[doc = "User callback function signature.\n\n A function with such signature must be provided by the user upon calling nfc_scanner_start().\n\n # Arguments\n\n* `event` (direction in) - occurred event, complete with type and data.\n * `context` (direction in) - pointer to the context data provided in nfc_scanner_start() call."]
pub type NfcScannerCallback = ::core::option::Option<
unsafe extern "C" fn(event: NfcScannerEvent, context: *mut core::ffi::c_void),
>;
extern "C" {
#[doc = "Allocate an NfcScanner instance.\n\n # Arguments\n\n* `nfc` (direction in) - pointer to an Nfc instance.\n # Returns\n\npointer to the allocated NfcScanner instance.\n\n [`nfc.h`]"]
pub fn nfc_scanner_alloc(nfc: *mut Nfc) -> *mut NfcScanner;
}
extern "C" {
#[doc = "Delete an NfcScanner instance.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be deleted."]
pub fn nfc_scanner_free(instance: *mut NfcScanner);
}
extern "C" {
#[doc = "Start an NfcScanner.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be started.\n * `callback` (direction in) - pointer to the callback function (will be called upon a detection event).\n * `context` (direction in) - pointer to the caller-specific context (will be passed to the callback)."]
pub fn nfc_scanner_start(
instance: *mut NfcScanner,
callback: NfcScannerCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Stop an NfcScanner.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be stopped."]
pub fn nfc_scanner_stop(instance: *mut NfcScanner);
}
pub const FelicaError_FelicaErrorNone: FelicaError = 0;
pub const FelicaError_FelicaErrorNotPresent: FelicaError = 1;
pub const FelicaError_FelicaErrorColResFailed: FelicaError = 2;
pub const FelicaError_FelicaErrorBufferOverflow: FelicaError = 3;
pub const FelicaError_FelicaErrorCommunication: FelicaError = 4;
pub const FelicaError_FelicaErrorFieldOff: FelicaError = 5;
pub const FelicaError_FelicaErrorWrongCrc: FelicaError = 6;
pub const FelicaError_FelicaErrorProtocol: FelicaError = 7;
pub const FelicaError_FelicaErrorTimeout: FelicaError = 8;
#[doc = "Type of possible Felica errors"]
pub type FelicaError = core::ffi::c_uchar;
#[doc = "Separate type for card key block. Used in authentication process"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaCardKey {
pub data: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_FelicaCardKey() {
const UNINIT: ::core::mem::MaybeUninit<FelicaCardKey> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaCardKey>(),
16usize,
concat!("Size of: ", stringify!(FelicaCardKey))
);
assert_eq!(
::core::mem::align_of::<FelicaCardKey>(),
1usize,
concat!("Alignment of ", stringify!(FelicaCardKey))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaCardKey),
"::",
stringify!(data)
)
);
}
#[doc = "Felica ID block"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaIDm {
pub data: [u8; 8usize],
}
#[test]
fn bindgen_test_layout_FelicaIDm() {
const UNINIT: ::core::mem::MaybeUninit<FelicaIDm> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaIDm>(),
8usize,
concat!("Size of: ", stringify!(FelicaIDm))
);
assert_eq!(
::core::mem::align_of::<FelicaIDm>(),
1usize,
concat!("Alignment of ", stringify!(FelicaIDm))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaIDm),
"::",
stringify!(data)
)
);
}
#[doc = "Felica PMm block"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaPMm {
pub data: [u8; 8usize],
}
#[test]
fn bindgen_test_layout_FelicaPMm() {
const UNINIT: ::core::mem::MaybeUninit<FelicaPMm> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaPMm>(),
8usize,
concat!("Size of: ", stringify!(FelicaPMm))
);
assert_eq!(
::core::mem::align_of::<FelicaPMm>(),
1usize,
concat!("Alignment of ", stringify!(FelicaPMm))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaPMm),
"::",
stringify!(data)
)
);
}
#[doc = "Felica block with status flags indicating last operation with it.\n See Felica manual for more details on status codes."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaBlock {
#[doc = "< Status flag 1, equals to 0 when success"]
pub SF1: u8,
#[doc = "< Status flag 2, equals to 0 when success"]
pub SF2: u8,
#[doc = "< Block data"]
pub data: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_FelicaBlock() {
const UNINIT: ::core::mem::MaybeUninit<FelicaBlock> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaBlock>(),
18usize,
concat!("Size of: ", stringify!(FelicaBlock))
);
assert_eq!(
::core::mem::align_of::<FelicaBlock>(),
1usize,
concat!("Alignment of ", stringify!(FelicaBlock))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SF1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaBlock),
"::",
stringify!(SF1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SF2) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(FelicaBlock),
"::",
stringify!(SF2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(FelicaBlock),
"::",
stringify!(data)
)
);
}
#[doc = "Felica filesystem structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaFileSystem {
pub spad: [FelicaBlock; 14usize],
pub reg: FelicaBlock,
pub rc: FelicaBlock,
pub mac: FelicaBlock,
pub id: FelicaBlock,
pub d_id: FelicaBlock,
pub ser_c: FelicaBlock,
pub sys_c: FelicaBlock,
pub ckv: FelicaBlock,
pub ck: FelicaBlock,
pub mc: FelicaBlock,
pub wcnt: FelicaBlock,
pub mac_a: FelicaBlock,
pub state: FelicaBlock,
pub crc_check: FelicaBlock,
}
#[test]
fn bindgen_test_layout_FelicaFileSystem() {
const UNINIT: ::core::mem::MaybeUninit<FelicaFileSystem> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaFileSystem>(),
504usize,
concat!("Size of: ", stringify!(FelicaFileSystem))
);
assert_eq!(
::core::mem::align_of::<FelicaFileSystem>(),
1usize,
concat!("Alignment of ", stringify!(FelicaFileSystem))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).spad) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(spad)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reg) as usize - ptr as usize },
252usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(reg)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rc) as usize - ptr as usize },
270usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(rc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mac) as usize - ptr as usize },
288usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(mac)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
306usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).d_id) as usize - ptr as usize },
324usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(d_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ser_c) as usize - ptr as usize },
342usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(ser_c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sys_c) as usize - ptr as usize },
360usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(sys_c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ckv) as usize - ptr as usize },
378usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(ckv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ck) as usize - ptr as usize },
396usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(ck)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mc) as usize - ptr as usize },
414usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(mc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wcnt) as usize - ptr as usize },
432usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(wcnt)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mac_a) as usize - ptr as usize },
450usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(mac_a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).state) as usize - ptr as usize },
468usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(state)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).crc_check) as usize - ptr as usize },
486usize,
concat!(
"Offset of field: ",
stringify!(FelicaFileSystem),
"::",
stringify!(crc_check)
)
);
}
#[doc = "Union which represents filesystem in junction with plain data dump"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union FelicaFSUnion {
pub fs: FelicaFileSystem,
pub dump: [u8; 504usize],
}
#[test]
fn bindgen_test_layout_FelicaFSUnion() {
const UNINIT: ::core::mem::MaybeUninit<FelicaFSUnion> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaFSUnion>(),
504usize,
concat!("Size of: ", stringify!(FelicaFSUnion))
);
assert_eq!(
::core::mem::align_of::<FelicaFSUnion>(),
1usize,
concat!("Alignment of ", stringify!(FelicaFSUnion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fs) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaFSUnion),
"::",
stringify!(fs)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dump) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaFSUnion),
"::",
stringify!(dump)
)
);
}
#[doc = "Structure used to store Felica data and additional values about reading"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct FelicaData {
pub idm: FelicaIDm,
pub pmm: FelicaPMm,
pub blocks_total: u8,
pub blocks_read: u8,
pub data: FelicaFSUnion,
}
#[test]
fn bindgen_test_layout_FelicaData() {
const UNINIT: ::core::mem::MaybeUninit<FelicaData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<FelicaData>(),
522usize,
concat!("Size of: ", stringify!(FelicaData))
);
assert_eq!(
::core::mem::align_of::<FelicaData>(),
1usize,
concat!("Alignment of ", stringify!(FelicaData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).idm) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(FelicaData),
"::",
stringify!(idm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pmm) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(FelicaData),
"::",
stringify!(pmm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks_total) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(FelicaData),
"::",
stringify!(blocks_total)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks_read) as usize - ptr as usize },
17usize,
concat!(
"Offset of field: ",
stringify!(FelicaData),
"::",
stringify!(blocks_read)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
18usize,
concat!(
"Offset of field: ",
stringify!(FelicaData),
"::",
stringify!(data)
)
);
}
extern "C" {
pub fn felica_alloc() -> *mut FelicaData;
}
extern "C" {
pub fn felica_free(data: *mut FelicaData);
}
extern "C" {
pub fn felica_reset(data: *mut FelicaData);
}
extern "C" {
pub fn felica_copy(data: *mut FelicaData, other: *const FelicaData);
}
extern "C" {
pub fn felica_verify(data: *mut FelicaData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn felica_load(data: *mut FelicaData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn felica_save(data: *const FelicaData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn felica_is_equal(data: *const FelicaData, other: *const FelicaData) -> bool;
}
extern "C" {
pub fn felica_get_device_name(
data: *const FelicaData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn felica_get_uid(data: *const FelicaData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn felica_set_uid(data: *mut FelicaData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn felica_get_base_data(data: *const FelicaData) -> *mut FelicaData;
}
extern "C" {
pub fn felica_calculate_session_key(
ctx: *mut mbedtls_des3_context,
ck: *const u8,
rc: *const u8,
out: *mut u8,
);
}
extern "C" {
pub fn felica_check_mac(
ctx: *mut mbedtls_des3_context,
session_key: *const u8,
rc: *const u8,
blocks: *const u8,
block_count: u8,
data: *mut u8,
) -> bool;
}
extern "C" {
pub fn felica_calculate_mac_read(
ctx: *mut mbedtls_des3_context,
session_key: *const u8,
rc: *const u8,
blocks: *const u8,
block_count: u8,
data: *const u8,
mac: *mut u8,
);
}
extern "C" {
pub fn felica_calculate_mac_write(
ctx: *mut mbedtls_des3_context,
session_key: *const u8,
rc: *const u8,
wcnt: *const u8,
data: *const u8,
mac: *mut u8,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FelicaPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Perform collision resolution procedure.\n\n Must ONLY be used inside the callback function.\n\n Perfoms the collision resolution procedure as defined in FeliCa standars. The data\n field will be filled with Felica data on success.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the Felica data structure to be filled.\n # Returns\n\nFelicaErrorNone on success, an error code on failure."]
pub fn felica_poller_activate(
instance: *mut FelicaPoller,
data: *mut FelicaData,
) -> FelicaError;
}
extern "C" {
pub fn felica_poller_sync_read(
nfc: *mut Nfc,
data: *mut FelicaData,
card_key: *const FelicaCardKey,
) -> FelicaError;
}
pub const Iso14443_3aError_Iso14443_3aErrorNone: Iso14443_3aError = 0;
pub const Iso14443_3aError_Iso14443_3aErrorNotPresent: Iso14443_3aError = 1;
pub const Iso14443_3aError_Iso14443_3aErrorColResFailed: Iso14443_3aError = 2;
pub const Iso14443_3aError_Iso14443_3aErrorBufferOverflow: Iso14443_3aError = 3;
pub const Iso14443_3aError_Iso14443_3aErrorCommunication: Iso14443_3aError = 4;
pub const Iso14443_3aError_Iso14443_3aErrorFieldOff: Iso14443_3aError = 5;
pub const Iso14443_3aError_Iso14443_3aErrorWrongCrc: Iso14443_3aError = 6;
pub const Iso14443_3aError_Iso14443_3aErrorTimeout: Iso14443_3aError = 7;
pub type Iso14443_3aError = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_3aData {
pub uid: [u8; 10usize],
pub uid_len: u8,
pub atqa: [u8; 2usize],
pub sak: u8,
}
#[test]
fn bindgen_test_layout_Iso14443_3aData() {
const UNINIT: ::core::mem::MaybeUninit<Iso14443_3aData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso14443_3aData>(),
14usize,
concat!("Size of: ", stringify!(Iso14443_3aData))
);
assert_eq!(
::core::mem::align_of::<Iso14443_3aData>(),
1usize,
concat!("Alignment of ", stringify!(Iso14443_3aData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_3aData),
"::",
stringify!(uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid_len) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_3aData),
"::",
stringify!(uid_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).atqa) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_3aData),
"::",
stringify!(atqa)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sak) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_3aData),
"::",
stringify!(sak)
)
);
}
extern "C" {
pub fn iso14443_3a_alloc() -> *mut Iso14443_3aData;
}
extern "C" {
pub fn iso14443_3a_free(data: *mut Iso14443_3aData);
}
extern "C" {
pub fn iso14443_3a_reset(data: *mut Iso14443_3aData);
}
extern "C" {
pub fn iso14443_3a_copy(data: *mut Iso14443_3aData, other: *const Iso14443_3aData);
}
extern "C" {
pub fn iso14443_3a_verify(data: *mut Iso14443_3aData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn iso14443_3a_load(
data: *mut Iso14443_3aData,
ff: *mut FlipperFormat,
version: u32,
) -> bool;
}
extern "C" {
pub fn iso14443_3a_save(data: *const Iso14443_3aData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn iso14443_3a_is_equal(
data: *const Iso14443_3aData,
other: *const Iso14443_3aData,
) -> bool;
}
extern "C" {
pub fn iso14443_3a_get_device_name(
data: *const Iso14443_3aData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn iso14443_3a_get_uid(data: *const Iso14443_3aData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn iso14443_3a_set_uid(data: *mut Iso14443_3aData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn iso14443_3a_get_base_data(data: *const Iso14443_3aData) -> *mut Iso14443_3aData;
}
extern "C" {
pub fn iso14443_3a_get_cuid(data: *const Iso14443_3aData) -> u32;
}
extern "C" {
pub fn iso14443_3a_supports_iso14443_4(data: *const Iso14443_3aData) -> bool;
}
extern "C" {
pub fn iso14443_3a_get_sak(data: *const Iso14443_3aData) -> u8;
}
extern "C" {
pub fn iso14443_3a_get_atqa(data: *const Iso14443_3aData, atqa: *mut u8);
}
extern "C" {
pub fn iso14443_3a_set_sak(data: *mut Iso14443_3aData, sak: u8);
}
extern "C" {
pub fn iso14443_3a_set_atqa(data: *mut Iso14443_3aData, atqa: *const u8);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_3aPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nIso14443_3aErrorNone on success, an error code on failure."]
pub fn iso14443_3a_poller_txrx(
instance: *mut Iso14443_3aPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> Iso14443_3aError;
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a standard frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nIso14443_3aErrorNone on success, an error code on failure."]
pub fn iso14443_3a_poller_send_standard_frame(
instance: *mut Iso14443_3aPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> Iso14443_3aError;
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a frames with custom parity bits in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n Custom parity bits must be set in the tx_buffer. The rx_buffer will contain\n the received data with the parity bits.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nIso14443_3aErrorNone on success, an error code on failure."]
pub fn iso14443_3a_poller_txrx_custom_parity(
instance: *mut Iso14443_3aPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> Iso14443_3aError;
}
extern "C" {
#[doc = "Checks presence of Iso14443_3a complient card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nIso14443_3aErrorNone if card is present, an error code otherwise."]
pub fn iso14443_3a_poller_check_presence(instance: *mut Iso14443_3aPoller) -> Iso14443_3aError;
}
extern "C" {
#[doc = "Perform collision resolution procedure.\n\n Must ONLY be used inside the callback function.\n\n Perfoms the collision resolution procedure as defined in Iso14443-3a. The iso14443_3a_data\n field will be filled with Iso14443-3a data on success.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `iso14443_3a_data` (direction out) - pointer to the Iso14443_3a data structure to be filled.\n # Returns\n\nIso14443_3aErrorNone on success, an error code on failure."]
pub fn iso14443_3a_poller_activate(
instance: *mut Iso14443_3aPoller,
iso14443_3a_data: *mut Iso14443_3aData,
) -> Iso14443_3aError;
}
extern "C" {
#[doc = "Send HALT command to the card.\n\n Must ONLY be used inside the callback function.\n\n Halts card and changes internal Iso14443_3aPoller state to Idle.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nIso14443_3aErrorNone on success, an error code on failure."]
pub fn iso14443_3a_poller_halt(instance: *mut Iso14443_3aPoller) -> Iso14443_3aError;
}
extern "C" {
pub fn iso14443_3a_poller_sync_read(
nfc: *mut Nfc,
iso14443_3a_data: *mut Iso14443_3aData,
) -> Iso14443_3aError;
}
pub const Iso14443_3bError_Iso14443_3bErrorNone: Iso14443_3bError = 0;
pub const Iso14443_3bError_Iso14443_3bErrorNotPresent: Iso14443_3bError = 1;
pub const Iso14443_3bError_Iso14443_3bErrorColResFailed: Iso14443_3bError = 2;
pub const Iso14443_3bError_Iso14443_3bErrorBufferOverflow: Iso14443_3bError = 3;
pub const Iso14443_3bError_Iso14443_3bErrorCommunication: Iso14443_3bError = 4;
pub const Iso14443_3bError_Iso14443_3bErrorFieldOff: Iso14443_3bError = 5;
pub const Iso14443_3bError_Iso14443_3bErrorWrongCrc: Iso14443_3bError = 6;
pub const Iso14443_3bError_Iso14443_3bErrorTimeout: Iso14443_3bError = 7;
pub type Iso14443_3bError = core::ffi::c_uchar;
pub const Iso14443_3bBitRate_Iso14443_3bBitRateBoth106Kbit: Iso14443_3bBitRate = 0;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePiccToPcd212Kbit: Iso14443_3bBitRate = 1;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePiccToPcd424Kbit: Iso14443_3bBitRate = 2;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePiccToPcd848Kbit: Iso14443_3bBitRate = 3;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePcdToPicc212Kbit: Iso14443_3bBitRate = 4;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePcdToPicc424Kbit: Iso14443_3bBitRate = 5;
pub const Iso14443_3bBitRate_Iso14443_3bBitRatePcdToPicc848Kbit: Iso14443_3bBitRate = 6;
pub type Iso14443_3bBitRate = core::ffi::c_uchar;
pub const Iso14443_3bFrameOption_Iso14443_3bFrameOptionNad: Iso14443_3bFrameOption = 0;
pub const Iso14443_3bFrameOption_Iso14443_3bFrameOptionCid: Iso14443_3bFrameOption = 1;
pub type Iso14443_3bFrameOption = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_3bData {
_unused: [u8; 0],
}
extern "C" {
pub fn iso14443_3b_alloc() -> *mut Iso14443_3bData;
}
extern "C" {
pub fn iso14443_3b_free(data: *mut Iso14443_3bData);
}
extern "C" {
pub fn iso14443_3b_reset(data: *mut Iso14443_3bData);
}
extern "C" {
pub fn iso14443_3b_copy(data: *mut Iso14443_3bData, other: *const Iso14443_3bData);
}
extern "C" {
pub fn iso14443_3b_verify(data: *mut Iso14443_3bData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn iso14443_3b_load(
data: *mut Iso14443_3bData,
ff: *mut FlipperFormat,
version: u32,
) -> bool;
}
extern "C" {
pub fn iso14443_3b_save(data: *const Iso14443_3bData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn iso14443_3b_is_equal(
data: *const Iso14443_3bData,
other: *const Iso14443_3bData,
) -> bool;
}
extern "C" {
pub fn iso14443_3b_get_device_name(
data: *const Iso14443_3bData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn iso14443_3b_get_uid(data: *const Iso14443_3bData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn iso14443_3b_set_uid(data: *mut Iso14443_3bData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn iso14443_3b_get_base_data(data: *const Iso14443_3bData) -> *mut Iso14443_3bData;
}
extern "C" {
pub fn iso14443_3b_supports_iso14443_4(data: *const Iso14443_3bData) -> bool;
}
extern "C" {
pub fn iso14443_3b_supports_bit_rate(
data: *const Iso14443_3bData,
bit_rate: Iso14443_3bBitRate,
) -> bool;
}
extern "C" {
pub fn iso14443_3b_supports_frame_option(
data: *const Iso14443_3bData,
option: Iso14443_3bFrameOption,
) -> bool;
}
extern "C" {
pub fn iso14443_3b_get_application_data(
data: *const Iso14443_3bData,
data_size: *mut usize,
) -> *const u8;
}
extern "C" {
pub fn iso14443_3b_get_frame_size_max(data: *const Iso14443_3bData) -> u16;
}
extern "C" {
pub fn iso14443_3b_get_fwt_fc_max(data: *const Iso14443_3bData) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_3bPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3b frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nIso14443_3bErrorNone on success, an error code on failure."]
pub fn iso14443_3b_poller_send_frame(
instance: *mut Iso14443_3bPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
) -> Iso14443_3bError;
}
extern "C" {
#[doc = "Perform collision resolution procedure.\n\n Must ONLY be used inside the callback function.\n\n Perfoms the collision resolution procedure as defined in Iso14443-3b. The data\n field will be filled with Iso14443-3b data on success.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the Iso14443_3b data structure to be filled.\n # Returns\n\nIso14443_3bErrorNone on success, an error code on failure."]
pub fn iso14443_3b_poller_activate(
instance: *mut Iso14443_3bPoller,
data: *mut Iso14443_3bData,
) -> Iso14443_3bError;
}
extern "C" {
#[doc = "Send HALT command to the card.\n\n Must ONLY be used inside the callback function.\n\n Halts card and changes internal Iso14443_3bPoller state to Idle.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nIso14443_3bErrorNone on success, an error code on failure."]
pub fn iso14443_3b_poller_halt(instance: *mut Iso14443_3bPoller) -> Iso14443_3bError;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SimpleArray {
_unused: [u8; 0],
}
pub type SimpleArrayData = core::ffi::c_void;
pub type SimpleArrayElement = core::ffi::c_void;
pub type SimpleArrayInit =
::core::option::Option<unsafe extern "C" fn(elem: *mut SimpleArrayElement)>;
pub type SimpleArrayReset =
::core::option::Option<unsafe extern "C" fn(elem: *mut SimpleArrayElement)>;
pub type SimpleArrayCopy = ::core::option::Option<
unsafe extern "C" fn(elem: *mut SimpleArrayElement, other: *const SimpleArrayElement),
>;
#[doc = "Simple Array configuration structure. Defined per type."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SimpleArrayConfig {
#[doc = "< Initialisation (in-place constructor) method."]
pub init: SimpleArrayInit,
#[doc = "< Reset (custom destructor) method."]
pub reset: SimpleArrayReset,
#[doc = "< Copy (custom copy-constructor) method."]
pub copy: SimpleArrayCopy,
pub type_size: usize,
}
#[test]
fn bindgen_test_layout_SimpleArrayConfig() {
const UNINIT: ::core::mem::MaybeUninit<SimpleArrayConfig> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SimpleArrayConfig>(),
16usize,
concat!("Size of: ", stringify!(SimpleArrayConfig))
);
assert_eq!(
::core::mem::align_of::<SimpleArrayConfig>(),
4usize,
concat!("Alignment of ", stringify!(SimpleArrayConfig))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).init) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SimpleArrayConfig),
"::",
stringify!(init)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reset) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SimpleArrayConfig),
"::",
stringify!(reset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).copy) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SimpleArrayConfig),
"::",
stringify!(copy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_size) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SimpleArrayConfig),
"::",
stringify!(type_size)
)
);
}
extern "C" {
#[doc = "Allocate a SimpleArray instance with the given configuration.\n\n # Arguments\n\n* `[in]` - config Pointer to the type-specific configuration\n # Returns\n\nPointer to the allocated SimpleArray instance"]
pub fn simple_array_alloc(config: *const SimpleArrayConfig) -> *mut SimpleArray;
}
extern "C" {
#[doc = "Free a SimpleArray instance and release its contents.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to be freed"]
pub fn simple_array_free(instance: *mut SimpleArray);
}
extern "C" {
#[doc = "Initialise a SimpleArray instance by allocating additional space to contain\n the requested number of elements.\n If init() is specified in the config, then it is called for each element,\n otherwise the data is filled with zeroes.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to be init'd\n * `[in]` - count Number of elements to be allocated and init'd"]
pub fn simple_array_init(instance: *mut SimpleArray, count: u32);
}
extern "C" {
#[doc = "Reset a SimpleArray instance and delete all of its elements.\n If reset() is specified in the config, then it is called for each element,\n otherwise the data is simply free()'d.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to be reset"]
pub fn simple_array_reset(instance: *mut SimpleArray);
}
extern "C" {
#[doc = "Copy (duplicate) another SimpleArray instance to this one.\n If copy() is specified in the config, then it is called for each element,\n otherwise the data is simply memcpy()'d.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to copy to\n * `[in]` - other Pointer to the SimpleArray instance to copy from"]
pub fn simple_array_copy(instance: *mut SimpleArray, other: *const SimpleArray);
}
extern "C" {
#[doc = "Check if another SimpleArray instance is equal (the same object or holds the\n same data) to this one.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to be compared\n * `[in]` - other Pointer to the SimpleArray instance to be compared\n # Returns\n\nTrue if instances are considered equal, false otherwise"]
pub fn simple_array_is_equal(instance: *const SimpleArray, other: *const SimpleArray) -> bool;
}
extern "C" {
#[doc = "Get the count of elements currently contained in a SimpleArray instance.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to query the count from\n # Returns\n\nCount of elements contained in the instance"]
pub fn simple_array_get_count(instance: *const SimpleArray) -> u32;
}
extern "C" {
#[doc = "Get a pointer to an element contained in a SimpleArray instance.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to get an element from\n * `[in]` - index Index of the element in question. MUST be less than total element count\n # Returns\n\nPointer to the element specified by index"]
pub fn simple_array_get(instance: *mut SimpleArray, index: u32) -> *mut SimpleArrayElement;
}
extern "C" {
#[doc = "Get a const pointer to an element contained in a SimpleArray instance.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to get an element from\n * `[in]` - index Index of the element in question. MUST be less than total element count\n # Returns\n\nConst pointer to the element specified by index"]
pub fn simple_array_cget(instance: *const SimpleArray, index: u32)
-> *const SimpleArrayElement;
}
extern "C" {
#[doc = "Get a pointer to the internal data of a SimpleArray instance.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to get the data of\n # Returns\n\nPointer to the instance's internal data"]
pub fn simple_array_get_data(instance: *mut SimpleArray) -> *mut SimpleArrayData;
}
extern "C" {
#[doc = "Get a constant pointer to the internal data of a SimpleArray instance.\n\n # Arguments\n\n* `[in]` - instance Pointer to the SimpleArray instance to get the data of\n # Returns\n\nConstant pointer to the instance's internal data"]
pub fn simple_array_cget_data(instance: *const SimpleArray) -> *const SimpleArrayData;
}
extern "C" {
pub static simple_array_config_uint8_t: SimpleArrayConfig;
}
pub const Iso14443_4aError_Iso14443_4aErrorNone: Iso14443_4aError = 0;
pub const Iso14443_4aError_Iso14443_4aErrorNotPresent: Iso14443_4aError = 1;
pub const Iso14443_4aError_Iso14443_4aErrorProtocol: Iso14443_4aError = 2;
pub const Iso14443_4aError_Iso14443_4aErrorTimeout: Iso14443_4aError = 3;
pub type Iso14443_4aError = core::ffi::c_uchar;
pub const Iso14443_4aBitRate_Iso14443_4aBitRateBoth106Kbit: Iso14443_4aBitRate = 0;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePiccToPcd212Kbit: Iso14443_4aBitRate = 1;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePiccToPcd424Kbit: Iso14443_4aBitRate = 2;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePiccToPcd848Kbit: Iso14443_4aBitRate = 3;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePcdToPicc212Kbit: Iso14443_4aBitRate = 4;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePcdToPicc424Kbit: Iso14443_4aBitRate = 5;
pub const Iso14443_4aBitRate_Iso14443_4aBitRatePcdToPicc848Kbit: Iso14443_4aBitRate = 6;
pub type Iso14443_4aBitRate = core::ffi::c_uchar;
pub const Iso14443_4aFrameOption_Iso14443_4aFrameOptionNad: Iso14443_4aFrameOption = 0;
pub const Iso14443_4aFrameOption_Iso14443_4aFrameOptionCid: Iso14443_4aFrameOption = 1;
pub type Iso14443_4aFrameOption = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_4aAtsData {
pub tl: u8,
pub t0: u8,
pub ta_1: u8,
pub tb_1: u8,
pub tc_1: u8,
pub t1_tk: *mut SimpleArray,
}
#[test]
fn bindgen_test_layout_Iso14443_4aAtsData() {
const UNINIT: ::core::mem::MaybeUninit<Iso14443_4aAtsData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso14443_4aAtsData>(),
12usize,
concat!("Size of: ", stringify!(Iso14443_4aAtsData))
);
assert_eq!(
::core::mem::align_of::<Iso14443_4aAtsData>(),
4usize,
concat!("Alignment of ", stringify!(Iso14443_4aAtsData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tl) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(tl)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).t0) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(t0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ta_1) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(ta_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tb_1) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(tb_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tc_1) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(tc_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).t1_tk) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aAtsData),
"::",
stringify!(t1_tk)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_4aData {
pub iso14443_3a_data: *mut Iso14443_3aData,
pub ats_data: Iso14443_4aAtsData,
}
#[test]
fn bindgen_test_layout_Iso14443_4aData() {
const UNINIT: ::core::mem::MaybeUninit<Iso14443_4aData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso14443_4aData>(),
16usize,
concat!("Size of: ", stringify!(Iso14443_4aData))
);
assert_eq!(
::core::mem::align_of::<Iso14443_4aData>(),
4usize,
concat!("Alignment of ", stringify!(Iso14443_4aData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso14443_3a_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aData),
"::",
stringify!(iso14443_3a_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ats_data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(Iso14443_4aData),
"::",
stringify!(ats_data)
)
);
}
extern "C" {
pub fn iso14443_4a_alloc() -> *mut Iso14443_4aData;
}
extern "C" {
pub fn iso14443_4a_free(data: *mut Iso14443_4aData);
}
extern "C" {
pub fn iso14443_4a_reset(data: *mut Iso14443_4aData);
}
extern "C" {
pub fn iso14443_4a_copy(data: *mut Iso14443_4aData, other: *const Iso14443_4aData);
}
extern "C" {
pub fn iso14443_4a_verify(data: *mut Iso14443_4aData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn iso14443_4a_load(
data: *mut Iso14443_4aData,
ff: *mut FlipperFormat,
version: u32,
) -> bool;
}
extern "C" {
pub fn iso14443_4a_save(data: *const Iso14443_4aData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn iso14443_4a_is_equal(
data: *const Iso14443_4aData,
other: *const Iso14443_4aData,
) -> bool;
}
extern "C" {
pub fn iso14443_4a_get_device_name(
data: *const Iso14443_4aData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn iso14443_4a_get_uid(data: *const Iso14443_4aData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn iso14443_4a_set_uid(data: *mut Iso14443_4aData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn iso14443_4a_get_base_data(data: *const Iso14443_4aData) -> *mut Iso14443_3aData;
}
extern "C" {
pub fn iso14443_4a_get_frame_size_max(data: *const Iso14443_4aData) -> u16;
}
extern "C" {
pub fn iso14443_4a_get_fwt_fc_max(data: *const Iso14443_4aData) -> u32;
}
extern "C" {
pub fn iso14443_4a_get_historical_bytes(
data: *const Iso14443_4aData,
count: *mut u32,
) -> *const u8;
}
extern "C" {
pub fn iso14443_4a_supports_bit_rate(
data: *const Iso14443_4aData,
bit_rate: Iso14443_4aBitRate,
) -> bool;
}
extern "C" {
pub fn iso14443_4a_supports_frame_option(
data: *const Iso14443_4aData,
option: Iso14443_4aFrameOption,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_4aPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive Iso14443_4a blocks in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer. The fwt parameter is calculated during activation procedure.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n # Returns\n\nIso14443_4aErrorNone on success, an error code on failure."]
pub fn iso14443_4a_poller_send_block(
instance: *mut Iso14443_4aPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
) -> Iso14443_4aError;
}
extern "C" {
#[doc = "Send HALT command to the card.\n\n Must ONLY be used inside the callback function.\n\n Halts card and changes internal Iso14443_4aPoller state to Idle.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nIso14443_4aErrorNone on success, an error code on failure."]
pub fn iso14443_4a_poller_halt(instance: *mut Iso14443_4aPoller) -> Iso14443_4aError;
}
extern "C" {
#[doc = "Read Answer To Select (ATS) from the card.\n\n Must ONLY be used inside the callback function.\n\n Send Request Answer To Select (RATS) command to the card and parse the response.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the buffer to be filled with ATS data.\n # Returns\n\nIso14443_4aErrorNone on success, an error code on failure."]
pub fn iso14443_4a_poller_read_ats(
instance: *mut Iso14443_4aPoller,
data: *mut Iso14443_4aAtsData,
) -> Iso14443_4aError;
}
pub const Iso14443_4bError_Iso14443_4bErrorNone: Iso14443_4bError = 0;
pub const Iso14443_4bError_Iso14443_4bErrorNotPresent: Iso14443_4bError = 1;
pub const Iso14443_4bError_Iso14443_4bErrorProtocol: Iso14443_4bError = 2;
pub const Iso14443_4bError_Iso14443_4bErrorTimeout: Iso14443_4bError = 3;
pub type Iso14443_4bError = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_4bData {
_unused: [u8; 0],
}
extern "C" {
pub fn iso14443_4b_alloc() -> *mut Iso14443_4bData;
}
extern "C" {
pub fn iso14443_4b_free(data: *mut Iso14443_4bData);
}
extern "C" {
pub fn iso14443_4b_reset(data: *mut Iso14443_4bData);
}
extern "C" {
pub fn iso14443_4b_copy(data: *mut Iso14443_4bData, other: *const Iso14443_4bData);
}
extern "C" {
pub fn iso14443_4b_verify(data: *mut Iso14443_4bData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn iso14443_4b_load(
data: *mut Iso14443_4bData,
ff: *mut FlipperFormat,
version: u32,
) -> bool;
}
extern "C" {
pub fn iso14443_4b_save(data: *const Iso14443_4bData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn iso14443_4b_is_equal(
data: *const Iso14443_4bData,
other: *const Iso14443_4bData,
) -> bool;
}
extern "C" {
pub fn iso14443_4b_get_device_name(
data: *const Iso14443_4bData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn iso14443_4b_get_uid(data: *const Iso14443_4bData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn iso14443_4b_set_uid(data: *mut Iso14443_4bData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn iso14443_4b_get_base_data(data: *const Iso14443_4bData) -> *mut Iso14443_3bData;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso14443_4bPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive Iso14443_4b blocks in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer. The fwt parameter is calculated during activation procedure.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n # Returns\n\nIso14443_4bErrorNone on success, an error code on failure."]
pub fn iso14443_4b_poller_send_block(
instance: *mut Iso14443_4bPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
) -> Iso14443_4bError;
}
extern "C" {
#[doc = "Send HALT command to the card.\n\n Must ONLY be used inside the callback function.\n\n Halts card and changes internal Iso14443_4aPoller state to Idle.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nIso14443_4bErrorNone on success, an error code on failure."]
pub fn iso14443_4b_poller_halt(instance: *mut Iso14443_4bPoller) -> Iso14443_4bError;
}
pub const MfClassicError_MfClassicErrorNone: MfClassicError = 0;
pub const MfClassicError_MfClassicErrorNotPresent: MfClassicError = 1;
pub const MfClassicError_MfClassicErrorProtocol: MfClassicError = 2;
pub const MfClassicError_MfClassicErrorAuth: MfClassicError = 3;
pub const MfClassicError_MfClassicErrorPartialRead: MfClassicError = 4;
pub const MfClassicError_MfClassicErrorTimeout: MfClassicError = 5;
pub type MfClassicError = core::ffi::c_uchar;
pub const MfClassicType_MfClassicTypeMini: MfClassicType = 0;
pub const MfClassicType_MfClassicType1k: MfClassicType = 1;
pub const MfClassicType_MfClassicType4k: MfClassicType = 2;
pub const MfClassicType_MfClassicTypeNum: MfClassicType = 3;
pub type MfClassicType = core::ffi::c_uchar;
pub const MfClassicAction_MfClassicActionDataRead: MfClassicAction = 0;
pub const MfClassicAction_MfClassicActionDataWrite: MfClassicAction = 1;
pub const MfClassicAction_MfClassicActionDataInc: MfClassicAction = 2;
pub const MfClassicAction_MfClassicActionDataDec: MfClassicAction = 3;
pub const MfClassicAction_MfClassicActionKeyARead: MfClassicAction = 4;
pub const MfClassicAction_MfClassicActionKeyAWrite: MfClassicAction = 5;
pub const MfClassicAction_MfClassicActionKeyBRead: MfClassicAction = 6;
pub const MfClassicAction_MfClassicActionKeyBWrite: MfClassicAction = 7;
pub const MfClassicAction_MfClassicActionACRead: MfClassicAction = 8;
pub const MfClassicAction_MfClassicActionACWrite: MfClassicAction = 9;
pub type MfClassicAction = core::ffi::c_uchar;
pub const MfClassicValueCommand_MfClassicValueCommandIncrement: MfClassicValueCommand = 0;
pub const MfClassicValueCommand_MfClassicValueCommandDecrement: MfClassicValueCommand = 1;
pub const MfClassicValueCommand_MfClassicValueCommandRestore: MfClassicValueCommand = 2;
pub const MfClassicValueCommand_MfClassicValueCommandInvalid: MfClassicValueCommand = 3;
pub type MfClassicValueCommand = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicBlock {
pub data: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_MfClassicBlock() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicBlock> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicBlock>(),
16usize,
concat!("Size of: ", stringify!(MfClassicBlock))
);
assert_eq!(
::core::mem::align_of::<MfClassicBlock>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicBlock))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicBlock),
"::",
stringify!(data)
)
);
}
pub const MfClassicKeyType_MfClassicKeyTypeA: MfClassicKeyType = 0;
pub const MfClassicKeyType_MfClassicKeyTypeB: MfClassicKeyType = 1;
pub type MfClassicKeyType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicKey {
pub data: [u8; 6usize],
}
#[test]
fn bindgen_test_layout_MfClassicKey() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicKey> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicKey>(),
6usize,
concat!("Size of: ", stringify!(MfClassicKey))
);
assert_eq!(
::core::mem::align_of::<MfClassicKey>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicKey))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicKey),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicAccessBits {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfClassicAccessBits() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicAccessBits> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicAccessBits>(),
4usize,
concat!("Size of: ", stringify!(MfClassicAccessBits))
);
assert_eq!(
::core::mem::align_of::<MfClassicAccessBits>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicAccessBits))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAccessBits),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicNt {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfClassicNt() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicNt> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicNt>(),
4usize,
concat!("Size of: ", stringify!(MfClassicNt))
);
assert_eq!(
::core::mem::align_of::<MfClassicNt>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicNt))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicNt),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicAt {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfClassicAt() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicAt> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicAt>(),
4usize,
concat!("Size of: ", stringify!(MfClassicAt))
);
assert_eq!(
::core::mem::align_of::<MfClassicAt>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicAt))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAt),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicNr {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfClassicNr() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicNr> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicNr>(),
4usize,
concat!("Size of: ", stringify!(MfClassicNr))
);
assert_eq!(
::core::mem::align_of::<MfClassicNr>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicNr))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicNr),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicAr {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfClassicAr() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicAr> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicAr>(),
4usize,
concat!("Size of: ", stringify!(MfClassicAr))
);
assert_eq!(
::core::mem::align_of::<MfClassicAr>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicAr))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAr),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicAuthContext {
pub block_num: u8,
pub key: MfClassicKey,
pub key_type: MfClassicKeyType,
pub nt: MfClassicNt,
pub nr: MfClassicNr,
pub ar: MfClassicAr,
pub at: MfClassicAt,
}
#[test]
fn bindgen_test_layout_MfClassicAuthContext() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicAuthContext> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicAuthContext>(),
24usize,
concat!("Size of: ", stringify!(MfClassicAuthContext))
);
assert_eq!(
::core::mem::align_of::<MfClassicAuthContext>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicAuthContext))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_num) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(block_num)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_type) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(key_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).nt) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(nt)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).nr) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(nr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ar) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(ar)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).at) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(MfClassicAuthContext),
"::",
stringify!(at)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union MfClassicSectorTrailer {
pub block: MfClassicBlock,
pub __bindgen_anon_1: MfClassicSectorTrailer__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicSectorTrailer__bindgen_ty_1 {
pub key_a: MfClassicKey,
pub access_bits: MfClassicAccessBits,
pub key_b: MfClassicKey,
}
#[test]
fn bindgen_test_layout_MfClassicSectorTrailer__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicSectorTrailer__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicSectorTrailer__bindgen_ty_1>(),
16usize,
concat!(
"Size of: ",
stringify!(MfClassicSectorTrailer__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<MfClassicSectorTrailer__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(MfClassicSectorTrailer__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicSectorTrailer__bindgen_ty_1),
"::",
stringify!(key_a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).access_bits) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfClassicSectorTrailer__bindgen_ty_1),
"::",
stringify!(access_bits)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_b) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(MfClassicSectorTrailer__bindgen_ty_1),
"::",
stringify!(key_b)
)
);
}
#[test]
fn bindgen_test_layout_MfClassicSectorTrailer() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicSectorTrailer> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicSectorTrailer>(),
16usize,
concat!("Size of: ", stringify!(MfClassicSectorTrailer))
);
assert_eq!(
::core::mem::align_of::<MfClassicSectorTrailer>(),
1usize,
concat!("Alignment of ", stringify!(MfClassicSectorTrailer))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicSectorTrailer),
"::",
stringify!(block)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicDeviceKeys {
pub key_a_mask: u64,
pub key_a: [MfClassicKey; 40usize],
pub key_b_mask: u64,
pub key_b: [MfClassicKey; 40usize],
}
#[test]
fn bindgen_test_layout_MfClassicDeviceKeys() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicDeviceKeys> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicDeviceKeys>(),
496usize,
concat!("Size of: ", stringify!(MfClassicDeviceKeys))
);
assert_eq!(
::core::mem::align_of::<MfClassicDeviceKeys>(),
8usize,
concat!("Alignment of ", stringify!(MfClassicDeviceKeys))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_a_mask) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicDeviceKeys),
"::",
stringify!(key_a_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_a) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfClassicDeviceKeys),
"::",
stringify!(key_a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_b_mask) as usize - ptr as usize },
248usize,
concat!(
"Offset of field: ",
stringify!(MfClassicDeviceKeys),
"::",
stringify!(key_b_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_b) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(MfClassicDeviceKeys),
"::",
stringify!(key_b)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicData {
pub iso14443_3a_data: *mut Iso14443_3aData,
pub type_: MfClassicType,
pub block_read_mask: [u32; 8usize],
pub key_a_mask: u64,
pub key_b_mask: u64,
pub block: [MfClassicBlock; 256usize],
}
#[test]
fn bindgen_test_layout_MfClassicData() {
const UNINIT: ::core::mem::MaybeUninit<MfClassicData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfClassicData>(),
4152usize,
concat!("Size of: ", stringify!(MfClassicData))
);
assert_eq!(
::core::mem::align_of::<MfClassicData>(),
8usize,
concat!("Alignment of ", stringify!(MfClassicData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso14443_3a_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(iso14443_3a_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_read_mask) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(block_read_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_a_mask) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(key_a_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_b_mask) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(key_b_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(MfClassicData),
"::",
stringify!(block)
)
);
}
extern "C" {
pub fn mf_classic_alloc() -> *mut MfClassicData;
}
extern "C" {
pub fn mf_classic_free(data: *mut MfClassicData);
}
extern "C" {
pub fn mf_classic_reset(data: *mut MfClassicData);
}
extern "C" {
pub fn mf_classic_copy(data: *mut MfClassicData, other: *const MfClassicData);
}
extern "C" {
pub fn mf_classic_verify(data: *mut MfClassicData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn mf_classic_load(data: *mut MfClassicData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn mf_classic_save(data: *const MfClassicData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn mf_classic_is_equal(data: *const MfClassicData, other: *const MfClassicData) -> bool;
}
extern "C" {
pub fn mf_classic_get_device_name(
data: *const MfClassicData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mf_classic_get_uid(data: *const MfClassicData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn mf_classic_set_uid(data: *mut MfClassicData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn mf_classic_get_base_data(data: *const MfClassicData) -> *mut Iso14443_3aData;
}
extern "C" {
pub fn mf_classic_get_total_sectors_num(type_: MfClassicType) -> u8;
}
extern "C" {
pub fn mf_classic_get_total_block_num(type_: MfClassicType) -> u16;
}
extern "C" {
pub fn mf_classic_get_first_block_num_of_sector(sector: u8) -> u8;
}
extern "C" {
pub fn mf_classic_get_blocks_num_in_sector(sector: u8) -> u8;
}
extern "C" {
pub fn mf_classic_get_sector_trailer_num_by_sector(sector: u8) -> u8;
}
extern "C" {
pub fn mf_classic_get_sector_trailer_num_by_block(block: u8) -> u8;
}
extern "C" {
pub fn mf_classic_get_sector_trailer_by_sector(
data: *const MfClassicData,
sector_num: u8,
) -> *mut MfClassicSectorTrailer;
}
extern "C" {
pub fn mf_classic_is_sector_trailer(block: u8) -> bool;
}
extern "C" {
pub fn mf_classic_set_sector_trailer_read(
data: *mut MfClassicData,
block_num: u8,
sec_tr: *mut MfClassicSectorTrailer,
);
}
extern "C" {
pub fn mf_classic_get_sector_by_block(block: u8) -> u8;
}
extern "C" {
pub fn mf_classic_block_to_value(
block: *const MfClassicBlock,
value: *mut i32,
addr: *mut u8,
) -> bool;
}
extern "C" {
pub fn mf_classic_value_to_block(value: i32, addr: u8, block: *mut MfClassicBlock);
}
extern "C" {
pub fn mf_classic_is_key_found(
data: *const MfClassicData,
sector_num: u8,
key_type: MfClassicKeyType,
) -> bool;
}
extern "C" {
pub fn mf_classic_set_key_found(
data: *mut MfClassicData,
sector_num: u8,
key_type: MfClassicKeyType,
key: u64,
);
}
extern "C" {
pub fn mf_classic_set_key_not_found(
data: *mut MfClassicData,
sector_num: u8,
key_type: MfClassicKeyType,
);
}
extern "C" {
pub fn mf_classic_is_block_read(data: *const MfClassicData, block_num: u8) -> bool;
}
extern "C" {
pub fn mf_classic_set_block_read(
data: *mut MfClassicData,
block_num: u8,
block_data: *mut MfClassicBlock,
);
}
extern "C" {
pub fn mf_classic_is_sector_read(data: *const MfClassicData, sector_num: u8) -> bool;
}
extern "C" {
pub fn mf_classic_get_read_sectors_and_keys(
data: *const MfClassicData,
sectors_read: *mut u8,
keys_found: *mut u8,
);
}
extern "C" {
pub fn mf_classic_is_card_read(data: *const MfClassicData) -> bool;
}
extern "C" {
pub fn mf_classic_is_value_block(sec_tr: *mut MfClassicSectorTrailer, block_num: u8) -> bool;
}
extern "C" {
pub fn mf_classic_is_allowed_access_data_block(
sec_tr: *mut MfClassicSectorTrailer,
block_num: u8,
key_type: MfClassicKeyType,
action: MfClassicAction,
) -> bool;
}
extern "C" {
pub fn mf_classic_is_allowed_access(
data: *mut MfClassicData,
block_num: u8,
key_type: MfClassicKeyType,
action: MfClassicAction,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfClassicPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Collect tag nonce during authentication.\n\n Must ONLY be used inside the callback function.\n\n Starts authentication procedure and collects tag nonce.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number for authentication.\n * `key_type` (direction in) - key type to be used for authentication.\n * `nt` (direction out) - pointer to the MfClassicNt structure to be filled with nonce data.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_get_nt(
instance: *mut MfClassicPoller,
block_num: u8,
key_type: MfClassicKeyType,
nt: *mut MfClassicNt,
) -> MfClassicError;
}
extern "C" {
#[doc = "Collect tag nonce during nested authentication.\n\n Must ONLY be used inside the callback function.\n\n Starts nested authentication procedure and collects tag nonce.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number for authentication.\n * `key_type` (direction in) - key type to be used for authentication.\n * `nt` (direction out) - pointer to the MfClassicNt structure to be filled with nonce data.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_get_nt_nested(
instance: *mut MfClassicPoller,
block_num: u8,
key_type: MfClassicKeyType,
nt: *mut MfClassicNt,
) -> MfClassicError;
}
extern "C" {
#[doc = "Perform authentication.\n\n Must ONLY be used inside the callback function.\n\n Perform authentication as specified in Mf Classic protocol. Initialize crypto state for futher\n communication with the tag.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number for authentication.\n * `key` (direction in) - key to be used for authentication.\n * `key_type` (direction in) - key type to be used for authentication.\n * `data` (direction out) - pointer to MfClassicAuthContext structure to be filled with authentication data.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_auth(
instance: *mut MfClassicPoller,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: *mut MfClassicAuthContext,
) -> MfClassicError;
}
extern "C" {
#[doc = "Perform nested authentication.\n\n Must ONLY be used inside the callback function.\n\n Perform nested authentication as specified in Mf Classic protocol.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number for authentication.\n * `key` (direction in) - key to be used for authentication.\n * `key_type` (direction in) - key type to be used for authentication.\n * `data` (direction out) - pointer to MfClassicAuthContext structure to be filled with authentication data.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_auth_nested(
instance: *mut MfClassicPoller,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: *mut MfClassicAuthContext,
) -> MfClassicError;
}
extern "C" {
#[doc = "Halt the tag.\n\n Must ONLY be used inside the callback function.\n\n Halt the tag and reset crypto state of the poller.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_halt(instance: *mut MfClassicPoller) -> MfClassicError;
}
extern "C" {
#[doc = "Read block from tag.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number to be read.\n * `data` (direction out) - pointer to the MfClassicBlock structure to be filled with block data.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_read_block(
instance: *mut MfClassicPoller,
block_num: u8,
data: *mut MfClassicBlock,
) -> MfClassicError;
}
extern "C" {
#[doc = "Write block to tag.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number to be written.\n * `data` (direction in) - pointer to the MfClassicBlock structure to be written.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_write_block(
instance: *mut MfClassicPoller,
block_num: u8,
data: *mut MfClassicBlock,
) -> MfClassicError;
}
extern "C" {
#[doc = "Perform value command on tag.\n\n Must ONLY be used inside the callback function.\n\n Perform Increment, Decrement or Restore command on tag. The result is stored in internal transfer\n block of the tag. Use mf_classic_poller_value_transfer to transfer the result to the tag.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number to be used for value command.\n * `cmd` (direction in) - value command to be performed.\n * `data` (direction in) - value to be used for value command.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_value_cmd(
instance: *mut MfClassicPoller,
block_num: u8,
cmd: MfClassicValueCommand,
data: i32,
) -> MfClassicError;
}
extern "C" {
#[doc = "Transfer internal transfer block to tag.\n\n Must ONLY be used inside the callback function.\n\n Transfer internal transfer block to tag. The block is filled by mf_classic_poller_value_cmd.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `block_num` (direction in) - block number to be used for value command.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_value_transfer(
instance: *mut MfClassicPoller,
block_num: u8,
) -> MfClassicError;
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a standard frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_send_standard_frame(
instance: *mut MfClassicPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt_fc: u32,
) -> MfClassicError;
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_send_frame(
instance: *mut MfClassicPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt_fc: u32,
) -> MfClassicError;
}
extern "C" {
#[doc = "Transmit and receive Iso14443_3a frames with custom parity bits in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n Custom parity bits must be set in the tx_buffer. The rx_buffer will contain\n the received data with the parity bits.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_send_custom_parity_frame(
instance: *mut MfClassicPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt_fc: u32,
) -> MfClassicError;
}
extern "C" {
#[doc = "Transmit and receive Mifare Classic encrypted frames with custom parity bits in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the plain data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with decyphered received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nMfClassicErrorNone on success, an error code on failure."]
pub fn mf_classic_poller_send_encrypted_frame(
instance: *mut MfClassicPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt_fc: u32,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_collect_nt(
nfc: *mut Nfc,
block_num: u8,
key_type: MfClassicKeyType,
nt: *mut MfClassicNt,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_auth(
nfc: *mut Nfc,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: *mut MfClassicAuthContext,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_read_block(
nfc: *mut Nfc,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: *mut MfClassicBlock,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_write_block(
nfc: *mut Nfc,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: *mut MfClassicBlock,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_read_value(
nfc: *mut Nfc,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
value: *mut i32,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_change_value(
nfc: *mut Nfc,
block_num: u8,
key: *mut MfClassicKey,
key_type: MfClassicKeyType,
data: i32,
new_value: *mut i32,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_detect_type(
nfc: *mut Nfc,
type_: *mut MfClassicType,
) -> MfClassicError;
}
extern "C" {
pub fn mf_classic_poller_sync_read(
nfc: *mut Nfc,
keys: *const MfClassicDeviceKeys,
data: *mut MfClassicData,
) -> MfClassicError;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireVersion {
pub hw_vendor: u8,
pub hw_type: u8,
pub hw_subtype: u8,
pub hw_major: u8,
pub hw_minor: u8,
pub hw_storage: u8,
pub hw_proto: u8,
pub sw_vendor: u8,
pub sw_type: u8,
pub sw_subtype: u8,
pub sw_major: u8,
pub sw_minor: u8,
pub sw_storage: u8,
pub sw_proto: u8,
pub uid: [u8; 7usize],
pub batch: [u8; 5usize],
pub prod_week: u8,
pub prod_year: u8,
}
#[test]
fn bindgen_test_layout_MfDesfireVersion() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireVersion> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireVersion>(),
28usize,
concat!("Size of: ", stringify!(MfDesfireVersion))
);
assert_eq!(
::core::mem::align_of::<MfDesfireVersion>(),
1usize,
concat!("Alignment of ", stringify!(MfDesfireVersion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_vendor) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_vendor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_type) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_subtype) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_subtype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_major) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_minor) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_storage) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_storage)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_proto) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(hw_proto)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_vendor) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_vendor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_type) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_subtype) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_subtype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_major) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_minor) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_storage) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_storage)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_proto) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(sw_proto)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).batch) as usize - ptr as usize },
21usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(batch)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_week) as usize - ptr as usize },
26usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(prod_week)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_year) as usize - ptr as usize },
27usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireVersion),
"::",
stringify!(prod_year)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireFreeMemory {
pub bytes_free: u32,
pub is_present: bool,
}
#[test]
fn bindgen_test_layout_MfDesfireFreeMemory() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFreeMemory> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFreeMemory>(),
8usize,
concat!("Size of: ", stringify!(MfDesfireFreeMemory))
);
assert_eq!(
::core::mem::align_of::<MfDesfireFreeMemory>(),
4usize,
concat!("Alignment of ", stringify!(MfDesfireFreeMemory))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).bytes_free) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFreeMemory),
"::",
stringify!(bytes_free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_present) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFreeMemory),
"::",
stringify!(is_present)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireKeySettings {
pub is_master_key_changeable: bool,
pub is_free_directory_list: bool,
pub is_free_create_delete: bool,
pub is_config_changeable: bool,
pub change_key_id: u8,
pub max_keys: u8,
pub flags: u8,
}
#[test]
fn bindgen_test_layout_MfDesfireKeySettings() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireKeySettings> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireKeySettings>(),
7usize,
concat!("Size of: ", stringify!(MfDesfireKeySettings))
);
assert_eq!(
::core::mem::align_of::<MfDesfireKeySettings>(),
1usize,
concat!("Alignment of ", stringify!(MfDesfireKeySettings))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_master_key_changeable) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(is_master_key_changeable)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_free_directory_list) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(is_free_directory_list)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_free_create_delete) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(is_free_create_delete)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_config_changeable) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(is_config_changeable)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).change_key_id) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(change_key_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_keys) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(max_keys)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireKeySettings),
"::",
stringify!(flags)
)
);
}
pub type MfDesfireKeyVersion = u8;
pub const MfDesfireFileType_MfDesfireFileTypeStandard: MfDesfireFileType = 0;
pub const MfDesfireFileType_MfDesfireFileTypeBackup: MfDesfireFileType = 1;
pub const MfDesfireFileType_MfDesfireFileTypeValue: MfDesfireFileType = 2;
pub const MfDesfireFileType_MfDesfireFileTypeLinearRecord: MfDesfireFileType = 3;
pub const MfDesfireFileType_MfDesfireFileTypeCyclicRecord: MfDesfireFileType = 4;
pub type MfDesfireFileType = core::ffi::c_uchar;
pub const MfDesfireFileCommunicationSettings_MfDesfireFileCommunicationSettingsPlaintext:
MfDesfireFileCommunicationSettings = 0;
pub const MfDesfireFileCommunicationSettings_MfDesfireFileCommunicationSettingsAuthenticated:
MfDesfireFileCommunicationSettings = 1;
pub const MfDesfireFileCommunicationSettings_MfDesfireFileCommunicationSettingsEnciphered:
MfDesfireFileCommunicationSettings = 3;
pub type MfDesfireFileCommunicationSettings = core::ffi::c_uchar;
pub type MfDesfireFileId = u8;
pub type MfDesfireFileAccessRights = u16;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MfDesfireFileSettings {
pub type_: MfDesfireFileType,
pub comm: MfDesfireFileCommunicationSettings,
pub access_rights: [MfDesfireFileAccessRights; 14usize],
pub access_rights_len: u8,
pub __bindgen_anon_1: MfDesfireFileSettings__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union MfDesfireFileSettings__bindgen_ty_1 {
pub data: MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1,
pub value: MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2,
pub record: MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1 {
pub size: u32,
}
#[test]
fn bindgen_test_layout_MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(size)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2 {
pub lo_limit: u32,
pub hi_limit: u32,
pub limited_credit_value: u32,
pub limited_credit_enabled: bool,
}
#[test]
fn bindgen_test_layout_MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2>(),
16usize,
concat!(
"Size of: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2>(),
4usize,
concat!(
"Alignment of ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).lo_limit) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(lo_limit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hi_limit) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(hi_limit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).limited_credit_value) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(limited_credit_value)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).limited_credit_enabled) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(limited_credit_enabled)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3 {
pub size: u32,
pub max: u32,
pub cur: u32,
}
#[test]
fn bindgen_test_layout_MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3>(),
12usize,
concat!(
"Size of: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3)
)
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3>(),
4usize,
concat!(
"Alignment of ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3),
"::",
stringify!(max)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cur) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1__bindgen_ty_3),
"::",
stringify!(cur)
)
);
}
#[test]
fn bindgen_test_layout_MfDesfireFileSettings__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileSettings__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileSettings__bindgen_ty_1>(),
16usize,
concat!("Size of: ", stringify!(MfDesfireFileSettings__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileSettings__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(MfDesfireFileSettings__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1),
"::",
stringify!(value)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).record) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings__bindgen_ty_1),
"::",
stringify!(record)
)
);
}
#[test]
fn bindgen_test_layout_MfDesfireFileSettings() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileSettings> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileSettings>(),
48usize,
concat!("Size of: ", stringify!(MfDesfireFileSettings))
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileSettings>(),
4usize,
concat!("Alignment of ", stringify!(MfDesfireFileSettings))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).comm) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings),
"::",
stringify!(comm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).access_rights) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings),
"::",
stringify!(access_rights)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).access_rights_len) as usize - ptr as usize },
30usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileSettings),
"::",
stringify!(access_rights_len)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireFileData {
pub data: *mut SimpleArray,
}
#[test]
fn bindgen_test_layout_MfDesfireFileData() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireFileData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireFileData>(),
4usize,
concat!("Size of: ", stringify!(MfDesfireFileData))
);
assert_eq!(
::core::mem::align_of::<MfDesfireFileData>(),
4usize,
concat!("Alignment of ", stringify!(MfDesfireFileData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireFileData),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireApplicationId {
pub data: [u8; 3usize],
}
#[test]
fn bindgen_test_layout_MfDesfireApplicationId() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireApplicationId> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireApplicationId>(),
3usize,
concat!("Size of: ", stringify!(MfDesfireApplicationId))
);
assert_eq!(
::core::mem::align_of::<MfDesfireApplicationId>(),
1usize,
concat!("Alignment of ", stringify!(MfDesfireApplicationId))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplicationId),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireApplication {
pub key_settings: MfDesfireKeySettings,
pub key_versions: *mut SimpleArray,
pub file_ids: *mut SimpleArray,
pub file_settings: *mut SimpleArray,
pub file_data: *mut SimpleArray,
}
#[test]
fn bindgen_test_layout_MfDesfireApplication() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireApplication> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireApplication>(),
24usize,
concat!("Size of: ", stringify!(MfDesfireApplication))
);
assert_eq!(
::core::mem::align_of::<MfDesfireApplication>(),
4usize,
concat!("Alignment of ", stringify!(MfDesfireApplication))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_settings) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplication),
"::",
stringify!(key_settings)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_versions) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplication),
"::",
stringify!(key_versions)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).file_ids) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplication),
"::",
stringify!(file_ids)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).file_settings) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplication),
"::",
stringify!(file_settings)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).file_data) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireApplication),
"::",
stringify!(file_data)
)
);
}
pub const MfDesfireError_MfDesfireErrorNone: MfDesfireError = 0;
pub const MfDesfireError_MfDesfireErrorNotPresent: MfDesfireError = 1;
pub const MfDesfireError_MfDesfireErrorProtocol: MfDesfireError = 2;
pub const MfDesfireError_MfDesfireErrorTimeout: MfDesfireError = 3;
pub const MfDesfireError_MfDesfireErrorAuthentication: MfDesfireError = 4;
pub type MfDesfireError = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfireData {
pub iso14443_4a_data: *mut Iso14443_4aData,
pub version: MfDesfireVersion,
pub free_memory: MfDesfireFreeMemory,
pub master_key_settings: MfDesfireKeySettings,
pub master_key_versions: *mut SimpleArray,
pub application_ids: *mut SimpleArray,
pub applications: *mut SimpleArray,
}
#[test]
fn bindgen_test_layout_MfDesfireData() {
const UNINIT: ::core::mem::MaybeUninit<MfDesfireData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfDesfireData>(),
60usize,
concat!("Size of: ", stringify!(MfDesfireData))
);
assert_eq!(
::core::mem::align_of::<MfDesfireData>(),
4usize,
concat!("Alignment of ", stringify!(MfDesfireData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso14443_4a_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(iso14443_4a_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).free_memory) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(free_memory)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).master_key_settings) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(master_key_settings)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).master_key_versions) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(master_key_versions)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).application_ids) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(application_ids)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).applications) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(MfDesfireData),
"::",
stringify!(applications)
)
);
}
extern "C" {
pub fn mf_desfire_alloc() -> *mut MfDesfireData;
}
extern "C" {
pub fn mf_desfire_free(data: *mut MfDesfireData);
}
extern "C" {
pub fn mf_desfire_reset(data: *mut MfDesfireData);
}
extern "C" {
pub fn mf_desfire_copy(data: *mut MfDesfireData, other: *const MfDesfireData);
}
extern "C" {
pub fn mf_desfire_verify(data: *mut MfDesfireData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn mf_desfire_load(data: *mut MfDesfireData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn mf_desfire_save(data: *const MfDesfireData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn mf_desfire_is_equal(data: *const MfDesfireData, other: *const MfDesfireData) -> bool;
}
extern "C" {
pub fn mf_desfire_get_device_name(
data: *const MfDesfireData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mf_desfire_get_uid(data: *const MfDesfireData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn mf_desfire_set_uid(data: *mut MfDesfireData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn mf_desfire_get_base_data(data: *const MfDesfireData) -> *mut Iso14443_4aData;
}
extern "C" {
pub fn mf_desfire_get_application(
data: *const MfDesfireData,
app_id: *const MfDesfireApplicationId,
) -> *const MfDesfireApplication;
}
extern "C" {
pub fn mf_desfire_get_file_settings(
data: *const MfDesfireApplication,
file_id: *const MfDesfireFileId,
) -> *const MfDesfireFileSettings;
}
extern "C" {
pub fn mf_desfire_get_file_data(
data: *const MfDesfireApplication,
file_id: *const MfDesfireFileId,
) -> *const MfDesfireFileData;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfDesfirePoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive MfDesfire chunks in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_send_chunks(
instance: *mut MfDesfirePoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read MfDesfire card version.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfDesfireVersion structure to be filled with version data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_version(
instance: *mut MfDesfirePoller,
data: *mut MfDesfireVersion,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read free memory available on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfDesfireFreeMemory structure to be filled with free memory data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_free_memory(
instance: *mut MfDesfirePoller,
data: *mut MfDesfireFreeMemory,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read key settings on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfDesfireKeySettings structure to be filled with key settings data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_key_settings(
instance: *mut MfDesfirePoller,
data: *mut MfDesfireKeySettings,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read key version on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `key_num` (direction out) - key number.\n * `data` (direction in) - pointer to the MfDesfireKeyVersion structure to be filled with key version data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_key_version(
instance: *mut MfDesfirePoller,
key_num: u8,
data: *mut MfDesfireKeyVersion,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read key versions on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SimpleArray structure to be filled with key versions data.\n * `count` (direction in) - number of key versions to read.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_key_versions(
instance: *mut MfDesfirePoller,
data: *mut SimpleArray,
count: u32,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read applications IDs on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SimpleArray structure to be filled with application ids data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_application_ids(
instance: *mut MfDesfirePoller,
data: *mut SimpleArray,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Select application on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `id` (direction in) - pointer to the MfDesfireApplicationId structure with application id to select.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_select_application(
instance: *mut MfDesfirePoller,
id: *const MfDesfireApplicationId,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read file IDs for selected application on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SimpleArray structure to be filled with file ids data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_ids(
instance: *mut MfDesfirePoller,
data: *mut SimpleArray,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read file settings on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `id` (direction in) - file id to read settings for.\n * `data` (direction out) - pointer to the MfDesfireFileSettings structure to be filled with file settings data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_settings(
instance: *mut MfDesfirePoller,
id: MfDesfireFileId,
data: *mut MfDesfireFileSettings,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read multiple file settings on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `file_ids` (direction in) - pointer to the SimpleArray structure array with file ids to read settings for.\n * `data` (direction out) - pointer to the SimpleArray structure array to be filled with file settings data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_settings_multi(
instance: *mut MfDesfirePoller,
file_ids: *const SimpleArray,
data: *mut SimpleArray,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read file data on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `id` (direction in) - file id to read data from.\n * `offset` (direction in) - offset in bytes to start reading from.\n * `size` (direction in) - number of bytes to read.\n * `data` (direction out) - pointer to the MfDesfireFileData structure to be filled with file data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_data(
instance: *mut MfDesfirePoller,
id: MfDesfireFileId,
offset: u32,
size: usize,
data: *mut MfDesfireFileData,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read file value on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `id` (direction in) - file id to read value from.\n * `data` (direction out) - pointer to the MfDesfireFileData structure to be filled with file value.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_value(
instance: *mut MfDesfirePoller,
id: MfDesfireFileId,
data: *mut MfDesfireFileData,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read file records on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `id` (direction in) - file id to read data from.\n * `offset` (direction in) - offset in bytes to start reading from.\n * `size` (direction in) - number of bytes to read.\n * `data` (direction out) - pointer to the MfDesfireFileData structure to be filled with file records data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_records(
instance: *mut MfDesfirePoller,
id: MfDesfireFileId,
offset: u32,
size: usize,
data: *mut MfDesfireFileData,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read data from multiple files on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `file_ids` (direction in) - pointer to the SimpleArray structure array with files ids to read data from.\n * `file_settings` (direction in) - pointer to the SimpleArray structure array with files settings to read data from.\n * `data` (direction out) - pointer to the SimpleArray structure array to be filled with files data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_file_data_multi(
instance: *mut MfDesfirePoller,
file_ids: *const SimpleArray,
file_settings: *const SimpleArray,
data: *mut SimpleArray,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read application data for selected application on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfDesfireApplication structure to be filled with application data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_application(
instance: *mut MfDesfirePoller,
data: *mut MfDesfireApplication,
) -> MfDesfireError;
}
extern "C" {
#[doc = "Read multiple applications data on MfDesfire card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `app_ids` (direction in) - pointer to the SimpleArray structure array with application ids to read data from.\n * `data` (direction out) - pointer to the SimpleArray structure array to be filled with applications data.\n # Returns\n\nMfDesfireErrorNone on success, an error code on failure."]
pub fn mf_desfire_poller_read_applications(
instance: *mut MfDesfirePoller,
app_ids: *const SimpleArray,
data: *mut SimpleArray,
) -> MfDesfireError;
}
pub const MfPlusError_MfPlusErrorNone: MfPlusError = 0;
pub const MfPlusError_MfPlusErrorUnknown: MfPlusError = 1;
pub const MfPlusError_MfPlusErrorNotPresent: MfPlusError = 2;
pub const MfPlusError_MfPlusErrorProtocol: MfPlusError = 3;
pub const MfPlusError_MfPlusErrorAuth: MfPlusError = 4;
pub const MfPlusError_MfPlusErrorPartialRead: MfPlusError = 5;
pub const MfPlusError_MfPlusErrorTimeout: MfPlusError = 6;
pub type MfPlusError = core::ffi::c_uchar;
pub const MfPlusType_MfPlusTypePlus: MfPlusType = 0;
pub const MfPlusType_MfPlusTypeEV1: MfPlusType = 1;
pub const MfPlusType_MfPlusTypeEV2: MfPlusType = 2;
pub const MfPlusType_MfPlusTypeS: MfPlusType = 3;
pub const MfPlusType_MfPlusTypeSE: MfPlusType = 4;
pub const MfPlusType_MfPlusTypeX: MfPlusType = 5;
pub const MfPlusType_MfPlusTypeUnknown: MfPlusType = 6;
pub const MfPlusType_MfPlusTypeNum: MfPlusType = 7;
pub type MfPlusType = core::ffi::c_uchar;
pub const MfPlusSize_MfPlusSize1K: MfPlusSize = 0;
pub const MfPlusSize_MfPlusSize2K: MfPlusSize = 1;
pub const MfPlusSize_MfPlusSize4K: MfPlusSize = 2;
pub const MfPlusSize_MfPlusSizeUnknown: MfPlusSize = 3;
pub const MfPlusSize_MfPlusSizeNum: MfPlusSize = 4;
pub type MfPlusSize = core::ffi::c_uchar;
pub const MfPlusSecurityLevel_MfPlusSecurityLevel0: MfPlusSecurityLevel = 0;
pub const MfPlusSecurityLevel_MfPlusSecurityLevel1: MfPlusSecurityLevel = 1;
pub const MfPlusSecurityLevel_MfPlusSecurityLevel2: MfPlusSecurityLevel = 2;
pub const MfPlusSecurityLevel_MfPlusSecurityLevel3: MfPlusSecurityLevel = 3;
pub const MfPlusSecurityLevel_MfPlusSecurityLevelUnknown: MfPlusSecurityLevel = 4;
pub const MfPlusSecurityLevel_MfPlusSecurityLevelNum: MfPlusSecurityLevel = 5;
pub type MfPlusSecurityLevel = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfPlusVersion {
pub hw_vendor: u8,
pub hw_type: u8,
pub hw_subtype: u8,
pub hw_major: u8,
pub hw_minor: u8,
pub hw_storage: u8,
pub hw_proto: u8,
pub sw_vendor: u8,
pub sw_type: u8,
pub sw_subtype: u8,
pub sw_major: u8,
pub sw_minor: u8,
pub sw_storage: u8,
pub sw_proto: u8,
pub uid: [u8; 7usize],
pub batch: [u8; 5usize],
pub prod_week: u8,
pub prod_year: u8,
}
#[test]
fn bindgen_test_layout_MfPlusVersion() {
const UNINIT: ::core::mem::MaybeUninit<MfPlusVersion> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfPlusVersion>(),
28usize,
concat!("Size of: ", stringify!(MfPlusVersion))
);
assert_eq!(
::core::mem::align_of::<MfPlusVersion>(),
1usize,
concat!("Alignment of ", stringify!(MfPlusVersion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_vendor) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_vendor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_type) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_subtype) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_subtype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_major) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_minor) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_storage) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_storage)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hw_proto) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(hw_proto)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_vendor) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_vendor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_type) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_subtype) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_subtype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_major) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_minor) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_storage) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_storage)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sw_proto) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(sw_proto)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).batch) as usize - ptr as usize },
21usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(batch)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_week) as usize - ptr as usize },
26usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(prod_week)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_year) as usize - ptr as usize },
27usize,
concat!(
"Offset of field: ",
stringify!(MfPlusVersion),
"::",
stringify!(prod_year)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfPlusData {
pub iso14443_4a_data: *mut Iso14443_4aData,
pub version: MfPlusVersion,
pub type_: MfPlusType,
pub size: MfPlusSize,
pub security_level: MfPlusSecurityLevel,
pub device_name: *mut FuriString,
}
#[test]
fn bindgen_test_layout_MfPlusData() {
const UNINIT: ::core::mem::MaybeUninit<MfPlusData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfPlusData>(),
40usize,
concat!("Size of: ", stringify!(MfPlusData))
);
assert_eq!(
::core::mem::align_of::<MfPlusData>(),
4usize,
concat!("Alignment of ", stringify!(MfPlusData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso14443_4a_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(iso14443_4a_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
33usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).security_level) as usize - ptr as usize },
34usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(security_level)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).device_name) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(MfPlusData),
"::",
stringify!(device_name)
)
);
}
extern "C" {
pub fn mf_plus_alloc() -> *mut MfPlusData;
}
extern "C" {
pub fn mf_plus_free(data: *mut MfPlusData);
}
extern "C" {
pub fn mf_plus_reset(data: *mut MfPlusData);
}
extern "C" {
pub fn mf_plus_copy(data: *mut MfPlusData, other: *const MfPlusData);
}
extern "C" {
pub fn mf_plus_verify(data: *mut MfPlusData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn mf_plus_load(data: *mut MfPlusData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn mf_plus_save(data: *const MfPlusData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn mf_plus_is_equal(data: *const MfPlusData, other: *const MfPlusData) -> bool;
}
extern "C" {
pub fn mf_plus_get_device_name(
data: *const MfPlusData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mf_plus_get_uid(data: *const MfPlusData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn mf_plus_set_uid(data: *mut MfPlusData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn mf_plus_get_base_data(data: *const MfPlusData) -> *mut Iso14443_4aData;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfPlusPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Read MfPlus card version.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfPlusVersion structure to be filled with version data.\n # Returns\n\nMfPlusErrorNone on success, an error code on failure."]
pub fn mf_plus_poller_read_version(
instance: *mut MfPlusPoller,
data: *mut MfPlusVersion,
) -> MfPlusError;
}
pub const MfUltralightError_MfUltralightErrorNone: MfUltralightError = 0;
pub const MfUltralightError_MfUltralightErrorNotPresent: MfUltralightError = 1;
pub const MfUltralightError_MfUltralightErrorProtocol: MfUltralightError = 2;
pub const MfUltralightError_MfUltralightErrorAuth: MfUltralightError = 3;
pub const MfUltralightError_MfUltralightErrorTimeout: MfUltralightError = 4;
pub type MfUltralightError = core::ffi::c_uchar;
pub const MfUltralightType_MfUltralightTypeOrigin: MfUltralightType = 0;
pub const MfUltralightType_MfUltralightTypeNTAG203: MfUltralightType = 1;
pub const MfUltralightType_MfUltralightTypeMfulC: MfUltralightType = 2;
pub const MfUltralightType_MfUltralightTypeUL11: MfUltralightType = 3;
pub const MfUltralightType_MfUltralightTypeUL21: MfUltralightType = 4;
pub const MfUltralightType_MfUltralightTypeNTAG213: MfUltralightType = 5;
pub const MfUltralightType_MfUltralightTypeNTAG215: MfUltralightType = 6;
pub const MfUltralightType_MfUltralightTypeNTAG216: MfUltralightType = 7;
pub const MfUltralightType_MfUltralightTypeNTAGI2C1K: MfUltralightType = 8;
pub const MfUltralightType_MfUltralightTypeNTAGI2C2K: MfUltralightType = 9;
pub const MfUltralightType_MfUltralightTypeNTAGI2CPlus1K: MfUltralightType = 10;
pub const MfUltralightType_MfUltralightTypeNTAGI2CPlus2K: MfUltralightType = 11;
pub const MfUltralightType_MfUltralightTypeNum: MfUltralightType = 12;
pub type MfUltralightType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightPage {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfUltralightPage() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightPage> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightPage>(),
4usize,
concat!("Size of: ", stringify!(MfUltralightPage))
);
assert_eq!(
::core::mem::align_of::<MfUltralightPage>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightPage))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPage),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightPageReadCommandData {
pub page: [MfUltralightPage; 4usize],
}
#[test]
fn bindgen_test_layout_MfUltralightPageReadCommandData() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightPageReadCommandData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightPageReadCommandData>(),
16usize,
concat!("Size of: ", stringify!(MfUltralightPageReadCommandData))
);
assert_eq!(
::core::mem::align_of::<MfUltralightPageReadCommandData>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightPageReadCommandData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).page) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPageReadCommandData),
"::",
stringify!(page)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightVersion {
pub header: u8,
pub vendor_id: u8,
pub prod_type: u8,
pub prod_subtype: u8,
pub prod_ver_major: u8,
pub prod_ver_minor: u8,
pub storage_size: u8,
pub protocol_type: u8,
}
#[test]
fn bindgen_test_layout_MfUltralightVersion() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightVersion> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightVersion>(),
8usize,
concat!("Size of: ", stringify!(MfUltralightVersion))
);
assert_eq!(
::core::mem::align_of::<MfUltralightVersion>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightVersion))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).header) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(header)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vendor_id) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(vendor_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_type) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(prod_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_subtype) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(prod_subtype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_ver_major) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(prod_ver_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prod_ver_minor) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(prod_ver_minor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).storage_size) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(storage_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol_type) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightVersion),
"::",
stringify!(protocol_type)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightSignature {
pub data: [u8; 32usize],
}
#[test]
fn bindgen_test_layout_MfUltralightSignature() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightSignature> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightSignature>(),
32usize,
concat!("Size of: ", stringify!(MfUltralightSignature))
);
assert_eq!(
::core::mem::align_of::<MfUltralightSignature>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightSignature))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightSignature),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union MfUltralightCounter {
pub counter: u32,
pub data: [u8; 3usize],
}
#[test]
fn bindgen_test_layout_MfUltralightCounter() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightCounter> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightCounter>(),
4usize,
concat!("Size of: ", stringify!(MfUltralightCounter))
);
assert_eq!(
::core::mem::align_of::<MfUltralightCounter>(),
4usize,
concat!("Alignment of ", stringify!(MfUltralightCounter))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightCounter),
"::",
stringify!(counter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightCounter),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightTearingFlag {
pub data: u8,
}
#[test]
fn bindgen_test_layout_MfUltralightTearingFlag() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightTearingFlag> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightTearingFlag>(),
1usize,
concat!("Size of: ", stringify!(MfUltralightTearingFlag))
);
assert_eq!(
::core::mem::align_of::<MfUltralightTearingFlag>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightTearingFlag))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightTearingFlag),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightAuthPassword {
pub data: [u8; 4usize],
}
#[test]
fn bindgen_test_layout_MfUltralightAuthPassword() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightAuthPassword> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightAuthPassword>(),
4usize,
concat!("Size of: ", stringify!(MfUltralightAuthPassword))
);
assert_eq!(
::core::mem::align_of::<MfUltralightAuthPassword>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightAuthPassword))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightAuthPassword),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightC3DesAuthKey {
pub data: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_MfUltralightC3DesAuthKey() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightC3DesAuthKey> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightC3DesAuthKey>(),
16usize,
concat!("Size of: ", stringify!(MfUltralightC3DesAuthKey))
);
assert_eq!(
::core::mem::align_of::<MfUltralightC3DesAuthKey>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightC3DesAuthKey))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightC3DesAuthKey),
"::",
stringify!(data)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightAuthPack {
pub data: [u8; 2usize],
}
#[test]
fn bindgen_test_layout_MfUltralightAuthPack() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightAuthPack> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightAuthPack>(),
2usize,
concat!("Size of: ", stringify!(MfUltralightAuthPack))
);
assert_eq!(
::core::mem::align_of::<MfUltralightAuthPack>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightAuthPack))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightAuthPack),
"::",
stringify!(data)
)
);
}
pub const MfUltralightMirrorConf_MfUltralightMirrorNone: MfUltralightMirrorConf = 0;
pub const MfUltralightMirrorConf_MfUltralightMirrorUid: MfUltralightMirrorConf = 1;
pub const MfUltralightMirrorConf_MfUltralightMirrorCounter: MfUltralightMirrorConf = 2;
pub const MfUltralightMirrorConf_MfUltralightMirrorUidCounter: MfUltralightMirrorConf = 3;
pub type MfUltralightMirrorConf = core::ffi::c_uchar;
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub struct MfUltralightConfigPages {
pub mirror: MfUltralightConfigPages__bindgen_ty_1,
pub rfui1: u8,
pub mirror_page: u8,
pub auth0: u8,
pub access: MfUltralightConfigPages__bindgen_ty_2,
pub vctid: u8,
pub rfui2: [u8; 2usize],
pub password: MfUltralightAuthPassword,
pub pack: MfUltralightAuthPack,
pub rfui3: [u8; 2usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union MfUltralightConfigPages__bindgen_ty_1 {
pub value: u8,
pub __bindgen_anon_1: MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1 {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
}
#[test]
fn bindgen_test_layout_MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(
::core::mem::size_of::<MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1>(),
1usize,
concat!(
"Size of: ",
stringify!(MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1)
)
);
}
impl MfUltralightConfigPages__bindgen_ty_1__bindgen_ty_1 {
#[inline]
pub fn rfui1(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
}
#[inline]
pub fn set_rfui1(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 2u8, val as u64)
}
}
#[inline]
pub fn strg_mod_en(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
}
#[inline]
pub fn set_strg_mod_en(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(2usize, 1u8, val as u64)
}
}
#[inline]
pub fn rfui2(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
}
#[inline]
pub fn set_rfui2(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(3usize, 1u8, val as u64)
}
}
#[inline]
pub fn mirror_byte(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
}
#[inline]
pub fn set_mirror_byte(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(4usize, 2u8, val as u64)
}
}
#[inline]
pub fn mirror_conf(&self) -> MfUltralightMirrorConf {
unsafe { ::core::mem::transmute(self._bitfield_1.get(6usize, 2u8) as u8) }
}
#[inline]
pub fn set_mirror_conf(&mut self, val: MfUltralightMirrorConf) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(6usize, 2u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
rfui1: u8,
strg_mod_en: bool,
rfui2: bool,
mirror_byte: u8,
mirror_conf: MfUltralightMirrorConf,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 2u8, {
let rfui1: u8 = unsafe { ::core::mem::transmute(rfui1) };
rfui1 as u64
});
__bindgen_bitfield_unit.set(2usize, 1u8, {
let strg_mod_en: u8 = unsafe { ::core::mem::transmute(strg_mod_en) };
strg_mod_en as u64
});
__bindgen_bitfield_unit.set(3usize, 1u8, {
let rfui2: u8 = unsafe { ::core::mem::transmute(rfui2) };
rfui2 as u64
});
__bindgen_bitfield_unit.set(4usize, 2u8, {
let mirror_byte: u8 = unsafe { ::core::mem::transmute(mirror_byte) };
mirror_byte as u64
});
__bindgen_bitfield_unit.set(6usize, 2u8, {
let mirror_conf: u8 = unsafe { ::core::mem::transmute(mirror_conf) };
mirror_conf as u64
});
__bindgen_bitfield_unit
}
}
#[test]
fn bindgen_test_layout_MfUltralightConfigPages__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightConfigPages__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightConfigPages__bindgen_ty_1>(),
1usize,
concat!(
"Size of: ",
stringify!(MfUltralightConfigPages__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<MfUltralightConfigPages__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(MfUltralightConfigPages__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages__bindgen_ty_1),
"::",
stringify!(value)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union MfUltralightConfigPages__bindgen_ty_2 {
pub value: u8,
pub __bindgen_anon_1: MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
}
#[test]
fn bindgen_test_layout_MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1() {
assert_eq!(
::core::mem::size_of::<MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1>(),
1usize,
concat!(
"Size of: ",
stringify!(MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1>(),
1usize,
concat!(
"Alignment of ",
stringify!(MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1)
)
);
}
impl MfUltralightConfigPages__bindgen_ty_2__bindgen_ty_1 {
#[inline]
pub fn authlim(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) }
}
#[inline]
pub fn set_authlim(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 3u8, val as u64)
}
}
#[inline]
pub fn nfc_cnt_pwd_prot(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
}
#[inline]
pub fn set_nfc_cnt_pwd_prot(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(3usize, 1u8, val as u64)
}
}
#[inline]
pub fn nfc_cnt_en(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
}
#[inline]
pub fn set_nfc_cnt_en(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(4usize, 1u8, val as u64)
}
}
#[inline]
pub fn nfc_dis_sec1(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
}
#[inline]
pub fn set_nfc_dis_sec1(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(5usize, 1u8, val as u64)
}
}
#[inline]
pub fn cfglck(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
}
#[inline]
pub fn set_cfglck(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(6usize, 1u8, val as u64)
}
}
#[inline]
pub fn prot(&self) -> bool {
unsafe { ::core::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
}
#[inline]
pub fn set_prot(&mut self, val: bool) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(7usize, 1u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
authlim: u8,
nfc_cnt_pwd_prot: bool,
nfc_cnt_en: bool,
nfc_dis_sec1: bool,
cfglck: bool,
prot: bool,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let authlim: u8 = unsafe { ::core::mem::transmute(authlim) };
authlim as u64
});
__bindgen_bitfield_unit.set(3usize, 1u8, {
let nfc_cnt_pwd_prot: u8 = unsafe { ::core::mem::transmute(nfc_cnt_pwd_prot) };
nfc_cnt_pwd_prot as u64
});
__bindgen_bitfield_unit.set(4usize, 1u8, {
let nfc_cnt_en: u8 = unsafe { ::core::mem::transmute(nfc_cnt_en) };
nfc_cnt_en as u64
});
__bindgen_bitfield_unit.set(5usize, 1u8, {
let nfc_dis_sec1: u8 = unsafe { ::core::mem::transmute(nfc_dis_sec1) };
nfc_dis_sec1 as u64
});
__bindgen_bitfield_unit.set(6usize, 1u8, {
let cfglck: u8 = unsafe { ::core::mem::transmute(cfglck) };
cfglck as u64
});
__bindgen_bitfield_unit.set(7usize, 1u8, {
let prot: u8 = unsafe { ::core::mem::transmute(prot) };
prot as u64
});
__bindgen_bitfield_unit
}
}
#[test]
fn bindgen_test_layout_MfUltralightConfigPages__bindgen_ty_2() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightConfigPages__bindgen_ty_2> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightConfigPages__bindgen_ty_2>(),
1usize,
concat!(
"Size of: ",
stringify!(MfUltralightConfigPages__bindgen_ty_2)
)
);
assert_eq!(
::core::mem::align_of::<MfUltralightConfigPages__bindgen_ty_2>(),
1usize,
concat!(
"Alignment of ",
stringify!(MfUltralightConfigPages__bindgen_ty_2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages__bindgen_ty_2),
"::",
stringify!(value)
)
);
}
#[test]
fn bindgen_test_layout_MfUltralightConfigPages() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightConfigPages> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightConfigPages>(),
16usize,
concat!("Size of: ", stringify!(MfUltralightConfigPages))
);
assert_eq!(
::core::mem::align_of::<MfUltralightConfigPages>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightConfigPages))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mirror) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(mirror)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rfui1) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(rfui1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mirror_page) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(mirror_page)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).auth0) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(auth0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).access) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(access)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vctid) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(vctid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rfui2) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(rfui2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).password) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(password)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pack) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(pack)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rfui3) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightConfigPages),
"::",
stringify!(rfui3)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct MfUltralightData {
pub iso14443_3a_data: *mut Iso14443_3aData,
pub type_: MfUltralightType,
pub version: MfUltralightVersion,
pub signature: MfUltralightSignature,
pub counter: [MfUltralightCounter; 3usize],
pub tearing_flag: [MfUltralightTearingFlag; 3usize],
pub page: [MfUltralightPage; 510usize],
pub pages_read: u16,
pub pages_total: u16,
pub auth_attempts: u32,
}
#[test]
fn bindgen_test_layout_MfUltralightData() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightData>(),
2112usize,
concat!("Size of: ", stringify!(MfUltralightData))
);
assert_eq!(
::core::mem::align_of::<MfUltralightData>(),
4usize,
concat!("Alignment of ", stringify!(MfUltralightData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso14443_3a_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(iso14443_3a_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).signature) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(signature)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(counter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tearing_flag) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(tearing_flag)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).page) as usize - ptr as usize },
63usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(page)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pages_read) as usize - ptr as usize },
2104usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(pages_read)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pages_total) as usize - ptr as usize },
2106usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(pages_total)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).auth_attempts) as usize - ptr as usize },
2108usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightData),
"::",
stringify!(auth_attempts)
)
);
}
extern "C" {
pub fn mf_ultralight_alloc() -> *mut MfUltralightData;
}
extern "C" {
pub fn mf_ultralight_free(data: *mut MfUltralightData);
}
extern "C" {
pub fn mf_ultralight_reset(data: *mut MfUltralightData);
}
extern "C" {
pub fn mf_ultralight_copy(data: *mut MfUltralightData, other: *const MfUltralightData);
}
extern "C" {
pub fn mf_ultralight_verify(
data: *mut MfUltralightData,
device_type: *const FuriString,
) -> bool;
}
extern "C" {
pub fn mf_ultralight_load(
data: *mut MfUltralightData,
ff: *mut FlipperFormat,
version: u32,
) -> bool;
}
extern "C" {
pub fn mf_ultralight_save(data: *const MfUltralightData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn mf_ultralight_is_equal(
data: *const MfUltralightData,
other: *const MfUltralightData,
) -> bool;
}
extern "C" {
pub fn mf_ultralight_get_device_name(
data: *const MfUltralightData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn mf_ultralight_get_uid(data: *const MfUltralightData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn mf_ultralight_set_uid(
data: *mut MfUltralightData,
uid: *const u8,
uid_len: usize,
) -> bool;
}
extern "C" {
pub fn mf_ultralight_get_base_data(data: *const MfUltralightData) -> *mut Iso14443_3aData;
}
extern "C" {
pub fn mf_ultralight_get_type_by_version(version: *mut MfUltralightVersion)
-> MfUltralightType;
}
extern "C" {
pub fn mf_ultralight_get_pages_total(type_: MfUltralightType) -> u16;
}
extern "C" {
pub fn mf_ultralight_get_feature_support_set(type_: MfUltralightType) -> u32;
}
extern "C" {
pub fn mf_ultralight_get_config_page_num(type_: MfUltralightType) -> u16;
}
extern "C" {
pub fn mf_ultralight_get_write_end_page(type_: MfUltralightType) -> u8;
}
extern "C" {
pub fn mf_ultralight_get_pwd_page_num(type_: MfUltralightType) -> u8;
}
extern "C" {
pub fn mf_ultralight_is_page_pwd_or_pack(type_: MfUltralightType, page_num: u16) -> bool;
}
extern "C" {
pub fn mf_ultralight_support_feature(feature_set: u32, features_to_check: u32) -> bool;
}
extern "C" {
pub fn mf_ultralight_get_config_page(
data: *const MfUltralightData,
config: *mut *mut MfUltralightConfigPages,
) -> bool;
}
extern "C" {
pub fn mf_ultralight_is_all_data_read(data: *const MfUltralightData) -> bool;
}
extern "C" {
pub fn mf_ultralight_detect_protocol(iso14443_3a_data: *const Iso14443_3aData) -> bool;
}
extern "C" {
pub fn mf_ultralight_is_counter_configured(data: *const MfUltralightData) -> bool;
}
extern "C" {
pub fn mf_ultralight_3des_shift_data(arr: *mut u8);
}
extern "C" {
pub fn mf_ultralight_3des_key_valid(data: *const MfUltralightData) -> bool;
}
extern "C" {
pub fn mf_ultralight_3des_get_key(data: *const MfUltralightData) -> *const u8;
}
extern "C" {
pub fn mf_ultralight_3des_encrypt(
ctx: *mut mbedtls_des3_context,
ck: *const u8,
iv: *const u8,
input: *const u8,
length: u8,
out: *mut u8,
);
}
extern "C" {
pub fn mf_ultralight_3des_decrypt(
ctx: *mut mbedtls_des3_context,
ck: *const u8,
iv: *const u8,
input: *const u8,
length: u8,
out: *mut u8,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightPoller {
_unused: [u8; 0],
}
#[doc = "MfUltralight poller authentication context."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MfUltralightPollerAuthContext {
#[doc = "< Password to be used for authentication."]
pub password: MfUltralightAuthPassword,
pub tdes_key: MfUltralightC3DesAuthKey,
#[doc = "< Pack received on successfull authentication."]
pub pack: MfUltralightAuthPack,
#[doc = "< Set to true if authentication succeeded, false otherwise."]
pub auth_success: bool,
#[doc = "< Set to true if authentication should be skipped, false otherwise."]
pub skip_auth: bool,
}
#[test]
fn bindgen_test_layout_MfUltralightPollerAuthContext() {
const UNINIT: ::core::mem::MaybeUninit<MfUltralightPollerAuthContext> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<MfUltralightPollerAuthContext>(),
24usize,
concat!("Size of: ", stringify!(MfUltralightPollerAuthContext))
);
assert_eq!(
::core::mem::align_of::<MfUltralightPollerAuthContext>(),
1usize,
concat!("Alignment of ", stringify!(MfUltralightPollerAuthContext))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).password) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPollerAuthContext),
"::",
stringify!(password)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tdes_key) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPollerAuthContext),
"::",
stringify!(tdes_key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pack) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPollerAuthContext),
"::",
stringify!(pack)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).auth_success) as usize - ptr as usize },
22usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPollerAuthContext),
"::",
stringify!(auth_success)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).skip_auth) as usize - ptr as usize },
23usize,
concat!(
"Offset of field: ",
stringify!(MfUltralightPollerAuthContext),
"::",
stringify!(skip_auth)
)
);
}
extern "C" {
#[doc = "Perform authentication with password.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction in, out) - pointer to the authentication context.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_auth_pwd(
instance: *mut MfUltralightPoller,
data: *mut MfUltralightPollerAuthContext,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Start authentication procedure.\n\n Must ONLY be used inside the callback function.\n\n This function is used to start authentication process for Ultralight C cards.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `RndA` (direction in) - Randomly generated block which is required for authentication process.\n * `output` (direction out) - Authentication encryption result.\n # Returns\n\nMfUltralightErrorNone if card supports authentication command, an error code on otherwise."]
pub fn mf_ultralight_poller_authenticate_start(
instance: *mut MfUltralightPoller,
RndA: *const u8,
output: *mut u8,
) -> MfUltralightError;
}
extern "C" {
#[doc = "End authentication procedure\n\n This function is used to end authentication process for Ultralight C cards.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `RndB` (direction in) - Block received from the card (card generates it randomly) which is required for authentication process.\n * `request` (direction in) - Contains data of RndA + RndB', where RndB' is decoded and shifted RndB received from the card on previous step.\n * `response` (direction out) - Must return RndA' which an encrypted shifted RndA value received from the card and decrypted by this function."]
pub fn mf_ultralight_poller_authenticate_end(
instance: *mut MfUltralightPoller,
RndB: *const u8,
request: *const u8,
response: *mut u8,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read page from card.\n\n Must ONLY be used inside the callback function.\n\n Send read command and parse response. The response on this command is data of 4 pages starting\n from the page specified in the command.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `start_page` (direction in) - page number to be read.\n * `data` (direction out) - pointer to the MfUltralightPageReadCommandData structure to be filled with page data.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_page(
instance: *mut MfUltralightPoller,
start_page: u8,
data: *mut MfUltralightPageReadCommandData,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read page from sector.\n\n Must ONLY be used inside the callback function.\n\n This command should be used for NTAGI2C tags.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `sector` (direction in) - sector number to be read.\n * `tag` (direction in) - tag number to be read.\n * `data` (direction out) - pointer to the MfUltralightPageReadCommandData structure to be filled with page data.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_page_from_sector(
instance: *mut MfUltralightPoller,
sector: u8,
tag: u8,
data: *mut MfUltralightPageReadCommandData,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Write page to card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `page` (direction in) - page number to be written.\n * `data` (direction in) - pointer to the MfUltralightPage structure to be written.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_write_page(
instance: *mut MfUltralightPoller,
page: u8,
data: *const MfUltralightPage,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read version from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfUltralightVersion structure to be filled.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_version(
instance: *mut MfUltralightPoller,
data: *mut MfUltralightVersion,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read signature from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the MfUltralightSignature structure to be filled.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_signature(
instance: *mut MfUltralightPoller,
data: *mut MfUltralightSignature,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read counter from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `counter_num` (direction in) - counter number to be read.\n * `data` (direction out) - pointer to the MfUltralightCounter structure to be filled.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_counter(
instance: *mut MfUltralightPoller,
counter_num: u8,
data: *mut MfUltralightCounter,
) -> MfUltralightError;
}
extern "C" {
#[doc = "Read tearing flag from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tearing_falg_num` (direction in) - tearing flag number to be read.\n * `data` (direction out) - pointer to the MfUltralightTearingFlag structure to be filled.\n # Returns\n\nMfUltralightErrorNone on success, an error code on failure."]
pub fn mf_ultralight_poller_read_tearing_flag(
instance: *mut MfUltralightPoller,
tearing_falg_num: u8,
data: *mut MfUltralightTearingFlag,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_page(
nfc: *mut Nfc,
page: u16,
data: *mut MfUltralightPage,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_write_page(
nfc: *mut Nfc,
page: u16,
data: *mut MfUltralightPage,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_version(
nfc: *mut Nfc,
data: *mut MfUltralightVersion,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_signature(
nfc: *mut Nfc,
data: *mut MfUltralightSignature,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_counter(
nfc: *mut Nfc,
counter_num: u8,
data: *mut MfUltralightCounter,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_tearing_flag(
nfc: *mut Nfc,
flag_num: u8,
data: *mut MfUltralightTearingFlag,
) -> MfUltralightError;
}
extern "C" {
pub fn mf_ultralight_poller_sync_read_card(
nfc: *mut Nfc,
data: *mut MfUltralightData,
) -> MfUltralightError;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso15693_3SystemInfo {
pub flags: u8,
pub dsfid: u8,
pub afi: u8,
pub ic_ref: u8,
pub block_count: u16,
pub block_size: u8,
}
#[test]
fn bindgen_test_layout_Iso15693_3SystemInfo() {
const UNINIT: ::core::mem::MaybeUninit<Iso15693_3SystemInfo> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso15693_3SystemInfo>(),
8usize,
concat!("Size of: ", stringify!(Iso15693_3SystemInfo))
);
assert_eq!(
::core::mem::align_of::<Iso15693_3SystemInfo>(),
2usize,
concat!("Alignment of ", stringify!(Iso15693_3SystemInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dsfid) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(dsfid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).afi) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(afi)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ic_ref) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(ic_ref)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_count) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(block_count)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_size) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3SystemInfo),
"::",
stringify!(block_size)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso15693_3LockBits {
pub dsfid: bool,
pub afi: bool,
}
#[test]
fn bindgen_test_layout_Iso15693_3LockBits() {
const UNINIT: ::core::mem::MaybeUninit<Iso15693_3LockBits> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso15693_3LockBits>(),
2usize,
concat!("Size of: ", stringify!(Iso15693_3LockBits))
);
assert_eq!(
::core::mem::align_of::<Iso15693_3LockBits>(),
1usize,
concat!("Alignment of ", stringify!(Iso15693_3LockBits))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dsfid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3LockBits),
"::",
stringify!(dsfid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).afi) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3LockBits),
"::",
stringify!(afi)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso15693_3Settings {
pub lock_bits: Iso15693_3LockBits,
}
#[test]
fn bindgen_test_layout_Iso15693_3Settings() {
const UNINIT: ::core::mem::MaybeUninit<Iso15693_3Settings> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso15693_3Settings>(),
2usize,
concat!("Size of: ", stringify!(Iso15693_3Settings))
);
assert_eq!(
::core::mem::align_of::<Iso15693_3Settings>(),
1usize,
concat!("Alignment of ", stringify!(Iso15693_3Settings))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).lock_bits) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Settings),
"::",
stringify!(lock_bits)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Iso15693_3Data {
pub uid: [u8; 8usize],
pub system_info: Iso15693_3SystemInfo,
pub settings: Iso15693_3Settings,
pub block_data: *mut SimpleArray,
pub block_security: *mut SimpleArray,
}
#[test]
fn bindgen_test_layout_Iso15693_3Data() {
const UNINIT: ::core::mem::MaybeUninit<Iso15693_3Data> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Iso15693_3Data>(),
28usize,
concat!("Size of: ", stringify!(Iso15693_3Data))
);
assert_eq!(
::core::mem::align_of::<Iso15693_3Data>(),
4usize,
concat!("Alignment of ", stringify!(Iso15693_3Data))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Data),
"::",
stringify!(uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).system_info) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Data),
"::",
stringify!(system_info)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).settings) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Data),
"::",
stringify!(settings)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_data) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Data),
"::",
stringify!(block_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).block_security) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(Iso15693_3Data),
"::",
stringify!(block_security)
)
);
}
extern "C" {
pub fn iso15693_3_alloc() -> *mut Iso15693_3Data;
}
extern "C" {
pub fn iso15693_3_free(data: *mut Iso15693_3Data);
}
extern "C" {
pub fn iso15693_3_reset(data: *mut Iso15693_3Data);
}
extern "C" {
pub fn iso15693_3_copy(data: *mut Iso15693_3Data, other: *const Iso15693_3Data);
}
extern "C" {
pub fn iso15693_3_verify(data: *mut Iso15693_3Data, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn iso15693_3_load(data: *mut Iso15693_3Data, ff: *mut FlipperFormat, version: u32)
-> bool;
}
extern "C" {
pub fn iso15693_3_save(data: *const Iso15693_3Data, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn iso15693_3_is_equal(data: *const Iso15693_3Data, other: *const Iso15693_3Data) -> bool;
}
extern "C" {
pub fn iso15693_3_get_device_name(
data: *const Iso15693_3Data,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn iso15693_3_get_uid(data: *const Iso15693_3Data, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn iso15693_3_set_uid(data: *mut Iso15693_3Data, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn iso15693_3_get_base_data(data: *const Iso15693_3Data) -> *mut Iso15693_3Data;
}
extern "C" {
pub fn iso15693_3_is_block_locked(data: *const Iso15693_3Data, block_index: u8) -> bool;
}
extern "C" {
pub fn iso15693_3_get_manufacturer_id(data: *const Iso15693_3Data) -> u8;
}
extern "C" {
pub fn iso15693_3_get_block_count(data: *const Iso15693_3Data) -> u16;
}
extern "C" {
pub fn iso15693_3_get_block_size(data: *const Iso15693_3Data) -> u8;
}
extern "C" {
pub fn iso15693_3_get_block_data(data: *const Iso15693_3Data, block_index: u8) -> *const u8;
}
pub type SlixTypeFeatures = u32;
pub const SlixError_SlixErrorNone: SlixError = 0;
pub const SlixError_SlixErrorTimeout: SlixError = 1;
pub const SlixError_SlixErrorFormat: SlixError = 2;
pub const SlixError_SlixErrorNotSupported: SlixError = 3;
pub const SlixError_SlixErrorInternal: SlixError = 4;
pub const SlixError_SlixErrorWrongPassword: SlixError = 5;
pub const SlixError_SlixErrorUidMismatch: SlixError = 6;
pub const SlixError_SlixErrorUnknown: SlixError = 7;
pub type SlixError = core::ffi::c_uchar;
pub const SlixType_SlixTypeSlix: SlixType = 0;
pub const SlixType_SlixTypeSlixS: SlixType = 1;
pub const SlixType_SlixTypeSlixL: SlixType = 2;
pub const SlixType_SlixTypeSlix2: SlixType = 3;
pub const SlixType_SlixTypeCount: SlixType = 4;
pub const SlixType_SlixTypeUnknown: SlixType = 5;
pub type SlixType = core::ffi::c_uchar;
pub const SlixPasswordType_SlixPasswordTypeRead: SlixPasswordType = 0;
pub const SlixPasswordType_SlixPasswordTypeWrite: SlixPasswordType = 1;
pub const SlixPasswordType_SlixPasswordTypePrivacy: SlixPasswordType = 2;
pub const SlixPasswordType_SlixPasswordTypeDestroy: SlixPasswordType = 3;
pub const SlixPasswordType_SlixPasswordTypeEasAfi: SlixPasswordType = 4;
pub const SlixPasswordType_SlixPasswordTypeCount: SlixPasswordType = 5;
pub type SlixPasswordType = core::ffi::c_uchar;
pub type SlixPassword = u32;
pub type SlixSignature = [u8; 32usize];
pub type SlixPrivacy = bool;
pub type SlixRandomNumber = u16;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SlixProtection {
pub pointer: u8,
pub condition: u8,
}
#[test]
fn bindgen_test_layout_SlixProtection() {
const UNINIT: ::core::mem::MaybeUninit<SlixProtection> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SlixProtection>(),
2usize,
concat!("Size of: ", stringify!(SlixProtection))
);
assert_eq!(
::core::mem::align_of::<SlixProtection>(),
1usize,
concat!("Alignment of ", stringify!(SlixProtection))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pointer) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SlixProtection),
"::",
stringify!(pointer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).condition) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(SlixProtection),
"::",
stringify!(condition)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SlixLockBits {
pub eas: bool,
pub ppl: bool,
}
#[test]
fn bindgen_test_layout_SlixLockBits() {
const UNINIT: ::core::mem::MaybeUninit<SlixLockBits> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SlixLockBits>(),
2usize,
concat!("Size of: ", stringify!(SlixLockBits))
);
assert_eq!(
::core::mem::align_of::<SlixLockBits>(),
1usize,
concat!("Alignment of ", stringify!(SlixLockBits))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).eas) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SlixLockBits),
"::",
stringify!(eas)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ppl) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(SlixLockBits),
"::",
stringify!(ppl)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SlixSystemInfo {
pub protection: SlixProtection,
pub lock_bits: SlixLockBits,
}
#[test]
fn bindgen_test_layout_SlixSystemInfo() {
const UNINIT: ::core::mem::MaybeUninit<SlixSystemInfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SlixSystemInfo>(),
4usize,
concat!("Size of: ", stringify!(SlixSystemInfo))
);
assert_eq!(
::core::mem::align_of::<SlixSystemInfo>(),
1usize,
concat!("Alignment of ", stringify!(SlixSystemInfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protection) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SlixSystemInfo),
"::",
stringify!(protection)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).lock_bits) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(SlixSystemInfo),
"::",
stringify!(lock_bits)
)
);
}
pub const SlixCapabilities_SlixCapabilitiesDefault: SlixCapabilities = 0;
pub const SlixCapabilities_SlixCapabilitiesAcceptAllPasswords: SlixCapabilities = 1;
pub const SlixCapabilities_SlixCapabilitiesCount: SlixCapabilities = 2;
pub type SlixCapabilities = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SlixData {
pub iso15693_3_data: *mut Iso15693_3Data,
pub system_info: SlixSystemInfo,
pub signature: SlixSignature,
pub passwords: [SlixPassword; 5usize],
pub privacy: SlixPrivacy,
pub capabilities: SlixCapabilities,
}
#[test]
fn bindgen_test_layout_SlixData() {
const UNINIT: ::core::mem::MaybeUninit<SlixData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SlixData>(),
64usize,
concat!("Size of: ", stringify!(SlixData))
);
assert_eq!(
::core::mem::align_of::<SlixData>(),
4usize,
concat!("Alignment of ", stringify!(SlixData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iso15693_3_data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(iso15693_3_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).system_info) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(system_info)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).signature) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(signature)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).passwords) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(passwords)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).privacy) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(privacy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).capabilities) as usize - ptr as usize },
61usize,
concat!(
"Offset of field: ",
stringify!(SlixData),
"::",
stringify!(capabilities)
)
);
}
extern "C" {
pub fn slix_alloc() -> *mut SlixData;
}
extern "C" {
pub fn slix_free(data: *mut SlixData);
}
extern "C" {
pub fn slix_reset(data: *mut SlixData);
}
extern "C" {
pub fn slix_copy(data: *mut SlixData, other: *const SlixData);
}
extern "C" {
pub fn slix_verify(data: *mut SlixData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn slix_load(data: *mut SlixData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn slix_save(data: *const SlixData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn slix_is_equal(data: *const SlixData, other: *const SlixData) -> bool;
}
extern "C" {
pub fn slix_get_device_name(
data: *const SlixData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn slix_get_uid(data: *const SlixData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn slix_set_uid(data: *mut SlixData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn slix_get_base_data(data: *const SlixData) -> *const Iso15693_3Data;
}
extern "C" {
pub fn slix_get_type(data: *const SlixData) -> SlixType;
}
extern "C" {
pub fn slix_get_password(
data: *const SlixData,
password_type: SlixPasswordType,
) -> SlixPassword;
}
extern "C" {
pub fn slix_get_counter(data: *const SlixData) -> u16;
}
extern "C" {
pub fn slix_is_privacy_mode(data: *const SlixData) -> bool;
}
extern "C" {
pub fn slix_is_block_protected(
data: *const SlixData,
password_type: SlixPasswordType,
block_num: u8,
) -> bool;
}
extern "C" {
pub fn slix_is_counter_increment_protected(data: *const SlixData) -> bool;
}
extern "C" {
pub fn slix_type_has_features(slix_type: SlixType, features: SlixTypeFeatures) -> bool;
}
extern "C" {
pub fn slix_type_supports_password(
slix_type: SlixType,
password_type: SlixPasswordType,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SlixPoller {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Transmit and receive Slix frames in poller mode.\n\n Must ONLY be used inside the callback function.\n\n The rx_buffer will be filled with any data received as a response to data\n sent from tx_buffer, with a timeout defined by the fwt parameter.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `tx_buffer` (direction in) - pointer to the buffer containing the data to be transmitted.\n * `rx_buffer` (direction out) - pointer to the buffer to be filled with received data.\n * `fwt` (direction in) - frame wait time (response timeout), in carrier cycles.\n # Returns\n\nSlixErrorNone on success, an error code on failure."]
pub fn slix_poller_send_frame(
instance: *mut SlixPoller,
tx_data: *const BitBuffer,
rx_data: *mut BitBuffer,
fwt: u32,
) -> SlixError;
}
extern "C" {
#[doc = "Send get nxp system info command and parse response.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SlixSystemInfo structure to be filled.\n # Returns\n\nSlixErrorNone on success, an error code on failure."]
pub fn slix_poller_get_nxp_system_info(
instance: *mut SlixPoller,
data: *mut SlixSystemInfo,
) -> SlixError;
}
extern "C" {
#[doc = "Read signature from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SlixSignature structure to be filled.\n # Returns\n\nSlixErrorNone on success, an error code on failure."]
pub fn slix_poller_read_signature(
instance: *mut SlixPoller,
data: *mut SlixSignature,
) -> SlixError;
}
extern "C" {
#[doc = "Get random number from card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `data` (direction out) - pointer to the SlixRandomNumber structure to be filled.\n # Returns\n\nSlixErrorNone on success, an error code on failure."]
pub fn slix_poller_get_random_number(
instance: *mut SlixPoller,
data: *mut SlixRandomNumber,
) -> SlixError;
}
extern "C" {
#[doc = "Set password to card.\n\n Must ONLY be used inside the callback function.\n\n # Arguments\n\n* `instance` (direction in, out) - pointer to the instance to be used in the transaction.\n * `type` (direction in) - SlixPasswordType instance.\n * `password` (direction in) - SlixPassword instance.\n * `random_number` (direction in) - SlixRandomNumber instance.\n # Returns\n\nSlixErrorNone on success, an error code on failure."]
pub fn slix_poller_set_password(
instance: *mut SlixPoller,
type_: SlixPasswordType,
password: SlixPassword,
random_number: SlixRandomNumber,
) -> SlixError;
}
pub const St25tbError_St25tbErrorNone: St25tbError = 0;
pub const St25tbError_St25tbErrorNotPresent: St25tbError = 1;
pub const St25tbError_St25tbErrorColResFailed: St25tbError = 2;
pub const St25tbError_St25tbErrorBufferOverflow: St25tbError = 3;
pub const St25tbError_St25tbErrorCommunication: St25tbError = 4;
pub const St25tbError_St25tbErrorFieldOff: St25tbError = 5;
pub const St25tbError_St25tbErrorWrongCrc: St25tbError = 6;
pub const St25tbError_St25tbErrorTimeout: St25tbError = 7;
pub const St25tbError_St25tbErrorWriteFailed: St25tbError = 8;
pub type St25tbError = core::ffi::c_uchar;
pub const St25tbType_St25tbType512At: St25tbType = 0;
pub const St25tbType_St25tbType512Ac: St25tbType = 1;
pub const St25tbType_St25tbTypeX512: St25tbType = 2;
pub const St25tbType_St25tbType02k: St25tbType = 3;
pub const St25tbType_St25tbType04k: St25tbType = 4;
pub const St25tbType_St25tbTypeX4k: St25tbType = 5;
pub const St25tbType_St25tbTypeNum: St25tbType = 6;
pub type St25tbType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct St25tbData {
pub uid: [u8; 8usize],
pub type_: St25tbType,
pub blocks: [u32; 128usize],
pub system_otp_block: u32,
}
#[test]
fn bindgen_test_layout_St25tbData() {
const UNINIT: ::core::mem::MaybeUninit<St25tbData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<St25tbData>(),
528usize,
concat!("Size of: ", stringify!(St25tbData))
);
assert_eq!(
::core::mem::align_of::<St25tbData>(),
4usize,
concat!("Alignment of ", stringify!(St25tbData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(St25tbData),
"::",
stringify!(uid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(St25tbData),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(St25tbData),
"::",
stringify!(blocks)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).system_otp_block) as usize - ptr as usize },
524usize,
concat!(
"Offset of field: ",
stringify!(St25tbData),
"::",
stringify!(system_otp_block)
)
);
}
extern "C" {
pub fn st25tb_alloc() -> *mut St25tbData;
}
extern "C" {
pub fn st25tb_free(data: *mut St25tbData);
}
extern "C" {
pub fn st25tb_reset(data: *mut St25tbData);
}
extern "C" {
pub fn st25tb_copy(data: *mut St25tbData, other: *const St25tbData);
}
extern "C" {
pub fn st25tb_verify(data: *mut St25tbData, device_type: *const FuriString) -> bool;
}
extern "C" {
pub fn st25tb_load(data: *mut St25tbData, ff: *mut FlipperFormat, version: u32) -> bool;
}
extern "C" {
pub fn st25tb_save(data: *const St25tbData, ff: *mut FlipperFormat) -> bool;
}
extern "C" {
pub fn st25tb_is_equal(data: *const St25tbData, other: *const St25tbData) -> bool;
}
extern "C" {
pub fn st25tb_get_block_count(type_: St25tbType) -> u8;
}
extern "C" {
pub fn st25tb_get_device_name(
data: *const St25tbData,
name_type: NfcDeviceNameType,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn st25tb_get_uid(data: *const St25tbData, uid_len: *mut usize) -> *const u8;
}
extern "C" {
pub fn st25tb_set_uid(data: *mut St25tbData, uid: *const u8, uid_len: usize) -> bool;
}
extern "C" {
pub fn st25tb_get_base_data(data: *const St25tbData) -> *mut St25tbData;
}
extern "C" {
pub fn st25tb_get_type_from_uid(uid: *const u8) -> St25tbType;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct St25tbPoller {
_unused: [u8; 0],
}
extern "C" {
pub fn st25tb_poller_send_frame(
instance: *mut St25tbPoller,
tx_buffer: *const BitBuffer,
rx_buffer: *mut BitBuffer,
fwt: u32,
) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_initiate(instance: *mut St25tbPoller, chip_id_ptr: *mut u8)
-> St25tbError;
}
extern "C" {
pub fn st25tb_poller_select(instance: *mut St25tbPoller, chip_id_ptr: *mut u8) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_get_uid(instance: *mut St25tbPoller, uid: *mut u8) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_read_block(
instance: *mut St25tbPoller,
block: *mut u32,
block_number: u8,
) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_write_block(
instance: *mut St25tbPoller,
block: u32,
block_number: u8,
) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_halt(instance: *mut St25tbPoller) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_sync_read_block(
nfc: *mut Nfc,
block_num: u8,
block: *mut u32,
) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_sync_write_block(nfc: *mut Nfc, block_num: u8, block: u32) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_sync_detect_type(nfc: *mut Nfc, type_: *mut St25tbType) -> St25tbError;
}
extern "C" {
pub fn st25tb_poller_sync_read(nfc: *mut Nfc, data: *mut St25tbData) -> St25tbError;
}
extern "C" {
pub fn maxim_crc8(data: *const u8, data_size: u8, crc_init: u8) -> u8;
}
#[doc = "< Search for alarmed device"]
pub const OneWireHostSearchMode_OneWireHostSearchModeConditional: OneWireHostSearchMode = 0;
#[doc = "< Search for all devices"]
pub const OneWireHostSearchMode_OneWireHostSearchModeNormal: OneWireHostSearchMode = 1;
pub type OneWireHostSearchMode = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OneWireHost {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate OneWireHost instance\n # Arguments\n\n* `[in]` - gpio_pin connection pin\n # Returns\n\npointer to OneWireHost instance"]
pub fn onewire_host_alloc(gpio_pin: *const GpioPin) -> *mut OneWireHost;
}
extern "C" {
#[doc = "Destroy OneWireHost instance, free resources\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance"]
pub fn onewire_host_free(host: *mut OneWireHost);
}
extern "C" {
#[doc = "Reset the 1-Wire bus\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n # Returns\n\ntrue if presence was detected, false otherwise"]
pub fn onewire_host_reset(host: *mut OneWireHost) -> bool;
}
extern "C" {
#[doc = "Read one bit\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n # Returns\n\nreceived bit value"]
pub fn onewire_host_read_bit(host: *mut OneWireHost) -> bool;
}
extern "C" {
#[doc = "Read one byte\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n # Returns\n\nreceived byte value"]
pub fn onewire_host_read(host: *mut OneWireHost) -> u8;
}
extern "C" {
#[doc = "Read one or more bytes\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `[out]` - buffer received data buffer\n * `[in]` - count number of bytes to read"]
pub fn onewire_host_read_bytes(host: *mut OneWireHost, buffer: *mut u8, count: u16);
}
extern "C" {
#[doc = "Write one bit\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `value` - bit value to write"]
pub fn onewire_host_write_bit(host: *mut OneWireHost, value: bool);
}
extern "C" {
#[doc = "Write one byte\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `value` - byte value to write"]
pub fn onewire_host_write(host: *mut OneWireHost, value: u8);
}
extern "C" {
#[doc = "Write one or more bytes\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `[in]` - buffer pointer to the data to write\n * `[in]` - count size of the data to write"]
pub fn onewire_host_write_bytes(host: *mut OneWireHost, buffer: *const u8, count: u16);
}
extern "C" {
#[doc = "Start working with the bus\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance"]
pub fn onewire_host_start(host: *mut OneWireHost);
}
extern "C" {
#[doc = "Stop working with the bus\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance"]
pub fn onewire_host_stop(host: *mut OneWireHost);
}
extern "C" {
#[doc = "Reset previous search results\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance"]
pub fn onewire_host_reset_search(host: *mut OneWireHost);
}
extern "C" {
#[doc = "Set the family code to search for\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `[in]` - family_code device family code"]
pub fn onewire_host_target_search(host: *mut OneWireHost, family_code: u8);
}
extern "C" {
#[doc = "Search for devices on the 1-Wire bus\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `[out]` - new_addr pointer to the buffer to contain the unique ROM of the found device\n * `[in]` - mode search mode\n # Returns\n\ntrue on success, false otherwise"]
pub fn onewire_host_search(
host: *mut OneWireHost,
new_addr: *mut u8,
mode: OneWireHostSearchMode,
) -> bool;
}
extern "C" {
#[doc = "Enable overdrive mode\n # Arguments\n\n* `[in]` - host pointer to OneWireHost instance\n * `[in]` - set true to turn overdrive on, false to turn it off"]
pub fn onewire_host_set_overdrive(host: *mut OneWireHost, set: bool);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OneWireSlave {
_unused: [u8; 0],
}
pub type OneWireSlaveResetCallback = ::core::option::Option<
unsafe extern "C" fn(is_short: bool, context: *mut core::ffi::c_void) -> bool,
>;
pub type OneWireSlaveCommandCallback = ::core::option::Option<
unsafe extern "C" fn(command: u8, context: *mut core::ffi::c_void) -> bool,
>;
pub type OneWireSlaveResultCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Allocate OneWireSlave instance\n # Arguments\n\n* `[in]` - gpio_pin connection pin\n # Returns\n\npointer to OneWireSlave instance"]
pub fn onewire_slave_alloc(gpio_pin: *const GpioPin) -> *mut OneWireSlave;
}
extern "C" {
#[doc = "Destroy OneWireSlave instance, free resources\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance"]
pub fn onewire_slave_free(bus: *mut OneWireSlave);
}
extern "C" {
#[doc = "Start working with the bus\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance"]
pub fn onewire_slave_start(bus: *mut OneWireSlave);
}
extern "C" {
#[doc = "Stop working with the bus\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance"]
pub fn onewire_slave_stop(bus: *mut OneWireSlave);
}
extern "C" {
#[doc = "Receive one bit\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n # Returns\n\nreceived bit value"]
pub fn onewire_slave_receive_bit(bus: *mut OneWireSlave) -> bool;
}
extern "C" {
#[doc = "Send one bit\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - value bit value to send\n # Returns\n\ntrue on success, false on failure"]
pub fn onewire_slave_send_bit(bus: *mut OneWireSlave, value: bool) -> bool;
}
extern "C" {
#[doc = "Send one or more bytes of data\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - data pointer to the data to send\n * `[in]` - data_size size of the data to send\n # Returns\n\ntrue on success, false on failure"]
pub fn onewire_slave_send(bus: *mut OneWireSlave, data: *const u8, data_size: usize) -> bool;
}
extern "C" {
#[doc = "Receive one or more bytes of data\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[out]` - data pointer to the receive buffer\n * `[in]` - data_size number of bytes to receive\n # Returns\n\ntrue on success, false on failure"]
pub fn onewire_slave_receive(bus: *mut OneWireSlave, data: *mut u8, data_size: usize) -> bool;
}
extern "C" {
#[doc = "Enable overdrive mode\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - set true to turn overdrive on, false to turn it off"]
pub fn onewire_slave_set_overdrive(bus: *mut OneWireSlave, set: bool);
}
extern "C" {
#[doc = "Set a callback function to be called on each reset.\n The return value of the callback determines whether the emulated device\n supports the short reset (passed as the is_short parameter).\n In most applications, it should also call onewire_slave_set_overdrive()\n to set the appropriate speed mode.\n\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - callback pointer to a callback function\n * `[in]` - context additional parameter to be passed to the callback"]
pub fn onewire_slave_set_reset_callback(
bus: *mut OneWireSlave,
callback: OneWireSlaveResetCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Set a callback function to be called on each command.\n The return value of the callback determines whether further operation\n is possible. As a rule of thumb, return true unless a critical error happened.\n\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - callback pointer to a callback function\n * `[in]` - context additional parameter to be passed to the callback"]
pub fn onewire_slave_set_command_callback(
bus: *mut OneWireSlave,
callback: OneWireSlaveCommandCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Set a callback to report emulation success\n # Arguments\n\n* `[in]` - bus pointer to OneWireSlave instance\n * `[in]` - result_cb pointer to a callback function\n * `[in]` - context additional parameter to be passed to the callback"]
pub fn onewire_slave_set_result_callback(
bus: *mut OneWireSlave,
result_cb: OneWireSlaveResultCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn __wrap_printf(format: *const core::ffi::c_char, ...) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_vsnprintf(
str_: *mut core::ffi::c_char,
size: usize,
format: *const core::ffi::c_char,
args: va_list,
) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_puts(str_: *const core::ffi::c_char) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_putchar(ch: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_putc(ch: core::ffi::c_int, stream: *mut FILE) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_snprintf(
str_: *mut core::ffi::c_char,
size: usize,
format: *const core::ffi::c_char,
...
) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap_fflush(stream: *mut FILE) -> core::ffi::c_int;
}
extern "C" {
pub fn __wrap___assert(
file: *const core::ffi::c_char,
line: core::ffi::c_int,
e: *const core::ffi::c_char,
) -> !;
}
extern "C" {
pub fn __wrap___assert_func(
file: *const core::ffi::c_char,
line: core::ffi::c_int,
func: *const core::ffi::c_char,
e: *const core::ffi::c_char,
) -> !;
}
pub const SignalReaderEventType_SignalReaderEventTypeHalfBufferFilled: SignalReaderEventType = 0;
pub const SignalReaderEventType_SignalReaderEventTypeFullBufferFilled: SignalReaderEventType = 1;
pub type SignalReaderEventType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SignalReaderEventData {
pub data: *mut u8,
pub len: usize,
}
#[test]
fn bindgen_test_layout_SignalReaderEventData() {
const UNINIT: ::core::mem::MaybeUninit<SignalReaderEventData> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SignalReaderEventData>(),
8usize,
concat!("Size of: ", stringify!(SignalReaderEventData))
);
assert_eq!(
::core::mem::align_of::<SignalReaderEventData>(),
4usize,
concat!("Alignment of ", stringify!(SignalReaderEventData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SignalReaderEventData),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).len) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SignalReaderEventData),
"::",
stringify!(len)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SignalReaderEvent {
pub type_: SignalReaderEventType,
pub data: *mut SignalReaderEventData,
}
#[test]
fn bindgen_test_layout_SignalReaderEvent() {
const UNINIT: ::core::mem::MaybeUninit<SignalReaderEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SignalReaderEvent>(),
8usize,
concat!("Size of: ", stringify!(SignalReaderEvent))
);
assert_eq!(
::core::mem::align_of::<SignalReaderEvent>(),
4usize,
concat!("Alignment of ", stringify!(SignalReaderEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SignalReaderEvent),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SignalReaderEvent),
"::",
stringify!(data)
)
);
}
pub const SignalReaderTimeUnit_SignalReaderTimeUnit64Mhz: SignalReaderTimeUnit = 0;
pub type SignalReaderTimeUnit = core::ffi::c_uchar;
pub const SignalReaderPolarity_SignalReaderPolarityNormal: SignalReaderPolarity = 0;
pub const SignalReaderPolarity_SignalReaderPolarityInverted: SignalReaderPolarity = 1;
pub type SignalReaderPolarity = core::ffi::c_uchar;
pub const SignalReaderTrigger_SignalReaderTriggerNone: SignalReaderTrigger = 0;
pub const SignalReaderTrigger_SignalReaderTriggerRisingFallingEdge: SignalReaderTrigger = 1;
pub type SignalReaderTrigger = core::ffi::c_uchar;
pub type SignalReaderCallback = ::core::option::Option<
unsafe extern "C" fn(event: SignalReaderEvent, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SignalReader {
_unused: [u8; 0],
}
extern "C" {
pub fn signal_reader_alloc(gpio_pin: *const GpioPin, size: u32) -> *mut SignalReader;
}
extern "C" {
pub fn signal_reader_free(instance: *mut SignalReader);
}
extern "C" {
pub fn signal_reader_set_pull(instance: *mut SignalReader, pull: GpioPull);
}
extern "C" {
pub fn signal_reader_set_polarity(instance: *mut SignalReader, polarity: SignalReaderPolarity);
}
extern "C" {
pub fn signal_reader_set_sample_rate(
instance: *mut SignalReader,
time_unit: SignalReaderTimeUnit,
time: u32,
);
}
extern "C" {
pub fn signal_reader_set_trigger(instance: *mut SignalReader, trigger: SignalReaderTrigger);
}
extern "C" {
pub fn signal_reader_start(
instance: *mut SignalReader,
callback: SignalReaderCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn signal_reader_stop(instance: *mut SignalReader);
}
#[doc = "Structure definition of some features of COMP instance."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_COMP_InitTypeDef {
#[doc = "< Set comparator operating mode to adjust power and speed.\nThis parameter can be a value of COMP_LL_EC_POWERMODE\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetPowerMode()."]
pub PowerMode: u32,
#[doc = "< Set comparator input plus (non-inverting input).\nThis parameter can be a value of COMP_LL_EC_INPUT_PLUS\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetInputPlus()."]
pub InputPlus: u32,
#[doc = "< Set comparator input minus (inverting input).\nThis parameter can be a value of COMP_LL_EC_INPUT_MINUS\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetInputMinus()."]
pub InputMinus: u32,
#[doc = "< Set comparator hysteresis mode of the input minus.\nThis parameter can be a value of COMP_LL_EC_INPUT_HYSTERESIS\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetInputHysteresis()."]
pub InputHysteresis: u32,
#[doc = "< Set comparator output polarity.\nThis parameter can be a value of COMP_LL_EC_OUTPUT_POLARITY\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetOutputPolarity()."]
pub OutputPolarity: u32,
#[doc = "< Set comparator blanking source.\nThis parameter can be a value of COMP_LL_EC_OUTPUT_BLANKING_SOURCE\n\nThis feature can be modified afterwards using unitary function LL_COMP_SetOutputBlankingSource()."]
pub OutputBlankingSource: u32,
}
#[test]
fn bindgen_test_layout_LL_COMP_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_COMP_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_COMP_InitTypeDef>(),
24usize,
concat!("Size of: ", stringify!(LL_COMP_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_COMP_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_COMP_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PowerMode) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(PowerMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).InputPlus) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(InputPlus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).InputMinus) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(InputMinus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).InputHysteresis) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(InputHysteresis)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OutputPolarity) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(OutputPolarity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OutputBlankingSource) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_COMP_InitTypeDef),
"::",
stringify!(OutputBlankingSource)
)
);
}
extern "C" {
pub fn LL_COMP_Init(
COMPx: *mut COMP_TypeDef,
COMP_InitStruct: *const LL_COMP_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "DMA_LL_ES_INIT DMA Exported Init structure\n # "]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_DMA_InitTypeDef {
#[doc = "< Specifies the peripheral base address for DMA transfer\nor as Source base address in case of memory to memory transfer direction.\n\nThis parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF."]
pub PeriphOrM2MSrcAddress: u32,
#[doc = "< Specifies the memory base address for DMA transfer\nor as Destination base address in case of memory to memory transfer direction.\n\nThis parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF."]
pub MemoryOrM2MDstAddress: u32,
#[doc = "< Specifies if the data will be transferred from memory to peripheral,\nfrom memory to memory or from peripheral to memory.\nThis parameter can be a value of DMA_LL_EC_DIRECTION\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetDataTransferDirection()."]
pub Direction: u32,
#[doc = "< Specifies the normal or circular operation mode.\nThis parameter can be a value of DMA_LL_EC_MODE\nThe circular buffer mode cannot be used if the memory to memory\ndata transfer direction is configured on the selected Channel\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetMode()."]
pub Mode: u32,
#[doc = "< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction\nis incremented or not.\nThis parameter can be a value of DMA_LL_EC_PERIPH\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetPeriphIncMode()."]
pub PeriphOrM2MSrcIncMode: u32,
#[doc = "< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction\nis incremented or not.\nThis parameter can be a value of DMA_LL_EC_MEMORY\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetMemoryIncMode()."]
pub MemoryOrM2MDstIncMode: u32,
#[doc = "< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word)\nin case of memory to memory transfer direction.\nThis parameter can be a value of DMA_LL_EC_PDATAALIGN\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetPeriphSize()."]
pub PeriphOrM2MSrcDataSize: u32,
#[doc = "< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word)\nin case of memory to memory transfer direction.\nThis parameter can be a value of DMA_LL_EC_MDATAALIGN\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetMemorySize()."]
pub MemoryOrM2MDstDataSize: u32,
#[doc = "< Specifies the number of data to transfer, in data unit.\nThe data unit is equal to the source buffer configuration set in PeripheralSize\nor MemorySize parameters depending in the transfer direction.\nThis parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetDataLength()."]
pub NbData: u32,
#[doc = "< Specifies the peripheral request.\nThis parameter can be a value of DMAMUX_LL_EC_REQUEST\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetPeriphRequest()."]
pub PeriphRequest: u32,
#[doc = "< Specifies the channel priority level.\nThis parameter can be a value of DMA_LL_EC_PRIORITY\n\nThis feature can be modified afterwards using unitary function LL_DMA_SetChannelPriorityLevel()."]
pub Priority: u32,
}
#[test]
fn bindgen_test_layout_LL_DMA_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_DMA_InitTypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_DMA_InitTypeDef>(),
44usize,
concat!("Size of: ", stringify!(LL_DMA_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_DMA_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_DMA_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PeriphOrM2MSrcAddress) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(PeriphOrM2MSrcAddress)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemoryOrM2MDstAddress) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(MemoryOrM2MDstAddress)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Direction) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(Direction)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Mode) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(Mode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PeriphOrM2MSrcIncMode) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(PeriphOrM2MSrcIncMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemoryOrM2MDstIncMode) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(MemoryOrM2MDstIncMode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PeriphOrM2MSrcDataSize) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(PeriphOrM2MSrcDataSize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).MemoryOrM2MDstDataSize) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(MemoryOrM2MDstDataSize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).NbData) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(NbData)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PeriphRequest) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(PeriphRequest)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Priority) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(LL_DMA_InitTypeDef),
"::",
stringify!(Priority)
)
);
}
extern "C" {
#[doc = "DMA_LL_EF_Init Initialization and de-initialization functions\n # "]
pub fn LL_DMA_Init(
DMAx: *mut DMA_TypeDef,
Channel: u32,
DMA_InitStruct: *mut LL_DMA_InitTypeDef,
) -> ErrorStatus;
}
extern "C" {
pub fn LL_DMA_DeInit(DMAx: *mut DMA_TypeDef, Channel: u32) -> ErrorStatus;
}
#[doc = "LPTIM Init structure definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_LPTIM_InitTypeDef {
#[doc = "< Specifies the source of the clock used by the LPTIM instance.\nThis parameter can be a value of LPTIM_LL_EC_CLK_SOURCE.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPTIM_SetClockSource()."]
pub ClockSource: u32,
#[doc = "< Specifies the prescaler division ratio.\nThis parameter can be a value of LPTIM_LL_EC_PRESCALER.\n\nThis feature can be modified afterwards using using unitary\nfunction LL_LPTIM_SetPrescaler()."]
pub Prescaler: u32,
#[doc = "< Specifies the waveform shape.\nThis parameter can be a value of LPTIM_LL_EC_OUTPUT_WAVEFORM.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPTIM_ConfigOutput()."]
pub Waveform: u32,
#[doc = "< Specifies waveform polarity.\nThis parameter can be a value of LPTIM_LL_EC_OUTPUT_POLARITY.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPTIM_ConfigOutput()."]
pub Polarity: u32,
}
#[test]
fn bindgen_test_layout_LL_LPTIM_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_LPTIM_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_LPTIM_InitTypeDef>(),
16usize,
concat!("Size of: ", stringify!(LL_LPTIM_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_LPTIM_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_LPTIM_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ClockSource) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_LPTIM_InitTypeDef),
"::",
stringify!(ClockSource)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Prescaler) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_LPTIM_InitTypeDef),
"::",
stringify!(Prescaler)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Waveform) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_LPTIM_InitTypeDef),
"::",
stringify!(Waveform)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Polarity) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_LPTIM_InitTypeDef),
"::",
stringify!(Polarity)
)
);
}
extern "C" {
#[doc = "LPTIM_LL_EF_Init Initialisation and deinitialisation functions\n # "]
pub fn LL_LPTIM_DeInit(LPTIMx: *mut LPTIM_TypeDef) -> ErrorStatus;
}
extern "C" {
pub fn LL_LPTIM_Init(
LPTIMx: *mut LPTIM_TypeDef,
LPTIM_InitStruct: *const LL_LPTIM_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "LL LPUART Init Structure definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_LPUART_InitTypeDef {
#[doc = "< Specifies the Prescaler to compute the communication baud rate.\nThis parameter can be a value of LPUART_LL_EC_PRESCALER.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetPrescaler()."]
pub PrescalerValue: u32,
#[doc = "< This field defines expected LPUART communication baud rate.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetBaudRate()."]
pub BaudRate: u32,
#[doc = "< Specifies the number of data bits transmitted or received in a frame.\nThis parameter can be a value of LPUART_LL_EC_DATAWIDTH.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetDataWidth()."]
pub DataWidth: u32,
#[doc = "< Specifies the number of stop bits transmitted.\nThis parameter can be a value of LPUART_LL_EC_STOPBITS.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetStopBitsLength()."]
pub StopBits: u32,
#[doc = "< Specifies the parity mode.\nThis parameter can be a value of LPUART_LL_EC_PARITY.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetParity()."]
pub Parity: u32,
#[doc = "< Specifies whether the Receive and/or Transmit mode is enabled or disabled.\nThis parameter can be a value of LPUART_LL_EC_DIRECTION.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetTransferDirection()."]
pub TransferDirection: u32,
#[doc = "< Specifies whether the hardware flow control mode is enabled or disabled.\nThis parameter can be a value of LPUART_LL_EC_HWCONTROL.\n\nThis feature can be modified afterwards using unitary\nfunction LL_LPUART_SetHWFlowCtrl()."]
pub HardwareFlowControl: u32,
}
#[test]
fn bindgen_test_layout_LL_LPUART_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_LPUART_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_LPUART_InitTypeDef>(),
28usize,
concat!("Size of: ", stringify!(LL_LPUART_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_LPUART_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_LPUART_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PrescalerValue) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(PrescalerValue)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BaudRate) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(BaudRate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DataWidth) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(DataWidth)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).StopBits) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(StopBits)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Parity) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(Parity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TransferDirection) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(TransferDirection)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).HardwareFlowControl) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_LPUART_InitTypeDef),
"::",
stringify!(HardwareFlowControl)
)
);
}
extern "C" {
pub fn LL_LPUART_Init(
LPUARTx: *mut USART_TypeDef,
LPUART_InitStruct: *const LL_LPUART_InitTypeDef,
) -> ErrorStatus;
}
#[doc = "RTC Init structures definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_RTC_InitTypeDef {
#[doc = "< Specifies the RTC Hours Format.\nThis parameter can be a value of RTC_LL_EC_HOURFORMAT\n\nThis feature can be modified afterwards using unitary function\nLL_RTC_SetHourFormat()."]
pub HourFormat: u32,
#[doc = "< Specifies the RTC Asynchronous Predivider value.\nThis parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F\n\nThis feature can be modified afterwards using unitary function\nLL_RTC_SetAsynchPrescaler()."]
pub AsynchPrescaler: u32,
#[doc = "< Specifies the RTC Synchronous Predivider value.\nThis parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF\n\nThis feature can be modified afterwards using unitary function\nLL_RTC_SetSynchPrescaler()."]
pub SynchPrescaler: u32,
}
#[test]
fn bindgen_test_layout_LL_RTC_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_RTC_InitTypeDef> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_RTC_InitTypeDef>(),
12usize,
concat!("Size of: ", stringify!(LL_RTC_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_RTC_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_RTC_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).HourFormat) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_RTC_InitTypeDef),
"::",
stringify!(HourFormat)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).AsynchPrescaler) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_RTC_InitTypeDef),
"::",
stringify!(AsynchPrescaler)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).SynchPrescaler) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_RTC_InitTypeDef),
"::",
stringify!(SynchPrescaler)
)
);
}
extern "C" {
pub fn LL_RTC_Init(
RTCx: *mut RTC_TypeDef,
RTC_InitStruct: *mut LL_RTC_InitTypeDef,
) -> ErrorStatus;
}
extern "C" {
pub fn LL_RTC_EnterInitMode(RTCx: *mut RTC_TypeDef) -> ErrorStatus;
}
#[doc = "LL USART Init Structure definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LL_USART_InitTypeDef {
#[doc = "< Specifies the Prescaler to compute the communication baud rate.\nThis parameter can be a value of USART_LL_EC_PRESCALER.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetPrescaler()."]
pub PrescalerValue: u32,
#[doc = "< This field defines expected Usart communication baud rate.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetBaudRate()."]
pub BaudRate: u32,
#[doc = "< Specifies the number of data bits transmitted or received in a frame.\nThis parameter can be a value of USART_LL_EC_DATAWIDTH.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetDataWidth()."]
pub DataWidth: u32,
#[doc = "< Specifies the number of stop bits transmitted.\nThis parameter can be a value of USART_LL_EC_STOPBITS.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetStopBitsLength()."]
pub StopBits: u32,
#[doc = "< Specifies the parity mode.\nThis parameter can be a value of USART_LL_EC_PARITY.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetParity()."]
pub Parity: u32,
#[doc = "< Specifies whether the Receive and/or Transmit mode is enabled or disabled.\nThis parameter can be a value of USART_LL_EC_DIRECTION.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetTransferDirection()."]
pub TransferDirection: u32,
#[doc = "< Specifies whether the hardware flow control mode is enabled or disabled.\nThis parameter can be a value of USART_LL_EC_HWCONTROL.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetHWFlowCtrl()."]
pub HardwareFlowControl: u32,
#[doc = "< Specifies whether USART oversampling mode is 16 or 8.\nThis parameter can be a value of USART_LL_EC_OVERSAMPLING.\n\nThis feature can be modified afterwards using unitary\nfunction LL_USART_SetOverSampling()."]
pub OverSampling: u32,
}
#[test]
fn bindgen_test_layout_LL_USART_InitTypeDef() {
const UNINIT: ::core::mem::MaybeUninit<LL_USART_InitTypeDef> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<LL_USART_InitTypeDef>(),
32usize,
concat!("Size of: ", stringify!(LL_USART_InitTypeDef))
);
assert_eq!(
::core::mem::align_of::<LL_USART_InitTypeDef>(),
4usize,
concat!("Alignment of ", stringify!(LL_USART_InitTypeDef))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).PrescalerValue) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(PrescalerValue)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).BaudRate) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(BaudRate)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).DataWidth) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(DataWidth)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).StopBits) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(StopBits)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Parity) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(Parity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).TransferDirection) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(TransferDirection)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).HardwareFlowControl) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(HardwareFlowControl)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).OverSampling) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(LL_USART_InitTypeDef),
"::",
stringify!(OverSampling)
)
);
}
extern "C" {
pub fn LL_USART_Init(
USARTx: *mut USART_TypeDef,
USART_InitStruct: *const LL_USART_InitTypeDef,
) -> ErrorStatus;
}
extern "C" {
#[doc = "UTILS_EF_SYSTEM SYSTEM\n # "]
pub fn LL_SetSystemCoreClock(HCLKFrequency: u32);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzBlockDecoder {
pub parser_step: u32,
pub te_last: u32,
pub decode_data: u64,
pub decode_count_bit: u8,
}
#[test]
fn bindgen_test_layout_SubGhzBlockDecoder() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzBlockDecoder> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzBlockDecoder>(),
24usize,
concat!("Size of: ", stringify!(SubGhzBlockDecoder))
);
assert_eq!(
::core::mem::align_of::<SubGhzBlockDecoder>(),
8usize,
concat!("Alignment of ", stringify!(SubGhzBlockDecoder))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).parser_step) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockDecoder),
"::",
stringify!(parser_step)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).te_last) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockDecoder),
"::",
stringify!(te_last)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).decode_data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockDecoder),
"::",
stringify!(decode_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).decode_count_bit) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockDecoder),
"::",
stringify!(decode_count_bit)
)
);
}
extern "C" {
#[doc = "Add data bit when decoding.\n # Arguments\n\n* `decoder` - Pointer to a SubGhzBlockDecoder instance\n * `bit` - data, 1bit"]
pub fn subghz_protocol_blocks_add_bit(decoder: *mut SubGhzBlockDecoder, bit: u8);
}
extern "C" {
#[doc = "Add data to_128 bit when decoding.\n # Arguments\n\n* `decoder` - Pointer to a SubGhzBlockDecoder instance\n * `head_64_bit` - Pointer to a head_64_bit\n * `bit` - data, 1bit"]
pub fn subghz_protocol_blocks_add_to_128_bit(
decoder: *mut SubGhzBlockDecoder,
bit: u8,
head_64_bit: *mut u64,
);
}
extern "C" {
#[doc = "Getting the hash sum of the last randomly received parcel.\n # Arguments\n\n* `decoder` - Pointer to a SubGhzBlockDecoder instance\n # Returns\n\nhash Hash sum"]
pub fn subghz_protocol_blocks_get_hash_data(decoder: *mut SubGhzBlockDecoder, len: usize)
-> u8;
}
pub const SubGhzProtocolBlockAlignBit_SubGhzProtocolBlockAlignBitLeft: SubGhzProtocolBlockAlignBit =
0;
pub const SubGhzProtocolBlockAlignBit_SubGhzProtocolBlockAlignBitRight:
SubGhzProtocolBlockAlignBit = 1;
pub type SubGhzProtocolBlockAlignBit = core::ffi::c_uchar;
extern "C" {
#[doc = "Set data bit when encoding HEX array.\n # Arguments\n\n* `bit_value` - The value of the bit to be set\n * `data_array` - Pointer to a HEX array\n * `set_index_bit` - Number set a bit in the array starting from the left\n * `max_size_array` - array size, check not to overflow"]
pub fn subghz_protocol_blocks_set_bit_array(
bit_value: bool,
data_array: *mut u8,
set_index_bit: usize,
max_size_array: usize,
);
}
extern "C" {
#[doc = "Get data bit when encoding HEX array.\n # Arguments\n\n* `data_array` - Pointer to a HEX array\n * `read_index_bit` - Number get a bit in the array starting from the left\n # Returns\n\nbool value bit"]
pub fn subghz_protocol_blocks_get_bit_array(data_array: *mut u8, read_index_bit: usize)
-> bool;
}
extern "C" {
#[doc = "Generating an upload from data.\n # Arguments\n\n* `data_array` - Pointer to a HEX array\n * `count_bit_data_array` - How many bits in the array are processed\n * `upload` - Pointer to a LevelDuration\n * `max_size_upload` - upload size, check not to overflow\n * `duration_bit` - duration 1 bit\n * `align_bit` - alignment of useful bits in an array"]
pub fn subghz_protocol_blocks_get_upload_from_bit_array(
data_array: *mut u8,
count_bit_data_array: usize,
upload: *mut LevelDuration,
max_size_upload: usize,
duration_bit: u32,
align_bit: SubGhzProtocolBlockAlignBit,
) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzEnvironment {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolRegistry {
pub items: *mut *const SubGhzProtocol,
pub size: usize,
}
#[test]
fn bindgen_test_layout_SubGhzProtocolRegistry() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocolRegistry> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocolRegistry>(),
8usize,
concat!("Size of: ", stringify!(SubGhzProtocolRegistry))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocolRegistry>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocolRegistry))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).items) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolRegistry),
"::",
stringify!(items)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolRegistry),
"::",
stringify!(size)
)
);
}
extern "C" {
#[doc = "Registration by name SubGhzProtocol.\n # Arguments\n\n* `protocol_registry` - SubGhzProtocolRegistry\n * `name` - Protocol name\n # Returns\n\nSubGhzProtocol* pointer to a SubGhzProtocol instance"]
pub fn subghz_protocol_registry_get_by_name(
protocol_registry: *const SubGhzProtocolRegistry,
name: *const core::ffi::c_char,
) -> *const SubGhzProtocol;
}
extern "C" {
#[doc = "Registration protocol by index in array SubGhzProtocol.\n # Arguments\n\n* `protocol_registry` - SubGhzProtocolRegistry\n * `index` - Protocol by index in array\n # Returns\n\nSubGhzProtocol* pointer to a SubGhzProtocol instance"]
pub fn subghz_protocol_registry_get_by_index(
protocol_registry: *const SubGhzProtocolRegistry,
index: usize,
) -> *const SubGhzProtocol;
}
extern "C" {
#[doc = "Getting the number of registered protocols.\n # Arguments\n\n* `protocol_registry` - SubGhzProtocolRegistry\n # Returns\n\nNumber of protocols"]
pub fn subghz_protocol_registry_count(
protocol_registry: *const SubGhzProtocolRegistry,
) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzKeystore {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate SubGhzEnvironment.\n # Returns\n\nSubGhzEnvironment* pointer to a SubGhzEnvironment instance"]
pub fn subghz_environment_alloc() -> *mut SubGhzEnvironment;
}
extern "C" {
#[doc = "Free SubGhzEnvironment.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance"]
pub fn subghz_environment_free(instance: *mut SubGhzEnvironment);
}
extern "C" {
#[doc = "Downloading the manufacture key file.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `filename` - Full path to the file\n # Returns\n\ntrue On success"]
pub fn subghz_environment_load_keystore(
instance: *mut SubGhzEnvironment,
filename: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Get pointer to a SubGhzKeystore* instance.\n # Returns\n\nSubGhzEnvironment* pointer to a SubGhzEnvironment instance"]
pub fn subghz_environment_get_keystore(instance: *mut SubGhzEnvironment)
-> *mut SubGhzKeystore;
}
extern "C" {
#[doc = "Set filename to work with Came Atomo.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `filename` - Full path to the file"]
pub fn subghz_environment_set_came_atomo_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
filename: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Get filename to work with Came Atomo.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nFull path to the file"]
pub fn subghz_environment_get_came_atomo_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Set filename to work with Alutech at-4n.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `filename` - Full path to the file"]
pub fn subghz_environment_set_alutech_at_4n_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
filename: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Get filename to work with Alutech at-4n.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nFull path to the file"]
pub fn subghz_environment_get_alutech_at_4n_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Set filename to work with Nice Flor-S.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `filename` - Full path to the file"]
pub fn subghz_environment_set_nice_flor_s_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
filename: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Get filename to work with Nice Flor-S.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nFull path to the file"]
pub fn subghz_environment_get_nice_flor_s_rainbow_table_file_name(
instance: *mut SubGhzEnvironment,
) -> *const core::ffi::c_char;
}
extern "C" {
#[doc = "Set list of protocols to work.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `protocol_registry_items` - Pointer to a SubGhzProtocolRegistry"]
pub fn subghz_environment_set_protocol_registry(
instance: *mut SubGhzEnvironment,
protocol_registry_items: *const SubGhzProtocolRegistry,
);
}
extern "C" {
#[doc = "Get list of protocols to work.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nPointer to a SubGhzProtocolRegistry"]
pub fn subghz_environment_get_protocol_registry(
instance: *mut SubGhzEnvironment,
) -> *const SubGhzProtocolRegistry;
}
extern "C" {
#[doc = "Get list of protocols names.\n # Arguments\n\n* `instance` - Pointer to a SubGhzEnvironment instance\n * `idx` - index protocols\n # Returns\n\nPointer to a SubGhzProtocolRegistry"]
pub fn subghz_environment_get_protocol_name_registry(
instance: *mut SubGhzEnvironment,
idx: usize,
) -> *const core::ffi::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzRadioPreset {
pub name: *mut FuriString,
pub frequency: u32,
pub data: *mut u8,
pub data_size: usize,
}
#[test]
fn bindgen_test_layout_SubGhzRadioPreset() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzRadioPreset> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzRadioPreset>(),
16usize,
concat!("Size of: ", stringify!(SubGhzRadioPreset))
);
assert_eq!(
::core::mem::align_of::<SubGhzRadioPreset>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzRadioPreset))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzRadioPreset),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).frequency) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzRadioPreset),
"::",
stringify!(frequency)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzRadioPreset),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_size) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SubGhzRadioPreset),
"::",
stringify!(data_size)
)
);
}
pub const SubGhzProtocolStatus_SubGhzProtocolStatusOk: SubGhzProtocolStatus = 0;
#[doc = "< General unclassified error"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusError: SubGhzProtocolStatus = -1;
#[doc = "< Missing or invalid file header"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserHeader: SubGhzProtocolStatus = -2;
#[doc = "< Missing `Frequency`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserFrequency: SubGhzProtocolStatus = -3;
#[doc = "< Missing `Preset`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserPreset: SubGhzProtocolStatus = -4;
#[doc = "< Missing `Custom_preset_module`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserCustomPreset: SubGhzProtocolStatus =
-5;
#[doc = "< Missing `Protocol` name"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserProtocolName: SubGhzProtocolStatus =
-6;
#[doc = "< Missing `Bit`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserBitCount: SubGhzProtocolStatus = -7;
#[doc = "< Missing `Key`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserKey: SubGhzProtocolStatus = -8;
#[doc = "< Missing `Te`"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserTe: SubGhzProtocolStatus = -9;
#[doc = "< Missing some other mandatory keys"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorParserOthers: SubGhzProtocolStatus = -10;
#[doc = "< Invalid bit count value"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorValueBitCount: SubGhzProtocolStatus = -11;
#[doc = "< Payload encoder failure"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorEncoderGetUpload: SubGhzProtocolStatus =
-12;
#[doc = "< Protocol not found"]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusErrorProtocolNotFound: SubGhzProtocolStatus =
-13;
#[doc = "< Prevents enum down-size compiler optimization."]
pub const SubGhzProtocolStatus_SubGhzProtocolStatusReserved: SubGhzProtocolStatus = 2147483647;
pub type SubGhzProtocolStatus = core::ffi::c_int;
pub type SubGhzAlloc = ::core::option::Option<
unsafe extern "C" fn(environment: *mut SubGhzEnvironment) -> *mut core::ffi::c_void,
>;
pub type SubGhzFree = ::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub type SubGhzSerialize = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
preset: *mut SubGhzRadioPreset,
) -> SubGhzProtocolStatus,
>;
pub type SubGhzDeserialize = ::core::option::Option<
unsafe extern "C" fn(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus,
>;
pub type SubGhzDecoderFeed = ::core::option::Option<
unsafe extern "C" fn(decoder: *mut core::ffi::c_void, level: bool, duration: u32),
>;
pub type SubGhzDecoderReset =
::core::option::Option<unsafe extern "C" fn(decoder: *mut core::ffi::c_void)>;
pub type SubGhzGetHashData =
::core::option::Option<unsafe extern "C" fn(decoder: *mut core::ffi::c_void) -> u8>;
pub type SubGhzGetString = ::core::option::Option<
unsafe extern "C" fn(decoder: *mut core::ffi::c_void, output: *mut FuriString),
>;
pub type SubGhzEncoderStop =
::core::option::Option<unsafe extern "C" fn(encoder: *mut core::ffi::c_void)>;
pub type SubGhzEncoderYield =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void) -> LevelDuration>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolDecoder {
pub alloc: SubGhzAlloc,
pub free: SubGhzFree,
pub feed: SubGhzDecoderFeed,
pub reset: SubGhzDecoderReset,
pub get_hash_data: SubGhzGetHashData,
pub get_string: SubGhzGetString,
pub serialize: SubGhzSerialize,
pub deserialize: SubGhzDeserialize,
}
#[test]
fn bindgen_test_layout_SubGhzProtocolDecoder() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocolDecoder> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocolDecoder>(),
32usize,
concat!("Size of: ", stringify!(SubGhzProtocolDecoder))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocolDecoder>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocolDecoder))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(alloc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).free) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).feed) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(feed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reset) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(reset)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_hash_data) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(get_hash_data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).get_string) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(get_string)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).serialize) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(serialize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).deserialize) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoder),
"::",
stringify!(deserialize)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolEncoder {
pub alloc: SubGhzAlloc,
pub free: SubGhzFree,
pub deserialize: SubGhzDeserialize,
pub stop: SubGhzEncoderStop,
pub yield_: SubGhzEncoderYield,
}
#[test]
fn bindgen_test_layout_SubGhzProtocolEncoder() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocolEncoder> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocolEncoder>(),
20usize,
concat!("Size of: ", stringify!(SubGhzProtocolEncoder))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocolEncoder>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocolEncoder))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoder),
"::",
stringify!(alloc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).free) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoder),
"::",
stringify!(free)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).deserialize) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoder),
"::",
stringify!(deserialize)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).stop) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoder),
"::",
stringify!(stop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).yield_) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoder),
"::",
stringify!(yield_)
)
);
}
pub const SubGhzProtocolType_SubGhzProtocolTypeUnknown: SubGhzProtocolType = 0;
pub const SubGhzProtocolType_SubGhzProtocolTypeStatic: SubGhzProtocolType = 1;
pub const SubGhzProtocolType_SubGhzProtocolTypeDynamic: SubGhzProtocolType = 2;
pub const SubGhzProtocolType_SubGhzProtocolTypeRAW: SubGhzProtocolType = 3;
pub const SubGhzProtocolType_SubGhzProtocolWeatherStation: SubGhzProtocolType = 4;
pub const SubGhzProtocolType_SubGhzProtocolCustom: SubGhzProtocolType = 5;
pub type SubGhzProtocolType = core::ffi::c_uchar;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_RAW: SubGhzProtocolFlag = 1;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_Decodable: SubGhzProtocolFlag = 2;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_315: SubGhzProtocolFlag = 4;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_433: SubGhzProtocolFlag = 8;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_868: SubGhzProtocolFlag = 16;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_AM: SubGhzProtocolFlag = 32;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_FM: SubGhzProtocolFlag = 64;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_Save: SubGhzProtocolFlag = 128;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_Load: SubGhzProtocolFlag = 256;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_Send: SubGhzProtocolFlag = 512;
pub const SubGhzProtocolFlag_SubGhzProtocolFlag_BinRAW: SubGhzProtocolFlag = 1024;
pub type SubGhzProtocolFlag = core::ffi::c_ushort;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocol {
pub name: *const core::ffi::c_char,
pub type_: SubGhzProtocolType,
pub flag: SubGhzProtocolFlag,
pub encoder: *const SubGhzProtocolEncoder,
pub decoder: *const SubGhzProtocolDecoder,
}
#[test]
fn bindgen_test_layout_SubGhzProtocol() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocol> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocol>(),
16usize,
concat!("Size of: ", stringify!(SubGhzProtocol))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocol>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocol))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocol),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocol),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flag) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocol),
"::",
stringify!(flag)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).encoder) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocol),
"::",
stringify!(encoder)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).decoder) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocol),
"::",
stringify!(decoder)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzBlockGeneric {
pub protocol_name: *const core::ffi::c_char,
pub data: u64,
pub serial: u32,
pub data_count_bit: u16,
pub btn: u8,
pub cnt: u32,
}
#[test]
fn bindgen_test_layout_SubGhzBlockGeneric() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzBlockGeneric> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzBlockGeneric>(),
32usize,
concat!("Size of: ", stringify!(SubGhzBlockGeneric))
);
assert_eq!(
::core::mem::align_of::<SubGhzBlockGeneric>(),
8usize,
concat!("Alignment of ", stringify!(SubGhzBlockGeneric))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol_name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(protocol_name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).serial) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(serial)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_count_bit) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(data_count_bit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).btn) as usize - ptr as usize },
22usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(btn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(SubGhzBlockGeneric),
"::",
stringify!(cnt)
)
);
}
extern "C" {
#[doc = "Get name preset.\n # Arguments\n\n* `preset_name` - name preset\n * `preset_str` - Output name preset"]
pub fn subghz_block_generic_get_preset_name(
preset_name: *const core::ffi::c_char,
preset_str: *mut FuriString,
);
}
extern "C" {
#[doc = "Serialize data SubGhzBlockGeneric.\n # Arguments\n\n* `instance` - Pointer to a SubGhzBlockGeneric instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n * `preset` - The modulation on which the signal was received, SubGhzRadioPreset\n # Returns\n\nStatus Error"]
pub fn subghz_block_generic_serialize(
instance: *mut SubGhzBlockGeneric,
flipper_format: *mut FlipperFormat,
preset: *mut SubGhzRadioPreset,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Deserialize data SubGhzBlockGeneric.\n # Arguments\n\n* `instance` - Pointer to a SubGhzBlockGeneric instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n # Returns\n\nStatus Error"]
pub fn subghz_block_generic_deserialize(
instance: *mut SubGhzBlockGeneric,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Deserialize data SubGhzBlockGeneric.\n # Arguments\n\n* `instance` - Pointer to a SubGhzBlockGeneric instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n * `count_bit` - Count bit protocol\n # Returns\n\nStatus Error"]
pub fn subghz_block_generic_deserialize_check_count_bit(
instance: *mut SubGhzBlockGeneric,
flipper_format: *mut FlipperFormat,
count_bit: u16,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Flip the data bitwise\n\n # Arguments\n\n* `key` - In data\n * `bit_count` - number of data bits\n\n # Returns\n\nReverse data"]
pub fn subghz_protocol_blocks_reverse_key(key: u64, bit_count: u8) -> u64;
}
extern "C" {
#[doc = "Get parity the data bitwise\n\n # Arguments\n\n* `key` - In data\n * `bit_count` - number of data bits\n\n # Returns\n\nparity"]
pub fn subghz_protocol_blocks_get_parity(key: u64, bit_count: u8) -> u8;
}
extern "C" {
#[doc = "CRC-4\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - CRC polynomial\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc4(
message: *const u8,
size: usize,
polynomial: u8,
init: u8,
) -> u8;
}
extern "C" {
#[doc = "CRC-7\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - CRC polynomial\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc7(
message: *const u8,
size: usize,
polynomial: u8,
init: u8,
) -> u8;
}
extern "C" {
#[doc = "Generic Cyclic Redundancy Check CRC-8. Example polynomial: 0x31 = x8 + x5 +\n x4 + 1 (x8 is implicit) Example polynomial: 0x80 = x8 + x7 (a normal\n bit-by-bit parity XOR)\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - byte is from x^7 to x^0 (x^8 is implicitly one)\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc8(
message: *const u8,
size: usize,
polynomial: u8,
init: u8,
) -> u8;
}
extern "C" {
#[doc = "\"Little-endian\" Cyclic Redundancy Check CRC-8 LE Input and output are\n reflected, i.e. least significant bit is shifted in first\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - CRC polynomial\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc8le(
message: *const u8,
size: usize,
polynomial: u8,
init: u8,
) -> u8;
}
extern "C" {
#[doc = "CRC-16 LSB. Input and output are reflected, i.e. least significant bit is\n shifted in first. Note that poly and init already need to be reflected\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - CRC polynomial\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc16lsb(
message: *const u8,
size: usize,
polynomial: u16,
init: u16,
) -> u16;
}
extern "C" {
#[doc = "CRC-16\n\n # Arguments\n\n* `message` - array of bytes to check\n * `size` - number of bytes in message\n * `polynomial` - CRC polynomial\n * `init` - starting crc value\n\n # Returns\n\nCRC value"]
pub fn subghz_protocol_blocks_crc16(
message: *const u8,
size: usize,
polynomial: u16,
init: u16,
) -> u16;
}
extern "C" {
#[doc = "Digest-8 by \"LFSR-based Toeplitz hash\"\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to digest\n * `gen` - key stream generator, needs to includes the MSB if the\n LFSR is rolling\n * `key` - initial key\n\n # Returns\n\ndigest value"]
pub fn subghz_protocol_blocks_lfsr_digest8(
message: *const u8,
size: usize,
gen: u8,
key: u8,
) -> u8;
}
extern "C" {
#[doc = "Digest-8 by \"LFSR-based Toeplitz hash\", byte reflect, bit reflect\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to digest\n * `gen` - key stream generator, needs to includes the MSB if the\n LFSR is rolling\n * `key` - initial key\n\n # Returns\n\ndigest value"]
pub fn subghz_protocol_blocks_lfsr_digest8_reflect(
message: *const u8,
size: usize,
gen: u8,
key: u8,
) -> u8;
}
extern "C" {
#[doc = "Digest-16 by \"LFSR-based Toeplitz hash\"\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to digest\n * `gen` - key stream generator, needs to includes the MSB if the\n LFSR is rolling\n * `key` - initial key\n\n # Returns\n\ndigest value"]
pub fn subghz_protocol_blocks_lfsr_digest16(
message: *const u8,
size: usize,
gen: u16,
key: u16,
) -> u16;
}
extern "C" {
#[doc = "Compute Addition of a number of bytes\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to sum\n\n # Returns\n\nsummation value"]
pub fn subghz_protocol_blocks_add_bytes(message: *const u8, size: usize) -> u8;
}
extern "C" {
#[doc = "Compute bit parity of a single byte (8 bits)\n\n # Arguments\n\n* `byte` - single byte to check\n\n # Returns\n\n1 odd parity, 0 even parity"]
pub fn subghz_protocol_blocks_parity8(byte: u8) -> u8;
}
extern "C" {
#[doc = "Compute bit parity of a number of bytes\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to sum\n\n # Returns\n\n1 odd parity, 0 even parity"]
pub fn subghz_protocol_blocks_parity_bytes(message: *const u8, size: usize) -> u8;
}
extern "C" {
#[doc = "Compute XOR (byte-wide parity) of a number of bytes\n\n # Arguments\n\n* `message` - bytes of message data\n * `size` - number of bytes to sum\n\n # Returns\n\nsummation value, per bit-position 1 odd parity, 0 even parity"]
pub fn subghz_protocol_blocks_xor_bytes(message: *const u8, size: usize) -> u8;
}
extern "C" {
pub static subghz_device_cc1101_preset_ook_270khz_async_regs: [u8; 0usize];
}
extern "C" {
pub static subghz_device_cc1101_preset_ook_650khz_async_regs: [u8; 0usize];
}
extern "C" {
pub static subghz_device_cc1101_preset_2fsk_dev2_38khz_async_regs: [u8; 0usize];
}
extern "C" {
pub static subghz_device_cc1101_preset_2fsk_dev47_6khz_async_regs: [u8; 0usize];
}
extern "C" {
pub static subghz_device_cc1101_preset_msk_99_97kb_async_regs: [u8; 0usize];
}
extern "C" {
pub static subghz_device_cc1101_preset_gfsk_9_99kb_async_regs: [u8; 0usize];
}
extern "C" {
#[doc = "Key generation from simple data.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderSecPlus_v2 instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n * `serial` - Serial number, 32 bit\n * `btn` - Button number, 8 bit\n * `cnt` - Container value, 28 bit\n * `manufacture_name` - Name of manufacturer's key\n * `preset` - Modulation, SubGhzRadioPreset\n # Returns\n\ntrue On success"]
pub fn subghz_protocol_secplus_v2_create_data(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
serial: u32,
btn: u8,
cnt: u32,
preset: *mut SubGhzRadioPreset,
) -> bool;
}
extern "C" {
#[doc = "Key generation from simple data.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderKeeloq instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n * `serial` - Serial number, 28 bit\n * `btn` - Button number, 4 bit\n * `cnt` - Container value, 16 bit\n * `manufacture_name` - Name of manufacturer's key\n * `preset` - Modulation, SubGhzRadioPreset\n # Returns\n\ntrue On success"]
pub fn subghz_protocol_keeloq_create_data(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
serial: u32,
btn: u8,
cnt: u16,
manufacture_name: *const core::ffi::c_char,
preset: *mut SubGhzRadioPreset,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolDecoderBinRAW {
_unused: [u8; 0],
}
extern "C" {
pub fn subghz_protocol_decoder_bin_raw_data_input_rssi(
instance: *mut SubGhzProtocolDecoderBinRAW,
rssi: f32,
);
}
extern "C" {
#[doc = "Validation of fixed parts SubGhzProtocolDecoderSecPlus_v1.\n # Arguments\n\n* `fixed` - fixed parts\n # Returns\n\ntrue On success"]
pub fn subghz_protocol_secplus_v1_check_fixed(fixed: u32) -> bool;
}
pub type SubGhzProtocolDecoderBaseRxCallback = ::core::option::Option<
unsafe extern "C" fn(instance: *mut SubGhzProtocolDecoderBase, context: *mut core::ffi::c_void),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolDecoderBase {
pub protocol: *const SubGhzProtocol,
pub callback: SubGhzProtocolDecoderBaseRxCallback,
pub context: *mut core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_SubGhzProtocolDecoderBase() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocolDecoderBase> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocolDecoderBase>(),
12usize,
concat!("Size of: ", stringify!(SubGhzProtocolDecoderBase))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocolDecoderBase>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocolDecoderBase))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoderBase),
"::",
stringify!(protocol)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoderBase),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolDecoderBase),
"::",
stringify!(context)
)
);
}
extern "C" {
#[doc = "Getting a textual representation of the received data.\n # Arguments\n\n* `decoder_base` - Pointer to a SubGhzProtocolDecoderBase instance\n * `output` - Resulting text"]
pub fn subghz_protocol_decoder_base_get_string(
decoder_base: *mut SubGhzProtocolDecoderBase,
output: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Serialize data SubGhzProtocolDecoderBase.\n # Arguments\n\n* `decoder_base` - Pointer to a SubGhzProtocolDecoderBase instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n * `preset` - The modulation on which the signal was received, SubGhzRadioPreset\n # Returns\n\nStatus Error"]
pub fn subghz_protocol_decoder_base_serialize(
decoder_base: *mut SubGhzProtocolDecoderBase,
flipper_format: *mut FlipperFormat,
preset: *mut SubGhzRadioPreset,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Deserialize data SubGhzProtocolDecoderBase.\n # Arguments\n\n* `decoder_base` - Pointer to a SubGhzProtocolDecoderBase instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n # Returns\n\nStatus Error"]
pub fn subghz_protocol_decoder_base_deserialize(
decoder_base: *mut SubGhzProtocolDecoderBase,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Getting the hash sum of the last randomly received parcel.\n # Arguments\n\n* `decoder_base` - Pointer to a SubGhzProtocolDecoderBase instance\n # Returns\n\nhash Hash sum"]
pub fn subghz_protocol_decoder_base_get_hash_data(
decoder_base: *mut SubGhzProtocolDecoderBase,
) -> u8;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolEncoderBase {
pub protocol: *const SubGhzProtocol,
}
#[test]
fn bindgen_test_layout_SubGhzProtocolEncoderBase() {
const UNINIT: ::core::mem::MaybeUninit<SubGhzProtocolEncoderBase> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SubGhzProtocolEncoderBase>(),
4usize,
concat!("Size of: ", stringify!(SubGhzProtocolEncoderBase))
);
assert_eq!(
::core::mem::align_of::<SubGhzProtocolEncoderBase>(),
4usize,
concat!("Alignment of ", stringify!(SubGhzProtocolEncoderBase))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SubGhzProtocolEncoderBase),
"::",
stringify!(protocol)
)
);
}
pub type SubGhzProtocolEncoderRAWCallbackEnd =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolDecoderRAW {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzProtocolEncoderRAW {
_unused: [u8; 0],
}
extern "C" {
pub static subghz_protocol_raw_decoder: SubGhzProtocolDecoder;
}
extern "C" {
pub static subghz_protocol_raw_encoder: SubGhzProtocolEncoder;
}
extern "C" {
pub static subghz_protocol_raw: SubGhzProtocol;
}
extern "C" {
#[doc = "Open file for writing\n # Arguments\n\n* `instance` - Pointer to a SubGhzProtocolDecoderRAW instance\n * `dev_name` - File name\n * `preset` - The modulation on which the signal was received, SubGhzRadioPreset\n # Returns\n\ntrue On success"]
pub fn subghz_protocol_raw_save_to_file_init(
instance: *mut SubGhzProtocolDecoderRAW,
dev_name: *const core::ffi::c_char,
preset: *mut SubGhzRadioPreset,
) -> bool;
}
extern "C" {
#[doc = "Stop writing file to flash\n # Arguments\n\n* `instance` - Pointer to a SubGhzProtocolDecoderRAW instance"]
pub fn subghz_protocol_raw_save_to_file_stop(instance: *mut SubGhzProtocolDecoderRAW);
}
extern "C" {
#[doc = "Get the number of samples received SubGhzProtocolDecoderRAW.\n # Arguments\n\n* `instance` - Pointer to a SubGhzProtocolDecoderRAW instance\n # Returns\n\ncount of samples"]
pub fn subghz_protocol_raw_get_sample_write(instance: *mut SubGhzProtocolDecoderRAW) -> usize;
}
extern "C" {
#[doc = "Allocate SubGhzProtocolDecoderRAW.\n # Arguments\n\n* `environment` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nSubGhzProtocolDecoderRAW* pointer to a SubGhzProtocolDecoderRAW instance"]
pub fn subghz_protocol_decoder_raw_alloc(
environment: *mut SubGhzEnvironment,
) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Free SubGhzProtocolDecoderRAW.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolDecoderRAW instance"]
pub fn subghz_protocol_decoder_raw_free(context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Reset decoder SubGhzProtocolDecoderRAW.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolDecoderRAW instance"]
pub fn subghz_protocol_decoder_raw_reset(context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Parse a raw sequence of levels and durations received from the air.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolDecoderRAW instance\n * `level` - Signal level true-high false-low\n * `duration` - Duration of this level in, us"]
pub fn subghz_protocol_decoder_raw_feed(
context: *mut core::ffi::c_void,
level: bool,
duration: u32,
);
}
extern "C" {
#[doc = "Deserialize data SubGhzProtocolDecoderRAW.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolDecoderRAW instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n # Returns\n\nstatus"]
pub fn subghz_protocol_decoder_raw_deserialize(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Getting a textual representation of the received data.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolDecoderRAW instance\n * `output` - Resulting text"]
pub fn subghz_protocol_decoder_raw_get_string(
context: *mut core::ffi::c_void,
output: *mut FuriString,
);
}
extern "C" {
#[doc = "Allocate SubGhzProtocolEncoderRAW.\n # Arguments\n\n* `environment` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nSubGhzProtocolEncoderRAW* pointer to a SubGhzProtocolEncoderRAW instance"]
pub fn subghz_protocol_encoder_raw_alloc(
environment: *mut SubGhzEnvironment,
) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Free SubGhzProtocolEncoderRAW.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderRAW instance"]
pub fn subghz_protocol_encoder_raw_free(context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Forced transmission stop.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderRAW instance"]
pub fn subghz_protocol_encoder_raw_stop(context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "pause writing to flash.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderRAW instance\n * `pause` - pause writing"]
pub fn subghz_protocol_raw_save_to_file_pause(
instance: *mut SubGhzProtocolDecoderRAW,
pause: bool,
);
}
extern "C" {
#[doc = "Set callback on completion of file transfer.\n # Arguments\n\n* `instance` - Pointer to a SubGhzProtocolEncoderRAW instance\n * `callback_end` - Callback, SubGhzProtocolEncoderRAWCallbackEnd\n * `context_end` - Context"]
pub fn subghz_protocol_raw_file_encoder_worker_set_callback_end(
instance: *mut SubGhzProtocolEncoderRAW,
callback_end: SubGhzProtocolEncoderRAWCallbackEnd,
context_end: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "File generation for RAW work.\n # Arguments\n\n* `flipper_format` - Pointer to a FlipperFormat instance\n * `file_path` - File path\n * `radio_dev_name` - Radio device name"]
pub fn subghz_protocol_raw_gen_fff_data(
flipper_format: *mut FlipperFormat,
file_path: *const core::ffi::c_char,
radio_dev_name: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Deserialize and generating an upload to send.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderRAW instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n # Returns\n\nstatus"]
pub fn subghz_protocol_encoder_raw_deserialize(
context: *mut core::ffi::c_void,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Getting the level and duration of the upload to be loaded into DMA.\n # Arguments\n\n* `context` - Pointer to a SubGhzProtocolEncoderRAW instance\n # Returns\n\nLevelDuration"]
pub fn subghz_protocol_encoder_raw_yield(context: *mut core::ffi::c_void) -> LevelDuration;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzReceiver {
_unused: [u8; 0],
}
pub type SubGhzReceiverCallback = ::core::option::Option<
unsafe extern "C" fn(
decoder: *mut SubGhzReceiver,
decoder_base: *mut SubGhzProtocolDecoderBase,
context: *mut core::ffi::c_void,
),
>;
extern "C" {
#[doc = "Allocate and init SubGhzReceiver.\n # Arguments\n\n* `environment` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nSubGhzReceiver* pointer to a SubGhzReceiver instance"]
pub fn subghz_receiver_alloc_init(environment: *mut SubGhzEnvironment) -> *mut SubGhzReceiver;
}
extern "C" {
#[doc = "Free SubGhzReceiver.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance"]
pub fn subghz_receiver_free(instance: *mut SubGhzReceiver);
}
extern "C" {
#[doc = "Parse a raw sequence of levels and durations received from the air.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance\n * `level` - Signal level true-high false-low\n * `duration` - Duration of this level in, us"]
pub fn subghz_receiver_decode(instance: *mut SubGhzReceiver, level: bool, duration: u32);
}
extern "C" {
#[doc = "Reset decoder SubGhzReceiver.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance"]
pub fn subghz_receiver_reset(instance: *mut SubGhzReceiver);
}
extern "C" {
#[doc = "Set a callback upon completion of successful decoding of one of the protocols.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance\n * `callback` - Callback, SubGhzReceiverCallback\n * `context` - Context"]
pub fn subghz_receiver_set_rx_callback(
instance: *mut SubGhzReceiver,
callback: SubGhzReceiverCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Set the filter of receivers that will work at the moment.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance\n * `filter` - Filter, SubGhzProtocolFlag"]
pub fn subghz_receiver_set_filter(instance: *mut SubGhzReceiver, filter: SubGhzProtocolFlag);
}
extern "C" {
#[doc = "Search for a cattery by his name.\n # Arguments\n\n* `instance` - Pointer to a SubGhzReceiver instance\n * `decoder_name` - Receiver name\n # Returns\n\nSubGhzProtocolDecoderBase* pointer to a SubGhzProtocolDecoderBase instance"]
pub fn subghz_receiver_search_decoder_base_by_name(
instance: *mut SubGhzReceiver,
decoder_name: *const core::ffi::c_char,
) -> *mut SubGhzProtocolDecoderBase;
}
pub type SubGhzFileEncoderWorkerCallbackEnd =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzFileEncoderWorker {
_unused: [u8; 0],
}
extern "C" {
#[doc = "End callback SubGhzWorker.\n # Arguments\n\n* `instance` - SubGhzFileEncoderWorker instance\n * `callback` - SubGhzFileEncoderWorkerCallbackEnd callback"]
pub fn subghz_file_encoder_worker_callback_end(
instance: *mut SubGhzFileEncoderWorker,
callback_end: SubGhzFileEncoderWorkerCallbackEnd,
context_end: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Allocate SubGhzFileEncoderWorker.\n # Returns\n\nSubGhzFileEncoderWorker* pointer to a SubGhzFileEncoderWorker instance"]
pub fn subghz_file_encoder_worker_alloc() -> *mut SubGhzFileEncoderWorker;
}
extern "C" {
#[doc = "Free SubGhzFileEncoderWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzFileEncoderWorker instance"]
pub fn subghz_file_encoder_worker_free(instance: *mut SubGhzFileEncoderWorker);
}
extern "C" {
#[doc = "Getting the level and duration of the upload to be loaded into DMA.\n # Arguments\n\n* `context` - Pointer to a SubGhzFileEncoderWorker instance\n # Returns\n\nLevelDuration"]
pub fn subghz_file_encoder_worker_get_level_duration(
context: *mut core::ffi::c_void,
) -> LevelDuration;
}
extern "C" {
#[doc = "Start SubGhzFileEncoderWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzFileEncoderWorker instance\n * `file_path` - File path\n * `radio_device_name` - Radio device name\n # Returns\n\nbool - true if ok"]
pub fn subghz_file_encoder_worker_start(
instance: *mut SubGhzFileEncoderWorker,
file_path: *const core::ffi::c_char,
radio_device_name: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Stop SubGhzFileEncoderWorker\n # Arguments\n\n* `instance` - Pointer to a SubGhzFileEncoderWorker instance"]
pub fn subghz_file_encoder_worker_stop(instance: *mut SubGhzFileEncoderWorker);
}
extern "C" {
#[doc = "Check if worker is running\n # Arguments\n\n* `instance` - Pointer to a SubGhzFileEncoderWorker instance\n # Returns\n\nbool - true if running"]
pub fn subghz_file_encoder_worker_is_running(instance: *mut SubGhzFileEncoderWorker) -> bool;
}
extern "C" {
pub static subghz_protocol_registry: SubGhzProtocolRegistry;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzSetting {
_unused: [u8; 0],
}
extern "C" {
pub fn subghz_setting_alloc() -> *mut SubGhzSetting;
}
extern "C" {
pub fn subghz_setting_free(instance: *mut SubGhzSetting);
}
extern "C" {
pub fn subghz_setting_load(instance: *mut SubGhzSetting, file_path: *const core::ffi::c_char);
}
extern "C" {
pub fn subghz_setting_get_frequency_count(instance: *mut SubGhzSetting) -> usize;
}
extern "C" {
pub fn subghz_setting_get_hopper_frequency_count(instance: *mut SubGhzSetting) -> usize;
}
extern "C" {
pub fn subghz_setting_get_preset_count(instance: *mut SubGhzSetting) -> usize;
}
extern "C" {
pub fn subghz_setting_get_preset_name(
instance: *mut SubGhzSetting,
idx: usize,
) -> *const core::ffi::c_char;
}
extern "C" {
pub fn subghz_setting_get_inx_preset_by_name(
instance: *mut SubGhzSetting,
preset_name: *const core::ffi::c_char,
) -> core::ffi::c_int;
}
extern "C" {
pub fn subghz_setting_get_preset_data(instance: *mut SubGhzSetting, idx: usize) -> *mut u8;
}
extern "C" {
pub fn subghz_setting_get_preset_data_size(instance: *mut SubGhzSetting, idx: usize) -> usize;
}
extern "C" {
pub fn subghz_setting_get_preset_data_by_name(
instance: *mut SubGhzSetting,
preset_name: *const core::ffi::c_char,
) -> *mut u8;
}
extern "C" {
pub fn subghz_setting_load_custom_preset(
instance: *mut SubGhzSetting,
preset_name: *const core::ffi::c_char,
fff_data_file: *mut FlipperFormat,
) -> bool;
}
extern "C" {
pub fn subghz_setting_delete_custom_preset(
instance: *mut SubGhzSetting,
preset_name: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
pub fn subghz_setting_get_frequency(instance: *mut SubGhzSetting, idx: usize) -> u32;
}
extern "C" {
pub fn subghz_setting_get_hopper_frequency(instance: *mut SubGhzSetting, idx: usize) -> u32;
}
extern "C" {
pub fn subghz_setting_get_frequency_default_index(instance: *mut SubGhzSetting) -> u32;
}
extern "C" {
pub fn subghz_setting_get_default_frequency(instance: *mut SubGhzSetting) -> u32;
}
extern "C" {
pub fn subghz_devices_init();
}
extern "C" {
pub fn subghz_devices_deinit();
}
extern "C" {
pub fn subghz_devices_get_by_name(device_name: *const core::ffi::c_char)
-> *const SubGhzDevice;
}
extern "C" {
pub fn subghz_devices_get_name(device: *const SubGhzDevice) -> *const core::ffi::c_char;
}
extern "C" {
pub fn subghz_devices_begin(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_end(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_is_connect(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_reset(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_sleep(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_idle(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_load_preset(
device: *const SubGhzDevice,
preset: FuriHalSubGhzPreset,
preset_data: *mut u8,
);
}
extern "C" {
pub fn subghz_devices_set_frequency(device: *const SubGhzDevice, frequency: u32) -> u32;
}
extern "C" {
pub fn subghz_devices_is_frequency_valid(device: *const SubGhzDevice, frequency: u32) -> bool;
}
extern "C" {
pub fn subghz_devices_set_async_mirror_pin(device: *const SubGhzDevice, gpio: *const GpioPin);
}
extern "C" {
pub fn subghz_devices_get_data_gpio(device: *const SubGhzDevice) -> *const GpioPin;
}
extern "C" {
pub fn subghz_devices_set_tx(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_flush_tx(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_start_async_tx(
device: *const SubGhzDevice,
callback: *mut core::ffi::c_void,
context: *mut core::ffi::c_void,
) -> bool;
}
extern "C" {
pub fn subghz_devices_is_async_complete_tx(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_stop_async_tx(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_set_rx(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_flush_rx(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_start_async_rx(
device: *const SubGhzDevice,
callback: *mut core::ffi::c_void,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn subghz_devices_stop_async_rx(device: *const SubGhzDevice);
}
extern "C" {
pub fn subghz_devices_get_rssi(device: *const SubGhzDevice) -> f32;
}
extern "C" {
pub fn subghz_devices_get_lqi(device: *const SubGhzDevice) -> u8;
}
extern "C" {
pub fn subghz_devices_rx_pipe_not_empty(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_is_rx_data_crc_valid(device: *const SubGhzDevice) -> bool;
}
extern "C" {
pub fn subghz_devices_read_packet(device: *const SubGhzDevice, data: *mut u8, size: *mut u8);
}
extern "C" {
pub fn subghz_devices_write_packet(device: *const SubGhzDevice, data: *const u8, size: u8);
}
pub type SubGhzTxRxWorkerCallbackHaveRead =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzTxRxWorker {
_unused: [u8; 0],
}
extern "C" {
#[doc = "SubGhzTxRxWorker, add data to transfer\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n * `data` - *data\n * `size` - data size\n # Returns\n\nbool true if ok"]
pub fn subghz_tx_rx_worker_write(
instance: *mut SubGhzTxRxWorker,
data: *mut u8,
size: usize,
) -> bool;
}
extern "C" {
#[doc = "SubGhzTxRxWorker, get available data\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n # Returns\n\nsize_t data size"]
pub fn subghz_tx_rx_worker_available(instance: *mut SubGhzTxRxWorker) -> usize;
}
extern "C" {
#[doc = "SubGhzTxRxWorker, read data\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n * `data` - *data\n * `size` - max data size, which can be read\n # Returns\n\nsize_t data size, how much is actually read"]
pub fn subghz_tx_rx_worker_read(
instance: *mut SubGhzTxRxWorker,
data: *mut u8,
size: usize,
) -> usize;
}
extern "C" {
#[doc = "Сallback SubGhzTxRxWorker when there is data to read in an empty buffer\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n * `callback` - SubGhzTxRxWorkerCallbackHaveRead callback\n * `context` -"]
pub fn subghz_tx_rx_worker_set_callback_have_read(
instance: *mut SubGhzTxRxWorker,
callback: SubGhzTxRxWorkerCallbackHaveRead,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Allocate SubGhzTxRxWorker\n # Returns\n\nSubGhzTxRxWorker* Pointer to a SubGhzTxRxWorker instance"]
pub fn subghz_tx_rx_worker_alloc() -> *mut SubGhzTxRxWorker;
}
extern "C" {
#[doc = "Free SubGhzTxRxWorker\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance"]
pub fn subghz_tx_rx_worker_free(instance: *mut SubGhzTxRxWorker);
}
extern "C" {
#[doc = "Start SubGhzTxRxWorker\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n * `device` - Pointer to a SubGhzDevice instance\n # Returns\n\nbool - true if ok"]
pub fn subghz_tx_rx_worker_start(
instance: *mut SubGhzTxRxWorker,
device: *const SubGhzDevice,
frequency: u32,
) -> bool;
}
extern "C" {
#[doc = "Stop SubGhzTxRxWorker\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance"]
pub fn subghz_tx_rx_worker_stop(instance: *mut SubGhzTxRxWorker);
}
extern "C" {
#[doc = "Check if worker is running\n # Arguments\n\n* `instance` - Pointer to a SubGhzTxRxWorker instance\n # Returns\n\nbool - true if running"]
pub fn subghz_tx_rx_worker_is_running(instance: *mut SubGhzTxRxWorker) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzWorker {
_unused: [u8; 0],
}
pub type SubGhzWorkerOverrunCallback =
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>;
pub type SubGhzWorkerPairCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, level: bool, duration: u32),
>;
extern "C" {
pub fn subghz_worker_rx_callback(level: bool, duration: u32, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Allocate SubGhzWorker.\n # Returns\n\nSubGhzWorker* Pointer to a SubGhzWorker instance"]
pub fn subghz_worker_alloc() -> *mut SubGhzWorker;
}
extern "C" {
#[doc = "Free SubGhzWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance"]
pub fn subghz_worker_free(instance: *mut SubGhzWorker);
}
extern "C" {
#[doc = "Overrun callback SubGhzWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance\n * `callback` - SubGhzWorkerOverrunCallback callback"]
pub fn subghz_worker_set_overrun_callback(
instance: *mut SubGhzWorker,
callback: SubGhzWorkerOverrunCallback,
);
}
extern "C" {
#[doc = "Pair callback SubGhzWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance\n * `callback` - SubGhzWorkerOverrunCallback callback"]
pub fn subghz_worker_set_pair_callback(
instance: *mut SubGhzWorker,
callback: SubGhzWorkerPairCallback,
);
}
extern "C" {
#[doc = "Context callback SubGhzWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance\n * `context` -"]
pub fn subghz_worker_set_context(instance: *mut SubGhzWorker, context: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Start SubGhzWorker.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance"]
pub fn subghz_worker_start(instance: *mut SubGhzWorker);
}
extern "C" {
#[doc = "Stop SubGhzWorker\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance"]
pub fn subghz_worker_stop(instance: *mut SubGhzWorker);
}
extern "C" {
#[doc = "Check if worker is running.\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance\n # Returns\n\nbool - true if running"]
pub fn subghz_worker_is_running(instance: *mut SubGhzWorker) -> bool;
}
extern "C" {
#[doc = "Short duration filter setting.\n glues short durations into 1. The default setting is 30 us, if set to 0 the filter will be disabled\n # Arguments\n\n* `instance` - Pointer to a SubGhzWorker instance\n * `timeout` - time in us"]
pub fn subghz_worker_set_filter(instance: *mut SubGhzWorker, timeout: u16);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SubGhzTransmitter {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate and init SubGhzTransmitter.\n # Arguments\n\n* `environment` - Pointer to a SubGhzEnvironment instance\n # Returns\n\nSubGhzTransmitter* pointer to a SubGhzTransmitter instance"]
pub fn subghz_transmitter_alloc_init(
environment: *mut SubGhzEnvironment,
protocol_name: *const core::ffi::c_char,
) -> *mut SubGhzTransmitter;
}
extern "C" {
#[doc = "Free SubGhzTransmitter.\n # Arguments\n\n* `instance` - Pointer to a SubGhzTransmitter instance"]
pub fn subghz_transmitter_free(instance: *mut SubGhzTransmitter);
}
extern "C" {
#[doc = "Get protocol instance.\n # Arguments\n\n* `instance` - Pointer to a SubGhzTransmitter instance"]
pub fn subghz_transmitter_get_protocol_instance(
instance: *mut SubGhzTransmitter,
) -> *mut SubGhzProtocolEncoderBase;
}
extern "C" {
#[doc = "Forced transmission stop.\n # Arguments\n\n* `instance` - Pointer to a SubGhzTransmitter instance"]
pub fn subghz_transmitter_stop(instance: *mut SubGhzTransmitter) -> bool;
}
extern "C" {
#[doc = "Deserialize and generating an upload to send.\n # Arguments\n\n* `instance` - Pointer to a SubGhzTransmitter instance\n * `flipper_format` - Pointer to a FlipperFormat instance\n # Returns\n\nstatus"]
pub fn subghz_transmitter_deserialize(
instance: *mut SubGhzTransmitter,
flipper_format: *mut FlipperFormat,
) -> SubGhzProtocolStatus;
}
extern "C" {
#[doc = "Getting the level and duration of the upload to be loaded into DMA.\n # Arguments\n\n* `context` - Pointer to a SubGhzTransmitter instance\n # Returns\n\nLevelDuration"]
pub fn subghz_transmitter_yield(context: *mut core::ffi::c_void) -> LevelDuration;
}
extern "C" {
#[doc = "Extract int value and trim arguments string\n\n # Arguments\n\n* `args` - - arguments string\n * `word` - first argument, output\n # Returns\n\ntrue - success\n false - arguments string does not contain int"]
pub fn args_read_int_and_trim(args: *mut FuriString, value: *mut core::ffi::c_int) -> bool;
}
extern "C" {
#[doc = "Extract first argument from arguments string and trim arguments string\n\n # Arguments\n\n* `args` - arguments string\n * `word` - first argument, output\n # Returns\n\ntrue - success\n false - arguments string does not contain anything"]
pub fn args_read_string_and_trim(args: *mut FuriString, word: *mut FuriString) -> bool;
}
extern "C" {
#[doc = "Extract the first quoted argument from the argument string and trim the argument string. If the argument is not quoted, calls args_read_string_and_trim.\n\n # Arguments\n\n* `args` - arguments string\n * `word` - first argument, output, without quotes\n # Returns\n\ntrue - success\n false - arguments string does not contain anything"]
pub fn args_read_probably_quoted_string_and_trim(
args: *mut FuriString,
word: *mut FuriString,
) -> bool;
}
extern "C" {
#[doc = "Convert hex ASCII values to byte array\n\n # Arguments\n\n* `args` - arguments string\n * `bytes` - byte array pointer, output\n * `bytes_count` - needed bytes count\n # Returns\n\ntrue - success\n false - arguments string does not contain enough values, or contain non-hex ASCII values"]
pub fn args_read_hex_bytes(args: *mut FuriString, bytes: *mut u8, bytes_count: usize) -> bool;
}
extern "C" {
#[doc = "Get length of first word from arguments string\n\n # Arguments\n\n* `args` - arguments string\n # Returns\n\nsize_t length of first word"]
pub fn args_get_first_word_length(args: *mut FuriString) -> usize;
}
extern "C" {
#[doc = "Get length of arguments string\n\n # Arguments\n\n* `args` - arguments string\n # Returns\n\nsize_t length of arguments string"]
pub fn args_length(args: *mut FuriString) -> usize;
}
extern "C" {
#[doc = "Convert ASCII hex values to byte\n\n # Arguments\n\n* `hi_nibble` - ASCII hi nibble character\n * `low_nibble` - ASCII low nibble character\n * `byte` - byte pointer, output\n # Returns\n\nbool conversion status"]
pub fn args_char_to_hex(
hi_nibble: core::ffi::c_char,
low_nibble: core::ffi::c_char,
byte: *mut u8,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CompressIcon {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Initialize icon compressor\n\n # Arguments\n\n* `decode_buf_size` (direction in) - The icon buffer size for decoding. Ensure that\n it's big enough for any icons that you are\n planning to decode with it.\n\n # Returns\n\nCompress Icon instance"]
pub fn compress_icon_alloc(decode_buf_size: usize) -> *mut CompressIcon;
}
extern "C" {
#[doc = "Free icon compressor\n\n # Arguments\n\n* `instance` - The Compress Icon instance"]
pub fn compress_icon_free(instance: *mut CompressIcon);
}
extern "C" {
#[doc = "Decompress icon\n\n output pointer set by this function is valid till next\n `compress_icon_decode` or `compress_icon_free` call\n\n # Arguments\n\n* `instance` - The Compress Icon instance\n * `icon_data` - pointer to icon data.\n * `output` (direction in) - pointer to decoded buffer pointer. Data in buffer is\n valid till next call. If icon data was not compressed,\n pointer within icon_data is returned"]
pub fn compress_icon_decode(
instance: *mut CompressIcon,
icon_data: *const u8,
output: *mut *mut u8,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Compress {
_unused: [u8; 0],
}
pub const CompressType_CompressTypeHeatshrink: CompressType = 0;
#[doc = "Supported compression types"]
pub type CompressType = core::ffi::c_uchar;
#[doc = "Configuration for heatshrink compression"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CompressConfigHeatshrink {
pub window_sz2: u16,
pub lookahead_sz2: u16,
pub input_buffer_sz: u16,
}
#[test]
fn bindgen_test_layout_CompressConfigHeatshrink() {
const UNINIT: ::core::mem::MaybeUninit<CompressConfigHeatshrink> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<CompressConfigHeatshrink>(),
6usize,
concat!("Size of: ", stringify!(CompressConfigHeatshrink))
);
assert_eq!(
::core::mem::align_of::<CompressConfigHeatshrink>(),
2usize,
concat!("Alignment of ", stringify!(CompressConfigHeatshrink))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).window_sz2) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(CompressConfigHeatshrink),
"::",
stringify!(window_sz2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).lookahead_sz2) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(CompressConfigHeatshrink),
"::",
stringify!(lookahead_sz2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).input_buffer_sz) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(CompressConfigHeatshrink),
"::",
stringify!(input_buffer_sz)
)
);
}
extern "C" {
#[doc = "Default configuration for heatshrink compression. Used for image assets."]
pub static compress_config_heatshrink_default: CompressConfigHeatshrink;
}
extern "C" {
#[doc = "Allocate encoder and decoder\n\n # Arguments\n\n* `type` - Compression type\n * `config` (direction in) - Configuration for compression, specific to type\n\n # Returns\n\nCompress instance"]
pub fn compress_alloc(type_: CompressType, config: *const core::ffi::c_void) -> *mut Compress;
}
extern "C" {
#[doc = "Free encoder and decoder\n\n # Arguments\n\n* `compress` - Compress instance"]
pub fn compress_free(compress: *mut Compress);
}
extern "C" {
#[doc = "Encode data\n\n # Arguments\n\n* `compress` - Compress instance\n * `data_in` - pointer to input data\n * `data_in_size` - size of input data\n * `data_out` - maximum size of output data\n * `data_out_size` (direction in) - The data out size\n * `data_res_size` - pointer to result output data size\n\n > **Note:** Prepends compressed stream with a header. If data is not compressible,\n it will be stored as is after the header.\n # Returns\n\ntrue on success"]
pub fn compress_encode(
compress: *mut Compress,
data_in: *mut u8,
data_in_size: usize,
data_out: *mut u8,
data_out_size: usize,
data_res_size: *mut usize,
) -> bool;
}
extern "C" {
#[doc = "Decode data\n\n # Arguments\n\n* `compress` - Compress instance\n * `data_in` - pointer to input data\n * `data_in_size` - size of input data\n * `data_out` - maximum size of output data\n * `data_out_size` (direction in) - The data out size\n * `data_res_size` - pointer to result output data size\n\n > **Note:** Expects compressed stream with a header, as produced by `compress_encode`.\n # Returns\n\ntrue on success"]
pub fn compress_decode(
compress: *mut Compress,
data_in: *mut u8,
data_in_size: usize,
data_out: *mut u8,
data_out_size: usize,
data_res_size: *mut usize,
) -> bool;
}
#[doc = "I/O callback for streamed compression/decompression\n\n # Arguments\n\n* `context` - user context\n * `buffer` - buffer to read/write\n * `size` - size of buffer\n\n # Returns\n\nnumber of bytes read/written, 0 on end of stream, negative on error"]
pub type CompressIoCallback = ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, buffer: *mut u8, size: usize) -> i32,
>;
extern "C" {
#[doc = "Decompress streamed data\n\n # Arguments\n\n* `compress` - Compress instance\n * `read_cb` - read callback\n * `read_context` - read callback context\n * `write_cb` - write callback\n * `write_context` - write callback context\n\n > **Note:** Does not expect a header, just compressed data stream.\n # Returns\n\ntrue on success"]
pub fn compress_decode_streamed(
compress: *mut Compress,
read_cb: CompressIoCallback,
read_context: *mut core::ffi::c_void,
write_cb: CompressIoCallback,
write_context: *mut core::ffi::c_void,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CompressStreamDecoder {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Allocate stream decoder\n\n # Arguments\n\n* `type` - Compression type\n * `config` (direction in) - Configuration for compression, specific to type\n * `read_cb` - The read callback for input (compressed) data\n * `read_context` - The read context\n\n # Returns\n\nCompressStreamDecoder instance"]
pub fn compress_stream_decoder_alloc(
type_: CompressType,
config: *const core::ffi::c_void,
read_cb: CompressIoCallback,
read_context: *mut core::ffi::c_void,
) -> *mut CompressStreamDecoder;
}
extern "C" {
#[doc = "Free stream decoder\n\n # Arguments\n\n* `instance` - The CompressStreamDecoder instance"]
pub fn compress_stream_decoder_free(instance: *mut CompressStreamDecoder);
}
extern "C" {
#[doc = "Read uncompressed data chunk from stream decoder\n\n # Arguments\n\n* `instance` - The CompressStreamDecoder instance\n * `data_out` - The data out\n * `data_out_size` (direction in) - The data out size\n\n # Returns\n\ntrue on success"]
pub fn compress_stream_decoder_read(
instance: *mut CompressStreamDecoder,
data_out: *mut u8,
data_out_size: usize,
) -> bool;
}
extern "C" {
#[doc = "Seek to position in uncompressed data stream\n\n # Arguments\n\n* `instance` - The CompressStreamDecoder instance\n * `position` (direction in) - The position\n\n # Returns\n\ntrue on success\n Backward seeking is not supported"]
pub fn compress_stream_decoder_seek(
instance: *mut CompressStreamDecoder,
position: usize,
) -> bool;
}
extern "C" {
#[doc = "Get current position in uncompressed data stream\n\n # Arguments\n\n* `instance` - The CompressStreamDecoder instance\n\n # Returns\n\ncurrent position"]
pub fn compress_stream_decoder_tell(instance: *mut CompressStreamDecoder) -> usize;
}
extern "C" {
#[doc = "Reset stream decoder to the beginning\n Read callback must be repositioned by caller separately\n\n # Arguments\n\n* `instance` - The CompressStreamDecoder instance\n\n # Returns\n\ntrue on success"]
pub fn compress_stream_decoder_rewind(instance: *mut CompressStreamDecoder) -> bool;
}
extern "C" {
pub fn crc32_calc_buffer(crc: u32, buffer: *const core::ffi::c_void, size: usize) -> u32;
}
pub type FileCrcProgressCb =
::core::option::Option<unsafe extern "C" fn(progress: u8, context: *mut core::ffi::c_void)>;
extern "C" {
pub fn crc32_calc_file(
file: *mut File,
progress_cb: FileCrcProgressCb,
context: *mut core::ffi::c_void,
) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DirWalk {
_unused: [u8; 0],
}
#[doc = "< OK"]
pub const DirWalkResult_DirWalkOK: DirWalkResult = 0;
#[doc = "< Error"]
pub const DirWalkResult_DirWalkError: DirWalkResult = 1;
#[doc = "< Last element"]
pub const DirWalkResult_DirWalkLast: DirWalkResult = 2;
pub type DirWalkResult = core::ffi::c_uchar;
pub type DirWalkFilterCb = ::core::option::Option<
unsafe extern "C" fn(
name: *const core::ffi::c_char,
fileinfo: *mut FileInfo,
ctx: *mut core::ffi::c_void,
) -> bool,
>;
extern "C" {
#[doc = "Allocate DirWalk\n # Arguments\n\n* `storage` -\n # Returns\n\nDirWalk*"]
pub fn dir_walk_alloc(storage: *mut Storage) -> *mut DirWalk;
}
extern "C" {
#[doc = "Free DirWalk\n # Arguments\n\n* `dir_walk` -"]
pub fn dir_walk_free(dir_walk: *mut DirWalk);
}
extern "C" {
#[doc = "Set recursive mode (true by default)\n # Arguments\n\n* `dir_walk` -\n * `recursive` -"]
pub fn dir_walk_set_recursive(dir_walk: *mut DirWalk, recursive: bool);
}
extern "C" {
#[doc = "Set filter callback (Should return true if the data is valid)\n # Arguments\n\n* `dir_walk` -\n * `cb` -\n * `context` -"]
pub fn dir_walk_set_filter_cb(
dir_walk: *mut DirWalk,
cb: DirWalkFilterCb,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Open directory\n # Arguments\n\n* `dir_walk` -\n * `path` -\n # Returns\n\ntrue\n false"]
pub fn dir_walk_open(dir_walk: *mut DirWalk, path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Get error id\n # Arguments\n\n* `dir_walk` -\n # Returns\n\nFS_Error"]
pub fn dir_walk_get_error(dir_walk: *mut DirWalk) -> FS_Error;
}
extern "C" {
#[doc = "Read next element from directory\n # Arguments\n\n* `dir_walk` -\n * `return_path` -\n * `fileinfo` -\n # Returns\n\nDirWalkResult"]
pub fn dir_walk_read(
dir_walk: *mut DirWalk,
return_path: *mut FuriString,
fileinfo: *mut FileInfo,
) -> DirWalkResult;
}
extern "C" {
#[doc = "Close directory\n # Arguments\n\n* `dir_walk` -"]
pub fn dir_walk_close(dir_walk: *mut DirWalk);
}
extern "C" {
#[doc = "Compare two floating point numbers\n # Arguments\n\n* `a` - First number to compare\n * `b` - Second number to compare\n\n # Returns\n\nbool true if a equals b, false otherwise"]
pub fn float_is_equal(a: f32, b: f32) -> bool;
}
extern "C" {
#[doc = "Convert ASCII hex value to nibble\n # Arguments\n\n* `c` - ASCII character\n * `nibble` - nibble pointer, output\n\n # Returns\n\nbool conversion status"]
pub fn hex_char_to_hex_nibble(c: core::ffi::c_char, nibble: *mut u8) -> bool;
}
extern "C" {
#[doc = "Convert ASCII hex value to byte\n # Arguments\n\n* `hi` - hi nibble text\n * `low` - low nibble text\n * `value` - output value\n\n # Returns\n\nbool conversion status"]
pub fn hex_char_to_uint8(hi: core::ffi::c_char, low: core::ffi::c_char, value: *mut u8)
-> bool;
}
extern "C" {
#[doc = "Convert ASCII hex values to uint8_t\n # Arguments\n\n* `value_str` - ASCII data\n * `value` - output value\n\n # Returns\n\nbool conversion status"]
pub fn hex_chars_to_uint8(value_str: *const core::ffi::c_char, value: *mut u8) -> bool;
}
extern "C" {
#[doc = "Convert ASCII hex values to uint64_t\n # Arguments\n\n* `value_str` - ASCII 64 bi data\n * `value` - output value\n\n # Returns\n\nbool conversion status"]
pub fn hex_chars_to_uint64(value_str: *const core::ffi::c_char, value: *mut u64) -> bool;
}
extern "C" {
#[doc = "Convert uint8_t to ASCII hex values\n # Arguments\n\n* `src` - source data\n * `target` - output value\n * `length` - data length\n"]
pub fn uint8_to_hex_chars(src: *const u8, target: *mut u8, length: core::ffi::c_int);
}
pub const KeysDictMode_KeysDictModeOpenExisting: KeysDictMode = 0;
pub const KeysDictMode_KeysDictModeOpenAlways: KeysDictMode = 1;
pub type KeysDictMode = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct KeysDict {
_unused: [u8; 0],
}
extern "C" {
#[doc = "Check if the file list exists\n\n # Arguments\n\n* `path` - - list path\n\n # Returns\n\ntrue if list exists, false otherwise"]
pub fn keys_dict_check_presence(path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Open or create list\n Depending on mode, list will be opened or created.\n\n # Arguments\n\n* `path` - - Path of the file that contain the list\n * `mode` - - ListKeysMode value\n * `key_size` - - Size of each key in bytes\n\n # Returns\n\nReturns KeysDict list instance"]
pub fn keys_dict_alloc(
path: *const core::ffi::c_char,
mode: KeysDictMode,
key_size: usize,
) -> *mut KeysDict;
}
extern "C" {
#[doc = "Close list\n\n # Arguments\n\n* `instance` - - KeysDict list instance"]
pub fn keys_dict_free(instance: *mut KeysDict);
}
extern "C" {
#[doc = "Get total number of keys in list\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n\n # Returns\n\nReturns total number of keys in list"]
pub fn keys_dict_get_total_keys(instance: *mut KeysDict) -> usize;
}
extern "C" {
#[doc = "Rewind list\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n\n # Returns\n\nReturns true if rewind was successful, false otherwise"]
pub fn keys_dict_rewind(instance: *mut KeysDict) -> bool;
}
extern "C" {
#[doc = "Check if key is present in list\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n * `key` - - key to check\n * `key_size` - - Size of the key in bytes\n\n # Returns\n\nReturns true if key is present, false otherwise"]
pub fn keys_dict_is_key_present(
instance: *mut KeysDict,
key: *const u8,
key_size: usize,
) -> bool;
}
extern "C" {
#[doc = "Get next key from the list\n This function will return next key from list. If there are no more\n keys, it will return false, and keys_dict_rewind() should be called.\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n * `key` - - Array where to store key\n * `key_size` - - Size of key in bytes\n\n # Returns\n\nReturns true if key was successfully retrieved, false otherwise"]
pub fn keys_dict_get_next_key(instance: *mut KeysDict, key: *mut u8, key_size: usize) -> bool;
}
extern "C" {
#[doc = "Add key to list\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n * `key` - - Key to add\n * `key_size` - - Size of the key in bytes\n\n # Returns\n\nReturns true if key was successfully added, false otherwise"]
pub fn keys_dict_add_key(instance: *mut KeysDict, key: *const u8, key_size: usize) -> bool;
}
extern "C" {
#[doc = "Delete key from list\n\n # Arguments\n\n* `instance` - - KeysDict list instance\n * `key` - - Key to delete\n * `key_size` - - Size of the key in bytes\n\n # Returns\n\nReturns true if key was successfully deleted, false otherwise"]
pub fn keys_dict_delete_key(instance: *mut KeysDict, key: *const u8, key_size: usize) -> bool;
}
pub const ManchesterEvent_ManchesterEventShortLow: ManchesterEvent = 0;
pub const ManchesterEvent_ManchesterEventShortHigh: ManchesterEvent = 2;
pub const ManchesterEvent_ManchesterEventLongLow: ManchesterEvent = 4;
pub const ManchesterEvent_ManchesterEventLongHigh: ManchesterEvent = 6;
pub const ManchesterEvent_ManchesterEventReset: ManchesterEvent = 8;
pub type ManchesterEvent = core::ffi::c_uchar;
pub const ManchesterState_ManchesterStateStart1: ManchesterState = 0;
pub const ManchesterState_ManchesterStateMid1: ManchesterState = 1;
pub const ManchesterState_ManchesterStateMid0: ManchesterState = 2;
pub const ManchesterState_ManchesterStateStart0: ManchesterState = 3;
pub type ManchesterState = core::ffi::c_uchar;
extern "C" {
pub fn manchester_advance(
state: ManchesterState,
event: ManchesterEvent,
next_state: *mut ManchesterState,
data: *mut bool,
) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ManchesterEncoderState {
pub prev_bit: bool,
pub step: u8,
}
#[test]
fn bindgen_test_layout_ManchesterEncoderState() {
const UNINIT: ::core::mem::MaybeUninit<ManchesterEncoderState> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ManchesterEncoderState>(),
2usize,
concat!("Size of: ", stringify!(ManchesterEncoderState))
);
assert_eq!(
::core::mem::align_of::<ManchesterEncoderState>(),
1usize,
concat!("Alignment of ", stringify!(ManchesterEncoderState))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prev_bit) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ManchesterEncoderState),
"::",
stringify!(prev_bit)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).step) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(ManchesterEncoderState),
"::",
stringify!(step)
)
);
}
pub const ManchesterEncoderResult_ManchesterEncoderResultShortLow: ManchesterEncoderResult = 0;
pub const ManchesterEncoderResult_ManchesterEncoderResultLongLow: ManchesterEncoderResult = 1;
pub const ManchesterEncoderResult_ManchesterEncoderResultLongHigh: ManchesterEncoderResult = 2;
pub const ManchesterEncoderResult_ManchesterEncoderResultShortHigh: ManchesterEncoderResult = 3;
pub type ManchesterEncoderResult = core::ffi::c_uchar;
extern "C" {
pub fn manchester_encoder_reset(state: *mut ManchesterEncoderState);
}
extern "C" {
pub fn manchester_encoder_advance(
state: *mut ManchesterEncoderState,
curr_bit: bool,
result: *mut ManchesterEncoderResult,
) -> bool;
}
extern "C" {
pub fn manchester_encoder_finish(state: *mut ManchesterEncoderState)
-> ManchesterEncoderResult;
}
extern "C" {
pub fn md5_calc_file(
file: *mut File,
path: *const core::ffi::c_char,
output: *mut core::ffi::c_uchar,
file_error: *mut FS_Error,
) -> bool;
}
extern "C" {
pub fn md5_string_calc_file(
file: *mut File,
path: *const core::ffi::c_char,
output: *mut FuriString,
file_error: *mut FS_Error,
) -> bool;
}
extern "C" {
#[doc = "Generates detailed/random name based on furi_hal flags\n\n # Arguments\n\n* `name` - buffer to write random name\n * `max_name_size` - length of given buffer\n * `prefix` (direction in) - The prefix of the name"]
pub fn name_generator_make_auto(
name: *mut core::ffi::c_char,
max_name_size: usize,
prefix: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Generates random name\n\n # Arguments\n\n* `name` - buffer to write random name\n * `max_name_size` - length of given buffer"]
pub fn name_generator_make_random(name: *mut core::ffi::c_char, max_name_size: usize);
}
extern "C" {
#[doc = "Generates detailed name\n\n # Arguments\n\n* `name` - buffer to write random name\n * `max_name_size` - length of given buffer\n * `prefix` (direction in) - The prefix of the name"]
pub fn name_generator_make_detailed(
name: *mut core::ffi::c_char,
max_name_size: usize,
prefix: *const core::ffi::c_char,
);
}
extern "C" {
#[doc = "Extract filename without extension from path.\n\n # Arguments\n\n* `path` - path string\n * `filename` - output filename string. Must be initialized before."]
pub fn path_extract_filename_no_ext(path: *const core::ffi::c_char, filename: *mut FuriString);
}
extern "C" {
#[doc = "Extract filename string from path.\n\n # Arguments\n\n* `path` - path string\n * `filename` - output filename string. Must be initialized before.\n * `trim_ext` - true - get filename without extension"]
pub fn path_extract_filename(path: *mut FuriString, filename: *mut FuriString, trim_ext: bool);
}
extern "C" {
#[doc = "Extract file extension from path.\n\n # Arguments\n\n* `path` - path string\n * `ext` - output extension string\n * `ext_len_max` - maximum extension string length"]
pub fn path_extract_extension(
path: *mut FuriString,
ext: *mut core::ffi::c_char,
ext_len_max: usize,
);
}
extern "C" {
#[doc = "Extract last path component\n\n # Arguments\n\n* `path` - path string\n * `filename` - output string. Must be initialized before."]
pub fn path_extract_basename(path: *const core::ffi::c_char, basename: *mut FuriString);
}
extern "C" {
#[doc = "Extract path, except for last component\n\n # Arguments\n\n* `path` - path string\n * `filename` - output string. Must be initialized before."]
pub fn path_extract_dirname(path: *const core::ffi::c_char, dirname: *mut FuriString);
}
extern "C" {
#[doc = "Appends new component to path, adding path delimiter\n\n # Arguments\n\n* `path` - path string\n * `suffix` - path part to apply"]
pub fn path_append(path: *mut FuriString, suffix: *const core::ffi::c_char);
}
extern "C" {
#[doc = "Appends new component to path, adding path delimiter\n\n # Arguments\n\n* `path` - first path part\n * `suffix` - second path part\n * `out_path` - output string to combine parts into. Must be initialized"]
pub fn path_concat(
path: *const core::ffi::c_char,
suffix: *const core::ffi::c_char,
out_path: *mut FuriString,
);
}
extern "C" {
#[doc = "Check that path contains only ascii characters\n\n # Arguments\n\n* `path` -\n # Returns\n\ntrue\n false"]
pub fn path_contains_only_ascii(path: *const core::ffi::c_char) -> bool;
}
extern "C" {
#[doc = "Format a data buffer as a canonical HEX dump\n # Arguments\n\n* `[out]` - result pointer to the output string (must be initialised)\n * `[in]` - num_places the number of bytes on one line (both as HEX and ASCII)\n * `[in]` - line_prefix if not NULL, prepend this string to each line\n * `[in]` - data pointer to the input data buffer\n * `[in]` - data_size input data size"]
pub fn pretty_format_bytes_hex_canonical(
result: *mut FuriString,
num_places: usize,
line_prefix: *const core::ffi::c_char,
data: *const u8,
data_size: usize,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct PulseGlue {
_unused: [u8; 0],
}
extern "C" {
pub fn pulse_glue_alloc() -> *mut PulseGlue;
}
extern "C" {
pub fn pulse_glue_free(pulse_glue: *mut PulseGlue);
}
extern "C" {
pub fn pulse_glue_reset(pulse_glue: *mut PulseGlue);
}
extern "C" {
pub fn pulse_glue_push(pulse_glue: *mut PulseGlue, polarity: bool, length: u32) -> bool;
}
extern "C" {
pub fn pulse_glue_pop(pulse_glue: *mut PulseGlue, length: *mut u32, period: *mut u32);
}
extern "C" {
#[doc = "Load data from the file in saved structure format\n\n # Arguments\n\n* `path` (direction in) - The path to the file\n * `data` (direction out) - Pointer to the memory where to load data\n * `size` (direction in) - The size of the data\n * `magic` (direction in) - The magic to embed into metadata\n * `version` (direction in) - The version to embed into metadata\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn saved_struct_load(
path: *const core::ffi::c_char,
data: *mut core::ffi::c_void,
size: usize,
magic: u8,
version: u8,
) -> bool;
}
extern "C" {
#[doc = "Save data in saved structure format\n\n # Arguments\n\n* `path` (direction in) - The path to the file\n * `data` (direction in) - Pointer to the memory where data\n * `size` (direction in) - The size of the data\n * `magic` (direction in) - The magic to embed into metadata\n * `version` (direction in) - The version to embed into metadata\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn saved_struct_save(
path: *const core::ffi::c_char,
data: *const core::ffi::c_void,
size: usize,
magic: u8,
version: u8,
) -> bool;
}
extern "C" {
#[doc = "Get SavedStructure file metadata\n\n # Arguments\n\n* `path` (direction in) - The path to the file\n * `magic` (direction out) - Pointer to store magic or NULL if you don't need it\n * `version` (direction out) - Pointer to store version or NULL if you don't need\n it\n * `payload_size` (direction out) - Pointer to store payload size or NULL if you don't\n need it\n\n # Returns\n\ntrue on success, false otherwise"]
pub fn saved_struct_get_metadata(
path: *const core::ffi::c_char,
magic: *mut u8,
version: *mut u8,
payload_size: *mut usize,
) -> bool;
}
extern "C" {
#[doc = "Allocate a file stream with buffered read operations\n # Returns\n\nStream*"]
pub fn buffered_file_stream_alloc(storage: *mut Storage) -> *mut Stream;
}
extern "C" {
#[doc = "Opens an existing file or creates a new one.\n # Arguments\n\n* `stream` - pointer to file stream object.\n * `path` - path to file\n * `access_mode` - access mode from FS_AccessMode\n * `open_mode` - open mode from FS_OpenMode\n # Returns\n\nTrue on success, False on failure. You need to close the file even if the open operation failed."]
pub fn buffered_file_stream_open(
stream: *mut Stream,
path: *const core::ffi::c_char,
access_mode: FS_AccessMode,
open_mode: FS_OpenMode,
) -> bool;
}
extern "C" {
#[doc = "Closes the file.\n # Arguments\n\n* `stream` - pointer to file stream object.\n # Returns\n\nTrue on success, False on failure."]
pub fn buffered_file_stream_close(stream: *mut Stream) -> bool;
}
extern "C" {
#[doc = "Forces write from cache to the underlying file.\n # Arguments\n\n* `stream` - pointer to file stream object.\n # Returns\n\nTrue on success, False on failure."]
pub fn buffered_file_stream_sync(stream: *mut Stream) -> bool;
}
extern "C" {
#[doc = "Retrieves the error id from the file object\n # Arguments\n\n* `stream` - pointer to stream object.\n # Returns\n\nFS_Error error id"]
pub fn buffered_file_stream_get_error(stream: *mut Stream) -> FS_Error;
}
extern "C" {
#[doc = "Allocate file stream\n # Returns\n\nStream*"]
pub fn file_stream_alloc(storage: *mut Storage) -> *mut Stream;
}
extern "C" {
#[doc = "Opens an existing file or create a new one.\n # Arguments\n\n* `stream` - pointer to file stream object.\n * `path` - path to file\n * `access_mode` - access mode from FS_AccessMode\n * `open_mode` - open mode from FS_OpenMode\n # Returns\n\nsuccess flag. You need to close the file even if the open operation failed."]
pub fn file_stream_open(
stream: *mut Stream,
path: *const core::ffi::c_char,
access_mode: FS_AccessMode,
open_mode: FS_OpenMode,
) -> bool;
}
extern "C" {
#[doc = "Closes the file.\n # Arguments\n\n* `stream` -\n # Returns\n\ntrue\n false"]
pub fn file_stream_close(stream: *mut Stream) -> bool;
}
extern "C" {
#[doc = "Retrieves the error id from the file object\n # Arguments\n\n* `stream` - pointer to stream object.\n # Returns\n\nFS_Error error id"]
pub fn file_stream_get_error(stream: *mut Stream) -> FS_Error;
}
extern "C" {
#[doc = "Allocate string stream\n # Returns\n\nStream*"]
pub fn string_stream_alloc() -> *mut Stream;
}
#[doc = "!< Conversion performed successfully"]
pub const StrintParseError_StrintParseNoError: StrintParseError = 0;
#[doc = "!< Multiple leading `+` or `-` characters, or leading `-` character if the type is unsigned"]
pub const StrintParseError_StrintParseSignError: StrintParseError = 1;
#[doc = "!< No valid digits after the leading whitespace, sign and prefix"]
pub const StrintParseError_StrintParseAbsentError: StrintParseError = 2;
#[doc = "!< Result does not fit in the requested type"]
pub const StrintParseError_StrintParseOverflowError: StrintParseError = 3;
#[doc = "String to integer conversion error"]
pub type StrintParseError = core::ffi::c_uchar;
extern "C" {
#[doc = "See `strint_to_uint32`"]
pub fn strint_to_uint64(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut u64,
base: u8,
) -> StrintParseError;
}
extern "C" {
#[doc = "See `strint_to_uint32`"]
pub fn strint_to_int64(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut i64,
base: u8,
) -> StrintParseError;
}
extern "C" {
#[doc = "Converts a string to a `uint32_t`\n\n # Arguments\n\n* `str` (direction in) - Input string\n * `end` (direction out) - Pointer to first character after the number in input string\n * `out` (direction out) - Parse result\n * `base` (direction in) - Integer base\n\n # Returns\n\nParse error\n\n Parses the number in the input string. The number may be surrounded by\n whitespace characters to the left and any non-digit characters to the right.\n What's considered a digit is determined by the input base in the following\n order: `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`. The number may be prefixed\n with either a `+` or a `-` to indicate its sign. The pointer to the first\n character after the leading whitespace, allowed prefixes and digits is\n assigned to `end`.\n\n If the input base is 0, the base is inferred from the leading characters of\n the number:\n - If it starts with `0x`, it's read in base 16;\n - If it starts with a `0`, it's read in base 8;\n - If it starts with `0b`, it's read in base 2.\n - Otherwise, it's read in base 10.\n\n For a description of the return codes, see `StrintParseError`. If the return\n code is something other than `StrintParseNoError`, the values at `end` and\n `out` are unaltered."]
pub fn strint_to_uint32(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut u32,
base: u8,
) -> StrintParseError;
}
extern "C" {
#[doc = "See `strint_to_uint32`"]
pub fn strint_to_int32(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut i32,
base: u8,
) -> StrintParseError;
}
extern "C" {
#[doc = "See `strint_to_uint32`"]
pub fn strint_to_uint16(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut u16,
base: u8,
) -> StrintParseError;
}
extern "C" {
#[doc = "See `strint_to_uint32`"]
pub fn strint_to_int16(
str_: *const core::ffi::c_char,
end: *mut *mut core::ffi::c_char,
out: *mut i16,
base: u8,
) -> StrintParseError;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TarArchive {
_unused: [u8; 0],
}
pub const TarOpenMode_TarOpenModeRead: TarOpenMode = 114;
pub const TarOpenMode_TarOpenModeWrite: TarOpenMode = 119;
pub const TarOpenMode_TarOpenModeReadHeatshrink: TarOpenMode = 104;
#[doc = "Tar archive open mode"]
pub type TarOpenMode = core::ffi::c_uchar;
extern "C" {
#[doc = "Get expected open mode for archive at the path.\n Used for automatic mode detection based on the file extension.\n\n # Arguments\n\n* `path` (direction in) - Path to the archive\n\n # Returns\n\nopen mode from TarOpenMode enum"]
pub fn tar_archive_get_mode_for_path(path: *const core::ffi::c_char) -> TarOpenMode;
}
extern "C" {
#[doc = "Tar archive constructor\n\n # Arguments\n\n* `storage` - Storage API pointer\n\n # Returns\n\nallocated object"]
pub fn tar_archive_alloc(storage: *mut Storage) -> *mut TarArchive;
}
extern "C" {
#[doc = "Open tar archive\n\n # Arguments\n\n* `archive` - Tar archive object\n * `path` (direction in) - Path to the tar archive\n * `mode` - Open mode\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_open(
archive: *mut TarArchive,
path: *const core::ffi::c_char,
mode: TarOpenMode,
) -> bool;
}
extern "C" {
#[doc = "Tar archive destructor\n\n # Arguments\n\n* `archive` - Tar archive object"]
pub fn tar_archive_free(archive: *mut TarArchive);
}
pub type TarArchiveNameConverter =
::core::option::Option<unsafe extern "C" fn(arg1: *mut FuriString)>;
extern "C" {
#[doc = "Unpack tar archive to destination\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in read mode\n * `destination` (direction in) - Destination path\n * `converter` - Storage name converter\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_unpack_to(
archive: *mut TarArchive,
destination: *const core::ffi::c_char,
converter: TarArchiveNameConverter,
) -> bool;
}
extern "C" {
#[doc = "Add file to tar archive\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `fs_file_path` (direction in) - Path to the file on the filesystem\n * `archive_fname` (direction in) - Name of the file in the archive\n * `file_size` - Size of the file\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_add_file(
archive: *mut TarArchive,
fs_file_path: *const core::ffi::c_char,
archive_fname: *const core::ffi::c_char,
file_size: i32,
) -> bool;
}
extern "C" {
#[doc = "Add directory to tar archive\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `fs_full_path` - Path to the directory on the filesystem\n * `path_prefix` - Prefix to add to the directory name in the archive\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_add_dir(
archive: *mut TarArchive,
fs_full_path: *const core::ffi::c_char,
path_prefix: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Get number of entries in the archive\n\n # Arguments\n\n* `archive` - Tar archive object\n\n # Returns\n\nnumber of entries. -1 on error"]
pub fn tar_archive_get_entries_count(archive: *mut TarArchive) -> i32;
}
extern "C" {
#[doc = "Get read progress\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in read mode\n * `processed` (direction in) - Number of processed entries\n * `total` (direction in) - Total number of entries\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_get_read_progress(
archive: *mut TarArchive,
processed: *mut i32,
total: *mut i32,
) -> bool;
}
extern "C" {
#[doc = "Unpack single file from tar archive\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in read mode\n * `archive_fname` (direction in) - Name of the file in the archive\n * `destination` (direction in) - Destination path\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_unpack_file(
archive: *mut TarArchive,
archive_fname: *const core::ffi::c_char,
destination: *const core::ffi::c_char,
) -> bool;
}
#[doc = "Optional per-entry callback on unpacking\n # Arguments\n\n* `name` - Name of the file or directory\n * `is_directory` - True if the entry is a directory\n * `context` (direction in) - User context\n # Returns\n\ntrue to process the entry, false to skip"]
pub type tar_unpack_file_cb = ::core::option::Option<
unsafe extern "C" fn(
name: *const core::ffi::c_char,
is_directory: bool,
context: *mut core::ffi::c_void,
) -> bool,
>;
extern "C" {
#[doc = "Set per-entry callback on unpacking\n # Arguments\n\n* `archive` - Tar archive object\n * `callback` - Callback function\n * `context` (direction in) - User context"]
pub fn tar_archive_set_file_callback(
archive: *mut TarArchive,
callback: tar_unpack_file_cb,
context: *mut core::ffi::c_void,
);
}
extern "C" {
#[doc = "Add tar archive directory header\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `dirpath` (direction in) - Path to the directory\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_dir_add_element(
archive: *mut TarArchive,
dirpath: *const core::ffi::c_char,
) -> bool;
}
extern "C" {
#[doc = "Add tar archive file header\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `path` (direction in) - Path to the file\n * `data_len` - Size of the file\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_file_add_header(
archive: *mut TarArchive,
path: *const core::ffi::c_char,
data_len: i32,
) -> bool;
}
extern "C" {
#[doc = "Add tar archive file data block\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `data_block` (direction in) - Data block\n * `block_len` - Size of the data block\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_file_add_data_block(
archive: *mut TarArchive,
data_block: *const u8,
block_len: i32,
) -> bool;
}
extern "C" {
#[doc = "Finalize tar archive file\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_file_finalize(archive: *mut TarArchive) -> bool;
}
extern "C" {
#[doc = "Store data in tar archive\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n * `path` (direction in) - Path to the file\n * `data` (direction in) - Data to store\n * `data_len` - Size of the data\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_store_data(
archive: *mut TarArchive,
path: *const core::ffi::c_char,
data: *const u8,
data_len: i32,
) -> bool;
}
extern "C" {
#[doc = "Finalize tar archive\n\n # Arguments\n\n* `archive` - Tar archive object. Must be opened in write mode\n\n # Returns\n\ntrue if successful"]
pub fn tar_archive_finalize(archive: *mut TarArchive) -> bool;
}
extern "C" {
#[doc = "Get the index of a int32_t array element which is closest to the given value.\n\n Returned index corresponds to the first element found.\n If no suitable elements were found, the function returns 0.\n\n # Arguments\n\n* `value` - value to be searched.\n * `values` - pointer to the array to perform the search in.\n * `values_count` - array size.\n\n # Returns\n\nvalue's index."]
pub fn value_index_int32(value: i32, values: *const i32, values_count: usize) -> usize;
}
extern "C" {
#[doc = "Get the index of a uint32_t array element which is closest to the given value.\n\n Returned index corresponds to the first element found.\n If no suitable elements were found, the function returns 0.\n\n # Arguments\n\n* `value` - value to be searched.\n * `values` - pointer to the array to perform the search in.\n * `values_count` - array size.\n\n # Returns\n\nvalue's index."]
pub fn value_index_uint32(value: u32, values: *const u32, values_count: usize) -> usize;
}
extern "C" {
#[doc = "Get the index of a float array element which is closest to the given value.\n\n Returned index corresponds to the first element found.\n If no suitable elements were found, the function returns 0.\n\n # Arguments\n\n* `value` - value to be searched.\n * `values` - pointer to the array to perform the search in.\n * `values_count` - array size.\n\n # Returns\n\nvalue's index."]
pub fn value_index_float(value: f32, values: *const f32, values_count: usize) -> usize;
}
extern "C" {
#[doc = "Get the index of a bool array element which is equal to the given value.\n\n Returned index corresponds to the first element found.\n If no suitable elements were found, the function returns 0.\n\n # Arguments\n\n* `value` - value to be searched.\n * `values` - pointer to the array to perform the search in.\n * `values_count` - array size.\n\n # Returns\n\nvalue's index."]
pub fn value_index_bool(value: bool, values: *const bool, values_count: usize) -> usize;
}
extern "C" {
#[doc = "Pack uint32 to varint\n # Arguments\n\n* `value` - value from UINT32_MIN to UINT32_MAX\n * `output` - output array, need to be at least 5 bytes long\n # Returns\n\nsize_t"]
pub fn varint_uint32_pack(value: u32, output: *mut u8) -> usize;
}
extern "C" {
pub fn varint_uint32_unpack(value: *mut u32, input: *const u8, input_size: usize) -> usize;
}
extern "C" {
pub fn varint_uint32_length(value: u32) -> usize;
}
extern "C" {
#[doc = "Pack int32 to varint\n # Arguments\n\n* `value` - value from (INT32_MIN / 2 + 1) to INT32_MAX\n * `output` - output array, need to be at least 5 bytes long\n # Returns\n\nsize_t"]
pub fn varint_int32_pack(value: i32, output: *mut u8) -> usize;
}
extern "C" {
pub fn varint_int32_unpack(value: *mut i32, input: *const u8, input_size: usize) -> usize;
}
extern "C" {
pub fn varint_int32_length(value: i32) -> usize;
}
pub const BleEventAckStatus_BleEventNotAck: BleEventAckStatus = 0;
pub const BleEventAckStatus_BleEventAckFlowEnable: BleEventAckStatus = 1;
pub const BleEventAckStatus_BleEventAckFlowDisable: BleEventAckStatus = 2;
pub type BleEventAckStatus = core::ffi::c_uchar;
pub type BleSvcEventHandlerCb = ::core::option::Option<
unsafe extern "C" fn(
event: *mut core::ffi::c_void,
context: *mut core::ffi::c_void,
) -> BleEventAckStatus,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GapEventHandler {
_unused: [u8; 0],
}
pub type GapSvcEventHandler = GapEventHandler;
extern "C" {
pub fn ble_event_dispatcher_register_svc_handler(
handler: BleSvcEventHandlerCb,
context: *mut core::ffi::c_void,
) -> *mut GapSvcEventHandler;
}
extern "C" {
pub fn ble_event_dispatcher_unregister_svc_handler(handler: *mut GapSvcEventHandler);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub union Service_UUID_t {
#[doc = "16-bit UUID"]
pub Service_UUID_16: u16,
#[doc = "128-bit UUID"]
pub Service_UUID_128: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_Service_UUID_t() {
const UNINIT: ::core::mem::MaybeUninit<Service_UUID_t> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Service_UUID_t>(),
16usize,
concat!("Size of: ", stringify!(Service_UUID_t))
);
assert_eq!(
::core::mem::align_of::<Service_UUID_t>(),
1usize,
concat!("Alignment of ", stringify!(Service_UUID_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Service_UUID_16) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Service_UUID_t),
"::",
stringify!(Service_UUID_16)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Service_UUID_128) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Service_UUID_t),
"::",
stringify!(Service_UUID_128)
)
);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub union Char_UUID_t {
#[doc = "16-bit UUID"]
pub Char_UUID_16: u16,
#[doc = "128-bit UUID"]
pub Char_UUID_128: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_Char_UUID_t() {
const UNINIT: ::core::mem::MaybeUninit<Char_UUID_t> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Char_UUID_t>(),
16usize,
concat!("Size of: ", stringify!(Char_UUID_t))
);
assert_eq!(
::core::mem::align_of::<Char_UUID_t>(),
1usize,
concat!("Alignment of ", stringify!(Char_UUID_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Char_UUID_16) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Char_UUID_t),
"::",
stringify!(Char_UUID_16)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Char_UUID_128) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Char_UUID_t),
"::",
stringify!(Char_UUID_128)
)
);
}
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub union Char_Desc_Uuid_t {
#[doc = "16-bit UUID"]
pub Char_UUID_16: u16,
#[doc = "128-bit UUID"]
pub Char_UUID_128: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_Char_Desc_Uuid_t() {
const UNINIT: ::core::mem::MaybeUninit<Char_Desc_Uuid_t> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<Char_Desc_Uuid_t>(),
16usize,
concat!("Size of: ", stringify!(Char_Desc_Uuid_t))
);
assert_eq!(
::core::mem::align_of::<Char_Desc_Uuid_t>(),
1usize,
concat!("Alignment of ", stringify!(Char_Desc_Uuid_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Char_UUID_16) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Char_Desc_Uuid_t),
"::",
stringify!(Char_UUID_16)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).Char_UUID_128) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(Char_Desc_Uuid_t),
"::",
stringify!(Char_UUID_128)
)
);
}
pub type cbBleGattCharacteristicData = ::core::option::Option<
unsafe extern "C" fn(
context: *const core::ffi::c_void,
data: *mut *const u8,
data_len: *mut u16,
) -> bool,
>;
pub const BleGattCharacteristicDataType_FlipperGattCharacteristicDataFixed:
BleGattCharacteristicDataType = 0;
pub const BleGattCharacteristicDataType_FlipperGattCharacteristicDataCallback:
BleGattCharacteristicDataType = 1;
pub type BleGattCharacteristicDataType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BleGattCharacteristicDescriptorParams {
pub uuid: Char_Desc_Uuid_t,
pub data_callback: BleGattCharacteristicDescriptorParams__bindgen_ty_1,
pub uuid_type: u8,
pub max_length: u8,
pub security_permissions: u8,
pub access_permissions: u8,
pub gatt_evt_mask: u8,
pub is_variable: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleGattCharacteristicDescriptorParams__bindgen_ty_1 {
pub fn_: cbBleGattCharacteristicData,
pub context: *const core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicDescriptorParams__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<BleGattCharacteristicDescriptorParams__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicDescriptorParams__bindgen_ty_1>(),
8usize,
concat!(
"Size of: ",
stringify!(BleGattCharacteristicDescriptorParams__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicDescriptorParams__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(BleGattCharacteristicDescriptorParams__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fn_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams__bindgen_ty_1),
"::",
stringify!(fn_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams__bindgen_ty_1),
"::",
stringify!(context)
)
);
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicDescriptorParams() {
const UNINIT: ::core::mem::MaybeUninit<BleGattCharacteristicDescriptorParams> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicDescriptorParams>(),
32usize,
concat!(
"Size of: ",
stringify!(BleGattCharacteristicDescriptorParams)
)
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicDescriptorParams>(),
4usize,
concat!(
"Alignment of ",
stringify!(BleGattCharacteristicDescriptorParams)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uuid) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(uuid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_callback) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(data_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uuid_type) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(uuid_type)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_length) as usize - ptr as usize },
25usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(max_length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).security_permissions) as usize - ptr as usize },
26usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(security_permissions)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).access_permissions) as usize - ptr as usize },
27usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(access_permissions)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).gatt_evt_mask) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(gatt_evt_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).is_variable) as usize - ptr as usize },
29usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicDescriptorParams),
"::",
stringify!(is_variable)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct BleGattCharacteristicParams {
pub name: *const core::ffi::c_char,
pub descriptor_params: *mut BleGattCharacteristicDescriptorParams,
pub data: BleGattCharacteristicParams__bindgen_ty_1,
pub uuid: Char_UUID_t,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub char_properties: u8,
pub security_permissions: u8,
pub gatt_evt_mask: u8,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union BleGattCharacteristicParams__bindgen_ty_1 {
pub fixed: BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1,
pub callback: BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1 {
pub ptr: *const u8,
pub length: u16,
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<
BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1,
> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1>(),
8usize,
concat!(
"Size of: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(ptr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(length)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2 {
pub fn_: cbBleGattCharacteristicData,
pub context: *const core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2() {
const UNINIT: ::core::mem::MaybeUninit<
BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2,
> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2>(),
8usize,
concat!(
"Size of: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2>(),
4usize,
concat!(
"Alignment of ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fn_) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(fn_)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(context)
)
);
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicParams__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<BleGattCharacteristicParams__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicParams__bindgen_ty_1>(),
8usize,
concat!(
"Size of: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1)
)
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicParams__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fixed) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1),
"::",
stringify!(fixed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams__bindgen_ty_1),
"::",
stringify!(callback)
)
);
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicParams() {
const UNINIT: ::core::mem::MaybeUninit<BleGattCharacteristicParams> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicParams>(),
36usize,
concat!("Size of: ", stringify!(BleGattCharacteristicParams))
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicParams>(),
4usize,
concat!("Alignment of ", stringify!(BleGattCharacteristicParams))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).descriptor_params) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(descriptor_params)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).uuid) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(uuid)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).char_properties) as usize - ptr as usize },
33usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(char_properties)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).security_permissions) as usize - ptr as usize },
34usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(security_permissions)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).gatt_evt_mask) as usize - ptr as usize },
35usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicParams),
"::",
stringify!(gatt_evt_mask)
)
);
}
impl BleGattCharacteristicParams {
#[inline]
pub fn data_prop_type(&self) -> BleGattCharacteristicDataType {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
}
#[inline]
pub fn set_data_prop_type(&mut self, val: BleGattCharacteristicDataType) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 2u8, val as u64)
}
}
#[inline]
pub fn is_variable(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
}
#[inline]
pub fn set_is_variable(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(2usize, 2u8, val as u64)
}
}
#[inline]
pub fn uuid_type(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
}
#[inline]
pub fn set_uuid_type(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(4usize, 2u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
data_prop_type: BleGattCharacteristicDataType,
is_variable: u8,
uuid_type: u8,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 2u8, {
let data_prop_type: u8 = unsafe { ::core::mem::transmute(data_prop_type) };
data_prop_type as u64
});
__bindgen_bitfield_unit.set(2usize, 2u8, {
let is_variable: u8 = unsafe { ::core::mem::transmute(is_variable) };
is_variable as u64
});
__bindgen_bitfield_unit.set(4usize, 2u8, {
let uuid_type: u8 = unsafe { ::core::mem::transmute(uuid_type) };
uuid_type as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleGattCharacteristicInstance {
pub characteristic: *const BleGattCharacteristicParams,
pub handle: u16,
pub descriptor_handle: u16,
}
#[test]
fn bindgen_test_layout_BleGattCharacteristicInstance() {
const UNINIT: ::core::mem::MaybeUninit<BleGattCharacteristicInstance> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<BleGattCharacteristicInstance>(),
8usize,
concat!("Size of: ", stringify!(BleGattCharacteristicInstance))
);
assert_eq!(
::core::mem::align_of::<BleGattCharacteristicInstance>(),
4usize,
concat!("Alignment of ", stringify!(BleGattCharacteristicInstance))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).characteristic) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicInstance),
"::",
stringify!(characteristic)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).handle) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicInstance),
"::",
stringify!(handle)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).descriptor_handle) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(BleGattCharacteristicInstance),
"::",
stringify!(descriptor_handle)
)
);
}
extern "C" {
pub fn ble_gatt_characteristic_init(
svc_handle: u16,
char_descriptor: *const BleGattCharacteristicParams,
char_instance: *mut BleGattCharacteristicInstance,
);
}
extern "C" {
pub fn ble_gatt_characteristic_delete(
svc_handle: u16,
char_instance: *mut BleGattCharacteristicInstance,
);
}
extern "C" {
pub fn ble_gatt_characteristic_update(
svc_handle: u16,
char_instance: *mut BleGattCharacteristicInstance,
source: *const core::ffi::c_void,
) -> bool;
}
extern "C" {
pub fn ble_gatt_service_add(
Service_UUID_Type: u8,
Service_UUID: *const Service_UUID_t,
Service_Type: u8,
Max_Attribute_Records: u8,
Service_Handle: *mut u16,
) -> bool;
}
extern "C" {
pub fn ble_gatt_service_delete(svc_handle: u16) -> bool;
}
pub const SerialServiceEventType_SerialServiceEventTypeDataReceived: SerialServiceEventType = 0;
pub const SerialServiceEventType_SerialServiceEventTypeDataSent: SerialServiceEventType = 1;
pub const SerialServiceEventType_SerialServiceEventTypesBleResetRequest: SerialServiceEventType = 2;
pub type SerialServiceEventType = core::ffi::c_uchar;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SerialServiceData {
pub buffer: *mut u8,
pub size: u16,
}
#[test]
fn bindgen_test_layout_SerialServiceData() {
const UNINIT: ::core::mem::MaybeUninit<SerialServiceData> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SerialServiceData>(),
8usize,
concat!("Size of: ", stringify!(SerialServiceData))
);
assert_eq!(
::core::mem::align_of::<SerialServiceData>(),
4usize,
concat!("Alignment of ", stringify!(SerialServiceData))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SerialServiceData),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SerialServiceData),
"::",
stringify!(size)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SerialServiceEvent {
pub event: SerialServiceEventType,
pub data: SerialServiceData,
}
#[test]
fn bindgen_test_layout_SerialServiceEvent() {
const UNINIT: ::core::mem::MaybeUninit<SerialServiceEvent> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<SerialServiceEvent>(),
12usize,
concat!("Size of: ", stringify!(SerialServiceEvent))
);
assert_eq!(
::core::mem::align_of::<SerialServiceEvent>(),
4usize,
concat!("Alignment of ", stringify!(SerialServiceEvent))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).event) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SerialServiceEvent),
"::",
stringify!(event)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SerialServiceEvent),
"::",
stringify!(data)
)
);
}
pub type SerialServiceEventCallback = ::core::option::Option<
unsafe extern "C" fn(event: SerialServiceEvent, context: *mut core::ffi::c_void) -> u16,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleServiceSerial {
_unused: [u8; 0],
}
extern "C" {
pub fn ble_svc_serial_start() -> *mut BleServiceSerial;
}
extern "C" {
pub fn ble_svc_serial_stop(service: *mut BleServiceSerial);
}
extern "C" {
pub fn ble_svc_serial_set_callbacks(
service: *mut BleServiceSerial,
buff_size: u16,
callback: SerialServiceEventCallback,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn ble_svc_serial_set_rpc_active(service: *mut BleServiceSerial, active: bool);
}
extern "C" {
pub fn ble_svc_serial_notify_buffer_is_empty(service: *mut BleServiceSerial);
}
extern "C" {
pub fn ble_svc_serial_update_tx(
service: *mut BleServiceSerial,
data: *mut u8,
data_len: u16,
) -> bool;
}
#[doc = "Serial service callback type"]
pub type FuriHalBtSerialCallback = SerialServiceEventCallback;
extern "C" {
#[doc = "Send data through BLE\n\n # Arguments\n\n* `profile` - Profile instance\n * `data` - data buffer\n * `size` - data buffer size\n\n # Returns\n\ntrue on success"]
pub fn ble_profile_serial_tx(
profile: *mut FuriHalBleProfileBase,
data: *mut u8,
size: u16,
) -> bool;
}
extern "C" {
#[doc = "Set BLE RPC status\n\n # Arguments\n\n* `profile` - Profile instance\n * `active` - true if RPC is active"]
pub fn ble_profile_serial_set_rpc_active(profile: *mut FuriHalBleProfileBase, active: bool);
}
extern "C" {
#[doc = "Notify that application buffer is empty\n # Arguments\n\n* `profile` - Profile instance"]
pub fn ble_profile_serial_notify_buffer_is_empty(profile: *mut FuriHalBleProfileBase);
}
extern "C" {
#[doc = "Set Serial service events callback\n\n # Arguments\n\n* `profile` - Profile instance\n * `buffer_size` - Applicaition buffer size\n * `calback` - FuriHalBtSerialCallback instance\n * `context` - pointer to context"]
pub fn ble_profile_serial_set_event_callback(
profile: *mut FuriHalBleProfileBase,
buff_size: u16,
callback: FuriHalBtSerialCallback,
context: *mut core::ffi::c_void,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleServiceBattery {
_unused: [u8; 0],
}
extern "C" {
pub fn ble_svc_battery_start(auto_update: bool) -> *mut BleServiceBattery;
}
extern "C" {
pub fn ble_svc_battery_stop(service: *mut BleServiceBattery);
}
extern "C" {
pub fn ble_svc_battery_update_level(service: *mut BleServiceBattery, battery_level: u8)
-> bool;
}
extern "C" {
pub fn ble_svc_battery_update_power_state(
service: *mut BleServiceBattery,
charging: bool,
) -> bool;
}
extern "C" {
pub fn ble_svc_battery_state_update(battery_level: *mut u8, charging: *mut bool);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BleServiceDevInfo {
_unused: [u8; 0],
}
extern "C" {
pub fn ble_svc_dev_info_start() -> *mut BleServiceDevInfo;
}
extern "C" {
pub fn ble_svc_dev_info_stop(service: *mut BleServiceDevInfo);
}
pub const FuriHalPwmOutputId_FuriHalPwmOutputIdTim1PA7: FuriHalPwmOutputId = 0;
pub const FuriHalPwmOutputId_FuriHalPwmOutputIdLptim2PA4: FuriHalPwmOutputId = 1;
pub type FuriHalPwmOutputId = core::ffi::c_uchar;
extern "C" {
#[doc = "Enable PWM channel and set parameters\n\n # Arguments\n\n* `channel` (direction in) - PWM channel (FuriHalPwmOutputId)\n * `freq` (direction in) - Frequency in Hz\n * `duty` (direction in) - Duty cycle value in %"]
pub fn furi_hal_pwm_start(channel: FuriHalPwmOutputId, freq: u32, duty: u8);
}
extern "C" {
#[doc = "Disable PWM channel\n\n # Arguments\n\n* `channel` (direction in) - PWM channel (FuriHalPwmOutputId)"]
pub fn furi_hal_pwm_stop(channel: FuriHalPwmOutputId);
}
extern "C" {
#[doc = "Set PWM channel parameters\n\n # Arguments\n\n* `channel` (direction in) - PWM channel (FuriHalPwmOutputId)\n * `freq` (direction in) - Frequency in Hz\n * `duty` (direction in) - Duty cycle value in %"]
pub fn furi_hal_pwm_set_params(channel: FuriHalPwmOutputId, freq: u32, duty: u8);
}
extern "C" {
#[doc = "Is PWM channel running?\n\n # Arguments\n\n* `channel` (direction in) - PWM channel (FuriHalPwmOutputId)\n # Returns\n\nbool - true if running"]
pub fn furi_hal_pwm_is_running(channel: FuriHalPwmOutputId) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CdcCallbacks {
pub tx_ep_callback:
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>,
pub rx_ep_callback:
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void)>,
pub state_callback:
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, state: u8)>,
pub ctrl_line_callback:
::core::option::Option<unsafe extern "C" fn(context: *mut core::ffi::c_void, state: u8)>,
pub config_callback: ::core::option::Option<
unsafe extern "C" fn(context: *mut core::ffi::c_void, config: *mut usb_cdc_line_coding),
>,
}
#[test]
fn bindgen_test_layout_CdcCallbacks() {
const UNINIT: ::core::mem::MaybeUninit<CdcCallbacks> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<CdcCallbacks>(),
20usize,
concat!("Size of: ", stringify!(CdcCallbacks))
);
assert_eq!(
::core::mem::align_of::<CdcCallbacks>(),
4usize,
concat!("Alignment of ", stringify!(CdcCallbacks))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tx_ep_callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(CdcCallbacks),
"::",
stringify!(tx_ep_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rx_ep_callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(CdcCallbacks),
"::",
stringify!(rx_ep_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).state_callback) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(CdcCallbacks),
"::",
stringify!(state_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ctrl_line_callback) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(CdcCallbacks),
"::",
stringify!(ctrl_line_callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(CdcCallbacks),
"::",
stringify!(config_callback)
)
);
}
extern "C" {
pub fn furi_hal_cdc_set_callbacks(
if_num: u8,
cb: *mut CdcCallbacks,
context: *mut core::ffi::c_void,
);
}
extern "C" {
pub fn furi_hal_cdc_get_port_settings(if_num: u8) -> *mut usb_cdc_line_coding;
}
extern "C" {
pub fn furi_hal_cdc_get_ctrl_line_state(if_num: u8) -> u8;
}
extern "C" {
pub fn furi_hal_cdc_send(if_num: u8, buf: *mut u8, len: u16);
}
extern "C" {
pub fn furi_hal_cdc_receive(if_num: u8, buf: *mut u8, max_len: u16) -> i32;
}
extern "C" {
pub fn __errno() -> *mut core::ffi::c_int;
}
extern "C" {
pub fn __cxa_pure_virtual();
}
extern "C" {
pub fn __clear_cache(arg1: *mut core::ffi::c_void, arg2: *mut core::ffi::c_void);
}
extern "C" {
pub fn __aeabi_uldivmod(arg1: u64, arg2: u64) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Init memory pool manager"]
pub fn furi_hal_memory_init();
}
extern "C" {
#[doc = "Allocate memory from separate memory pool. That memory can't be freed.\n\n # Arguments\n\n* `size` -\n # Returns\n\nvoid*"]
pub fn furi_hal_memory_alloc(size: usize) -> *mut core::ffi::c_void;
}
extern "C" {
#[doc = "Get free memory pool size\n\n # Returns\n\nsize_t"]
pub fn furi_hal_memory_get_free() -> usize;
}
extern "C" {
#[doc = "Get max free block size from memory pool\n\n # Returns\n\nsize_t"]
pub fn furi_hal_memory_max_pool_block() -> usize;
}
pub const FuriHalMpuRegion_FuriHalMpuRegionNULL: FuriHalMpuRegion = 0;
pub const FuriHalMpuRegion_FuriHalMpuRegionMainStack: FuriHalMpuRegion = 1;
pub const FuriHalMpuRegion_FuriHalMpuRegionThreadStack: FuriHalMpuRegion = 2;
pub const FuriHalMpuRegion_FuriHalMpuRegion3: FuriHalMpuRegion = 3;
pub const FuriHalMpuRegion_FuriHalMpuRegion4: FuriHalMpuRegion = 4;
pub const FuriHalMpuRegion_FuriHalMpuRegion5: FuriHalMpuRegion = 5;
pub const FuriHalMpuRegion_FuriHalMpuRegion6: FuriHalMpuRegion = 6;
pub const FuriHalMpuRegion_FuriHalMpuRegion7: FuriHalMpuRegion = 7;
pub type FuriHalMpuRegion = core::ffi::c_uchar;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize32B: FuriHalMPURegionSize = 4;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize64B: FuriHalMPURegionSize = 5;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize128B: FuriHalMPURegionSize = 6;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize256B: FuriHalMPURegionSize = 7;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize512B: FuriHalMPURegionSize = 8;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize1KB: FuriHalMPURegionSize = 9;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize2KB: FuriHalMPURegionSize = 10;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize4KB: FuriHalMPURegionSize = 11;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize8KB: FuriHalMPURegionSize = 12;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize16KB: FuriHalMPURegionSize = 13;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize32KB: FuriHalMPURegionSize = 14;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize64KB: FuriHalMPURegionSize = 15;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize128KB: FuriHalMPURegionSize = 16;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize256KB: FuriHalMPURegionSize = 17;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize512KB: FuriHalMPURegionSize = 18;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize1MB: FuriHalMPURegionSize = 19;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize2MB: FuriHalMPURegionSize = 20;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize4MB: FuriHalMPURegionSize = 21;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize8MB: FuriHalMPURegionSize = 22;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize16MB: FuriHalMPURegionSize = 23;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize32MB: FuriHalMPURegionSize = 24;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize64MB: FuriHalMPURegionSize = 25;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize128MB: FuriHalMPURegionSize = 26;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize256MB: FuriHalMPURegionSize = 27;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize512MB: FuriHalMPURegionSize = 28;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize1GB: FuriHalMPURegionSize = 29;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize2GB: FuriHalMPURegionSize = 30;
pub const FuriHalMPURegionSize_FuriHalMPURegionSize4GB: FuriHalMPURegionSize = 31;
pub type FuriHalMPURegionSize = core::ffi::c_uchar;
extern "C" {
#[doc = "Enable memory protection unit"]
pub fn furi_hal_mpu_enable();
}
extern "C" {
#[doc = "Disable memory protection unit"]
pub fn furi_hal_mpu_disable();
}
extern "C" {
pub fn furi_hal_mpu_protect_no_access(
region: FuriHalMpuRegion,
address: u32,
size: FuriHalMPURegionSize,
);
}
extern "C" {
pub fn furi_hal_mpu_protect_read_only(
region: FuriHalMpuRegion,
address: u32,
size: FuriHalMPURegionSize,
);
}
extern "C" {
pub fn furi_hal_mpu_protect_disable(region: FuriHalMpuRegion);
}
pub const HidU2fEvent_HidU2fDisconnected: HidU2fEvent = 0;
pub const HidU2fEvent_HidU2fConnected: HidU2fEvent = 1;
pub const HidU2fEvent_HidU2fRequest: HidU2fEvent = 2;
pub type HidU2fEvent = core::ffi::c_uchar;
pub type HidU2fCallback =
::core::option::Option<unsafe extern "C" fn(ev: HidU2fEvent, context: *mut core::ffi::c_void)>;
extern "C" {
#[doc = "Get HID U2F connection state\n\n # Returns\n\ntrue / false"]
pub fn furi_hal_hid_u2f_is_connected() -> bool;
}
extern "C" {
#[doc = "Set HID U2F event callback\n\n # Arguments\n\n* `cb` - callback\n * `ctx` - callback context"]
pub fn furi_hal_hid_u2f_set_callback(cb: HidU2fCallback, ctx: *mut core::ffi::c_void);
}
extern "C" {
#[doc = "Get received U2F HID packet\n"]
pub fn furi_hal_hid_u2f_get_request(data: *mut u8) -> u32;
}
extern "C" {
#[doc = "Send U2F HID response packet\n\n # Arguments\n\n* `data` - response data\n * `len` - packet length"]
pub fn furi_hal_hid_u2f_send_response(data: *mut u8, len: u8);
}