diff --git a/README.md b/README.md index 92d557f3..5967432b 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,13 @@ This means it's not possible to use anything the [`std`](https://doc.rust-lang.o ## SDK version -Currently supports SDK 10.1 ([flipperzero-firmware@0.73.1](https://github.com/flipperdevices/flipperzero-firmware/tree/0.73.1)). +Currently supports SDK 11.2 ([flipperzero-firmware@0.74.2](https://github.com/flipperdevices/flipperzero-firmware/tree/0.74.2)). The Rust crate version number will be updated after a major [API version](https://github.com/flipperdevices/flipperzero-firmware/blob/release/firmware/targets/f7/api_symbols.csv) bump in the Flipper Zero firmware. | Crate version | API version | | ------------- | ----------- | +| 0.6.x | 11.2 | | 0.5.x | 10.1 | | 0.4.x | 7.5 | | 0.3.x | 2.2 | diff --git a/crates/alloc/Cargo.toml b/crates/alloc/Cargo.toml index 19dea651..b3b33952 100644 --- a/crates/alloc/Cargo.toml +++ b/crates/alloc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flipperzero-alloc" -version = "0.5.0" +version = "0.6.0-alpha" description = "Rust for Flipper Zero" repository = "https://github.com/dcoles/flipperzero-rs" readme = "../../README.md" @@ -22,4 +22,4 @@ bench = false test = false [dependencies] -flipperzero-sys = { path = "../sys", version = "0.5.0" } +flipperzero-sys = { path = "../sys", version = "0.6.0-alpha" } diff --git a/crates/flipperzero/Cargo.toml b/crates/flipperzero/Cargo.toml index f3164188..395a4a25 100644 --- a/crates/flipperzero/Cargo.toml +++ b/crates/flipperzero/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flipperzero" -version = "0.5.0" +version = "0.6.0-alpha" description = "Rust for Flipper Zero" repository = "https://github.com/dcoles/flipperzero-rs" readme = "../../README.md" @@ -21,10 +21,10 @@ bench = false test = false [dependencies] -flipperzero-sys = { path = "../sys", version = "0.5.0" } +flipperzero-sys = { path = "../sys", version = "0.6.0-alpha" } [dev-dependencies] -flipperzero-rt = { path = "../rt", version = "0.5.0" } +flipperzero-rt = { path = "../rt", version = "0.6.0-alpha" } [features] # enables features requiring an allocator diff --git a/crates/rt/Cargo.toml b/crates/rt/Cargo.toml index 3b502030..48ea0dd1 100644 --- a/crates/rt/Cargo.toml +++ b/crates/rt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flipperzero-rt" -version = "0.5.0" +version = "0.6.0-alpha" description = "Rust for Flipper Zero" repository = "https://github.com/dcoles/flipperzero-rs" readme = "../../README.md" @@ -22,4 +22,4 @@ bench = false test = false [dependencies] -flipperzero-sys = { path = "../sys", version = "0.5.0" } +flipperzero-sys = { path = "../sys", version = "0.6.0-alpha" } diff --git a/crates/sys/Cargo.toml b/crates/sys/Cargo.toml index 64716cfb..4a1bfa0d 100644 --- a/crates/sys/Cargo.toml +++ b/crates/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flipperzero-sys" -version = "0.5.0" +version = "0.6.0-alpha" description = "Rust for Flipper Zero" repository = "https://github.com/dcoles/flipperzero-rs" readme = "../../README.md" diff --git a/crates/sys/src/bindings.rs b/crates/sys/src/bindings.rs index c8e5c70c..01ef623a 100644 --- a/crates/sys/src/bindings.rs +++ b/crates/sys/src/bindings.rs @@ -110,7 +110,7 @@ impl ::core::fmt::Debug for __IncompleteArrayField { fmt.write_str("__IncompleteArrayField") } } -pub const API_VERSION: u32 = 655361; +pub const API_VERSION: u32 = 720898; pub type wint_t = core::ffi::c_ushort; pub type _off_t = core::ffi::c_long; pub type _fpos_t = core::ffi::c_long; @@ -5469,6 +5469,22 @@ extern "C" { #[doc = " @param bt Bt instance"] pub fn bt_forget_bonded_devices(bt: *mut Bt); } +extern "C" { + #[doc = " Set keys storage file path"] + #[doc = ""] + #[doc = " @param bt Bt instance"] + #[doc = " @param 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"] + #[doc = ""] + #[doc = " @param bt Bt instance"] + pub fn bt_keys_storage_set_default_path(bt: *mut Bt); +} #[doc = "< Default, loader lock is used"] pub const CliCommandFlag_CliCommandFlagDefault: CliCommandFlag = 0; pub const CliCommandFlag_CliCommandFlagParallelSafe: CliCommandFlag = 1; @@ -7169,6 +7185,26 @@ extern "C" { #[doc = " @param width max width"] pub fn elements_string_fit_width(canvas: *mut Canvas, string: *mut FuriString, width: u8); } +extern "C" { + #[doc = " Draw scrollable text line"] + #[doc = ""] + #[doc = " @param canvas The canvas"] + #[doc = " @param[in] x X coordinate"] + #[doc = " @param[in] y Y coordinate"] + #[doc = " @param[in] width The width"] + #[doc = " @param string The string"] + #[doc = " @param[in] scroll The scroll counter: 0 - no scroll, any other number - scroll. Just count up, everything else will be calculated on the inside."] + #[doc = " @param[in] ellipsis The ellipsis flag: true to add ellipse"] + pub fn elements_scrollable_text_line( + canvas: *mut Canvas, + x: u8, + y: u8, + width: u8, + string: *mut FuriString, + scroll: usize, + ellipsis: bool, + ); +} extern "C" { #[doc = " Draw text box element"] #[doc = ""] @@ -9250,8250 +9286,8510 @@ extern "C" { #[doc = " Show primary loader"] pub fn loader_get_pubsub(instance: *mut Loader) -> *mut FuriPubSub; } +#[doc = " Cortex timer provides high precision low level expiring timer"] #[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, +pub struct FuriHalCortexTimer { + pub start: u32, + pub value: u32, } #[test] -fn bindgen_test_layout_NotificationMessageDataSound() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_FuriHalCortexTimer() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), + ::core::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(NotificationMessageDataSound)) + concat!("Size of: ", stringify!(FuriHalCortexTimer)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(NotificationMessageDataSound)) + concat!("Alignment of ", stringify!(FuriHalCortexTimer)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).frequency) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataSound), + stringify!(FuriHalCortexTimer), "::", - stringify!(frequency) + stringify!(start) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).volume) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataSound), + stringify!(FuriHalCortexTimer), "::", - stringify!(volume) + stringify!(value) ) ); } +extern "C" { + #[doc = " Microseconds delay"] + #[doc = ""] + #[doc = " @param[in] microseconds The microseconds to wait"] + pub fn furi_hal_cortex_delay_us(microseconds: u32); +} +extern "C" { + #[doc = " Get instructions per microsecond count"] + #[doc = ""] + #[doc = " @return instructions per microsecond count"] + pub fn furi_hal_cortex_instructions_per_microsecond() -> u32; +} +extern "C" { + #[doc = " Get Timer"] + #[doc = ""] + #[doc = " @param[in] timeout_us The expire timeout in us"] + #[doc = ""] + #[doc = " @return The FuriHalCortexTimer"] + pub fn furi_hal_cortex_timer_get(timeout_us: u32) -> FuriHalCortexTimer; +} +extern "C" { + #[doc = " Check if timer expired"] + #[doc = ""] + #[doc = " @param[in] cortex_timer The FuriHalCortexTimer"] + #[doc = ""] + #[doc = " @return true if expired"] + pub fn furi_hal_cortex_timer_is_expired(cortex_timer: FuriHalCortexTimer) -> bool; +} +extern "C" { + #[doc = " Wait for timer expire"] + #[doc = ""] + #[doc = " @param[in] cortex_timer The FuriHalCortexTimer"] + pub fn furi_hal_cortex_timer_wait(cortex_timer: FuriHalCortexTimer); +} +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 = " Early deinitialization"] + pub fn furi_hal_clock_deinit_early(); +} +extern "C" { + #[doc = " Enable clock output on MCO pin"] + #[doc = ""] + #[doc = " @param source MCO clock source"] + #[doc = " @param 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(); +} +#[doc = "< Master key"] +pub const FuriHalCryptoKeyType_FuriHalCryptoKeyTypeMaster: FuriHalCryptoKeyType = 0; +#[doc = "< Simple enencrypted 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 NotificationMessageDataLed { - pub value: u8, +pub struct FuriHalCryptoKey { + pub type_: FuriHalCryptoKeyType, + pub size: FuriHalCryptoKeySize, + pub data: *mut u8, } #[test] -fn bindgen_test_layout_NotificationMessageDataLed() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_FuriHalCryptoKey() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(NotificationMessageDataLed)) + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(FuriHalCryptoKey)) ); assert_eq!( - ::core::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(NotificationMessageDataLed)) + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(FuriHalCryptoKey)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataLed), + stringify!(FuriHalCryptoKey), "::", - stringify!(value) + stringify!(type_) ) ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NotificationMessageDataVibro { - pub on: bool, -} -#[test] -fn bindgen_test_layout_NotificationMessageDataVibro() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(NotificationMessageDataVibro)) - ); assert_eq!( - ::core::mem::align_of::(), + unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 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!(FuriHalCryptoKey), "::", - stringify!(on) + stringify!(size) ) ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NotificationMessageDataDelay { - pub length: u32, -} -#[test] -fn bindgen_test_layout_NotificationMessageDataDelay() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(NotificationMessageDataDelay)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(NotificationMessageDataDelay)) - ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataDelay), + stringify!(FuriHalCryptoKey), "::", - stringify!(length) + stringify!(data) ) ); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NotificationMessageDataForcedSettings { - pub speaker_volume: f32, - pub vibro: bool, - pub display_brightness: f32, +extern "C" { + pub fn furi_hal_crypto_verify_enclave(keys_nb: *mut u8, valid_keys_nb: *mut u8) -> bool; } -#[test] -fn bindgen_test_layout_NotificationMessageDataForcedSettings() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 12usize, - concat!( - "Size of: ", - stringify!(NotificationMessageDataForcedSettings) - ) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!( - "Alignment of ", - stringify!(NotificationMessageDataForcedSettings) - ) +extern "C" { + pub fn furi_hal_crypto_verify_key(key_slot: u8) -> bool; +} +extern "C" { + #[doc = " Store key in crypto storage"] + #[doc = ""] + #[doc = " @param key FuriHalCryptoKey to store. Only Master, Simple or"] + #[doc = " Encrypted"] + #[doc = " @param slot pinter to int where store slot number will be saved"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_crypto_store_add_key(key: *mut FuriHalCryptoKey, slot: *mut u8) -> bool; +} +extern "C" { + #[doc = " Init AES engine and load key from crypto store"] + #[doc = ""] + #[doc = " @param slot store slot number"] + #[doc = " @param[in] iv pointer to 16 bytes Initialization Vector data"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_crypto_store_load_key(slot: u8, iv: *const u8) -> bool; +} +extern "C" { + #[doc = " Unload key engine and deinit AES engine"] + #[doc = ""] + #[doc = " @param slot store slot number"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_crypto_store_unload_key(slot: u8) -> bool; +} +extern "C" { + #[doc = " Encrypt data"] + #[doc = ""] + #[doc = " @param input pointer to input data"] + #[doc = " @param output pointer to output data"] + #[doc = " @param size input/output buffer size in bytes"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_crypto_encrypt(input: *const u8, output: *mut u8, size: usize) -> bool; +} +extern "C" { + #[doc = " Decrypt data"] + #[doc = ""] + #[doc = " @param input pointer to input data"] + #[doc = " @param output pointer to output data"] + #[doc = " @param size input/output buffer size in bytes"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_crypto_decrypt(input: *const u8, output: *mut u8, size: usize) -> bool; +} +pub type FuriHalConsoleTxCallback = ::core::option::Option< + unsafe extern "C" fn(buffer: *const u8, size: usize, context: *mut core::ffi::c_void), +>; +extern "C" { + pub fn furi_hal_console_init(); +} +extern "C" { + pub fn furi_hal_console_enable(); +} +extern "C" { + pub fn furi_hal_console_disable(); +} +extern "C" { + pub fn furi_hal_console_set_tx_callback( + callback: FuriHalConsoleTxCallback, + context: *mut core::ffi::c_void, + ); +} +extern "C" { + pub fn furi_hal_console_tx(buffer: *const u8, buffer_size: usize); +} +extern "C" { + pub fn furi_hal_console_tx_with_new_line(buffer: *const u8, buffer_size: usize); +} +extern "C" { + #[doc = " Printf-like plain uart interface"] + #[doc = " @warning Will not work in ISR context"] + #[doc = " @param format"] + #[doc = " @param ..."] + pub fn furi_hal_console_printf(format: *const core::ffi::c_char, ...); +} +extern "C" { + pub fn furi_hal_console_puts(data: *const core::ffi::c_char); +} +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" { + pub fn furi_hal_os_tick(); +} +#[doc = " @brief SPI Init structures definition"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct LL_SPI_InitTypeDef { + #[doc = "< Specifies the SPI unidirectional or bidirectional data mode."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferDirection()."] + pub TransferDirection: u32, + #[doc = "< Specifies the SPI mode (Master/Slave)."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_MODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetMode()."] + pub Mode: u32, + #[doc = "< Specifies the SPI data width."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_DATAWIDTH."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetDataWidth()."] + pub DataWidth: u32, + #[doc = "< Specifies the serial clock steady state."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_POLARITY."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPolarity()."] + pub ClockPolarity: u32, + #[doc = "< Specifies the clock active edge for the bit capture."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_PHASE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref 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."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_NSS_MODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetNSSMode()."] + pub NSS: u32, + #[doc = "< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_BAUDRATEPRESCALER."] + #[doc = "@note The communication clock is derived from the master clock. The slave clock does not need to be set."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetBaudRatePrescaler()."] + pub BaudRate: u32, + #[doc = "< Specifies whether data transfers start from MSB or LSB bit."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_BIT_ORDER."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferBitOrder()."] + pub BitOrder: u32, + #[doc = "< Specifies if the CRC calculation is enabled or not."] + #[doc = "This parameter can be a value of @ref SPI_LL_EC_CRC_CALCULATION."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary functions @ref LL_SPI_EnableCRC() and @ref LL_SPI_DisableCRC()."] + pub CRCCalculation: u32, + #[doc = "< Specifies the polynomial used for the CRC calculation."] + #[doc = "This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetCRCPolynomial()."] + pub CRCPoly: u32, +} +#[test] +fn bindgen_test_layout_LL_SPI_InitTypeDef() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(LL_SPI_InitTypeDef)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).speaker_volume) as usize - ptr as usize }, + ::core::mem::align_of::(), + 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!(NotificationMessageDataForcedSettings), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(speaker_volume) + stringify!(TransferDirection) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).Mode) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataForcedSettings), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(vibro) + stringify!(Mode) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).display_brightness) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).DataWidth) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataForcedSettings), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(display_brightness) + stringify!(DataWidth) ) ); -} -#[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 = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 6usize, - concat!("Size of: ", stringify!(NotificationMessageDataLedBlink)) + 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!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(NotificationMessageDataLedBlink)) + 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).on_time) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).NSS) as usize - ptr as usize }, + 20usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataLedBlink), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(on_time) + stringify!(NSS) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).period) as usize - ptr as usize }, - 2usize, + unsafe { ::core::ptr::addr_of!((*ptr).BaudRate) as usize - ptr as usize }, + 24usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataLedBlink), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(period) + stringify!(BaudRate) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).color) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).BitOrder) as usize - ptr as usize }, + 28usize, concat!( "Offset of field: ", - stringify!(NotificationMessageDataLedBlink), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(color) + stringify!(BitOrder) ) ); -} -#[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 = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(NotificationMessageData)) - ); assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(NotificationMessageData)) + 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).sound) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).CRCPoly) as usize - ptr as usize }, + 36usize, concat!( "Offset of field: ", - stringify!(NotificationMessageData), + stringify!(LL_SPI_InitTypeDef), "::", - stringify!(sound) + 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 = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(FuriHalSpiBus)) + ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).led) as usize - ptr as usize }, + ::core::mem::align_of::(), + 8usize, + 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!(NotificationMessageData), + stringify!(FuriHalSpiBus), "::", - stringify!(led) + stringify!(spi) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).led_blink) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(NotificationMessageData), + stringify!(FuriHalSpiBus), "::", - stringify!(led_blink) + stringify!(callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).current_handle) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(NotificationMessageData), + stringify!(FuriHalSpiBus), "::", - stringify!(vibro) + 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 = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(FuriHalSpiBusHandle)) + ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).delay) as usize - ptr as usize }, + ::core::mem::align_of::(), + 8usize, + 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!(NotificationMessageData), + stringify!(FuriHalSpiBusHandle), "::", - stringify!(delay) + stringify!(bus) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).forced_settings) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(NotificationMessageData), + stringify!(FuriHalSpiBusHandle), "::", - stringify!(forced_settings) + stringify!(callback) ) ); -} -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 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 = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), + unsafe { ::core::ptr::addr_of!((*ptr).miso) as usize - ptr as usize }, 16usize, - concat!("Size of: ", stringify!(NotificationMessage)) + concat!( + "Offset of field: ", + stringify!(FuriHalSpiBusHandle), + "::", + stringify!(miso) + ) ); assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(NotificationMessage)) + unsafe { ::core::ptr::addr_of!((*ptr).mosi) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(FuriHalSpiBusHandle), + "::", + stringify!(mosi) + ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).sck) as usize - ptr as usize }, + 32usize, concat!( "Offset of field: ", - stringify!(NotificationMessage), + stringify!(FuriHalSpiBusHandle), "::", - stringify!(type_) + stringify!(sck) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, + 40usize, concat!( "Offset of field: ", - stringify!(NotificationMessage), + stringify!(FuriHalSpiBusHandle), "::", - stringify!(data) + stringify!(cs) ) ); } -pub type NotificationSequence = [*const NotificationMessage; 0usize]; extern "C" { - pub fn notification_message(app: *mut NotificationApp, sequence: *const NotificationSequence); + #[doc = " Init SD card detect"] + pub fn hal_sd_detect_init(); } extern "C" { - pub fn notification_message_block( - app: *mut NotificationApp, - sequence: *const NotificationSequence, - ); + #[doc = " Set SD card detect pin to low"] + pub fn hal_sd_detect_set_low(); } extern "C" { - #[doc = " @brief Send internal (apply to permanent layer) notification message. Think twice before use."] + #[doc = " Get SD card status"] #[doc = ""] - #[doc = " @param app notification record content"] - #[doc = " @param sequence notification sequence"] - pub fn notification_internal_message( - app: *mut NotificationApp, - sequence: *const NotificationSequence, - ); + #[doc = " @return true if SD card present, false if SD card not present"] + pub fn hal_sd_detect() -> bool; } extern "C" { - #[doc = " @brief Send internal (apply to permanent layer) notification message and wait for notification end. Think twice before use."] - #[doc = ""] - #[doc = " @param app notification record content"] - #[doc = " @param sequence notification sequence"] - pub fn notification_internal_message_block( - app: *mut NotificationApp, - sequence: *const NotificationSequence, - ); + #[doc = " Pointer to currently used SPI Handle"] + pub static mut furi_hal_sd_spi_handle: *mut FuriHalSpiBusHandle; } -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; +#[doc = " @defgroup I2C_LL_ES_INIT I2C Exported Init structure"] +#[doc = " @{"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct LL_I2C_InitTypeDef { + #[doc = "< Specifies the peripheral mode."] + #[doc = "This parameter can be a value of @ref I2C_LL_EC_PERIPHERAL_MODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_SetMode()."] + pub PeripheralMode: u32, + #[doc = "< Specifies the SDA setup, hold time and the SCL high, low period values."] + #[doc = "This parameter must be set by referring to the STM32CubeMX Tool and"] + #[doc = "the helper macro @ref __LL_I2C_CONVERT_TIMINGS()."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_SetTiming()."] + pub Timing: u32, + #[doc = "< Enables or disables analog noise filter."] + #[doc = "This parameter can be a value of @ref I2C_LL_EC_ANALOGFILTER_SELECTION."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary functions"] + #[doc = "@ref LL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter()."] + pub AnalogFilter: u32, + #[doc = "< Configures the digital noise filter."] + #[doc = "This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_SetDigitalFilter()."] + pub DigitalFilter: u32, + #[doc = "< Specifies the device own address 1."] + #[doc = "This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_SetOwnAddress1()."] + pub OwnAddress1: u32, + #[doc = "< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive"] + #[doc = "match code or next received byte."] + #[doc = "This parameter can be a value of @ref I2C_LL_EC_I2C_ACKNOWLEDGE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_AcknowledgeNextData()."] + pub TypeAcknowledge: u32, + #[doc = "< Specifies the device own address 1 size (7-bit or 10-bit)."] + #[doc = "This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_I2C_SetOwnAddress1()."] + pub OwnAddrSize: u32, } -extern "C" { - pub static message_note_g0: NotificationMessage; +#[test] +fn bindgen_test_layout_LL_I2C_InitTypeDef() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(LL_I2C_InitTypeDef)) + ); + assert_eq!( + ::core::mem::align_of::(), + 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" { - pub static message_note_gs0: NotificationMessage; + #[doc = " @defgroup I2C_LL_EF_Init Initialization and de-initialization functions"] + #[doc = " @{"] + pub fn LL_I2C_Init( + I2Cx: *mut I2C_TypeDef, + I2C_InitStruct: *mut LL_I2C_InitTypeDef, + ) -> ErrorStatus; } -extern "C" { - pub static message_note_a0: NotificationMessage; +#[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, } -extern "C" { - pub static message_note_as0: NotificationMessage; +#[test] +fn bindgen_test_layout_FuriHalI2cBus() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(FuriHalI2cBus)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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 }, + 8usize, + concat!( + "Offset of field: ", + stringify!(FuriHalI2cBus), + "::", + stringify!(current_handle) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(FuriHalI2cBus), + "::", + stringify!(callback) + ) + ); } -extern "C" { - pub static message_note_b0: NotificationMessage; +#[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, } -extern "C" { - pub static message_note_c1: NotificationMessage; -} -extern "C" { - pub static message_note_cs1: NotificationMessage; +#[test] +fn bindgen_test_layout_FuriHalI2cBusHandle() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(FuriHalI2cBusHandle)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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 }, + 8usize, + concat!( + "Offset of field: ", + stringify!(FuriHalI2cBusHandle), + "::", + stringify!(callback) + ) + ); } extern "C" { - pub static message_note_d1: NotificationMessage; + #[doc = " Internal(power) i2c bus, I2C1, under reset when not used"] + pub static mut furi_hal_i2c_bus_power: FuriHalI2cBus; } extern "C" { - pub static message_note_ds1: NotificationMessage; + #[doc = " External i2c bus, I2C3, under reset when not used"] + pub static mut furi_hal_i2c_bus_external: FuriHalI2cBus; } extern "C" { - pub static message_note_e1: NotificationMessage; + #[doc = " Handle for internal(power) i2c bus"] + #[doc = " Bus: furi_hal_i2c_bus_external"] + #[doc = " Pins: PA9(SCL) / PA10(SDA), float on release"] + #[doc = " Params: 400khz"] + pub static mut furi_hal_i2c_handle_power: FuriHalI2cBusHandle; } extern "C" { - pub static message_note_f1: NotificationMessage; + #[doc = " Handle for external i2c bus"] + #[doc = " Bus: furi_hal_i2c_bus_external"] + #[doc = " Pins: PC0(SCL) / PC1(SDA), float on release"] + #[doc = " Params: 100khz"] + pub static mut furi_hal_i2c_handle_external: FuriHalI2cBusHandle; } extern "C" { - pub static message_note_fs1: NotificationMessage; + #[doc = " Early DeInit I2C"] + pub fn furi_hal_i2c_deinit_early(); } extern "C" { - pub static message_note_g1: NotificationMessage; + #[doc = " Acquire i2c bus handle"] + #[doc = ""] + #[doc = " @return Instance of FuriHalI2cBus"] + pub fn furi_hal_i2c_acquire(handle: *mut FuriHalI2cBusHandle); } extern "C" { - pub static message_note_gs1: NotificationMessage; + #[doc = " Release i2c bus handle"] + #[doc = ""] + #[doc = " @param bus instance of FuriHalI2cBus aquired in `furi_hal_i2c_acquire`"] + pub fn furi_hal_i2c_release(handle: *mut FuriHalI2cBusHandle); } extern "C" { - pub static message_note_a1: NotificationMessage; + #[doc = " Perform I2C tx transfer"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param address I2C slave address"] + #[doc = " @param data pointer to data buffer"] + #[doc = " @param size size of data buffer"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true on successful transfer, false otherwise"] + pub fn furi_hal_i2c_tx( + handle: *mut FuriHalI2cBusHandle, + address: u8, + data: *const u8, + size: u8, + timeout: u32, + ) -> bool; } extern "C" { - pub static message_note_as1: NotificationMessage; + #[doc = " Perform I2C rx transfer"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param address I2C slave address"] + #[doc = " @param data pointer to data buffer"] + #[doc = " @param size size of data buffer"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true on successful transfer, false otherwise"] + pub fn furi_hal_i2c_rx( + handle: *mut FuriHalI2cBusHandle, + address: u8, + data: *mut u8, + size: u8, + timeout: u32, + ) -> bool; } extern "C" { - pub static message_note_b1: NotificationMessage; + #[doc = " Perform I2C tx and rx transfers"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param address I2C slave address"] + #[doc = " @param tx_data pointer to tx data buffer"] + #[doc = " @param tx_size size of tx data buffer"] + #[doc = " @param rx_data pointer to rx data buffer"] + #[doc = " @param rx_size size of rx data buffer"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true on successful transfer, false otherwise"] + pub fn furi_hal_i2c_trx( + handle: *mut FuriHalI2cBusHandle, + address: u8, + tx_data: *const u8, + tx_size: u8, + rx_data: *mut u8, + rx_size: u8, + timeout: u32, + ) -> bool; } extern "C" { - pub static message_note_c2: NotificationMessage; + #[doc = " Check if I2C device presents on bus"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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" { - pub static message_note_cs2: NotificationMessage; + #[doc = " Perform I2C device register read (8-bit)"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param reg_addr register address"] + #[doc = " @param data pointer to register value"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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" { - pub static message_note_d2: NotificationMessage; + #[doc = " Perform I2C device register read (16-bit)"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param reg_addr register address"] + #[doc = " @param data pointer to register value"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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" { - pub static message_note_ds2: NotificationMessage; + #[doc = " Perform I2C device memory read"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param mem_addr memory start address"] + #[doc = " @param data pointer to data buffer"] + #[doc = " @param len size of data buffer"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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: u8, + timeout: u32, + ) -> bool; } extern "C" { - pub static message_note_e2: NotificationMessage; + #[doc = " Perform I2C device register write (8-bit)"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param reg_addr register address"] + #[doc = " @param data register value"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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" { - pub static message_note_f2: NotificationMessage; + #[doc = " Perform I2C device register write (16-bit)"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param reg_addr register address"] + #[doc = " @param data register value"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true 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" { - pub static message_note_fs2: NotificationMessage; + #[doc = " Perform I2C device memory"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] + #[doc = " @param i2c_addr I2C slave address"] + #[doc = " @param mem_addr memory start address"] + #[doc = " @param data pointer to data buffer"] + #[doc = " @param len size of data buffer"] + #[doc = " @param timeout timeout in ticks"] + #[doc = ""] + #[doc = " @return true on successful transfer, false otherwise"] + pub fn furi_hal_i2c_write_mem( + handle: *mut FuriHalI2cBusHandle, + i2c_addr: u8, + mem_addr: u8, + data: *mut u8, + len: u8, + timeout: u32, + ) -> bool; } -extern "C" { - pub static message_note_g2: NotificationMessage; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct FuriHalRegionBand { + pub start: u32, + pub end: u32, + pub power_limit: i8, + pub duty_cycle: u8, } -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; +#[test] +fn bindgen_test_layout_FuriHalRegionBand() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(FuriHalRegionBand)) + ); + assert_eq!( + ::core::mem::align_of::(), + 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) + ) + ); } -extern "C" { - pub static message_note_c5: NotificationMessage; +#[repr(C)] +#[derive(Debug)] +pub struct FuriHalRegion { + pub country_code: [core::ffi::c_char; 4usize], + pub bands_count: u16, + pub bands: __IncompleteArrayField, } -extern "C" { - pub static message_note_cs5: NotificationMessage; +#[test] +fn bindgen_test_layout_FuriHalRegion() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(FuriHalRegion)) + ); + assert_eq!( + ::core::mem::align_of::(), + 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" { - pub static message_note_d5: NotificationMessage; + #[doc = " Get Region Data."] + #[doc = ""] + #[doc = " Region data may be allocated in Flash or in RAM."] + #[doc = " Keep in mind that we don't do memory management on our side."] + #[doc = ""] + #[doc = " @return pointer to FuriHalRegion instance (in RAM or Flash, check before freeing on region update)"] + pub fn furi_hal_region_get() -> *const FuriHalRegion; } extern "C" { - pub static message_note_ds5: NotificationMessage; + #[doc = " Set device region data"] + #[doc = ""] + #[doc = " @param region pointer to the FuriHalRegion"] + pub fn furi_hal_region_set(region: *mut FuriHalRegion); } extern "C" { - pub static message_note_e5: NotificationMessage; + #[doc = " Check if region data provisioned"] + #[doc = ""] + #[doc = " @return true if provisioned, false otherwise"] + pub fn furi_hal_region_is_provisioned() -> bool; } extern "C" { - pub static message_note_f5: NotificationMessage; + #[doc = " Get region name"] + #[doc = ""] + #[doc = " 2 letter Region code according to iso 3166 standard"] + #[doc = " There are 2 extra values that we use in special cases:"] + #[doc = " - \"00\" - developer edition, unlocked"] + #[doc = " - \"WW\" - world wide, region provisioned by default"] + #[doc = " - \"--\" - no provisioned region"] + #[doc = ""] + #[doc = " @return Pointer to string"] + pub fn furi_hal_region_get_name() -> *const core::ffi::c_char; } extern "C" { - pub static message_note_fs5: NotificationMessage; + #[doc = " Сheck if transmission is allowed on this frequency for your flipper region"] + #[doc = ""] + #[doc = " @param[in] frequency The frequency"] + #[doc = " @param value frequency in Hz"] + #[doc = ""] + #[doc = " @return true if allowed"] + pub fn furi_hal_region_is_frequency_allowed(frequency: u32) -> bool; } extern "C" { - pub static message_note_g5: NotificationMessage; + #[doc = " Get band data for frequency"] + #[doc = ""] + #[doc = ""] + #[doc = ""] + #[doc = " @param[in] frequency The frequency"] + #[doc = ""] + #[doc = " @return { description_of_the_return_value }"] + pub fn furi_hal_region_get_band(frequency: u32) -> *const FuriHalRegionBand; } -extern "C" { - pub static message_note_gs5: NotificationMessage; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct FuriHalRtcDateTime { + #[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, } -extern "C" { - pub static message_note_a5: NotificationMessage; -} -extern "C" { - pub static message_note_as5: NotificationMessage; +#[test] +fn bindgen_test_layout_FuriHalRtcDateTime() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 10usize, + concat!("Size of: ", stringify!(FuriHalRtcDateTime)) + ); + assert_eq!( + ::core::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(FuriHalRtcDateTime)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).hour) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(hour) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).minute) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(minute) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).second) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(second) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).day) as usize - ptr as usize }, + 3usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(day) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).month) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(month) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).year) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(year) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).weekday) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(FuriHalRtcDateTime), + "::", + stringify!(weekday) + ) + ); } -extern "C" { - pub static message_note_b5: NotificationMessage; +pub const FuriHalRtcFlag_FuriHalRtcFlagDebug: FuriHalRtcFlag = 1; +pub const FuriHalRtcFlag_FuriHalRtcFlagFactoryReset: FuriHalRtcFlag = 2; +pub const FuriHalRtcFlag_FuriHalRtcFlagLock: FuriHalRtcFlag = 4; +pub const FuriHalRtcFlag_FuriHalRtcFlagC2Update: FuriHalRtcFlag = 8; +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 = "< Service value, do not use"] +pub const FuriHalRtcRegister_FuriHalRtcRegisterMAX: FuriHalRtcRegister = 7; +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; +extern "C" { + #[doc = " Early de-initialization"] + pub fn furi_hal_rtc_deinit_early(); } extern "C" { - pub static message_note_c6: NotificationMessage; + #[doc = " Get RTC register content"] + #[doc = ""] + #[doc = " @param[in] reg The register identifier"] + #[doc = ""] + #[doc = " @return content of the register"] + pub fn furi_hal_rtc_get_register(reg: FuriHalRtcRegister) -> u32; } extern "C" { - pub static message_note_cs6: NotificationMessage; + #[doc = " Set register content"] + #[doc = ""] + #[doc = " @param[in] reg The register identifier"] + #[doc = " @param[in] value The value to store into register"] + pub fn furi_hal_rtc_set_register(reg: FuriHalRtcRegister, value: u32); } extern "C" { - pub static message_note_d6: NotificationMessage; + #[doc = " Set Log Level value"] + #[doc = ""] + #[doc = " @param[in] level The level to store"] + pub fn furi_hal_rtc_set_log_level(level: u8); } extern "C" { - pub static message_note_ds6: NotificationMessage; + #[doc = " Get Log Level value"] + #[doc = ""] + #[doc = " @return The Log Level value"] + pub fn furi_hal_rtc_get_log_level() -> u8; } extern "C" { - pub static message_note_e6: NotificationMessage; + #[doc = " Set RTC Flag"] + #[doc = ""] + #[doc = " @param[in] flag The flag to set"] + pub fn furi_hal_rtc_set_flag(flag: FuriHalRtcFlag); } extern "C" { - pub static message_note_f6: NotificationMessage; + #[doc = " Reset RTC Flag"] + #[doc = ""] + #[doc = " @param[in] flag The flag to reset"] + pub fn furi_hal_rtc_reset_flag(flag: FuriHalRtcFlag); } extern "C" { - pub static message_note_fs6: NotificationMessage; + #[doc = " Check if RTC Flag is set"] + #[doc = ""] + #[doc = " @param[in] flag The flag to check"] + #[doc = ""] + #[doc = " @return true if set"] + pub fn furi_hal_rtc_is_flag_set(flag: FuriHalRtcFlag) -> bool; } extern "C" { - pub static message_note_g6: NotificationMessage; + #[doc = " Set RTC boot mode"] + #[doc = ""] + #[doc = " @param[in] mode The mode to set"] + pub fn furi_hal_rtc_set_boot_mode(mode: FuriHalRtcBootMode); } extern "C" { - pub static message_note_gs6: NotificationMessage; + #[doc = " Get RTC boot mode"] + #[doc = ""] + #[doc = " @return The RTC boot mode."] + pub fn furi_hal_rtc_get_boot_mode() -> FuriHalRtcBootMode; } extern "C" { - pub static message_note_a6: NotificationMessage; + #[doc = " Set Heap Track mode"] + #[doc = ""] + #[doc = " @param[in] mode The mode to set"] + pub fn furi_hal_rtc_set_heap_track_mode(mode: FuriHalRtcHeapTrackMode); } extern "C" { - pub static message_note_as6: NotificationMessage; + #[doc = " Get RTC Heap Track mode"] + #[doc = ""] + #[doc = " @return The RTC heap track mode."] + pub fn furi_hal_rtc_get_heap_track_mode() -> FuriHalRtcHeapTrackMode; } extern "C" { - pub static message_note_b6: NotificationMessage; + #[doc = " Set locale units"] + #[doc = ""] + #[doc = " @param[in] mode The RTC Locale Units"] + pub fn furi_hal_rtc_set_locale_units(value: FuriHalRtcLocaleUnits); } extern "C" { - pub static message_note_c7: NotificationMessage; + #[doc = " Get RTC Locale Units"] + #[doc = ""] + #[doc = " @return The RTC Locale Units."] + pub fn furi_hal_rtc_get_locale_units() -> FuriHalRtcLocaleUnits; } extern "C" { - pub static message_note_cs7: NotificationMessage; + #[doc = " Set RTC Locale Time Format"] + #[doc = ""] + #[doc = " @param[in] value The RTC Locale Time Format"] + pub fn furi_hal_rtc_set_locale_timeformat(value: FuriHalRtcLocaleTimeFormat); } extern "C" { - pub static message_note_d7: NotificationMessage; + #[doc = " Get RTC Locale Time Format"] + #[doc = ""] + #[doc = " @return The RTC Locale Time Format."] + pub fn furi_hal_rtc_get_locale_timeformat() -> FuriHalRtcLocaleTimeFormat; } extern "C" { - pub static message_note_ds7: NotificationMessage; + #[doc = " Set RTC Locale Date Format"] + #[doc = ""] + #[doc = " @param[in] value The RTC Locale Date Format"] + pub fn furi_hal_rtc_set_locale_dateformat(value: FuriHalRtcLocaleDateFormat); } extern "C" { - pub static message_note_e7: NotificationMessage; + #[doc = " Get RTC Locale Date Format"] + #[doc = ""] + #[doc = " @return The RTC Locale Date Format"] + pub fn furi_hal_rtc_get_locale_dateformat() -> FuriHalRtcLocaleDateFormat; } extern "C" { - pub static message_note_f7: NotificationMessage; + #[doc = " Set RTC Date Time"] + #[doc = ""] + #[doc = " @param datetime The date time to set"] + pub fn furi_hal_rtc_set_datetime(datetime: *mut FuriHalRtcDateTime); } extern "C" { - pub static message_note_fs7: NotificationMessage; + #[doc = " Get RTC Date Time"] + #[doc = ""] + #[doc = " @param datetime The datetime"] + pub fn furi_hal_rtc_get_datetime(datetime: *mut FuriHalRtcDateTime); } extern "C" { - pub static message_note_g7: NotificationMessage; + #[doc = " Validate Date Time"] + #[doc = ""] + #[doc = " @param datetime The datetime to validate"] + #[doc = ""] + #[doc = " @return { description_of_the_return_value }"] + pub fn furi_hal_rtc_validate_datetime(datetime: *mut FuriHalRtcDateTime) -> bool; } extern "C" { - pub static message_note_gs7: NotificationMessage; + #[doc = " Set RTC Fault Data"] + #[doc = ""] + #[doc = " @param[in] value The value"] + pub fn furi_hal_rtc_set_fault_data(value: u32); } extern "C" { - pub static message_note_a7: NotificationMessage; + #[doc = " Get RTC Fault Data"] + #[doc = ""] + #[doc = " @return RTC Fault Data value"] + pub fn furi_hal_rtc_get_fault_data() -> u32; } extern "C" { - pub static message_note_as7: NotificationMessage; + #[doc = " Set Pin Fails count"] + #[doc = ""] + #[doc = " @param[in] value The Pin Fails count"] + pub fn furi_hal_rtc_set_pin_fails(value: u32); } extern "C" { - pub static message_note_b7: NotificationMessage; + #[doc = " Get Pin Fails count"] + #[doc = ""] + #[doc = " @return Pin Fails Count"] + pub fn furi_hal_rtc_get_pin_fails() -> u32; } extern "C" { - pub static message_note_c8: NotificationMessage; + #[doc = " Get UNIX Timestamp"] + #[doc = ""] + #[doc = " @return Unix Timestamp in seconds from UNIX epoch start"] + pub fn furi_hal_rtc_get_timestamp() -> u32; } extern "C" { - pub static message_note_cs8: NotificationMessage; + #[doc = " Convert DateTime to UNIX timestamp"] + #[doc = ""] + #[doc = " @param datetime The datetime"] + #[doc = ""] + #[doc = " @return UNIX Timestamp in seconds from UNIX epoch start"] + pub fn furi_hal_rtc_datetime_to_timestamp(datetime: *mut FuriHalRtcDateTime) -> u32; } extern "C" { - pub static message_note_d8: NotificationMessage; + #[doc = " Acquire speaker ownership"] + #[doc = ""] + #[doc = " @warning You must acquire speaker ownership before use"] + #[doc = ""] + #[doc = " @param timeout Timeout during which speaker ownership must be acquired"] + #[doc = ""] + #[doc = " @return bool returns true on success"] + pub fn furi_hal_speaker_acquire(timeout: u32) -> bool; } extern "C" { - pub static message_note_ds8: NotificationMessage; + #[doc = " Release speaker ownership"] + #[doc = ""] + #[doc = " @warning You must release speaker ownership after use"] + pub fn furi_hal_speaker_release(); } extern "C" { - pub static message_note_e8: NotificationMessage; + #[doc = " Check current process speaker ownership"] + #[doc = ""] + #[doc = " @warning always returns true if called from ISR"] + #[doc = ""] + #[doc = " @return bool returns true if process owns speaker"] + pub fn furi_hal_speaker_is_mine() -> bool; } extern "C" { - pub static message_note_f8: NotificationMessage; + #[doc = " Play a note"] + #[doc = ""] + #[doc = " @warning no ownership check if called from ISR"] + #[doc = ""] + #[doc = " @param frequency The frequency"] + #[doc = " @param volume The volume"] + pub fn furi_hal_speaker_start(frequency: f32, volume: f32); } extern "C" { - pub static message_note_fs8: NotificationMessage; + #[doc = " Set volume"] + #[doc = ""] + #[doc = " @warning no ownership check if called from ISR"] + #[doc = ""] + #[doc = " @param volume The volume"] + pub fn furi_hal_speaker_set_volume(volume: f32); } extern "C" { - pub static message_note_g8: NotificationMessage; + #[doc = " Stop playback"] + #[doc = ""] + #[doc = " @warning no ownership check if called from ISR"] + pub fn furi_hal_speaker_stop(); } extern "C" { - pub static message_note_gs8: NotificationMessage; + #[doc = " Set light value"] + #[doc = ""] + #[doc = " @param light Light"] + #[doc = " @param value light brightness [0-255]"] + pub fn furi_hal_light_set(light: Light, value: u8); } extern "C" { - pub static message_note_a8: NotificationMessage; + #[doc = " Start hardware LED blinking mode"] + #[doc = ""] + #[doc = " @param light Light"] + #[doc = " @param brightness light brightness [0-255]"] + #[doc = " @param on_time LED on time in ms"] + #[doc = " @param period LED blink period in ms"] + pub fn furi_hal_light_blink_start(light: Light, brightness: u8, on_time: u16, period: u16); } extern "C" { - pub static message_note_as8: NotificationMessage; + #[doc = " Stop hardware LED blinking mode"] + pub fn furi_hal_light_blink_stop(); } extern "C" { - pub static message_note_b8: NotificationMessage; + #[doc = " Set color in hardware LED blinking mode"] + #[doc = ""] + #[doc = " @param light Light"] + pub fn furi_hal_light_blink_set_color(light: Light); } extern "C" { - #[doc = " Messages"] - pub static message_display_backlight_on: NotificationMessage; + #[doc = " Execute sequence"] + #[doc = ""] + #[doc = " @param sequence Sequence to execute"] + pub fn furi_hal_light_sequence(sequence: *const core::ffi::c_char); } -extern "C" { - pub static message_display_backlight_off: NotificationMessage; +#[doc = " Callback type called every time another key-value pair of device information is ready"] +#[doc = ""] +#[doc = " @param key[in] device information type identifier"] +#[doc = " @param value[in] device information value"] +#[doc = " @param last[in] whether the passed key-value pair is the last one"] +#[doc = " @param 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, } -extern "C" { - pub static message_display_backlight_enforce_on: NotificationMessage; +#[test] +fn bindgen_test_layout_PropertyValueContext() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(PropertyValueContext)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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 }, + 8usize, + concat!( + "Offset of field: ", + stringify!(PropertyValueContext), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).out) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(PropertyValueContext), + "::", + stringify!(out) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).sep) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(PropertyValueContext), + "::", + stringify!(sep) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).last) as usize - ptr as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(PropertyValueContext), + "::", + stringify!(last) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(PropertyValueContext), + "::", + stringify!(context) + ) + ); } extern "C" { - pub static message_display_backlight_enforce_auto: NotificationMessage; + #[doc = " Builds key and value strings and outputs them via a callback function"] + #[doc = ""] + #[doc = " @param ctx[in] local property context"] + #[doc = " @param fmt[in] value format, set to NULL to bypass formatting"] + #[doc = " @param nparts[in] number of key parts (separated by character)"] + #[doc = " @param ...[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" { - pub static message_red_255: NotificationMessage; + #[doc = " Check if gauge is ok"] + #[doc = ""] + #[doc = " Verifies that:"] + #[doc = " - gauge is alive"] + #[doc = " - correct profile loaded"] + #[doc = " - self diagnostic status is good"] + #[doc = ""] + #[doc = " @return true if gauge is ok"] + pub fn furi_hal_power_gauge_is_ok() -> bool; } extern "C" { - pub static message_green_255: NotificationMessage; + #[doc = " Enter insomnia mode Prevents device from going to sleep"] + #[doc = " @warning Internally increases insomnia level Must be paired with"] + #[doc = " furi_hal_power_insomnia_exit"] + pub fn furi_hal_power_insomnia_enter(); } extern "C" { - pub static message_blue_255: NotificationMessage; + #[doc = " Exit insomnia mode Allow device to go to sleep"] + #[doc = " @warning Internally decreases insomnia level. Must be paired with"] + #[doc = " furi_hal_power_insomnia_enter"] + pub fn furi_hal_power_insomnia_exit(); } extern "C" { - pub static message_red_0: NotificationMessage; + #[doc = " Check if sleep availble"] + #[doc = ""] + #[doc = " @return true if available"] + pub fn furi_hal_power_sleep_available() -> bool; } extern "C" { - pub static message_green_0: NotificationMessage; + #[doc = " Check if deep sleep availble"] + #[doc = ""] + #[doc = " @return true if available"] + pub fn furi_hal_power_deep_sleep_available() -> bool; } extern "C" { - pub static message_blue_0: NotificationMessage; + #[doc = " Go to sleep"] + pub fn furi_hal_power_sleep(); } extern "C" { - pub static message_blink_start_10: NotificationMessage; + #[doc = " Get predicted remaining battery capacity in percents"] + #[doc = ""] + #[doc = " @return remaining battery capacity in percents"] + pub fn furi_hal_power_get_pct() -> u8; } extern "C" { - pub static message_blink_start_100: NotificationMessage; + #[doc = " Get battery health state in percents"] + #[doc = ""] + #[doc = " @return health in percents"] + pub fn furi_hal_power_get_bat_health_pct() -> u8; } extern "C" { - pub static message_blink_stop: NotificationMessage; + #[doc = " Get charging status"] + #[doc = ""] + #[doc = " @return true if charging"] + pub fn furi_hal_power_is_charging() -> bool; } extern "C" { - pub static message_blink_set_color_red: NotificationMessage; + #[doc = " Get charge complete status"] + #[doc = ""] + #[doc = " @return true if done charging and connected to charger"] + pub fn furi_hal_power_is_charging_done() -> bool; } extern "C" { - pub static message_blink_set_color_green: NotificationMessage; + #[doc = " Switch MCU to SHUTDOWN"] + pub fn furi_hal_power_shutdown(); } extern "C" { - pub static message_blink_set_color_blue: NotificationMessage; + #[doc = " Poweroff device"] + pub fn furi_hal_power_off(); } extern "C" { - pub static message_blink_set_color_cyan: NotificationMessage; + #[doc = " Reset device"] + pub fn furi_hal_power_reset(); } extern "C" { - pub static message_blink_set_color_magenta: NotificationMessage; + #[doc = " OTG enable"] + pub fn furi_hal_power_enable_otg(); } extern "C" { - pub static message_blink_set_color_yellow: NotificationMessage; + #[doc = " OTG disable"] + pub fn furi_hal_power_disable_otg(); } extern "C" { - pub static message_blink_set_color_white: NotificationMessage; + #[doc = " Check OTG status and disable it if falt happened"] + pub fn furi_hal_power_check_otg_status(); } extern "C" { - pub static message_delay_1: NotificationMessage; + #[doc = " Get OTG status"] + #[doc = ""] + #[doc = " @return true if enabled"] + pub fn furi_hal_power_is_otg_enabled() -> bool; } extern "C" { - pub static message_delay_10: NotificationMessage; + #[doc = " Get battery charging voltage in V"] + #[doc = ""] + #[doc = " @return voltage in V"] + pub fn furi_hal_power_get_battery_charging_voltage() -> f32; } extern "C" { - pub static message_delay_25: NotificationMessage; + #[doc = " Set battery charging voltage in V"] + #[doc = ""] + #[doc = " Invalid values will be clamped to the nearest valid value."] + #[doc = ""] + #[doc = " @param voltage[in] voltage in V"] + #[doc = ""] + #[doc = " @return voltage in V"] + pub fn furi_hal_power_set_battery_charging_voltage(voltage: f32); } extern "C" { - pub static message_delay_50: NotificationMessage; + #[doc = " Get remaining battery battery capacity in mAh"] + #[doc = ""] + #[doc = " @return capacity in mAh"] + pub fn furi_hal_power_get_battery_remaining_capacity() -> u32; } extern "C" { - pub static message_delay_100: NotificationMessage; + #[doc = " Get full charge battery capacity in mAh"] + #[doc = ""] + #[doc = " @return capacity in mAh"] + pub fn furi_hal_power_get_battery_full_capacity() -> u32; } extern "C" { - pub static message_delay_250: NotificationMessage; + #[doc = " Get battery capacity in mAh from battery profile"] + #[doc = ""] + #[doc = " @return capacity in mAh"] + pub fn furi_hal_power_get_battery_design_capacity() -> u32; } extern "C" { - pub static message_delay_500: NotificationMessage; + #[doc = " Get battery voltage in V"] + #[doc = ""] + #[doc = " @param ic FuriHalPowerIc to get measurment"] + #[doc = ""] + #[doc = " @return voltage in V"] + pub fn furi_hal_power_get_battery_voltage(ic: FuriHalPowerIC) -> f32; } extern "C" { - pub static message_delay_1000: NotificationMessage; + #[doc = " Get battery current in A"] + #[doc = ""] + #[doc = " @param ic FuriHalPowerIc to get measurment"] + #[doc = ""] + #[doc = " @return current in A"] + pub fn furi_hal_power_get_battery_current(ic: FuriHalPowerIC) -> f32; } extern "C" { - pub static message_sound_off: NotificationMessage; + #[doc = " Get temperature in C"] + #[doc = ""] + #[doc = " @param ic FuriHalPowerIc to get measurment"] + #[doc = ""] + #[doc = " @return temperature in C"] + pub fn furi_hal_power_get_battery_temperature(ic: FuriHalPowerIC) -> f32; } extern "C" { - pub static message_vibro_on: NotificationMessage; + #[doc = " Get USB voltage in V"] + #[doc = ""] + #[doc = " @return voltage in V"] + pub fn furi_hal_power_get_usb_voltage() -> f32; } 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" { - #[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; + #[doc = " Enable 3.3v on external gpio and sd card"] + pub fn furi_hal_power_enable_external_3_3v(); } extern "C" { - pub static sequence_single_vibro: NotificationSequence; + #[doc = " Disable 3.3v on external gpio and sd card"] + pub fn furi_hal_power_disable_external_3_3v(); } extern "C" { - pub static sequence_double_vibro: NotificationSequence; + #[doc = " Enter supress charge mode."] + #[doc = ""] + #[doc = " Use this function when your application need clean power supply."] + pub fn furi_hal_power_suppress_charge_enter(); } extern "C" { - pub static sequence_success: NotificationSequence; + #[doc = " Exit supress charge mode"] + pub fn furi_hal_power_suppress_charge_exit(); } extern "C" { - pub static sequence_error: NotificationSequence; + #[doc = " Get power information"] + #[doc = ""] + #[doc = " @param[in] callback callback to provide with new data"] + #[doc = " @param[in] sep category separator character"] + #[doc = " @param[in] context 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" { - pub static sequence_audiovisual_alert: NotificationSequence; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Power { - _unused: [u8; 0], + #[doc = " Get power debug information"] + #[doc = ""] + #[doc = " @param[in] callback callback to provide with new data"] + #[doc = " @param[in] context context to pass to callback"] + pub fn furi_hal_power_debug_get( + callback: PropertyValueCallback, + context: *mut core::ffi::c_void, + ); } -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; +#[doc = " @brief TIM Time Base configuration structure definition."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct PowerInfo { - pub gauge_is_ok: bool, - pub is_charging: bool, - pub current_charger: f32, - pub current_gauge: f32, - pub voltage_battery_charging: 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, +pub struct LL_TIM_InitTypeDef { + #[doc = "< Specifies the prescaler value used to divide the TIM clock."] + #[doc = "This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_SetPrescaler()."] + pub Prescaler: u16, + #[doc = "< Specifies the counter mode."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_SetCounterMode()."] + pub CounterMode: u32, + #[doc = "< Specifies the auto reload value to be loaded into the active"] + #[doc = "Auto-Reload Register at the next update event."] + #[doc = "This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] + #[doc = "Some timer instances may support 32 bits counters. In that case this parameter must"] + #[doc = "be a number between 0x0000 and 0xFFFFFFFF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_SetAutoReload()."] + pub Autoreload: u32, + #[doc = "< Specifies the clock division."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_SetClockDivision()."] + pub ClockDivision: u32, + #[doc = "< Specifies the repetition counter value. Each time the RCR downcounter"] + #[doc = "reaches zero, an update event is generated and counting restarts"] + #[doc = "from the RCR value (N)."] + #[doc = "This means in PWM mode that (N+1) corresponds to:"] + #[doc = "- the number of PWM periods in edge-aligned mode"] + #[doc = "- the number of half PWM period in center-aligned mode"] + #[doc = "GP timers: this parameter must be a number between Min_Data = 0x00 and"] + #[doc = "Max_Data = 0xFF."] + #[doc = "Advanced timers: this parameter must be a number between Min_Data = 0x0000 and"] + #[doc = "Max_Data = 0xFFFF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_SetRepetitionCounter()."] + pub RepetitionCounter: u32, } #[test] -fn bindgen_test_layout_PowerInfo() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_LL_TIM_InitTypeDef() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(PowerInfo)) + ::core::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(LL_TIM_InitTypeDef)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(PowerInfo)) + concat!("Alignment of ", stringify!(LL_TIM_InitTypeDef)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).gauge_is_ok) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).Prescaler) 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!(LL_TIM_InitTypeDef), "::", - stringify!(is_charging) + stringify!(Prescaler) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).current_charger) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).CounterMode) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_InitTypeDef), "::", - stringify!(current_charger) + stringify!(CounterMode) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).current_gauge) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).Autoreload) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_InitTypeDef), "::", - stringify!(current_gauge) + stringify!(Autoreload) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).voltage_battery_charging) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).ClockDivision) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_InitTypeDef), "::", - stringify!(voltage_battery_charging) + stringify!(ClockDivision) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).voltage_charger) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).RepetitionCounter) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_InitTypeDef), "::", - stringify!(voltage_charger) + stringify!(RepetitionCounter) ) ); +} +#[doc = " @brief TIM Output Compare configuration structure definition."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct LL_TIM_OC_InitTypeDef { + #[doc = "< Specifies the output mode."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCMODE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_OC_SetMode()."] + pub OCMode: u32, + #[doc = "< Specifies the TIM Output Compare state."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCSTATE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary functions"] + #[doc = "@ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel()."] + pub OCState: u32, + #[doc = "< Specifies the TIM complementary Output Compare state."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCSTATE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary functions"] + #[doc = "@ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel()."] + pub OCNState: u32, + #[doc = "< Specifies the Compare value to be loaded into the Capture Compare Register."] + #[doc = "This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "LL_TIM_OC_SetCompareCHx (x=1..6)."] + pub CompareValue: u32, + #[doc = "< Specifies the output polarity."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_OC_SetPolarity()."] + pub OCPolarity: u32, + #[doc = "< Specifies the complementary output polarity."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_OC_SetPolarity()."] + pub OCNPolarity: u32, + #[doc = "< Specifies the TIM Output Compare pin state during Idle state."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_OC_SetIdleState()."] + pub OCIdleState: u32, + #[doc = "< Specifies the TIM Output Compare pin state during Idle state."] + #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary function"] + #[doc = "@ref LL_TIM_OC_SetIdleState()."] + pub OCNIdleState: u32, +} +#[test] +fn bindgen_test_layout_LL_TIM_OC_InitTypeDef() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(LL_TIM_OC_InitTypeDef)) + ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).voltage_gauge) as usize - ptr as usize }, - 20usize, + ::core::mem::align_of::(), + 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!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(voltage_gauge) + stringify!(OCMode) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).voltage_vbus) as usize - ptr as usize }, - 24usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCState) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(voltage_vbus) + stringify!(OCState) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).capacity_remaining) as usize - ptr as usize }, - 28usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCNState) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(capacity_remaining) + stringify!(OCNState) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).capacity_full) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).CompareValue) as usize - ptr as usize }, + 12usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(capacity_full) + stringify!(CompareValue) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).temperature_charger) as usize - ptr as usize }, - 36usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCPolarity) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(temperature_charger) + stringify!(OCPolarity) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).temperature_gauge) as usize - ptr as usize }, - 40usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCNPolarity) as usize - ptr as usize }, + 20usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(temperature_gauge) + stringify!(OCNPolarity) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).charge) as usize - ptr as usize }, - 44usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCIdleState) as usize - ptr as usize }, + 24usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(charge) + stringify!(OCIdleState) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).health) as usize - ptr as usize }, - 45usize, + unsafe { ::core::ptr::addr_of!((*ptr).OCNIdleState) as usize - ptr as usize }, + 28usize, concat!( "Offset of field: ", - stringify!(PowerInfo), + stringify!(LL_TIM_OC_InitTypeDef), "::", - stringify!(health) + stringify!(OCNIdleState) ) ); } extern "C" { - #[doc = " Power off device"] - pub fn power_off(power: *mut Power); + #[doc = " @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions"] + #[doc = " @{"] + pub fn LL_TIM_DeInit(TIMx: *mut TIM_TypeDef) -> ErrorStatus; } extern "C" { - #[doc = " Reboot device"] - #[doc = ""] - #[doc = " @param mode PowerBootMode"] - pub fn power_reboot(mode: PowerBootMode); + pub fn LL_TIM_Init( + TIMx: *mut TIM_TypeDef, + TIM_InitStruct: *mut LL_TIM_InitTypeDef, + ) -> ErrorStatus; } extern "C" { - #[doc = " Get power info"] - #[doc = ""] - #[doc = " @param power Power instance"] - #[doc = " @param info PowerInfo instance"] - pub fn power_get_info(power: *mut Power, info: *mut PowerInfo); + pub fn LL_TIM_OC_Init( + TIMx: *mut TIM_TypeDef, + Channel: u32, + TIM_OC_InitStruct: *mut LL_TIM_OC_InitTypeDef, + ) -> ErrorStatus; } +#[doc = " Timer ISR"] +pub type FuriHalInterruptISR = + ::core::option::Option; +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_FuriHalInterruptIdMax: FuriHalInterruptId = 23; +pub type FuriHalInterruptId = core::ffi::c_uchar; extern "C" { - #[doc = " Get power event pubsub handler"] - #[doc = ""] - #[doc = " @param power Power instance"] - #[doc = ""] - #[doc = " @return FuriPubSub instance"] - pub fn power_get_pubsub(power: *mut Power) -> *mut FuriPubSub; + #[doc = " Set ISR and enable interrupt with default priority"] + #[doc = " We don't clear interrupt flags for you, do it by your self."] + #[doc = " @param index - interrupt ID"] + #[doc = " @param isr - your interrupt service routine or use NULL to clear"] + #[doc = " @param context - isr context"] + pub fn furi_hal_interrupt_set_isr( + index: FuriHalInterruptId, + isr: FuriHalInterruptISR, + context: *mut core::ffi::c_void, + ); } extern "C" { - #[doc = " Check battery health"] - #[doc = ""] - #[doc = " @return true if battery is healthy"] - pub fn power_is_battery_healthy(power: *mut Power) -> bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rpc { - _unused: [u8; 0], + #[doc = " Set ISR and enable interrupt with custom priority"] + #[doc = " We don't clear interrupt flags for you, do it by your self."] + #[doc = " @param index - interrupt ID"] + #[doc = " @param priority - 0 to 15, 0 highest"] + #[doc = " @param isr - your interrupt service routine or use NULL to clear"] + #[doc = " @param context - isr context"] + pub fn furi_hal_interrupt_set_isr_ex( + index: FuriHalInterruptId, + priority: u16, + isr: FuriHalInterruptISR, + context: *mut core::ffi::c_void, + ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct RpcSession { +pub struct Version { _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; -#[doc = " Callback to notify transport layer that close_session command"] -#[doc = " is received. Any other actions lays on transport layer."] -#[doc = " No destruction or session close performed."] -pub type RpcSessionClosedCallback = - ::core::option::Option; -#[doc = " Callback to notify transport layer that session was closed"] -#[doc = " and all operations were finished"] -pub type RpcSessionTerminatedCallback = - ::core::option::Option; extern "C" { - #[doc = " Open RPC session"] - #[doc = ""] - #[doc = " USAGE:"] - #[doc = " 1) rpc_session_open();"] - #[doc = " 2) rpc_session_set_context();"] - #[doc = " 3) rpc_session_set_send_bytes_callback();"] - #[doc = " 4) rpc_session_set_close_callback();"] - #[doc = " 5) while(1) {"] - #[doc = " rpc_session_feed();"] - #[doc = " }"] - #[doc = " 6) rpc_session_close();"] + #[doc = " Get current running firmware version handle."] #[doc = ""] + #[doc = " You can store it somewhere. But if you want to retrieve data, you have to use"] + #[doc = " 'version_*_get()' set of functions. Also, 'version_*_get()' imply to use this"] + #[doc = " handle if no handle (NULL_PTR) provided."] #[doc = ""] - #[doc = " @param rpc instance"] - #[doc = " @return pointer to RpcSession descriptor, or"] - #[doc = " NULL if RPC is busy and can't open session now"] - pub fn rpc_session_open(rpc: *mut Rpc) -> *mut RpcSession; + #[doc = " @return pointer to Version data."] + pub fn version_get() -> *const Version; } extern "C" { - #[doc = " Close RPC session"] - #[doc = " It is guaranteed that no callbacks will be called"] - #[doc = " as soon as session is closed. So no need in setting"] - #[doc = " callbacks to NULL after session close."] + #[doc = " Get git commit hash."] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - pub fn rpc_session_close(session: *mut RpcSession); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return git hash"] + pub fn version_get_githash(v: *const Version) -> *const core::ffi::c_char; } extern "C" { - #[doc = " Set session context for callbacks to pass"] + #[doc = " Get git branch."] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param context context to pass to callbacks"] - pub fn rpc_session_set_context(session: *mut RpcSession, context: *mut core::ffi::c_void); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return git branch"] + pub fn version_get_gitbranch(v: *const Version) -> *const core::ffi::c_char; } extern "C" { - #[doc = " Set callback to send bytes to client"] - #[doc = " WARN: It's forbidden to call RPC API within RpcSendBytesCallback"] + #[doc = " Get number of commit in git branch."] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param callback callback to send bytes to client (can be NULL)"] - pub fn rpc_session_set_send_bytes_callback( - session: *mut RpcSession, - callback: RpcSendBytesCallback, - ); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return number of commit"] + pub fn version_get_gitbranchnum(v: *const Version) -> *const core::ffi::c_char; } extern "C" { - #[doc = " Set callback to notify that buffer is empty"] + #[doc = " Get build date."] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param callback callback to notify client that buffer is empty (can be NULL)"] - pub fn rpc_session_set_buffer_is_empty_callback( - session: *mut RpcSession, - callback: RpcBufferIsEmptyCallback, - ); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return build date"] + pub fn version_get_builddate(v: *const Version) -> *const core::ffi::c_char; } extern "C" { - #[doc = " Set callback to be called when RPC command to close session is received"] - #[doc = " WARN: It's forbidden to call RPC API within RpcSessionClosedCallback"] + #[doc = " Get build version. Build version is last tag in git history."] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param callback callback to inform about RPC close session command (can be NULL)"] - pub fn rpc_session_set_close_callback( - session: *mut RpcSession, - callback: RpcSessionClosedCallback, - ); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return build date"] + pub fn version_get_version(v: *const Version) -> *const core::ffi::c_char; } extern "C" { - #[doc = " Set callback to be called when RPC session is closed"] + #[doc = " Get hardware target this firmware was built for"] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param callback callback to inform about RPC session state"] - pub fn rpc_session_set_terminated_callback( - session: *mut RpcSession, - callback: RpcSessionTerminatedCallback, - ); + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] + #[doc = ""] + #[doc = " @return build date"] + pub fn version_get_target(v: *const Version) -> u8; } extern "C" { - #[doc = " Give bytes to RPC service to decode them and perform command"] + #[doc = " Get flag indicating if this build is \"dirty\" (source code had uncommited changes)"] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] - #[doc = " @param buffer buffer to provide to RPC service"] - #[doc = " @param size size of buffer"] - #[doc = " @param timeout max timeout to wait till all buffer will be consumed"] + #[doc = " @param v pointer to Version data. NULL for currently running"] + #[doc = " software."] #[doc = ""] - #[doc = " @return actually consumed bytes"] - pub fn rpc_session_feed( - session: *mut RpcSession, - buffer: *mut u8, - size: usize, - timeout: TickType_t, - ) -> usize; + #[doc = " @return build date"] + pub fn version_get_dirty_flag(v: *const Version) -> bool; } +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; +#[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 = " Get available size of RPC buffer"] + #[doc = " Check target firmware version"] #[doc = ""] - #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @return true if target and real matches"] + pub fn furi_hal_version_do_i_belong_here() -> bool; +} +extern "C" { + #[doc = " Get model name"] #[doc = ""] - #[doc = " @return bytes available in buffer"] - pub fn rpc_session_get_available_size(session: *mut RpcSession) -> usize; + #[doc = " @return model name C-string"] + pub fn furi_hal_version_get_model_name() -> *const core::ffi::c_char; } -pub const RpcAppSystemEvent_RpcAppEventSessionClose: RpcAppSystemEvent = 0; -pub const RpcAppSystemEvent_RpcAppEventAppExit: RpcAppSystemEvent = 1; -pub const RpcAppSystemEvent_RpcAppEventLoadFile: RpcAppSystemEvent = 2; -pub const RpcAppSystemEvent_RpcAppEventButtonPress: RpcAppSystemEvent = 3; -pub const RpcAppSystemEvent_RpcAppEventButtonRelease: RpcAppSystemEvent = 4; -pub type RpcAppSystemEvent = core::ffi::c_uchar; -pub type RpcAppSystemCallback = ::core::option::Option< - unsafe extern "C" fn(event: RpcAppSystemEvent, context: *mut core::ffi::c_void), ->; -pub type RpcAppSystemDataExchangeCallback = ::core::option::Option< - unsafe extern "C" fn(data: *const u8, data_size: usize, context: *mut core::ffi::c_void), ->; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RpcAppSystem { - _unused: [u8; 0], +extern "C" { + #[doc = " Get OTP version"] + #[doc = ""] + #[doc = " @return OTP Version"] + pub fn furi_hal_version_get_otp_version() -> FuriHalVersionOtpVersion; } extern "C" { - pub fn rpc_system_app_set_callback( - rpc_app: *mut RpcAppSystem, - callback: RpcAppSystemCallback, - ctx: *mut core::ffi::c_void, - ); + #[doc = " Get hardware version"] + #[doc = ""] + #[doc = " @return Hardware Version"] + pub fn furi_hal_version_get_hw_version() -> u8; } extern "C" { - pub fn rpc_system_app_send_started(rpc_app: *mut RpcAppSystem); + #[doc = " Get hardware target"] + #[doc = ""] + #[doc = " @return Hardware Target"] + pub fn furi_hal_version_get_hw_target() -> u8; } extern "C" { - pub fn rpc_system_app_send_exited(rpc_app: *mut RpcAppSystem); + #[doc = " Get hardware body"] + #[doc = ""] + #[doc = " @return Hardware Body"] + pub fn furi_hal_version_get_hw_body() -> u8; } extern "C" { - pub fn rpc_system_app_get_data(rpc_app: *mut RpcAppSystem) -> *const core::ffi::c_char; + #[doc = " Get hardware body color"] + #[doc = ""] + #[doc = " @return Hardware Color"] + pub fn furi_hal_version_get_hw_color() -> FuriHalVersionColor; } extern "C" { - pub fn rpc_system_app_confirm( - rpc_app: *mut RpcAppSystem, - event: RpcAppSystemEvent, - result: bool, - ); + #[doc = " Get hardware connect"] + #[doc = ""] + #[doc = " @return Hardware Interconnect"] + pub fn furi_hal_version_get_hw_connect() -> u8; } extern "C" { - pub fn rpc_system_app_set_error_code(rpc_app: *mut RpcAppSystem, error_code: u32); + #[doc = " Get hardware region"] + #[doc = ""] + #[doc = " @return Hardware Region"] + pub fn furi_hal_version_get_hw_region() -> FuriHalVersionRegion; } extern "C" { - pub fn rpc_system_app_set_error_text( - rpc_app: *mut RpcAppSystem, - error_text: *const core::ffi::c_char, - ); + #[doc = " Get hardware region name"] + #[doc = ""] + #[doc = " @return Hardware Region name"] + pub fn furi_hal_version_get_hw_region_name() -> *const core::ffi::c_char; } extern "C" { - pub fn rpc_system_app_error_reset(rpc_app: *mut RpcAppSystem); + #[doc = " Get hardware display id"] + #[doc = ""] + #[doc = " @return Display id"] + pub fn furi_hal_version_get_hw_display() -> FuriHalVersionDisplay; } extern "C" { - pub fn rpc_system_app_set_data_exchange_callback( - rpc_app: *mut RpcAppSystem, - callback: RpcAppSystemDataExchangeCallback, - ctx: *mut core::ffi::c_void, - ); + #[doc = " Get hardware timestamp"] + #[doc = ""] + #[doc = " @return Hardware Manufacture timestamp"] + pub fn furi_hal_version_get_hw_timestamp() -> u32; } extern "C" { - pub fn rpc_system_app_exchange_data( - rpc_app: *mut RpcAppSystem, - data: *const u8, - data_size: usize, - ); + #[doc = " Get pointer to target name"] + #[doc = ""] + #[doc = " @return Hardware Name C-string"] + pub fn furi_hal_version_get_name_ptr() -> *const core::ffi::c_char; } -#[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], +extern "C" { + #[doc = " Get pointer to target device name"] + #[doc = ""] + #[doc = " @return Hardware Device Name C-string"] + pub fn furi_hal_version_get_device_name_ptr() -> *const core::ffi::c_char; } -#[doc = " Structure that hold file info"] +extern "C" { + #[doc = " Get pointer to target ble local device name"] + #[doc = ""] + #[doc = " @return Ble 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"] + #[doc = ""] + #[doc = " @return pointer to BLE MAC address"] + pub fn furi_hal_version_get_ble_mac() -> *const u8; +} +extern "C" { + #[doc = " Get address of version structure of firmware."] + #[doc = ""] + #[doc = " @return Address of firmware version structure."] + pub fn furi_hal_version_get_firmware_version() -> *const Version; +} +extern "C" { + #[doc = " Get platform UID size in bytes"] + #[doc = ""] + #[doc = " @return UID size in bytes"] + pub fn furi_hal_version_uid_size() -> usize; +} +extern "C" { + #[doc = " Get const pointer to UID"] + #[doc = ""] + #[doc = " @return pointer 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 type GapEventType = core::ffi::c_uchar; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct FileInfo { - #[doc = "< flags from FS_Flags enum"] - pub flags: u8, - #[doc = "< file size"] - pub size: u64, +#[derive(Copy, Clone)] +pub union GapEventData { + pub pin_code: u32, + pub max_packet_size: u16, } #[test] -fn bindgen_test_layout_FileInfo() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_GapEventData() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(FileInfo)) + ::core::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(GapEventData)) ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(FileInfo)) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(GapEventData)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).pin_code) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FileInfo), + stringify!(GapEventData), "::", - stringify!(flags) + stringify!(pin_code) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).max_packet_size) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(FileInfo), + stringify!(GapEventData), "::", - stringify!(size) + stringify!(max_packet_size) ) ); } -extern "C" { - #[doc = " Gets the error text from FS_Error"] - #[doc = " @param error_id error id"] - #[doc = " @return const char* error text"] - pub fn filesystem_api_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char; -} -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 error: FS_Error, +#[derive(Copy, Clone)] +pub struct GapEvent { + pub type_: GapEventType, + pub data: GapEventData, } #[test] -fn bindgen_test_layout_SDInfo() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_GapEvent() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 52usize, - concat!("Size of: ", stringify!(SDInfo)) + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(GapEvent)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(SDInfo)) + concat!("Alignment of ", stringify!(GapEvent)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).fs_type) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(SDInfo), + stringify!(GapEvent), "::", - stringify!(fs_type) + stringify!(type_) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).kb_total) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(SDInfo), + stringify!(GapEvent), "::", - stringify!(kb_total) + stringify!(data) ) ); +} +pub type GapEventCallback = ::core::option::Option< + unsafe extern "C" fn(event: GapEvent, context: *mut core::ffi::c_void) -> 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 = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); 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) - ) + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(SerialServiceData)) ); 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) - ) + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(SerialServiceData)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sector_size) as usize - ptr as usize }, - 14usize, + unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(SDInfo), + stringify!(SerialServiceData), "::", - stringify!(sector_size) + stringify!(buffer) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, - 16usize, + unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(SDInfo), + stringify!(SerialServiceData), "::", - stringify!(label) + stringify!(size) ) ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).error) as usize - ptr as usize }, - 50usize, +} +#[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 = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(SerialServiceEvent)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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!(SDInfo), + stringify!(SerialServiceEvent), "::", - stringify!(error) + stringify!(event) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(SerialServiceEvent), + "::", + stringify!(data) ) ); } -extern "C" { - pub fn sd_api_get_fs_type_text(fs_type: SDFsType) -> *const core::ffi::c_char; -} +pub type SerialServiceEventCallback = ::core::option::Option< + unsafe extern "C" fn(event: SerialServiceEvent, context: *mut core::ffi::c_void) -> u16, +>; +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 Storage { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Allocates and initializes a file descriptor"] - #[doc = " @return File*"] - pub fn storage_file_alloc(storage: *mut Storage) -> *mut File; -} -extern "C" { - #[doc = " Frees the file descriptor. Closes the file if it was open."] - pub fn storage_file_free(file: *mut File); -} -extern "C" { - #[doc = " Get storage pubsub."] - #[doc = " Storage will send StorageEvent messages."] - #[doc = " @param storage"] - #[doc = " @return FuriPubSub*"] - pub fn storage_get_pubsub(storage: *mut Storage) -> *mut FuriPubSub; -} -extern "C" { - #[doc = " Opens an existing file or create a new one."] - #[doc = " @param file pointer to file object."] - #[doc = " @param path path to file"] - #[doc = " @param access_mode access mode from FS_AccessMode"] - #[doc = " @param open_mode open mode from FS_OpenMode"] - #[doc = " @return success flag. You need to close the file even if the open operation failed."] - 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."] - #[doc = " @param file pointer to a file object, the file object will be freed."] - #[doc = " @return success flag"] - pub fn storage_file_close(file: *mut File) -> bool; -} -extern "C" { - #[doc = " Tells if the file is open"] - #[doc = " @param file pointer to a file object"] - #[doc = " @return bool true if file is open"] - pub fn storage_file_is_open(file: *mut File) -> bool; -} -extern "C" { - #[doc = " Tells if the file is a directory"] - #[doc = " @param file pointer to a file object"] - #[doc = " @return bool true if file is a directory"] - pub fn storage_file_is_dir(file: *mut File) -> bool; -} -extern "C" { - #[doc = " Reads bytes from a file into a buffer"] - #[doc = " @param file pointer to file object."] - #[doc = " @param buff pointer to a buffer, for reading"] - #[doc = " @param bytes_to_read how many bytes to read. Must be less than or equal to the size of the buffer."] - #[doc = " @return uint16_t how many bytes were actually read"] - pub fn storage_file_read( - file: *mut File, - buff: *mut core::ffi::c_void, - bytes_to_read: u16, - ) -> u16; -} -extern "C" { - #[doc = " Writes bytes from a buffer to a file"] - #[doc = " @param file pointer to file object."] - #[doc = " @param buff pointer to buffer, for writing"] - #[doc = " @param bytes_to_write how many bytes to write. Must be less than or equal to the size of the buffer."] - #[doc = " @return uint16_t how many bytes were actually written"] - pub fn storage_file_write( - file: *mut File, - buff: *const core::ffi::c_void, - bytes_to_write: u16, - ) -> u16; -} -extern "C" { - #[doc = " Moves the r/w pointer"] - #[doc = " @param file pointer to file object."] - #[doc = " @param offset offset to move the r/w pointer"] - #[doc = " @param from_start set an offset from the start or from the current position"] - #[doc = " @return success flag"] - pub fn storage_file_seek(file: *mut File, offset: u32, from_start: bool) -> bool; -} -extern "C" { - #[doc = " Gets the position of the r/w pointer"] - #[doc = " @param file pointer to file object."] - #[doc = " @return uint64_t position of the r/w pointer"] - pub fn storage_file_tell(file: *mut File) -> u64; -} -extern "C" { - #[doc = " Truncates the file size to the current position of the r/w pointer"] - #[doc = " @param file pointer to file object."] - #[doc = " @return bool success flag"] - pub fn storage_file_truncate(file: *mut File) -> bool; -} -extern "C" { - #[doc = " Gets the size of the file"] - #[doc = " @param file pointer to file object."] - #[doc = " @return uint64_t size of the file"] - pub fn storage_file_size(file: *mut File) -> u64; -} -extern "C" { - #[doc = " Checks that the r/w pointer is at the end of the file"] - #[doc = " @param file pointer to file object."] - #[doc = " @return bool success flag"] - pub fn storage_file_eof(file: *mut File) -> bool; -} -extern "C" { - #[doc = " @brief Check that file exists"] - #[doc = ""] - #[doc = " @param storage"] - #[doc = " @param path"] - #[doc = " @return true if file exists"] - pub fn storage_file_exists(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; -} -extern "C" { - #[doc = " Opens a directory to get objects from it"] - #[doc = " @param app pointer to the api"] - #[doc = " @param file pointer to file object."] - #[doc = " @param path path to directory"] - #[doc = " @return bool success flag. You need to close the directory even if the open operation failed."] - pub fn storage_dir_open(file: *mut File, path: *const core::ffi::c_char) -> bool; -} -extern "C" { - #[doc = " Close the directory. Also free file handle structure and point it to the NULL."] - #[doc = " @param file pointer to a file object."] - #[doc = " @return bool success flag"] - pub fn storage_dir_close(file: *mut File) -> bool; -} -extern "C" { - #[doc = " Reads the next object in the directory"] - #[doc = " @param file pointer to file object."] - #[doc = " @param fileinfo pointer to the read FileInfo, may be NULL"] - #[doc = " @param name pointer to name buffer, may be NULL"] - #[doc = " @param name_length name buffer length"] - #[doc = " @return success flag (if the next object does not exist, it also returns false and sets the file error id to FSE_NOT_EXIST)"] - pub fn storage_dir_read( - file: *mut File, - fileinfo: *mut FileInfo, - name: *mut core::ffi::c_char, - name_length: u16, - ) -> bool; -} -extern "C" { - #[doc = " Retrieves unix timestamp of last access"] - #[doc = ""] - #[doc = " @param storage The storage instance"] - #[doc = " @param path path to file/directory"] - #[doc = " @param timestamp the timestamp pointer"] - #[doc = ""] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_timestamp( - storage: *mut Storage, - path: *const core::ffi::c_char, - timestamp: *mut u32, - ) -> FS_Error; -} -extern "C" { - #[doc = " Retrieves information about a file/directory"] - #[doc = " @param app pointer to the api"] - #[doc = " @param path path to file/directory"] - #[doc = " @param fileinfo pointer to the read FileInfo, may be NULL"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_stat( - storage: *mut Storage, - path: *const core::ffi::c_char, - fileinfo: *mut FileInfo, - ) -> FS_Error; -} -extern "C" { - #[doc = " Removes a file/directory from the repository, the directory must be empty and the file/directory must not be open"] - #[doc = " @param app pointer to the api"] - #[doc = " @param path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_remove(storage: *mut Storage, path: *const core::ffi::c_char) - -> FS_Error; +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, } -extern "C" { - #[doc = " Renames file/directory, file/directory must not be open"] - #[doc = " @param app pointer to the api"] - #[doc = " @param old_path old path"] - #[doc = " @param new_path new path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_rename( - storage: *mut Storage, - old_path: *const core::ffi::c_char, - new_path: *const core::ffi::c_char, - ) -> FS_Error; +#[test] +fn bindgen_test_layout_BleGlueC2Info() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 37usize, + concat!("Size of: ", stringify!(BleGlueC2Info)) + ); + assert_eq!( + ::core::mem::align_of::(), + 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 = " Copy file, file must not be open"] - #[doc = " @param app pointer to the api"] - #[doc = " @param old_path old path"] - #[doc = " @param new_path new path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_copy( - storage: *mut Storage, - old_path: *const core::ffi::c_char, - new_path: *const core::ffi::c_char, - ) -> FS_Error; + #[doc = " Initialize start core2 and initialize transport"] + pub fn ble_glue_init(); } extern "C" { - #[doc = " Copy one folder contents into another with rename of all conflicting files"] - #[doc = " @param app pointer to the api"] - #[doc = " @param old_path old path"] - #[doc = " @param new_path new path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_merge( - storage: *mut Storage, - old_path: *const core::ffi::c_char, - new_path: *const core::ffi::c_char, - ) -> FS_Error; + #[doc = " Start Core2 Radio stack"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn ble_glue_start() -> bool; } extern "C" { - #[doc = " Creates a directory"] - #[doc = " @param app pointer to the api"] - #[doc = " @param path directory path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_common_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> FS_Error; + #[doc = " Is core2 alive and at least FUS is running"] + #[doc = ""] + #[doc = " @return true if core2 is alive"] + pub fn ble_glue_is_alive() -> bool; } extern "C" { - #[doc = " Gets general information about the storage"] - #[doc = " @param app pointer to the api"] - #[doc = " @param fs_path the path to the storage of interest"] - #[doc = " @param total_space pointer to total space record, will be filled"] - #[doc = " @param free_space pointer to free space record, will be filled"] - #[doc = " @return FS_Error operation result"] - 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; + #[doc = " Waits for C2 to reports its mode to callback"] + #[doc = ""] + #[doc = " @return true if it reported before reaching timeout"] + pub fn ble_glue_wait_for_c2_start(timeout: i32) -> bool; } extern "C" { - #[doc = " Retrieves the error text from the error id"] - #[doc = " @param error_id error id"] - #[doc = " @return const char* error text"] - pub fn storage_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char; + pub fn ble_glue_get_c2_info() -> *const BleGlueC2Info; } extern "C" { - #[doc = " Retrieves the error id from the file object"] - #[doc = " @param file pointer to file object. Pointer must not point to NULL. YOU CANNOT RETRIEVE THE ERROR ID IF THE FILE HAS BEEN CLOSED"] - #[doc = " @return FS_Error error id"] - pub fn storage_file_get_error(file: *mut File) -> FS_Error; + #[doc = " Is core2 radio stack present and ready"] + #[doc = ""] + #[doc = " @return true if present and ready"] + pub fn ble_glue_is_radio_stack_ready() -> bool; } extern "C" { - #[doc = " Retrieves the error text from the file object"] - #[doc = " @param file pointer to file object. Pointer must not point to NULL. YOU CANNOT RETRIEVE THE ERROR TEXT IF THE FILE HAS BEEN CLOSED"] - #[doc = " @return const char* error text"] - pub fn storage_file_get_error_desc(file: *mut File) -> *const core::ffi::c_char; + #[doc = " Set callback for NVM in RAM changes"] + #[doc = ""] + #[doc = " @param[in] callback The callback to call on NVM change"] + #[doc = " @param context The context for callback"] + pub fn ble_glue_set_key_storage_changed_callback( + callback: BleGlueKeyStorageChangedCallback, + context: *mut core::ffi::c_void, + ); } extern "C" { - #[doc = " Formats SD Card"] - #[doc = " @param api pointer to the api"] - #[doc = " @return FS_Error operation result"] - pub fn storage_sd_format(api: *mut Storage) -> FS_Error; + #[doc = " Stop SHCI thread"] + pub fn ble_glue_thread_stop(); } extern "C" { - #[doc = " Will unmount the SD card"] - #[doc = " @param api pointer to the api"] - #[doc = " @return FS_Error operation result"] - pub fn storage_sd_unmount(api: *mut Storage) -> FS_Error; + 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 = " Retrieves SD card information"] - #[doc = " @param api pointer to the api"] - #[doc = " @param info pointer to the info"] - #[doc = " @return FS_Error operation result"] - pub fn storage_sd_info(api: *mut Storage, info: *mut SDInfo) -> FS_Error; + #[doc = " Restart MCU to launch radio stack firmware if necessary"] + #[doc = ""] + #[doc = " @return true on radio stack start command"] + pub fn ble_glue_force_c2_mode(mode: BleGlueC2Mode) -> BleGlueCommandResult; } extern "C" { - #[doc = " Retrieves SD card status"] - #[doc = " @param api pointer to the api"] - #[doc = " @return FS_Error operation result"] - pub fn storage_sd_status(api: *mut Storage) -> FS_Error; + pub fn ble_app_init() -> bool; } -#[doc = " Internal LFS Functions"] -pub type Storage_name_converter = - ::core::option::Option; extern "C" { - #[doc = " Backs up internal storage to a tar archive"] - #[doc = " @param api pointer to the api"] - #[doc = " @param dstmane destination archive path"] - #[doc = " @return FS_Error operation result"] - pub fn storage_int_backup(api: *mut Storage, dstname: *const core::ffi::c_char) -> FS_Error; + pub fn ble_app_get_key_storage_buff(addr: *mut *mut u8, size: *mut u16); } extern "C" { - #[doc = " Restores internal storage from a tar archive"] - #[doc = " @param api pointer to the api"] - #[doc = " @param dstmane archive path"] - #[doc = " @param converter pointer to filename conversion function, may be NULL"] - #[doc = " @return FS_Error operation result"] - pub fn storage_int_restore( - api: *mut Storage, - dstname: *const core::ffi::c_char, - converter: Storage_name_converter, - ) -> FS_Error; + pub fn ble_app_thread_stop(); } +pub const FuriHalBtSerialRpcStatus_FuriHalBtSerialRpcStatusNotActive: FuriHalBtSerialRpcStatus = 0; +pub const FuriHalBtSerialRpcStatus_FuriHalBtSerialRpcStatusActive: FuriHalBtSerialRpcStatus = 1; +pub type FuriHalBtSerialRpcStatus = core::ffi::c_uchar; +#[doc = " Serial service callback type"] +pub type FuriHalBtSerialCallback = SerialServiceEventCallback; extern "C" { - #[doc = " Removes a file/directory, the directory must be empty and the file/directory must not be open"] - #[doc = " @param storage pointer to the api"] - #[doc = " @param path"] - #[doc = " @return true on success or if file/dir is not exist"] - pub fn storage_simply_remove(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; + #[doc = " Start Serial Profile"] + pub fn furi_hal_bt_serial_start(); } extern "C" { - #[doc = " Recursively removes a file/directory, the directory can be not empty"] - #[doc = " @param storage pointer to the api"] - #[doc = " @param path"] - #[doc = " @return true on success or if file/dir is not exist"] - pub fn storage_simply_remove_recursive( - storage: *mut Storage, - path: *const core::ffi::c_char, - ) -> bool; + #[doc = " Stop Serial Profile"] + pub fn furi_hal_bt_serial_stop(); } extern "C" { - #[doc = " Creates a directory"] - #[doc = " @param storage"] - #[doc = " @param path"] - #[doc = " @return true on success or if directory is already exist"] - pub fn storage_simply_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; + #[doc = " Set Serial service events callback"] + #[doc = ""] + #[doc = " @param buffer_size Applicaition buffer size"] + #[doc = " @param calback FuriHalBtSerialCallback instance"] + #[doc = " @param context pointer to context"] + pub fn furi_hal_bt_serial_set_event_callback( + buff_size: u16, + callback: FuriHalBtSerialCallback, + context: *mut core::ffi::c_void, + ); } extern "C" { - #[doc = " @brief Get next free filename."] + #[doc = " Set BLE RPC status"] #[doc = ""] - #[doc = " @param storage"] - #[doc = " @param dirname"] - #[doc = " @param filename"] - #[doc = " @param fileextension"] - #[doc = " @param nextfilename return name"] - #[doc = " @param max_len max len 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, - ); + #[doc = " @param status FuriHalBtSerialRpcStatus instance"] + pub fn furi_hal_bt_serial_set_rpc_status(status: FuriHalBtSerialRpcStatus); } extern "C" { - pub fn LL_RCC_GetUSARTClockFreq(USARTxSource: u32) -> u32; + #[doc = " Notify that application buffer is empty"] + pub fn furi_hal_bt_serial_notify_buffer_is_empty(); } extern "C" { - pub fn LL_RCC_GetLPUARTClockFreq(LPUARTxSource: u32) -> u32; + #[doc = " Send data through BLE"] + #[doc = ""] + #[doc = " @param data data buffer"] + #[doc = " @param size data buffer size"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_bt_serial_tx(data: *mut u8, size: u16) -> bool; } -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; +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; +pub const FuriHalBtProfile_FuriHalBtProfileSerial: FuriHalBtProfile = 0; +pub const FuriHalBtProfile_FuriHalBtProfileHidKeyboard: FuriHalBtProfile = 1; +pub const FuriHalBtProfile_FuriHalBtProfileNumber: FuriHalBtProfile = 2; +pub type FuriHalBtProfile = core::ffi::c_uchar; extern "C" { - #[doc = " Early deinitialization"] - pub fn furi_hal_clock_deinit_early(); + #[doc = " Lock core2 state transition"] + pub fn furi_hal_bt_lock_core2(); } extern "C" { - #[doc = " Enable clock output on MCO pin"] + #[doc = " Lock core2 state transition"] + pub fn furi_hal_bt_unlock_core2(); +} +extern "C" { + #[doc = " Start radio stack"] #[doc = ""] - #[doc = " @param source MCO clock source"] - #[doc = " @param div MCO clock division"] - pub fn furi_hal_clock_mco_enable( - source: FuriHalClockMcoSourceId, - div: FuriHalClockMcoDivisorId, - ); + #[doc = " @return true on successfull radio stack start"] + pub fn furi_hal_bt_start_radio_stack() -> bool; } extern "C" { - #[doc = " Disable clock output on MCO pin"] - pub fn furi_hal_clock_mco_disable(); + #[doc = " Get radio stack type"] + #[doc = ""] + #[doc = " @return FuriHalBtStack instance"] + pub fn furi_hal_bt_get_radio_stack() -> FuriHalBtStack; } -pub type FuriHalConsoleTxCallback = ::core::option::Option< - unsafe extern "C" fn(buffer: *const u8, size: usize, context: *mut core::ffi::c_void), ->; extern "C" { - pub fn furi_hal_console_init(); + #[doc = " Check if radio stack supports BLE GAT/GAP"] + #[doc = ""] + #[doc = " @return true if supported"] + pub fn furi_hal_bt_is_ble_gatt_gap_supported() -> bool; } extern "C" { - pub fn furi_hal_console_enable(); + #[doc = " Check if radio stack supports testing"] + #[doc = ""] + #[doc = " @return true if supported"] + pub fn furi_hal_bt_is_testing_supported() -> bool; } extern "C" { - pub fn furi_hal_console_disable(); + #[doc = " Start BLE app"] + #[doc = ""] + #[doc = " @param profile FuriHalBtProfile instance"] + #[doc = " @param event_cb GapEventCallback instance"] + #[doc = " @param context pointer to context"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_bt_start_app( + profile: FuriHalBtProfile, + event_cb: GapEventCallback, + context: *mut core::ffi::c_void, + ) -> bool; } extern "C" { - pub fn furi_hal_console_set_tx_callback( - callback: FuriHalConsoleTxCallback, + #[doc = " Reinitialize core2"] + #[doc = ""] + #[doc = " Also can be used to prepare core2 for stop modes"] + pub fn furi_hal_bt_reinit(); +} +extern "C" { + #[doc = " Change BLE app"] + #[doc = " Restarts 2nd core"] + #[doc = ""] + #[doc = " @param profile FuriHalBtProfile instance"] + #[doc = " @param event_cb GapEventCallback instance"] + #[doc = " @param context pointer to context"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_bt_change_app( + profile: FuriHalBtProfile, + event_cb: GapEventCallback, context: *mut core::ffi::c_void, - ); + ) -> bool; } extern "C" { - pub fn furi_hal_console_tx(buffer: *const u8, buffer_size: usize); + #[doc = " Update battery level"] + #[doc = ""] + #[doc = " @param battery_level battery level"] + pub fn furi_hal_bt_update_battery_level(battery_level: u8); } extern "C" { - pub fn furi_hal_console_tx_with_new_line(buffer: *const u8, buffer_size: usize); + #[doc = " Update battery power state"] + pub fn furi_hal_bt_update_power_state(); } extern "C" { - #[doc = " Printf-like plain uart interface"] - #[doc = " @warning Will not work in ISR context"] - #[doc = " @param format"] - #[doc = " @param ..."] - pub fn furi_hal_console_printf(format: *const core::ffi::c_char, ...); + #[doc = " Checks if BLE state is active"] + #[doc = ""] + #[doc = " @return true if device is connected or advertising, false otherwise"] + pub fn furi_hal_bt_is_active() -> bool; } extern "C" { - pub fn furi_hal_console_puts(data: *const core::ffi::c_char); + #[doc = " Start advertising"] + pub fn furi_hal_bt_start_advertising(); } -#[doc = " @defgroup I2C_LL_ES_INIT I2C Exported Init structure"] -#[doc = " @{"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct LL_I2C_InitTypeDef { - #[doc = "< Specifies the peripheral mode."] - #[doc = "This parameter can be a value of @ref I2C_LL_EC_PERIPHERAL_MODE."] +extern "C" { + #[doc = " Stop advertising"] + pub fn furi_hal_bt_stop_advertising(); +} +extern "C" { + #[doc = " Get BT/BLE system component state"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_SetMode()."] - pub PeripheralMode: u32, - #[doc = "< Specifies the SDA setup, hold time and the SCL high, low period values."] - #[doc = "This parameter must be set by referring to the STM32CubeMX Tool and"] - #[doc = "the helper macro @ref __LL_I2C_CONVERT_TIMINGS()."] + #[doc = " @param[in] buffer FuriString* buffer to write to"] + pub fn furi_hal_bt_dump_state(buffer: *mut FuriString); +} +extern "C" { + #[doc = " Get BT/BLE system component state"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_SetTiming()."] - pub Timing: u32, - #[doc = "< Enables or disables analog noise filter."] - #[doc = "This parameter can be a value of @ref I2C_LL_EC_ANALOGFILTER_SELECTION."] + #[doc = " @return true if core2 is alive"] + pub fn furi_hal_bt_is_alive() -> bool; +} +extern "C" { + #[doc = " Get key storage buffer address and size"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary functions"] - #[doc = "@ref LL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter()."] - pub AnalogFilter: u32, - #[doc = "< Configures the digital noise filter."] - #[doc = "This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F."] + #[doc = " @param key_buff_addr pointer to store buffer address"] + #[doc = " @param 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"] + #[doc = " @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"] + #[doc = " @note Must be called after SRAM2 read/write operations"] + pub fn furi_hal_bt_nvm_sram_sem_release(); +} +extern "C" { + #[doc = " Clear key storage"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_SetDigitalFilter()."] - pub DigitalFilter: u32, - #[doc = "< Specifies the device own address 1."] - #[doc = "This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF."] + #[doc = " @return true on success"] + pub fn furi_hal_bt_clear_white_list() -> bool; +} +extern "C" { + #[doc = " Set key storage change callback"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_SetOwnAddress1()."] - pub OwnAddress1: u32, - #[doc = "< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive"] - #[doc = "match code or next received byte."] - #[doc = "This parameter can be a value of @ref I2C_LL_EC_I2C_ACKNOWLEDGE."] + #[doc = " @param callback BleGlueKeyStorageChangedCallback instance"] + #[doc = " @param 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"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_AcknowledgeNextData()."] - pub TypeAcknowledge: u32, - #[doc = "< Specifies the device own address 1 size (7-bit or 10-bit)."] - #[doc = "This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1."] + #[doc = " @param[in] channel The channel"] + #[doc = " @param[in] power 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"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_I2C_SetOwnAddress1()."] - pub OwnAddrSize: u32, + #[doc = " @param[in] channel The channel"] + #[doc = " @param[in] pattern The pattern"] + #[doc = " @param[in] datarate The datarate"] + pub fn furi_hal_bt_start_packet_tx(channel: u8, pattern: u8, datarate: u8); } -#[test] -fn bindgen_test_layout_LL_I2C_InitTypeDef() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(LL_I2C_InitTypeDef)) - ); - assert_eq!( - ::core::mem::align_of::(), - 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 = " Stop sending ble packets"] + #[doc = ""] + #[doc = " @return sent packet count"] + pub fn furi_hal_bt_stop_packet_test() -> u16; } extern "C" { - #[doc = " @defgroup I2C_LL_EF_Init Initialization and de-initialization functions"] - #[doc = " @{"] - pub fn LL_I2C_Init( - I2Cx: *mut I2C_TypeDef, - I2C_InitStruct: *mut LL_I2C_InitTypeDef, - ) -> ErrorStatus; + #[doc = " Start receiving packets"] + #[doc = ""] + #[doc = " @param[in] channel RX channel"] + #[doc = " @param[in] datarate Datarate"] + pub fn furi_hal_bt_start_packet_rx(channel: u8, datarate: u8); } -#[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, +extern "C" { + #[doc = " Set up the RF to listen to a given RF channel"] + #[doc = ""] + #[doc = " @param[in] channel RX channel"] + pub fn furi_hal_bt_start_rx(channel: u8); } -#[test] -fn bindgen_test_layout_FuriHalI2cBus() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(FuriHalI2cBus)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - 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 }, - 8usize, - concat!( - "Offset of field: ", - stringify!(FuriHalI2cBus), - "::", - stringify!(current_handle) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(FuriHalI2cBus), - "::", - stringify!(callback) - ) - ); +extern "C" { + #[doc = " Stop RF listenning"] + pub fn furi_hal_bt_stop_rx(); +} +extern "C" { + #[doc = " Get RSSI"] + #[doc = ""] + #[doc = " @return RSSI in dBm"] + pub fn furi_hal_bt_get_rssi() -> f32; +} +extern "C" { + #[doc = " Get number of transmitted packets"] + #[doc = ""] + #[doc = " @return packet count"] + pub fn furi_hal_bt_get_transmitted_packets() -> u32; +} +extern "C" { + #[doc = " Check & switch C2 to given mode"] + #[doc = ""] + #[doc = " @param[in] mode mode to switch into"] + pub fn furi_hal_bt_ensure_c2_mode(mode: BleGlueC2Mode) -> bool; +} +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`"] + #[doc = " Preset: `furi_hal_spi_preset_1edge_low_2m`"] + #[doc = ""] + #[doc = " miso: pa6"] + #[doc = " mosi: pa7"] + #[doc = " sck: pb3"] + #[doc = " cs: pa4 (software controlled)"] + #[doc = ""] + #[doc = " @warning not initialized by default, call `furi_hal_spi_bus_handle_init` to initialize"] + #[doc = " Bus pins are floating on inactive state, CS high after initialization"] + #[doc = ""] + 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 = " Early initialize SPI HAL"] + pub fn furi_hal_spi_init_early(); +} +extern "C" { + #[doc = " Early deinitialize SPI HAL"] + pub fn furi_hal_spi_deinit_early(); +} +extern "C" { + #[doc = " Initialize SPI Bus"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBus instance"] + pub fn furi_hal_spi_bus_init(bus: *mut FuriHalSpiBus); +} +extern "C" { + #[doc = " Deinitialize SPI Bus"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBus instance"] + pub fn furi_hal_spi_bus_deinit(bus: *mut FuriHalSpiBus); +} +extern "C" { + #[doc = " Initialize SPI Bus Handle"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + pub fn furi_hal_spi_bus_handle_init(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Deinitialize SPI Bus Handle"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + pub fn furi_hal_spi_bus_handle_deinit(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Acquire SPI bus"] + #[doc = ""] + #[doc = " @warning blocking, calls `furi_crash` on programming error, CS transition is up to handler event routine"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + pub fn furi_hal_spi_acquire(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Release SPI bus"] + #[doc = ""] + #[doc = " @warning calls `furi_crash` on programming error, CS transition is up to handler event routine"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + pub fn furi_hal_spi_release(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " SPI Receive"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + #[doc = " @param buffer receive buffer"] + #[doc = " @param size transaction size (buffer size)"] + #[doc = " @param timeout operation timeout in ms"] + #[doc = ""] + #[doc = " @return true 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"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + #[doc = " @param buffer transmit buffer"] + #[doc = " @param size transaction size (buffer size)"] + #[doc = " @param timeout operation timeout in ms"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_spi_bus_tx( + handle: *mut FuriHalSpiBusHandle, + buffer: *mut u8, + size: usize, + timeout: u32, + ) -> bool; +} +extern "C" { + #[doc = " SPI Transmit and Receive"] + #[doc = ""] + #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] + #[doc = " @param tx_buffer pointer to tx buffer"] + #[doc = " @param rx_buffer pointer to rx buffer"] + #[doc = " @param size transaction size (buffer size)"] + #[doc = " @param timeout operation timeout in ms"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_spi_bus_trx( + handle: *mut FuriHalSpiBusHandle, + tx_buffer: *mut u8, + rx_buffer: *mut u8, + size: usize, + timeout: u32, + ) -> bool; } -#[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, +pub struct LevelDuration { + pub level: u32, + pub duration: u32, } #[test] -fn bindgen_test_layout_FuriHalI2cBusHandle() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_LevelDuration() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(FuriHalI2cBusHandle)) + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(LevelDuration)) ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(FuriHalI2cBusHandle)) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(LevelDuration)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bus) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).level) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FuriHalI2cBusHandle), + stringify!(LevelDuration), "::", - stringify!(bus) + stringify!(level) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).duration) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(FuriHalI2cBusHandle), + stringify!(LevelDuration), "::", - stringify!(callback) + stringify!(duration) ) ); } -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; +#[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; +#[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 = " Handle for internal(power) i2c bus"] - #[doc = " Bus: furi_hal_i2c_bus_external"] - #[doc = " Pins: PA9(SCL) / PA10(SDA), float on release"] - #[doc = " Params: 400khz"] - pub static mut furi_hal_i2c_handle_power: FuriHalI2cBusHandle; + #[doc = " Send device to sleep mode"] + pub fn furi_hal_subghz_sleep(); } extern "C" { - #[doc = " Handle for external i2c bus"] - #[doc = " Bus: furi_hal_i2c_bus_external"] - #[doc = " Pins: PC0(SCL) / PC1(SDA), float on release"] - #[doc = " Params: 100khz"] - pub static mut furi_hal_i2c_handle_external: FuriHalI2cBusHandle; + #[doc = " Load registers from preset by preset name"] + #[doc = ""] + #[doc = " @param preset to load"] + pub fn furi_hal_subghz_load_preset(preset: FuriHalSubGhzPreset); } -#[doc = " @brief 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."] - #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_CLK_SOURCE."] +extern "C" { + #[doc = " Load custom registers from preset"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary"] - #[doc = "function @ref LL_LPTIM_SetClockSource()."] - pub ClockSource: u32, - #[doc = "< Specifies the prescaler division ratio."] - #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER."] + #[doc = " @param preset_data registers to load"] + pub fn furi_hal_subghz_load_custom_preset(preset_data: *mut u8); +} +extern "C" { + #[doc = " Load registers"] #[doc = ""] - #[doc = "This feature can be modified afterwards using using unitary"] - #[doc = "function @ref LL_LPTIM_SetPrescaler()."] - pub Prescaler: u32, - #[doc = "< Specifies the waveform shape."] - #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_WAVEFORM."] + #[doc = " @param data Registers data"] + pub fn furi_hal_subghz_load_registers(data: *mut u8); +} +extern "C" { + #[doc = " Load PATABLE"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary"] - #[doc = "function @ref LL_LPTIM_ConfigOutput()."] - pub Waveform: u32, - #[doc = "< Specifies waveform polarity."] - #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_POLARITY."] + #[doc = " @param data 8 uint8_t values"] + pub fn furi_hal_subghz_load_patable(data: *const u8); +} +extern "C" { + #[doc = " Write packet to FIFO"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary"] - #[doc = "function @ref LL_LPTIM_ConfigOutput()."] - pub Polarity: u32, + #[doc = " @param data bytes array"] + #[doc = " @param size size"] + pub fn furi_hal_subghz_write_packet(data: *const u8, size: u8); } -#[test] -fn bindgen_test_layout_LL_LPTIM_InitTypeDef() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(LL_LPTIM_InitTypeDef)) - ); - assert_eq!( - ::core::mem::align_of::(), - 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 = " Check if receive pipe is not empty"] + #[doc = ""] + #[doc = " @return true if not empty"] + pub fn furi_hal_subghz_rx_pipe_not_empty() -> bool; } extern "C" { - #[doc = " @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions"] - #[doc = " @{"] - pub fn LL_LPTIM_DeInit(LPTIMx: *mut LPTIM_TypeDef) -> ErrorStatus; + #[doc = " Check if received data crc is valid"] + #[doc = ""] + #[doc = " @return true if valid"] + pub fn furi_hal_subghz_is_rx_data_crc_valid() -> bool; } extern "C" { - pub fn LL_LPTIM_Init( - LPTIMx: *mut LPTIM_TypeDef, - LPTIM_InitStruct: *mut LL_LPTIM_InitTypeDef, - ) -> ErrorStatus; + #[doc = " Read packet from FIFO"] + #[doc = ""] + #[doc = " @param data pointer"] + #[doc = " @param size size"] + pub fn furi_hal_subghz_read_packet(data: *mut u8, size: *mut u8); } -#[doc = " @brief 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."] - #[doc = "This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] +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 = " Reset Issue reset command"] + #[doc = " @warning 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"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_SetPrescaler()."] - pub Prescaler: u16, - #[doc = "< Specifies the counter mode."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE."] + #[doc = " @return true 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"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_SetCounterMode()."] - pub CounterMode: u32, - #[doc = "< Specifies the auto reload value to be loaded into the active"] - #[doc = "Auto-Reload Register at the next update event."] - #[doc = "This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] - #[doc = "Some timer instances may support 32 bits counters. In that case this parameter must"] - #[doc = "be a number between 0x0000 and 0xFFFFFFFF."] + #[doc = " @return RSSI value"] + pub fn furi_hal_subghz_get_rssi() -> f32; +} +extern "C" { + #[doc = " Get LQI"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_SetAutoReload()."] - pub Autoreload: u32, - #[doc = "< Specifies the clock division."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION."] + #[doc = " @return LQI value"] + pub fn furi_hal_subghz_get_lqi() -> u8; +} +extern "C" { + #[doc = " Check if frequency is in valid range"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_SetClockDivision()."] - pub ClockDivision: u32, - #[doc = "< Specifies the repetition counter value. Each time the RCR downcounter"] - #[doc = "reaches zero, an update event is generated and counting restarts"] - #[doc = "from the RCR value (N)."] - #[doc = "This means in PWM mode that (N+1) corresponds to:"] - #[doc = "- the number of PWM periods in edge-aligned mode"] - #[doc = "- the number of half PWM period in center-aligned mode"] - #[doc = "GP timers: this parameter must be a number between Min_Data = 0x00 and"] - #[doc = "Max_Data = 0xFF."] - #[doc = "Advanced timers: this parameter must be a number between Min_Data = 0x0000 and"] - #[doc = "Max_Data = 0xFFFF."] + #[doc = " @param value frequency in Hz"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_SetRepetitionCounter()."] - pub RepetitionCounter: u32, + #[doc = " @return true if frequency is valid, otherwise false"] + pub fn furi_hal_subghz_is_frequency_valid(value: u32) -> bool; } -#[test] -fn bindgen_test_layout_LL_TIM_InitTypeDef() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(LL_TIM_InitTypeDef)) - ); - assert_eq!( - ::core::mem::align_of::(), - 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 = " @brief TIM Output Compare configuration structure definition."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct LL_TIM_OC_InitTypeDef { - #[doc = "< Specifies the output mode."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCMODE."] +extern "C" { + #[doc = " Set frequency and path This function automatically selects antenna matching"] + #[doc = " network"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_OC_SetMode()."] - pub OCMode: u32, - #[doc = "< Specifies the TIM Output Compare state."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCSTATE."] + #[doc = " @param value frequency in Hz"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary functions"] - #[doc = "@ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel()."] - pub OCState: u32, - #[doc = "< Specifies the TIM complementary Output Compare state."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCSTATE."] + #[doc = " @return real frequency in Hz"] + pub fn furi_hal_subghz_set_frequency_and_path(value: u32) -> u32; +} +extern "C" { + #[doc = " Set frequency"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary functions"] - #[doc = "@ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel()."] - pub OCNState: u32, - #[doc = "< Specifies the Compare value to be loaded into the Capture Compare Register."] - #[doc = "This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF."] + #[doc = " @param value frequency in Hz"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "LL_TIM_OC_SetCompareCHx (x=1..6)."] - pub CompareValue: u32, - #[doc = "< Specifies the output polarity."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY."] + #[doc = " @return real frequency in Hz"] + pub fn furi_hal_subghz_set_frequency(value: u32) -> u32; +} +extern "C" { + #[doc = " Set path"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_OC_SetPolarity()."] - pub OCPolarity: u32, - #[doc = "< Specifies the complementary output polarity."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY."] + #[doc = " @param 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"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_OC_SetPolarity()."] - pub OCNPolarity: u32, - #[doc = "< Specifies the TIM Output Compare pin state during Idle state."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE."] + #[doc = " @param callback FuriHalSubGhzCaptureCallback"] + #[doc = " @param 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"] +#[doc = " @param context callback context"] +#[doc = " @return LevelDuration"] +pub type FuriHalSubGhzAsyncTxCallback = + ::core::option::Option LevelDuration>; +extern "C" { + #[doc = " Start async TX Initializes GPIO, TIM2 and DMA1 for signal output"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_OC_SetIdleState()."] - pub OCIdleState: u32, - #[doc = "< Specifies the TIM Output Compare pin state during Idle state."] - #[doc = "This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE."] + #[doc = " @param callback FuriHalSubGhzAsyncTxCallback"] + #[doc = " @param context callback context"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function"] - #[doc = "@ref LL_TIM_OC_SetIdleState()."] - pub OCNIdleState: u32, -} -#[test] -fn bindgen_test_layout_LL_TIM_OC_InitTypeDef() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(LL_TIM_OC_InitTypeDef)) - ); - assert_eq!( - ::core::mem::align_of::(), - 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) - ) - ); + #[doc = " @return true 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 = " @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions"] - #[doc = " @{"] - pub fn LL_TIM_DeInit(TIMx: *mut TIM_TypeDef) -> ErrorStatus; + #[doc = " Wait for async transmission to complete"] + #[doc = ""] + #[doc = " @return true if TX complete"] + pub fn furi_hal_subghz_is_async_tx_complete() -> bool; } extern "C" { - pub fn LL_TIM_Init( - TIMx: *mut TIM_TypeDef, - TIM_InitStruct: *mut LL_TIM_InitTypeDef, - ) -> ErrorStatus; + #[doc = " Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1"] + pub fn furi_hal_subghz_stop_async_tx(); } extern "C" { - pub fn LL_TIM_OC_Init( - TIMx: *mut TIM_TypeDef, - Channel: u32, - TIM_OC_InitStruct: *mut LL_TIM_OC_InitTypeDef, - ) -> ErrorStatus; + #[doc = " Turn on/off vibro"] + #[doc = ""] + #[doc = " @param[in] value new state"] + pub fn furi_hal_vibro_on(value: bool); } -#[doc = " Timer ISR"] -pub type FuriHalInterruptISR = +pub type FuriHalIbuttonEmulateCallback = ::core::option::Option; -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_FuriHalInterruptIdMax: FuriHalInterruptId = 23; -pub type FuriHalInterruptId = core::ffi::c_uchar; extern "C" { - #[doc = " Set ISR and enable interrupt with default priority"] - #[doc = " We don't clear interrupt flags for you, do it by your self."] - #[doc = " @param index - interrupt ID"] - #[doc = " @param isr - your interrupt service routine or use NULL to clear"] - #[doc = " @param context - isr context"] - pub fn furi_hal_interrupt_set_isr( - index: FuriHalInterruptId, - isr: FuriHalInterruptISR, + pub fn furi_hal_ibutton_emulate_start( + period: u32, + callback: FuriHalIbuttonEmulateCallback, context: *mut core::ffi::c_void, ); } extern "C" { - #[doc = " Set ISR and enable interrupt with custom priority"] - #[doc = " We don't clear interrupt flags for you, do it by your self."] - #[doc = " @param index - interrupt ID"] - #[doc = " @param priority - 0 to 15, 0 highest"] - #[doc = " @param isr - your interrupt service routine or use NULL to clear"] - #[doc = " @param context - isr context"] - pub fn furi_hal_interrupt_set_isr_ex( - index: FuriHalInterruptId, - priority: u16, - isr: FuriHalInterruptISR, + pub fn furi_hal_ibutton_emulate_set_next(period: u32); +} +extern "C" { + pub fn furi_hal_ibutton_emulate_stop(); +} +extern "C" { + #[doc = " Sets the pin to normal mode (open collector), and sets it to float"] + pub fn furi_hal_ibutton_start_drive(); +} +extern "C" { + #[doc = " Sets the pin to normal mode (open collector), and clears pin EXTI interrupt."] + #[doc = " Used in EXTI interrupt context."] + pub fn furi_hal_ibutton_start_drive_in_isr(); +} +extern "C" { + #[doc = " Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and sets it to float"] + pub fn furi_hal_ibutton_start_interrupt(); +} +extern "C" { + #[doc = " Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and clears pin EXTI interrupt."] + #[doc = " Used in EXTI interrupt context."] + pub fn furi_hal_ibutton_start_interrupt_in_isr(); +} +extern "C" { + #[doc = " Sets the pin to analog mode, and sets it to float"] + pub fn furi_hal_ibutton_stop(); +} +extern "C" { + #[doc = " Attach interrupt callback to iButton pin"] + #[doc = " @param cb callback"] + #[doc = " @param context context"] + pub fn furi_hal_ibutton_add_interrupt(cb: GpioExtiCallback, context: *mut core::ffi::c_void); +} +extern "C" { + #[doc = " Remove interrupt callback from iButton pin"] + pub fn furi_hal_ibutton_remove_interrupt(); +} +extern "C" { + #[doc = " Sets the pin to low"] + pub fn furi_hal_ibutton_pin_low(); +} +extern "C" { + #[doc = " Sets the pin to high (float in iButton pin modes)"] + pub fn furi_hal_ibutton_pin_high(); +} +extern "C" { + #[doc = " Get pin level"] + #[doc = " @return true if level is high"] + #[doc = " @return false if level is low"] + pub fn furi_hal_ibutton_pin_get_level() -> bool; +} +extern "C" { + #[doc = " Config rfid pins to reset state"] + pub fn furi_hal_rfid_pins_reset(); +} +extern "C" { + #[doc = " Config rfid pins to emulate state"] + pub fn furi_hal_rfid_pins_emulate(); +} +extern "C" { + #[doc = " Config rfid pins to read state"] + pub fn furi_hal_rfid_pins_read(); +} +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 = " Config rfid timer to read state"] + #[doc = ""] + #[doc = " @param freq timer frequency"] + #[doc = " @param duty_cycle timer duty cycle, 0.0-1.0"] + pub fn furi_hal_rfid_tim_read(freq: f32, duty_cycle: f32); +} +extern "C" { + #[doc = " Start read timer"] + pub fn furi_hal_rfid_tim_read_start(); +} +extern "C" { + #[doc = " Stop read timer"] + pub fn furi_hal_rfid_tim_read_stop(); +} +extern "C" { + #[doc = " Config rfid timer to emulate state"] + #[doc = ""] + #[doc = " @param freq timer frequency"] + pub fn furi_hal_rfid_tim_emulate(freq: f32); +} +pub type FuriHalRfidEmulateCallback = + ::core::option::Option; +extern "C" { + #[doc = " Start emulation timer"] + pub fn furi_hal_rfid_tim_emulate_start( + callback: FuriHalRfidEmulateCallback, context: *mut core::ffi::c_void, ); } +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_os_tick(); + pub fn furi_hal_rfid_tim_read_capture_start( + callback: FuriHalRfidReadCaptureCallback, + context: *mut core::ffi::c_void, + ); } -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"] - #[doc = ""] - #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] - #[doc = " @param[in] freq Frequency in Hz"] - #[doc = " @param[in] duty Duty cycle value in %"] - pub fn furi_hal_pwm_start(channel: FuriHalPwmOutputId, freq: u32, duty: u8); + pub fn furi_hal_rfid_tim_read_capture_stop(); } +pub type FuriHalRfidDMACallback = + ::core::option::Option; extern "C" { - #[doc = " Disable PWM channel"] + 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 = " Stop emulation timer"] + pub fn furi_hal_rfid_tim_emulate_stop(); +} +extern "C" { + #[doc = " Config rfid timers to reset state"] + pub fn furi_hal_rfid_tim_reset(); +} +extern "C" { + #[doc = " Set emulation timer period"] #[doc = ""] - #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] - pub fn furi_hal_pwm_stop(channel: FuriHalPwmOutputId); + #[doc = " @param period overall duration"] + pub fn furi_hal_rfid_set_emulate_period(period: u32); } extern "C" { - #[doc = " Set PWM channel parameters"] + #[doc = " Set emulation timer pulse"] #[doc = ""] - #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] - #[doc = " @param[in] freq Frequency in Hz"] - #[doc = " @param[in] duty Duty cycle value in %"] - pub fn furi_hal_pwm_set_params(channel: FuriHalPwmOutputId, freq: u32, duty: u8); + #[doc = " @param pulse duration of high level"] + pub fn furi_hal_rfid_set_emulate_pulse(pulse: u32); } -#[doc = " @brief SPI Init structures definition"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct LL_SPI_InitTypeDef { - #[doc = "< Specifies the SPI unidirectional or bidirectional data mode."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE."] +extern "C" { + #[doc = " Set read timer period"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferDirection()."] - pub TransferDirection: u32, - #[doc = "< Specifies the SPI mode (Master/Slave)."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_MODE."] + #[doc = " @param period overall duration"] + pub fn furi_hal_rfid_set_read_period(period: u32); +} +extern "C" { + #[doc = " Set read timer pulse"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetMode()."] - pub Mode: u32, - #[doc = "< Specifies the SPI data width."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_DATAWIDTH."] + #[doc = " @param pulse duration of high level"] + pub fn furi_hal_rfid_set_read_pulse(pulse: u32); +} +extern "C" { + #[doc = " Сhanges the configuration of the RFID timer \"on a fly\""] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetDataWidth()."] - pub DataWidth: u32, - #[doc = "< Specifies the serial clock steady state."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_POLARITY."] + #[doc = " @param freq new frequency"] + #[doc = " @param duty_cycle new duty cycle"] + pub fn furi_hal_rfid_change_read_config(freq: f32, duty_cycle: f32); +} +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; +extern "C" { + #[doc = " Set comparator callback"] + pub fn furi_hal_rfid_comp_set_callback( + callback: FuriHalRfidCompCallback, + context: *mut core::ffi::c_void, + ); +} +pub type ReturnCode = u16; +extern "C" { + #[doc = " \\brief Calculate Timer"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPolarity()."] - pub ClockPolarity: u32, - #[doc = "< Specifies the clock active edge for the bit capture."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_PHASE."] + #[doc = " This method calculates when the timer will be expired given the amount"] + #[doc = " time in milliseconds /a tOut."] + #[doc = " Once the timer has been calculated it will then be used to check when"] + #[doc = " it expires."] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref 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."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_NSS_MODE."] + #[doc = " \\see timersIsExpired"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetNSSMode()."] - pub NSS: u32, - #[doc = "< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_BAUDRATEPRESCALER."] - #[doc = "@note The communication clock is derived from the master clock. The slave clock does not need to be set."] + #[doc = " \\param[in] time : time/duration in Milliseconds for the timer"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetBaudRatePrescaler()."] - pub BaudRate: u32, - #[doc = "< Specifies whether data transfers start from MSB or LSB bit."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_BIT_ORDER."] + #[doc = " \\return u32 : The new timer calculated based on the given time"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferBitOrder()."] - pub BitOrder: u32, - #[doc = "< Specifies if the CRC calculation is enabled or not."] - #[doc = "This parameter can be a value of @ref SPI_LL_EC_CRC_CALCULATION."] + pub fn timerCalculateTimer(time: u16) -> u32; +} +extern "C" { + #[doc = " \\brief Checks if a Timer is Expired"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary functions @ref LL_SPI_EnableCRC() and @ref LL_SPI_DisableCRC()."] - pub CRCCalculation: u32, - #[doc = "< Specifies the polynomial used for the CRC calculation."] - #[doc = "This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF."] + #[doc = " This method checks if a timer has already expired."] + #[doc = " Based on the given timer previously calculated it checks if this timer"] + #[doc = " has already elapsed"] #[doc = ""] - #[doc = "This feature can be modified afterwards using unitary function @ref LL_SPI_SetCRCPolynomial()."] - pub CRCPoly: u32, + #[doc = " \\see timersCalculateTimer"] + #[doc = ""] + #[doc = " \\param[in] timer : the timer to check"] + #[doc = ""] + #[doc = " \\return true : timer has already expired"] + #[doc = " \\return false : timer is still running"] + #[doc = ""] + pub fn timerIsExpired(timer: u32) -> bool; +} +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" { + #[doc = " \\brief RFAL Turn Field On and Start GT"] + #[doc = ""] + #[doc = " Turns the Field On, performing Initial Collision Avoidance"] + #[doc = ""] + #[doc = " After Field On, if GT was set before, it starts the GT timer to be"] + #[doc = " used on the following communications."] + #[doc = ""] + #[doc = " \\return ERR_RF_COLLISION : External field detected"] + #[doc = " \\return ERR_NONE : Field turned On"] + #[doc = ""] + #[doc = ""] + pub fn rfalFieldOnAndStartGT() -> ReturnCode; +} +extern "C" { + #[doc = " \\brief RFAL Worker"] + #[doc = ""] + #[doc = " This runs RFAL layer, which drives the actual Transceive procedure"] + #[doc = " It MUST be executed frequently in order to execute the RFAL internal"] + #[doc = " states and perform the requested operations"] + #[doc = ""] + #[doc = ""] + pub fn rfalWorker(); +} +extern "C" { + #[doc = " \\brief Low Power Mode Start"] + #[doc = ""] + #[doc = " Sets the RF Chip in Low Power Mode."] + #[doc = " In this mode the RF Chip is placed in Low Power Mode, similar to Wake-up"] + #[doc = " mode but no operation nor period measurement is performed."] + #[doc = " Mode must be terminated by rfalLowPowerModeStop()"] + #[doc = ""] + #[doc = " \\return ERR_WRONG_STATE : Not initialized properly"] + #[doc = " \\return ERR_PARAM : Invalid parameter"] + #[doc = " \\return ERR_NONE : Done with no error"] + #[doc = ""] + #[doc = ""] + pub fn rfalLowPowerModeStart() -> ReturnCode; +} +extern "C" { + #[doc = " \\brief Low Power Mode Stop"] + #[doc = ""] + #[doc = " Stops the Low Power Mode re-enabling the device"] + #[doc = ""] + #[doc = " \\return ERR_WRONG_STATE : Not initialized properly"] + #[doc = " \\return ERR_PARAM : Invalid parameter"] + #[doc = " \\return ERR_NONE : Done with no error"] + #[doc = ""] + #[doc = ""] + pub fn rfalLowPowerModeStop() -> ReturnCode; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct DigitalSignal { + pub start_level: bool, + pub edge_cnt: u32, + pub edges_max_cnt: u32, + pub edge_timings: *mut u32, + pub reload_reg_buff: *mut u32, } #[test] -fn bindgen_test_layout_LL_SPI_InitTypeDef() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_DigitalSignal() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(LL_SPI_InitTypeDef)) + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(DigitalSignal)) ); assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(LL_SPI_InitTypeDef)) + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(DigitalSignal)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).TransferDirection) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).start_level) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(DigitalSignal), "::", - stringify!(TransferDirection) + stringify!(start_level) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).Mode) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).edge_cnt) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(DigitalSignal), "::", - stringify!(Mode) + stringify!(edge_cnt) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).DataWidth) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).edges_max_cnt) 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!(DigitalSignal), "::", - stringify!(ClockPolarity) + stringify!(edges_max_cnt) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ClockPhase) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).edge_timings) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(DigitalSignal), "::", - stringify!(ClockPhase) + stringify!(edge_timings) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).NSS) as usize - ptr as usize }, - 20usize, + unsafe { ::core::ptr::addr_of!((*ptr).reload_reg_buff) as usize - ptr as usize }, + 24usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(DigitalSignal), "::", - stringify!(NSS) + stringify!(reload_reg_buff) ) ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct NfcaSignal { + pub one: *mut DigitalSignal, + pub zero: *mut DigitalSignal, + pub tx_signal: *mut DigitalSignal, +} +#[test] +fn bindgen_test_layout_NfcaSignal() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).BaudRate) as usize - ptr as usize }, + ::core::mem::size_of::(), 24usize, - concat!( - "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), - "::", - stringify!(BaudRate) - ) + concat!("Size of: ", stringify!(NfcaSignal)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).BitOrder) as usize - ptr as usize }, - 28usize, + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(NfcaSignal)) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).one) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(NfcaSignal), "::", - stringify!(BitOrder) + stringify!(one) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).CRCCalculation) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).zero) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(NfcaSignal), "::", - stringify!(CRCCalculation) + stringify!(zero) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).CRCPoly) as usize - ptr as usize }, - 36usize, + unsafe { ::core::ptr::addr_of!((*ptr).tx_signal) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(LL_SPI_InitTypeDef), + stringify!(NfcaSignal), "::", - stringify!(CRCPoly) + stringify!(tx_signal) ) ); } -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, +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeDefault: FuriHalNfcTxRxType = 0; +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxNoCrc: FuriHalNfcTxRxType = 1; +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxKeepPar: FuriHalNfcTxRxType = 2; +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRaw: FuriHalNfcTxRxType = 3; +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxRaw: FuriHalNfcTxRxType = 4; +pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTransparent: FuriHalNfcTxRxType = 5; +pub type FuriHalNfcTxRxType = core::ffi::c_uchar; +pub type FuriHalNfcEmulateCallback = ::core::option::Option< + unsafe extern "C" fn( + buff_rx: *mut u8, + buff_rx_len: u16, + buff_tx: *mut u8, + buff_tx_len: *mut u16, + flags: *mut u32, + context: *mut core::ffi::c_void, + ) -> bool, +>; +pub const FuriHalNfcType_FuriHalNfcTypeA: FuriHalNfcType = 0; +pub const FuriHalNfcType_FuriHalNfcTypeB: FuriHalNfcType = 1; +pub const FuriHalNfcType_FuriHalNfcTypeF: FuriHalNfcType = 2; +pub const FuriHalNfcType_FuriHalNfcTypeV: FuriHalNfcType = 3; +pub type FuriHalNfcType = core::ffi::c_uchar; +pub const FuriHalNfcInterface_FuriHalNfcInterfaceRf: FuriHalNfcInterface = 0; +pub const FuriHalNfcInterface_FuriHalNfcInterfaceIsoDep: FuriHalNfcInterface = 1; +pub const FuriHalNfcInterface_FuriHalNfcInterfaceNfcDep: FuriHalNfcInterface = 2; +pub type FuriHalNfcInterface = core::ffi::c_uchar; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct FuriHalNfcDevData { + pub type_: FuriHalNfcType, + pub interface: FuriHalNfcInterface, + pub uid_len: u8, + pub uid: [u8; 10usize], + pub cuid: u32, + pub atqa: [u8; 2usize], + pub sak: u8, } #[test] -fn bindgen_test_layout_FuriHalSpiBus() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_FuriHalNfcDevData() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), + ::core::mem::size_of::(), 24usize, - concat!("Size of: ", stringify!(FuriHalSpiBus)) + concat!("Size of: ", stringify!(FuriHalNfcDevData)) ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(FuriHalSpiBus)) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(FuriHalNfcDevData)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).spi) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBus), + stringify!(FuriHalNfcDevData), "::", - stringify!(spi) + stringify!(type_) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).interface) as usize - ptr as usize }, + 1usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBus), + stringify!(FuriHalNfcDevData), "::", - stringify!(callback) + stringify!(interface) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).current_handle) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).uid_len) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcDevData), + "::", + stringify!(uid_len) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize }, + 3usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcDevData), + "::", + stringify!(uid) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).cuid) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBus), + stringify!(FuriHalNfcDevData), "::", - stringify!(current_handle) + stringify!(cuid) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).atqa) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcDevData), + "::", + stringify!(atqa) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).sak) as usize - ptr as usize }, + 22usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcDevData), + "::", + stringify!(sak) ) ); } -#[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), +pub type FuriHalNfcTxRxSniffCallback = ::core::option::Option< + unsafe extern "C" fn( + data: *mut u8, + bits: u16, + crc_dropped: bool, + context: *mut core::ffi::c_void, + ), >; -#[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, +pub struct FuriHalNfcTxRxContext { + pub tx_data: [u8; 512usize], + pub tx_parity: [u8; 64usize], + pub tx_bits: u16, + pub rx_data: [u8; 512usize], + pub rx_parity: [u8; 64usize], + pub rx_bits: u16, + pub tx_rx_type: FuriHalNfcTxRxType, + pub nfca_signal: *mut NfcaSignal, + pub sniff_tx: FuriHalNfcTxRxSniffCallback, + pub sniff_rx: FuriHalNfcTxRxSniffCallback, + pub sniff_context: *mut core::ffi::c_void, } #[test] -fn bindgen_test_layout_FuriHalSpiBusHandle() { - const UNINIT: ::core::mem::MaybeUninit = +fn bindgen_test_layout_FuriHalNfcTxRxContext() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(FuriHalSpiBusHandle)) + ::core::mem::size_of::(), + 1192usize, + concat!("Size of: ", stringify!(FuriHalNfcTxRxContext)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(FuriHalSpiBusHandle)) + concat!("Alignment of ", stringify!(FuriHalNfcTxRxContext)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bus) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).tx_data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(bus) + stringify!(tx_data) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).tx_parity) as usize - ptr as usize }, + 512usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(callback) + stringify!(tx_parity) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).miso) as usize - ptr as usize }, - 16usize, + unsafe { ::core::ptr::addr_of!((*ptr).tx_bits) as usize - ptr as usize }, + 576usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(miso) + stringify!(tx_bits) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).mosi) as usize - ptr as usize }, - 24usize, + unsafe { ::core::ptr::addr_of!((*ptr).rx_data) as usize - ptr as usize }, + 578usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(mosi) + stringify!(rx_data) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sck) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).rx_parity) as usize - ptr as usize }, + 1090usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(sck) + stringify!(rx_parity) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).cs) as usize - ptr as usize }, - 40usize, + unsafe { ::core::ptr::addr_of!((*ptr).rx_bits) as usize - ptr as usize }, + 1154usize, concat!( "Offset of field: ", - stringify!(FuriHalSpiBusHandle), + stringify!(FuriHalNfcTxRxContext), "::", - stringify!(cs) + stringify!(rx_bits) ) ); -} -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`"] - #[doc = " Preset: `furi_hal_spi_preset_1edge_low_2m`"] - #[doc = ""] - #[doc = " miso: pa6"] - #[doc = " mosi: pa7"] - #[doc = " sck: pb3"] - #[doc = " cs: pa4 (software controlled)"] - #[doc = ""] - #[doc = " @warning not initialized by default, call `furi_hal_spi_bus_handle_init` to initialize"] - #[doc = " Bus pins are floating on inactive state, CS high after initialization"] - #[doc = ""] - 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; -} -pub const CC1101State_CC1101StateIDLE: CC1101State = 0; -#[doc = " IDLE state"] -pub const CC1101State_CC1101StateRX: CC1101State = 1; -#[doc = " Receive mode"] -pub const CC1101State_CC1101StateTX: CC1101State = 2; -#[doc = " Transmit mode"] -pub const CC1101State_CC1101StateFSTXON: CC1101State = 3; -#[doc = " Fast TX ready"] -pub const CC1101State_CC1101StateCALIBRATE: CC1101State = 4; -#[doc = " Frequency synthesizer calibration is running"] -pub const CC1101State_CC1101StateSETTLING: CC1101State = 5; -#[doc = " PLL is settling"] -pub const CC1101State_CC1101StateRXFIFO_OVERFLOW: CC1101State = 6; -#[doc = " RX FIFO has overflowed. Read out any useful data, then flush the FIFO with SFRX"] -pub const CC1101State_CC1101StateTXFIFO_UNDERFLOW: CC1101State = 7; -pub type CC1101State = core::ffi::c_uchar; -#[repr(C, packed)] -#[derive(Debug, Copy, Clone)] -pub struct CC1101Status { - pub _bitfield_align_1: [u8; 0], - pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, -} -#[test] -fn bindgen_test_layout_CC1101Status() { assert_eq!( - ::core::mem::size_of::(), - 1usize, - concat!("Size of: ", stringify!(CC1101Status)) + unsafe { ::core::ptr::addr_of!((*ptr).tx_rx_type) as usize - ptr as usize }, + 1156usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcTxRxContext), + "::", + stringify!(tx_rx_type) + ) ); assert_eq!( - ::core::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(CC1101Status)) + unsafe { ::core::ptr::addr_of!((*ptr).nfca_signal) as usize - ptr as usize }, + 1160usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcTxRxContext), + "::", + stringify!(nfca_signal) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).sniff_tx) as usize - ptr as usize }, + 1168usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcTxRxContext), + "::", + stringify!(sniff_tx) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).sniff_rx) as usize - ptr as usize }, + 1176usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcTxRxContext), + "::", + stringify!(sniff_rx) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).sniff_context) as usize - ptr as usize }, + 1184usize, + concat!( + "Offset of field: ", + stringify!(FuriHalNfcTxRxContext), + "::", + stringify!(sniff_context) + ) ); -} -impl CC1101Status { - #[inline] - pub fn FIFO_BYTES_AVAILABLE(&self) -> u8 { - unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } - } - #[inline] - pub fn set_FIFO_BYTES_AVAILABLE(&mut self, val: u8) { - unsafe { - let val: u8 = ::core::mem::transmute(val); - self._bitfield_1.set(0usize, 4u8, val as u64) - } - } - #[inline] - pub fn STATE(&self) -> CC1101State { - unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 3u8) as u8) } - } - #[inline] - pub fn set_STATE(&mut self, val: CC1101State) { - unsafe { - let val: u8 = ::core::mem::transmute(val); - self._bitfield_1.set(4usize, 3u8, val as u64) - } - } - #[inline] - pub fn CHIP_RDYn(&self) -> bool { - unsafe { ::core::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) } - } - #[inline] - pub fn set_CHIP_RDYn(&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( - FIFO_BYTES_AVAILABLE: u8, - STATE: CC1101State, - CHIP_RDYn: bool, - ) -> __BindgenBitfieldUnit<[u8; 1usize]> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); - __bindgen_bitfield_unit.set(0usize, 4u8, { - let FIFO_BYTES_AVAILABLE: u8 = unsafe { ::core::mem::transmute(FIFO_BYTES_AVAILABLE) }; - FIFO_BYTES_AVAILABLE as u64 - }); - __bindgen_bitfield_unit.set(4usize, 3u8, { - let STATE: u8 = unsafe { ::core::mem::transmute(STATE) }; - STATE as u64 - }); - __bindgen_bitfield_unit.set(7usize, 1u8, { - let CHIP_RDYn: u8 = unsafe { ::core::mem::transmute(CHIP_RDYn) }; - CHIP_RDYn as u64 - }); - __bindgen_bitfield_unit - } } extern "C" { - #[doc = " Early initialize SPI HAL"] - pub fn furi_hal_spi_init_early(); + #[doc = " Check if nfc worker is busy"] + #[doc = ""] + #[doc = " @return true if busy"] + pub fn furi_hal_nfc_is_busy() -> bool; } extern "C" { - #[doc = " Early deinitialize SPI HAL"] - pub fn furi_hal_spi_deinit_early(); + #[doc = " Check if nfc is initialized"] + #[doc = ""] + #[doc = " @return true if initialized"] + pub fn furi_hal_nfc_is_init() -> bool; } extern "C" { - #[doc = " Initialize SPI Bus"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBus instance"] - pub fn furi_hal_spi_bus_init(bus: *mut FuriHalSpiBus); + #[doc = " NFC field on"] + pub fn furi_hal_nfc_field_on(); } extern "C" { - #[doc = " Deinitialize SPI Bus"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBus instance"] - pub fn furi_hal_spi_bus_deinit(bus: *mut FuriHalSpiBus); + #[doc = " NFC field off"] + pub fn furi_hal_nfc_field_off(); } extern "C" { - #[doc = " Initialize SPI Bus Handle"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - pub fn furi_hal_spi_bus_handle_init(handle: *mut FuriHalSpiBusHandle); + #[doc = " NFC start sleep"] + pub fn furi_hal_nfc_start_sleep(); } extern "C" { - #[doc = " Deinitialize SPI Bus Handle"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - pub fn furi_hal_spi_bus_handle_deinit(handle: *mut FuriHalSpiBusHandle); + pub fn furi_hal_nfc_stop_cmd(); } extern "C" { - #[doc = " Acquire SPI bus"] - #[doc = ""] - #[doc = " @warning blocking, calls `furi_crash` on programming error, CS transition is up to handler event routine"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - pub fn furi_hal_spi_acquire(handle: *mut FuriHalSpiBusHandle); + #[doc = " NFC stop sleep"] + pub fn furi_hal_nfc_exit_sleep(); } extern "C" { - #[doc = " Release SPI bus"] + #[doc = " NFC poll"] #[doc = ""] - #[doc = " @warning calls `furi_crash` on programming error, CS transition is up to handler event routine"] + #[doc = " @param dev_list pointer to rfalNfcDevice buffer"] + #[doc = " @param dev_cnt pointer device count"] + #[doc = " @param timeout timeout in ms"] + #[doc = " @param deactivate deactivate flag"] #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - pub fn furi_hal_spi_release(handle: *mut FuriHalSpiBusHandle); + #[doc = " @return true on success"] + pub fn furi_hal_nfc_detect(nfc_data: *mut FuriHalNfcDevData, timeout: u32) -> bool; } extern "C" { - #[doc = " SPI Receive"] + #[doc = " Activate NFC-A tag"] #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - #[doc = " @param buffer receive buffer"] - #[doc = " @param size transaction size (buffer size)"] - #[doc = " @param timeout operation timeout in ms"] + #[doc = " @param timeout timeout in ms"] + #[doc = " @param cuid pointer to 32bit uid"] #[doc = ""] - #[doc = " @return true on sucess"] - pub fn furi_hal_spi_bus_rx( - handle: *mut FuriHalSpiBusHandle, - buffer: *mut u8, - size: usize, - timeout: u32, - ) -> bool; + #[doc = " @return true on succeess"] + pub fn furi_hal_nfc_activate_nfca(timeout: u32, cuid: *mut u32) -> bool; } extern "C" { - #[doc = " SPI Transmit"] + #[doc = " NFC listen"] #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - #[doc = " @param buffer transmit buffer"] - #[doc = " @param size transaction size (buffer size)"] - #[doc = " @param timeout operation timeout in ms"] + #[doc = " @param uid pointer to uid buffer"] + #[doc = " @param uid_len uid length"] + #[doc = " @param atqa pointer to atqa"] + #[doc = " @param sak sak"] + #[doc = " @param activate_after_sak activate after sak flag"] + #[doc = " @param timeout timeout in ms"] #[doc = ""] #[doc = " @return true on success"] - pub fn furi_hal_spi_bus_tx( - handle: *mut FuriHalSpiBusHandle, - buffer: *mut u8, - size: usize, + pub fn furi_hal_nfc_listen( + uid: *mut u8, + uid_len: u8, + atqa: *mut u8, + sak: u8, + activate_after_sak: bool, timeout: u32, ) -> bool; } extern "C" { - #[doc = " SPI Transmit and Receive"] + #[doc = " Start Target Listen mode"] + #[doc = " @note RFAL free implementation"] #[doc = ""] - #[doc = " @param handle pointer to FuriHalSpiBusHandle instance"] - #[doc = " @param tx_buffer pointer to tx buffer"] - #[doc = " @param rx_buffer pointer to rx buffer"] - #[doc = " @param size transaction size (buffer size)"] - #[doc = " @param timeout operation timeout in ms"] + #[doc = " @param nfc_data FuriHalNfcDevData instance"] + pub fn furi_hal_nfc_listen_start(nfc_data: *mut FuriHalNfcDevData); +} +extern "C" { + #[doc = " Read data in Target Listen mode"] + #[doc = " @note Must be called only after furi_hal_nfc_listen_start()"] #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_spi_bus_trx( - handle: *mut FuriHalSpiBusHandle, - tx_buffer: *mut u8, - rx_buffer: *mut u8, - size: usize, - timeout: u32, - ) -> bool; -} -extern "C" { - #[doc = " Strobe command to the device"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param strobe - command to execute"] + #[doc = " @param tx_rx FuriHalNfcTxRxContext instance"] + #[doc = " @param timeout_ms timeout im ms"] #[doc = ""] - #[doc = " @return device status"] - pub fn cc1101_strobe(handle: *mut FuriHalSpiBusHandle, strobe: u8) -> CC1101Status; + #[doc = " @return true on not empty receive"] + pub fn furi_hal_nfc_listen_rx(tx_rx: *mut FuriHalNfcTxRxContext, timeout_ms: u32) -> bool; } extern "C" { - #[doc = " Write device register"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param reg - register"] - #[doc = " @param data - data to write"] - #[doc = ""] - #[doc = " @return device status"] - pub fn cc1101_write_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, data: u8) -> CC1101Status; + #[doc = " Set Target in Sleep state"] + pub fn furi_hal_nfc_listen_sleep(); } extern "C" { - #[doc = " Read device register"] + #[doc = " Emulate NFC-A Target"] + #[doc = " @note RFAL based implementation"] #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param reg - register"] - #[doc = " @param[out] data - pointer to data"] + #[doc = " @param uid NFC-A UID"] + #[doc = " @param uid_len NFC-A UID length"] + #[doc = " @param atqa NFC-A ATQA"] + #[doc = " @param sak NFC-A SAK"] + #[doc = " @param callback FuriHalNfcEmulateCallback instance"] + #[doc = " @param context pointer to context for callback"] + #[doc = " @param timeout timeout in ms"] #[doc = ""] - #[doc = " @return device status"] - pub fn cc1101_read_reg( - handle: *mut FuriHalSpiBusHandle, - reg: u8, - data: *mut u8, - ) -> CC1101Status; + #[doc = " @return true on success"] + pub fn furi_hal_nfc_emulate_nfca( + uid: *mut u8, + uid_len: u8, + atqa: *mut u8, + sak: u8, + callback: FuriHalNfcEmulateCallback, + context: *mut core::ffi::c_void, + timeout: u32, + ) -> bool; } extern "C" { - #[doc = " Reset"] + #[doc = " NFC data exchange"] #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_reset(handle: *mut FuriHalSpiBusHandle); + #[doc = " @param tx_rx_ctx FuriHalNfcTxRxContext instance"] + #[doc = ""] + #[doc = " @return true on success"] + pub fn furi_hal_nfc_tx_rx(tx_rx: *mut FuriHalNfcTxRxContext, timeout_ms: u16) -> bool; } extern "C" { - #[doc = " Get status"] + #[doc = " NFC data full exhange"] #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param tx_rx_ctx FuriHalNfcTxRxContext instance"] #[doc = ""] - #[doc = " @return CC1101Status structure"] - pub fn cc1101_get_status(handle: *mut FuriHalSpiBusHandle) -> CC1101Status; + #[doc = " @return true on success"] + pub fn furi_hal_nfc_tx_rx_full(tx_rx: *mut FuriHalNfcTxRxContext) -> bool; } extern "C" { - #[doc = " Enable shutdown mode"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_shutdown(handle: *mut FuriHalSpiBusHandle); + #[doc = " NFC deactivate and start sleep"] + pub fn furi_hal_nfc_sleep(); } extern "C" { - #[doc = " Get raw RSSI value"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = ""] - #[doc = " @return rssi value"] - pub fn cc1101_get_rssi(handle: *mut FuriHalSpiBusHandle) -> u8; + pub fn furi_hal_nfc_stop(); } +#[doc = "< no error occurred"] +pub const FuriHalNfcReturn_FuriHalNfcReturnOk: FuriHalNfcReturn = 0; +#[doc = "< not enough memory to perform the requested operation"] +pub const FuriHalNfcReturn_FuriHalNfcReturnNomem: FuriHalNfcReturn = 1; +#[doc = "< device or resource busy"] +pub const FuriHalNfcReturn_FuriHalNfcReturnBusy: FuriHalNfcReturn = 2; +#[doc = "< generic IO error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIo: FuriHalNfcReturn = 3; +#[doc = "< error due to timeout"] +pub const FuriHalNfcReturn_FuriHalNfcReturnTimeout: FuriHalNfcReturn = 4; +pub const FuriHalNfcReturn_FuriHalNfcReturnRequest: FuriHalNfcReturn = 5; +#[doc = "< No message of desired type"] +pub const FuriHalNfcReturn_FuriHalNfcReturnNomsg: FuriHalNfcReturn = 6; +#[doc = "< Parameter error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnParam: FuriHalNfcReturn = 7; +#[doc = "< System error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnSystem: FuriHalNfcReturn = 8; +#[doc = "< Framing error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnFraming: FuriHalNfcReturn = 9; +#[doc = "< lost one or more received bytes"] +pub const FuriHalNfcReturn_FuriHalNfcReturnOverrun: FuriHalNfcReturn = 10; +#[doc = "< protocol error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnProto: FuriHalNfcReturn = 11; +#[doc = "< Internal Error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnInternal: FuriHalNfcReturn = 12; +#[doc = "< Call again"] +pub const FuriHalNfcReturn_FuriHalNfcReturnAgain: FuriHalNfcReturn = 13; +#[doc = "< memory corruption"] +pub const FuriHalNfcReturn_FuriHalNfcReturnMemCorrupt: FuriHalNfcReturn = 14; +#[doc = "< not implemented"] +pub const FuriHalNfcReturn_FuriHalNfcReturnNotImplemented: FuriHalNfcReturn = 15; +pub const FuriHalNfcReturn_FuriHalNfcReturnPcCorrupt: FuriHalNfcReturn = 16; +#[doc = "< error sending"] +pub const FuriHalNfcReturn_FuriHalNfcReturnSend: FuriHalNfcReturn = 17; +#[doc = "< indicates error detected but to be ignored"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIgnore: FuriHalNfcReturn = 18; +#[doc = "< indicates error in state machine (unexpected cmd)"] +pub const FuriHalNfcReturn_FuriHalNfcReturnSemantic: FuriHalNfcReturn = 19; +#[doc = "< indicates error in state machine (unknown cmd)"] +pub const FuriHalNfcReturn_FuriHalNfcReturnSyntax: FuriHalNfcReturn = 20; +#[doc = "< crc error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnCrc: FuriHalNfcReturn = 21; +#[doc = "< transponder not found"] +pub const FuriHalNfcReturn_FuriHalNfcReturnNotfound: FuriHalNfcReturn = 22; +pub const FuriHalNfcReturn_FuriHalNfcReturnNotunique: FuriHalNfcReturn = 23; +#[doc = "< requested operation not supported"] +pub const FuriHalNfcReturn_FuriHalNfcReturnNotsupp: FuriHalNfcReturn = 24; +#[doc = "< write error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnWrite: FuriHalNfcReturn = 25; +#[doc = "< fifo over or underflow error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnFifo: FuriHalNfcReturn = 26; +#[doc = "< parity error"] +pub const FuriHalNfcReturn_FuriHalNfcReturnPar: FuriHalNfcReturn = 27; +#[doc = "< transfer has already finished"] +pub const FuriHalNfcReturn_FuriHalNfcReturnDone: FuriHalNfcReturn = 28; +pub const FuriHalNfcReturn_FuriHalNfcReturnRfCollision: FuriHalNfcReturn = 29; +#[doc = "< lost one or more received bytes"] +pub const FuriHalNfcReturn_FuriHalNfcReturnHwOverrun: FuriHalNfcReturn = 30; +#[doc = "< device requested release"] +pub const FuriHalNfcReturn_FuriHalNfcReturnReleaseReq: FuriHalNfcReturn = 31; +#[doc = "< device requested sleep"] +pub const FuriHalNfcReturn_FuriHalNfcReturnSleepReq: FuriHalNfcReturn = 32; +#[doc = "< incorrent state for requested operation"] +pub const FuriHalNfcReturn_FuriHalNfcReturnWrongState: FuriHalNfcReturn = 33; +#[doc = "< blocking procedure reached maximum runs"] +pub const FuriHalNfcReturn_FuriHalNfcReturnMaxReruns: FuriHalNfcReturn = 34; +#[doc = "< operation aborted due to disabled configuration"] +pub const FuriHalNfcReturn_FuriHalNfcReturnDisabled: FuriHalNfcReturn = 35; +#[doc = "< expected hw do not match"] +pub const FuriHalNfcReturn_FuriHalNfcReturnHwMismatch: FuriHalNfcReturn = 36; +pub const FuriHalNfcReturn_FuriHalNfcReturnLinkLoss: FuriHalNfcReturn = 37; +#[doc = "< invalid or not initalized device handle"] +pub const FuriHalNfcReturn_FuriHalNfcReturnInvalidHandle: FuriHalNfcReturn = 38; +#[doc = "< Incomplete byte rcvd"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte: FuriHalNfcReturn = 40; +#[doc = "< Incomplete byte rcvd - 1 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte01: FuriHalNfcReturn = 41; +#[doc = "< Incomplete byte rcvd - 2 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte02: FuriHalNfcReturn = 42; +#[doc = "< Incomplete byte rcvd - 3 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte03: FuriHalNfcReturn = 43; +#[doc = "< Incomplete byte rcvd - 4 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte04: FuriHalNfcReturn = 44; +#[doc = "< Incomplete byte rcvd - 5 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte05: FuriHalNfcReturn = 45; +#[doc = "< Incomplete byte rcvd - 6 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte06: FuriHalNfcReturn = 46; +#[doc = "< Incomplete byte rcvd - 7 bit"] +pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte07: FuriHalNfcReturn = 47; +pub type FuriHalNfcReturn = core::ffi::c_uchar; +#[doc = "< No mode selected/defined"] +pub const FuriHalNfcMode_FuriHalNfcModeNone: FuriHalNfcMode = 0; +#[doc = "< Mode to perform as NFCA (ISO14443A) Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollNfca: FuriHalNfcMode = 1; +#[doc = "< Mode to perform as NFCA T1T (Topaz) Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollNfcaT1t: FuriHalNfcMode = 2; +#[doc = "< Mode to perform as NFCB (ISO14443B) Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollNfcb: FuriHalNfcMode = 3; +#[doc = "< Mode to perform as B' Calypso (Innovatron) (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollBPrime: FuriHalNfcMode = 4; +#[doc = "< Mode to perform as CTS Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollBCts: FuriHalNfcMode = 5; +#[doc = "< Mode to perform as NFCF (FeliCa) Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollNfcf: FuriHalNfcMode = 6; +#[doc = "< Mode to perform as NFCV (ISO15963) Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollNfcv: FuriHalNfcMode = 7; +#[doc = "< Mode to perform as PicoPass / iClass Poller (PCD)"] +pub const FuriHalNfcMode_FuriHalNfcModePollPicopass: FuriHalNfcMode = 8; +#[doc = "< Mode to perform as Active P2P (ISO18092) Initiator"] +pub const FuriHalNfcMode_FuriHalNfcModePollActiveP2p: FuriHalNfcMode = 9; +#[doc = "< Mode to perform as NFCA (ISO14443A) Listener (PICC)"] +pub const FuriHalNfcMode_FuriHalNfcModeListenNfca: FuriHalNfcMode = 10; +#[doc = "< Mode to perform as NFCA (ISO14443B) Listener (PICC)"] +pub const FuriHalNfcMode_FuriHalNfcModeListenNfcb: FuriHalNfcMode = 11; +#[doc = "< Mode to perform as NFCA (ISO15963) Listener (PICC)"] +pub const FuriHalNfcMode_FuriHalNfcModeListenNfcf: FuriHalNfcMode = 12; +#[doc = "< Mode to perform as Active P2P (ISO18092) Target"] +pub const FuriHalNfcMode_FuriHalNfcModeListenActiveP2p: FuriHalNfcMode = 13; +pub type FuriHalNfcMode = core::ffi::c_uchar; +#[doc = "< Bit Rate 106 kbit/s (fc/128)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate106: FuriHalNfcBitrate = 0; +#[doc = "< Bit Rate 212 kbit/s (fc/64)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate212: FuriHalNfcBitrate = 1; +#[doc = "< Bit Rate 424 kbit/s (fc/32)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate424: FuriHalNfcBitrate = 2; +#[doc = "< Bit Rate 848 kbit/s (fc/16)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate848: FuriHalNfcBitrate = 3; +#[doc = "< Bit Rate 1695 kbit/s (fc/8)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate1695: FuriHalNfcBitrate = 4; +#[doc = "< Bit Rate 3390 kbit/s (fc/4)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate3390: FuriHalNfcBitrate = 5; +#[doc = "< Bit Rate 6780 kbit/s (fc/2)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate6780: FuriHalNfcBitrate = 6; +#[doc = "< Bit Rate 13560 kbit/s (fc)"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate13560: FuriHalNfcBitrate = 7; +#[doc = "< Bit Rate 52.97 kbit/s (fc/256) Fast Mode VICC->VCD"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate52p97: FuriHalNfcBitrate = 235; +pub const FuriHalNfcBitrate_FuriHalNfcBitrate26p48: FuriHalNfcBitrate = 236; +#[doc = "< Bit Rate 1,66 kbit/s (fc/8192) NFCV VCD->VICC 1of256"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrate1p66: FuriHalNfcBitrate = 237; +#[doc = "< Value indicating to keep the same previous bit rate"] +pub const FuriHalNfcBitrate_FuriHalNfcBitrateKeep: FuriHalNfcBitrate = 255; +pub type FuriHalNfcBitrate = core::ffi::c_uchar; extern "C" { - #[doc = " Calibrate oscillator"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_calibrate(handle: *mut FuriHalSpiBusHandle); + pub fn furi_hal_nfc_ll_set_mode( + mode: FuriHalNfcMode, + txBR: FuriHalNfcBitrate, + rxBR: FuriHalNfcBitrate, + ) -> FuriHalNfcReturn; } extern "C" { - #[doc = " Switch to idle"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_switch_to_idle(handle: *mut FuriHalSpiBusHandle); + pub fn furi_hal_nfc_ll_set_guard_time(cycles: u32); } +#[doc = "< No special error handling will be performed"] +pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingNone: FuriHalNfcErrorHandling = 0; +#[doc = "< Error handling set to perform as NFC compliant device"] +pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingNfc: FuriHalNfcErrorHandling = 1; +pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingEmvco: FuriHalNfcErrorHandling = 2; +pub type FuriHalNfcErrorHandling = core::ffi::c_uchar; extern "C" { - #[doc = " Switch to RX"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_switch_to_rx(handle: *mut FuriHalSpiBusHandle); + pub fn furi_hal_nfc_ll_set_error_handling(eHandling: FuriHalNfcErrorHandling); } extern "C" { - #[doc = " Switch to TX"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_switch_to_tx(handle: *mut FuriHalSpiBusHandle); -} -extern "C" { - #[doc = " Flush RX FIFO"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_flush_rx(handle: *mut FuriHalSpiBusHandle); -} -extern "C" { - #[doc = " Flush TX FIFO"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - pub fn cc1101_flush_tx(handle: *mut FuriHalSpiBusHandle); -} -extern "C" { - #[doc = " Set Frequency"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param value - frequency in herz"] - #[doc = ""] - #[doc = " @return real frequency that were synthesized"] - pub fn cc1101_set_frequency(handle: *mut FuriHalSpiBusHandle, value: u32) -> u32; -} -extern "C" { - #[doc = " Set Power Amplifier level table, ramp"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param value - array of power level values"] - pub fn cc1101_set_pa_table(handle: *mut FuriHalSpiBusHandle, value: *const u8); -} -extern "C" { - #[doc = " Write FIFO"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param data pointer to byte array"] - #[doc = " @param size write bytes count"] - #[doc = ""] - #[doc = " @return size, written bytes count"] - pub fn cc1101_write_fifo(handle: *mut FuriHalSpiBusHandle, data: *const u8, size: u8) -> u8; -} -extern "C" { - #[doc = " Read FIFO"] - #[doc = ""] - #[doc = " @param handle - pointer to FuriHalSpiHandle"] - #[doc = " @param data pointer to byte array"] - #[doc = " @param size bytes to read from fifo"] - #[doc = ""] - #[doc = " @return size, read bytes count"] - pub fn cc1101_read_fifo(handle: *mut FuriHalSpiBusHandle, data: *mut u8, size: *mut u8) -> u8; -} -pub const FuriHalUartId_FuriHalUartIdUSART1: FuriHalUartId = 0; -pub const FuriHalUartId_FuriHalUartIdLPUART1: FuriHalUartId = 1; -#[doc = " UART channels"] -pub type FuriHalUartId = core::ffi::c_uchar; -pub const UartIrqEvent_UartIrqEventRXNE: UartIrqEvent = 0; -#[doc = " UART events"] -pub type UartIrqEvent = core::ffi::c_uchar; -extern "C" { - #[doc = " Init UART"] - #[doc = " Configures GPIO to UART function, сonfigures UART hardware, enables UART hardware"] - #[doc = " @param channel UART channel"] - #[doc = " @param baud baudrate"] - pub fn furi_hal_uart_init(channel: FuriHalUartId, baud: u32); + pub fn furi_hal_nfc_ll_set_fdt_listen(cycles: u32); } extern "C" { - #[doc = " Deinit UART"] - #[doc = " Configures GPIO to analog, clears callback and callback context, disables UART hardware"] - #[doc = " @param channel UART channel"] - pub fn furi_hal_uart_deinit(channel: FuriHalUartId); + pub fn furi_hal_nfc_ll_set_fdt_poll(FDTPoll: u32); } extern "C" { - #[doc = " Suspend UART operation"] - #[doc = " Disables UART hardware, settings and callbacks are preserved"] - #[doc = " @param channel UART channel"] - pub fn furi_hal_uart_suspend(channel: FuriHalUartId); + pub fn furi_hal_nfc_ll_txrx_on(); } extern "C" { - #[doc = " Resume UART operation"] - #[doc = " Resumes UART hardware from suspended state"] - #[doc = " @param channel UART channel"] - pub fn furi_hal_uart_resume(channel: FuriHalUartId); + pub fn furi_hal_nfc_ll_txrx_off(); } extern "C" { - #[doc = " Changes UART baudrate"] - #[doc = " @param channel UART channel"] - #[doc = " @param baud baudrate"] - pub fn furi_hal_uart_set_br(channel: FuriHalUartId, baud: u32); + pub fn furi_hal_nfc_ll_txrx( + txBuf: *mut u8, + txBufLen: u16, + rxBuf: *mut u8, + rxBufLen: u16, + actLen: *mut u16, + flags: u32, + fwt: u32, + ) -> FuriHalNfcReturn; } extern "C" { - #[doc = " Transmits data"] - #[doc = " @param channel UART channel"] - #[doc = " @param buffer data"] - #[doc = " @param buffer_size data size (in bytes)"] - pub fn furi_hal_uart_tx(channel: FuriHalUartId, buffer: *mut u8, buffer_size: usize); + pub fn furi_hal_nfc_ll_txrx_bits( + txBuf: *mut u8, + txBufLen: u16, + rxBuf: *mut u8, + rxBufLen: u16, + actLen: *mut u16, + flags: u32, + fwt: u32, + ) -> FuriHalNfcReturn; } extern "C" { - #[doc = " Sets UART event callback"] - #[doc = " @param channel UART channel"] - #[doc = " @param callback callback pointer"] - #[doc = " @param context callback context"] - pub fn furi_hal_uart_set_irq_cb( - channel: FuriHalUartId, - callback: ::core::option::Option< - unsafe extern "C" fn(event: UartIrqEvent, data: u8, context: *mut core::ffi::c_void), - >, - context: *mut core::ffi::c_void, - ); + pub fn furi_hal_nfc_ll_poll(); } -#[doc = "\\brief Line Coding Structure"] -#[repr(C, packed)] -#[derive(Debug, Copy, Clone)] -pub struct usb_cdc_line_coding { - #[doc = "<\\brief Data terminal rate, in bits per second."] - pub dwDTERate: u32, - #[doc = "<\\brief Stop bits."] - pub bCharFormat: u8, - #[doc = "<\\brief Parity."] - pub bParityType: u8, - #[doc = "<\\brief Data bits (5,6,7,8 or 16)."] - pub bDataBits: u8, +#[doc = "<\\brief Function has an error, STALLPID will be issued."] +pub const _usbd_respond_usbd_fail: _usbd_respond = 0; +#[doc = "<\\brief Function completes request accepted ZLP or data will be send."] +pub const _usbd_respond_usbd_ack: _usbd_respond = 1; +#[doc = "<\\brief Function is busy. NAK handshake."] +pub const _usbd_respond_usbd_nak: _usbd_respond = 2; +#[doc = "\\brief Reporting status results."] +pub type _usbd_respond = core::ffi::c_uchar; +#[doc = "\\brief Reporting status results."] +pub use self::_usbd_respond as usbd_respond; +#[doc = "\\brief Represents a USB device data."] +pub type usbd_device = _usbd_device; +#[doc = "\\brief Represents generic USB control request."] +#[repr(C)] +#[derive(Debug)] +pub struct usbd_ctlreq { + #[doc = "<\\brief This bitmapped field identifies the characteristics of"] + #[doc = " the specific request."] + pub bmRequestType: u8, + #[doc = "<\\brief This field specifies the particular request."] + pub bRequest: u8, + #[doc = "<\\brief It is used to pass a parameter to the device, specific to"] + #[doc = " the request."] + pub wValue: u16, + #[doc = "<\\brief It is used to pass a parameter to the device, specific to"] + #[doc = " the request."] + pub wIndex: u16, + #[doc = "<\\brief This field specifies the length of the data transferred"] + #[doc = " during the second phase of the control transfer."] + pub wLength: u16, + #[doc = "<\\brief Data payload."] + pub data: __IncompleteArrayField, } #[test] -fn bindgen_test_layout_usb_cdc_line_coding() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_usbd_ctlreq() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 7usize, - concat!("Size of: ", stringify!(usb_cdc_line_coding)) + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(usbd_ctlreq)) ); assert_eq!( - ::core::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(usb_cdc_line_coding)) + ::core::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(usbd_ctlreq)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).dwDTERate) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).bmRequestType) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(usb_cdc_line_coding), + stringify!(usbd_ctlreq), "::", - stringify!(dwDTERate) + stringify!(bmRequestType) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bCharFormat) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).bRequest) as usize - ptr as usize }, + 1usize, concat!( "Offset of field: ", - stringify!(usb_cdc_line_coding), + stringify!(usbd_ctlreq), "::", - stringify!(bCharFormat) + stringify!(bRequest) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bParityType) as usize - ptr as usize }, - 5usize, + unsafe { ::core::ptr::addr_of!((*ptr).wValue) as usize - ptr as usize }, + 2usize, concat!( "Offset of field: ", - stringify!(usb_cdc_line_coding), + stringify!(usbd_ctlreq), "::", - stringify!(bParityType) + stringify!(wValue) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bDataBits) as usize - ptr as usize }, - 6usize, + unsafe { ::core::ptr::addr_of!((*ptr).wIndex) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(usb_cdc_line_coding), + stringify!(usbd_ctlreq), "::", - stringify!(bDataBits) + stringify!(wIndex) ) ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CdcCallbacks { - pub tx_ep_callback: - ::core::option::Option, - pub rx_ep_callback: - ::core::option::Option, - pub state_callback: - ::core::option::Option, - pub ctrl_line_callback: - ::core::option::Option, - 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 = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(CdcCallbacks)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(CdcCallbacks)) - ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_ep_callback) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).wLength) as usize - ptr as usize }, + 6usize, concat!( "Offset of field: ", - stringify!(CdcCallbacks), + stringify!(usbd_ctlreq), "::", - stringify!(tx_ep_callback) + stringify!(wLength) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).rx_ep_callback) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(CdcCallbacks), + stringify!(usbd_ctlreq), "::", - stringify!(rx_ep_callback) + stringify!(data) ) ); +} +#[doc = " USB device status data."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct usbd_status { + #[doc = "<\\brief Pointer to data buffer used for control requests."] + pub data_buf: *mut core::ffi::c_void, + #[doc = "<\\brief Pointer to current data for control request."] + pub data_ptr: *mut core::ffi::c_void, + #[doc = "<\\brief Count remained data for control request."] + pub data_count: u16, + #[doc = "<\\brief Size of the data buffer for control requests."] + pub data_maxsize: u16, + #[doc = "<\\brief Size of the control endpoint."] + pub ep0size: u8, + #[doc = "<\\brief Current device configuration number."] + pub device_cfg: u8, + #[doc = "<\\brief Current \\ref usbd_machine_state."] + pub device_state: u8, + #[doc = "<\\brief Current \\ref usbd_ctl_state."] + pub control_state: u8, +} +#[test] +fn bindgen_test_layout_usbd_status() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).state_callback) as usize - ptr as usize }, - 16usize, + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(usbd_status)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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!(CdcCallbacks), + stringify!(usbd_status), "::", - stringify!(state_callback) + stringify!(data_buf) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ctrl_line_callback) as usize - ptr as usize }, - 24usize, + unsafe { ::core::ptr::addr_of!((*ptr).data_ptr) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(CdcCallbacks), + stringify!(usbd_status), "::", - stringify!(ctrl_line_callback) + stringify!(data_ptr) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).data_count) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(CdcCallbacks), + stringify!(usbd_status), "::", - stringify!(config_callback) + stringify!(data_count) ) ); -} -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 __clear_cache(arg1: *mut core::ffi::c_void, arg2: *mut core::ffi::c_void); -} -#[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 = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(FuriHalCortexTimer)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(FuriHalCortexTimer)) - ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).data_maxsize) as usize - ptr as usize }, + 18usize, concat!( "Offset of field: ", - stringify!(FuriHalCortexTimer), + stringify!(usbd_status), "::", - stringify!(start) + stringify!(data_maxsize) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).ep0size) as usize - ptr as usize }, + 20usize, concat!( "Offset of field: ", - stringify!(FuriHalCortexTimer), + stringify!(usbd_status), "::", - stringify!(value) + stringify!(ep0size) ) ); -} -extern "C" { - #[doc = " Microseconds delay"] - #[doc = ""] - #[doc = " @param[in] microseconds The microseconds to wait"] - pub fn furi_hal_cortex_delay_us(microseconds: u32); -} -extern "C" { - #[doc = " Get instructions per microsecond count"] - #[doc = ""] - #[doc = " @return instructions per microsecond count"] - pub fn furi_hal_cortex_instructions_per_microsecond() -> u32; -} -extern "C" { - #[doc = " Get Timer"] - #[doc = ""] - #[doc = " @param[in] timeout_us The expire timeout in us"] - #[doc = ""] - #[doc = " @return The FuriHalCortexTimer"] - pub fn furi_hal_cortex_timer_get(timeout_us: u32) -> FuriHalCortexTimer; -} -extern "C" { - #[doc = " Check if timer expired"] - #[doc = ""] - #[doc = " @param[in] cortex_timer The FuriHalCortexTimer"] - #[doc = ""] - #[doc = " @return true if expired"] - pub fn furi_hal_cortex_timer_is_expired(cortex_timer: FuriHalCortexTimer) -> bool; -} -extern "C" { - #[doc = " Wait for timer expire"] - #[doc = ""] - #[doc = " @param[in] cortex_timer The FuriHalCortexTimer"] - pub fn furi_hal_cortex_timer_wait(cortex_timer: FuriHalCortexTimer); -} -#[doc = "< Master key"] -pub const FuriHalCryptoKeyType_FuriHalCryptoKeyTypeMaster: FuriHalCryptoKeyType = 0; -#[doc = "< Simple enencrypted 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 = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(FuriHalCryptoKey)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(FuriHalCryptoKey)) - ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).device_cfg) as usize - ptr as usize }, + 21usize, concat!( "Offset of field: ", - stringify!(FuriHalCryptoKey), + stringify!(usbd_status), "::", - stringify!(type_) + stringify!(device_cfg) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, - 1usize, + unsafe { ::core::ptr::addr_of!((*ptr).device_state) as usize - ptr as usize }, + 22usize, concat!( "Offset of field: ", - stringify!(FuriHalCryptoKey), + stringify!(usbd_status), "::", - stringify!(size) + stringify!(device_state) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).control_state) as usize - ptr as usize }, + 23usize, concat!( "Offset of field: ", - stringify!(FuriHalCryptoKey), + stringify!(usbd_status), "::", - stringify!(data) + stringify!(control_state) ) ); } -extern "C" { - pub fn furi_hal_crypto_verify_enclave(keys_nb: *mut u8, valid_keys_nb: *mut u8) -> bool; -} -extern "C" { - pub fn furi_hal_crypto_verify_key(key_slot: u8) -> bool; -} -extern "C" { - #[doc = " Store key in crypto storage"] - #[doc = ""] - #[doc = " @param key FuriHalCryptoKey to store. Only Master, Simple or"] - #[doc = " Encrypted"] - #[doc = " @param slot pinter to int where store slot number will be saved"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_crypto_store_add_key(key: *mut FuriHalCryptoKey, slot: *mut u8) -> bool; -} -extern "C" { - #[doc = " Init AES engine and load key from crypto store"] - #[doc = ""] - #[doc = " @param slot store slot number"] - #[doc = " @param[in] iv pointer to 16 bytes Initialization Vector data"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_crypto_store_load_key(slot: u8, iv: *const u8) -> bool; -} -extern "C" { - #[doc = " Unload key engine and deinit AES engine"] - #[doc = ""] - #[doc = " @param slot store slot number"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_crypto_store_unload_key(slot: u8) -> bool; -} -extern "C" { - #[doc = " Encrypt data"] - #[doc = ""] - #[doc = " @param input pointer to input data"] - #[doc = " @param output pointer to output data"] - #[doc = " @param size input/output buffer size in bytes"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_crypto_encrypt(input: *const u8, output: *mut u8, size: usize) -> bool; -} -extern "C" { - #[doc = " Decrypt data"] - #[doc = ""] - #[doc = " @param input pointer to input data"] - #[doc = " @param output pointer to output data"] - #[doc = " @param size input/output buffer size in bytes"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_crypto_decrypt(input: *const u8, output: *mut u8, size: usize) -> bool; -} -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 = " Init SD card detect"] - pub fn hal_sd_detect_init(); -} -extern "C" { - #[doc = " Set SD card detect pin to low"] - pub fn hal_sd_detect_set_low(); -} -extern "C" { - #[doc = " Get SD card status"] - #[doc = ""] - #[doc = " @return true if SD card present, false if SD card not present"] - pub fn hal_sd_detect() -> bool; -} -extern "C" { - #[doc = " Pointer to currently used SPI Handle"] - pub static mut furi_hal_sd_spi_handle: *mut FuriHalSpiBusHandle; -} -extern "C" { - #[doc = " Early DeInit I2C"] - pub fn furi_hal_i2c_deinit_early(); -} -extern "C" { - #[doc = " Acquire i2c bus handle"] - #[doc = ""] - #[doc = " @return Instance of FuriHalI2cBus"] - pub fn furi_hal_i2c_acquire(handle: *mut FuriHalI2cBusHandle); -} -extern "C" { - #[doc = " Release i2c bus handle"] - #[doc = ""] - #[doc = " @param bus instance of FuriHalI2cBus aquired in `furi_hal_i2c_acquire`"] - pub fn furi_hal_i2c_release(handle: *mut FuriHalI2cBusHandle); -} -extern "C" { - #[doc = " Perform I2C tx transfer"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param address I2C slave address"] - #[doc = " @param data pointer to data buffer"] - #[doc = " @param size size of data buffer"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true on successful transfer, false otherwise"] - pub fn furi_hal_i2c_tx( - handle: *mut FuriHalI2cBusHandle, - address: u8, - data: *const u8, - size: u8, - timeout: u32, - ) -> bool; -} -extern "C" { - #[doc = " Perform I2C rx transfer"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param address I2C slave address"] - #[doc = " @param data pointer to data buffer"] - #[doc = " @param size size of data buffer"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true on successful transfer, false otherwise"] - pub fn furi_hal_i2c_rx( - handle: *mut FuriHalI2cBusHandle, - address: u8, - data: *mut u8, - size: u8, - timeout: u32, - ) -> bool; -} -extern "C" { - #[doc = " Perform I2C tx and rx transfers"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param address I2C slave address"] - #[doc = " @param tx_data pointer to tx data buffer"] - #[doc = " @param tx_size size of tx data buffer"] - #[doc = " @param rx_data pointer to rx data buffer"] - #[doc = " @param rx_size size of rx data buffer"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true on successful transfer, false otherwise"] - pub fn furi_hal_i2c_trx( - handle: *mut FuriHalI2cBusHandle, - address: u8, - tx_data: *const u8, - tx_size: u8, - rx_data: *mut u8, - rx_size: u8, - timeout: u32, - ) -> bool; -} -extern "C" { - #[doc = " Check if I2C device presents on bus"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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)"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param reg_addr register address"] - #[doc = " @param data pointer to register value"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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)"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param reg_addr register address"] - #[doc = " @param data pointer to register value"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param mem_addr memory start address"] - #[doc = " @param data pointer to data buffer"] - #[doc = " @param len size of data buffer"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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: u8, - timeout: u32, - ) -> bool; -} -extern "C" { - #[doc = " Perform I2C device register write (8-bit)"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param reg_addr register address"] - #[doc = " @param data register value"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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)"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param reg_addr register address"] - #[doc = " @param data register value"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true 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; +#[doc = "\\brief Generic USB device event callback for events and endpoints processing"] +#[doc = " \\param[in] dev pointer to USB device"] +#[doc = " \\param event \\ref USB_EVENTS \"USB event\""] +#[doc = " \\param ep active endpoint number"] +#[doc = " \\note endpoints with same indexes i.e. 0x01 and 0x81 shares same callback."] +pub type usbd_evt_callback = + ::core::option::Option; +#[doc = "\\brief USB control transfer completed callback function."] +#[doc = " \\param[in] dev pointer to USB device"] +#[doc = " \\param[in] req pointer to usb request structure"] +#[doc = " \\note usbd_device->complete_callback will be set to NULL after this callback completion."] +pub type usbd_rqc_callback = + ::core::option::Option; +#[doc = "\\brief USB control callback function."] +#[doc = " \\details Uses for the control request processing."] +#[doc = " Some requests will be handled by core if callback don't process it (returns FALSE)."] +#[doc = " If request was not processed STALL PID will be issued."] +#[doc = " - GET_CONFIGURATION"] +#[doc = " - SET_CONFIGURATION (passes to \\ref usbd_cfg_callback)"] +#[doc = " - GET_DESCRIPTOR (passes to \\ref usbd_dsc_callback)"] +#[doc = " - GET_STATUS"] +#[doc = " - SET_FEATURE, CLEAR_FEATURE (endpoints only)"] +#[doc = " - SET_ADDRESS"] +#[doc = " \\param[in] dev points to USB device"] +#[doc = " \\param[in] req points to usb control request"] +#[doc = " \\param[out] *callback USB control transfer completion callback, default is NULL (no callback)"] +#[doc = " \\return usbd_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 = "\\brief USB get descriptor callback function"] +#[doc = " \\details Called when GET_DESCRIPTOR request issued"] +#[doc = " \\param[in] req pointer to usb control request structure"] +#[doc = " \\param[in,out] address pointer to the descriptor in memory. Points to req->data by default. You"] +#[doc = " can use this buffer."] +#[doc = " \\param[in,out] dsize descriptor size. maximum buffer size by default."] +#[doc = " \\return usbd_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 = "\\brief USB set configuration callback function"] +#[doc = " \\details called when SET_CONFIGURATION request issued"] +#[doc = " \\param[in] dev pointer to USB device"] +#[doc = " \\param[in] cfg configuration number."] +#[doc = " \\note if config is 0 device endpoints should be de-configured"] +#[doc = " \\return TRUE if success"] +pub type usbd_cfg_callback = + ::core::option::Option usbd_respond>; +#[doc = "\\addtogroup USBD_HW"] +#[doc = " @{ */"] +#[doc = " \\return Hardware status and capabilities \\ref USBD_HW_CAPS"] +pub type usbd_hw_getinfo = ::core::option::Option u32>; +#[doc = "\\brief Enables or disables USB hardware"] +#[doc = " \\param enable Enables USB when TRUE disables otherwise."] +pub type usbd_hw_enable = ::core::option::Option; +#[doc = " Connects or disconnects USB hardware to/from usb host"] +#[doc = " \\param connect Connects USB to host if TRUE, disconnects otherwise"] +#[doc = " \\return lanes connection status."] +pub type usbd_hw_connect = ::core::option::Option u8>; +#[doc = "\\brief Sets USB hardware address"] +#[doc = " \\param address USB address"] +pub type usbd_hw_setaddr = ::core::option::Option; +#[doc = "\\brief Configures endpoint"] +#[doc = " \\param ep endpoint address. Use USB_EPDIR_ macros to set endpoint direction"] +#[doc = " \\param eptype endpoint type. Use USB_EPTYPE_* macros."] +#[doc = " \\param epsize endpoint size in bytes"] +#[doc = " \\return TRUE if success"] +pub type usbd_hw_ep_config = + ::core::option::Option bool>; +#[doc = "\\brief De-configures, cleans and disables endpoint"] +#[doc = " \\param ep endpoint index"] +#[doc = " \\note if you have two one-direction single-buffered endpoints with same index (i.e. 0x02 and 0x82)"] +#[doc = " both will be deconfigured."] +pub type usbd_hw_ep_deconfig = ::core::option::Option; +#[doc = "\\brief Reads data from OUT or control endpoint"] +#[doc = " \\param ep endpoint index, should belong to OUT or CONTROL endpoint."] +#[doc = " \\param buf pointer to read buffer"] +#[doc = " \\param blen size of the read buffer in bytes"] +#[doc = " \\return size of the actually received data, -1 on error."] +#[doc = " \\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 = "\\brief Writes data to IN or control endpoint"] +#[doc = " \\param ep endpoint index, hould belong to IN or CONTROL endpoint"] +#[doc = " \\param buf pointer to data buffer"] +#[doc = " \\param blen size of data will be written"] +#[doc = " \\return number 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"] +#[doc = " \\param ep endpoint address"] +#[doc = " \\param stall endpoint will be stalled if TRUE and unstalled otherwise."] +#[doc = " \\note Has no effect on inactive endpoints."] +pub type usbd_hw_ep_setstall = ::core::option::Option; +#[doc = "\\brief Checks endpoint for stalled state"] +#[doc = " \\param ep endpoint address"] +#[doc = " \\return TRUE if endpoint is stalled"] +pub type usbd_hw_ep_isstalled = ::core::option::Option bool>; +#[doc = "\\brief Polls USB hardware for the events"] +#[doc = " \\param[in] dev pointer to usb device structure"] +#[doc = " \\param 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 = "\\brief Gets frame number from usb hardware."] +pub type usbd_hw_get_frameno = ::core::option::Option u16>; +#[doc = "\\brief Makes a string descriptor contains unique serial number from hardware ID's"] +#[doc = " \\param[in] buffer pointer to buffer for the descriptor"] +#[doc = " \\return of the descriptor in bytes"] +pub type usbd_hw_get_serialno = + ::core::option::Option u16>; +#[doc = "\\brief Represents a hardware USB driver call table."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct usbd_driver { + #[doc = "<\\copybrief usbd_hw_getinfo"] + pub getinfo: usbd_hw_getinfo, + #[doc = "<\\copybrief usbd_hw_enable"] + pub enable: usbd_hw_enable, + #[doc = "<\\copybrief usbd_hw_connect"] + pub connect: usbd_hw_connect, + #[doc = "<\\copybrief usbd_hw_setaddr"] + pub setaddr: usbd_hw_setaddr, + #[doc = "<\\copybrief usbd_hw_ep_config"] + pub ep_config: usbd_hw_ep_config, + #[doc = "<\\copybrief usbd_hw_ep_deconfig"] + pub ep_deconfig: usbd_hw_ep_deconfig, + #[doc = "<\\copybrief usbd_hw_ep_read"] + pub ep_read: usbd_hw_ep_read, + #[doc = "<\\copybrief usbd_hw_ep_write"] + pub ep_write: usbd_hw_ep_write, + #[doc = "<\\copybrief usbd_hw_ep_setstall"] + pub ep_setstall: usbd_hw_ep_setstall, + #[doc = "<\\copybrief usbd_hw_ep_isstalled"] + pub ep_isstalled: usbd_hw_ep_isstalled, + #[doc = "<\\copybrief usbd_hw_poll"] + pub poll: usbd_hw_poll, + #[doc = "<\\copybrief usbd_hw_get_frameno"] + pub frame_no: usbd_hw_get_frameno, + #[doc = "<\\copybrief usbd_hw_get_serialno"] + pub get_serialno_desc: usbd_hw_get_serialno, } -extern "C" { - #[doc = " Perform I2C device memory"] - #[doc = ""] - #[doc = " @param handle pointer to FuriHalI2cBusHandle instance"] - #[doc = " @param i2c_addr I2C slave address"] - #[doc = " @param mem_addr memory start address"] - #[doc = " @param data pointer to data buffer"] - #[doc = " @param len size of data buffer"] - #[doc = " @param timeout timeout in ticks"] - #[doc = ""] - #[doc = " @return true on successful transfer, false otherwise"] - pub fn furi_hal_i2c_write_mem( - handle: *mut FuriHalI2cBusHandle, - i2c_addr: u8, - mem_addr: u8, - data: *mut u8, - len: u8, - timeout: u32, - ) -> bool; +#[test] +fn bindgen_test_layout_usbd_driver() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(usbd_driver)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + 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 }, + 8usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(enable) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).connect) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(connect) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).setaddr) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(setaddr) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).ep_config) as usize - ptr as usize }, + 32usize, + 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 }, + 40usize, + 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 }, + 48usize, + 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 }, + 56usize, + 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 }, + 64usize, + 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 }, + 72usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(ep_isstalled) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).poll) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(poll) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).frame_no) as usize - ptr as usize }, + 88usize, + 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 }, + 96usize, + concat!( + "Offset of field: ", + stringify!(usbd_driver), + "::", + stringify!(get_serialno_desc) + ) + ); } +#[doc = "\\brief Represents a USB device data."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct FuriHalRegionBand { - pub start: u32, - pub end: u32, - pub power_limit: i8, - pub duty_cycle: u8, +pub struct _usbd_device { + #[doc = "<\\copybrief usbd_driver"] + pub driver: *const usbd_driver, + #[doc = "<\\copybrief usbd_ctl_callback"] + pub control_callback: usbd_ctl_callback, + #[doc = "<\\copybrief usbd_rqc_callback"] + pub complete_callback: usbd_rqc_callback, + #[doc = "<\\copybrief usbd_cfg_callback"] + pub config_callback: usbd_cfg_callback, + #[doc = "<\\copybrief usbd_dsc_callback"] + pub descriptor_callback: usbd_dsc_callback, + #[doc = "<\\brief array of the event callbacks."] + pub events: [usbd_evt_callback; 8usize], + #[doc = "<\\brief array of the endpoint callbacks."] + pub endpoint: [usbd_evt_callback; 8usize], + #[doc = "<\\copybrief usbd_status"] + pub status: usbd_status, } #[test] -fn bindgen_test_layout_FuriHalRegionBand() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +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::(), - 12usize, - concat!("Size of: ", stringify!(FuriHalRegionBand)) + ::core::mem::size_of::<_usbd_device>(), + 192usize, + concat!("Size of: ", stringify!(_usbd_device)) ); assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(FuriHalRegionBand)) + ::core::mem::align_of::<_usbd_device>(), + 8usize, + concat!("Alignment of ", stringify!(_usbd_device)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).driver) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FuriHalRegionBand), + stringify!(_usbd_device), "::", - stringify!(start) + stringify!(driver) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).control_callback) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(FuriHalRegionBand), + stringify!(_usbd_device), "::", - stringify!(end) + stringify!(control_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).power_limit) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).complete_callback) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(FuriHalRegionBand), + stringify!(_usbd_device), "::", - stringify!(power_limit) + stringify!(complete_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).duty_cycle) as usize - ptr as usize }, - 9usize, + unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize }, + 24usize, concat!( "Offset of field: ", - stringify!(FuriHalRegionBand), + stringify!(_usbd_device), "::", - stringify!(duty_cycle) + stringify!(config_callback) ) ); -} -#[repr(C)] -#[derive(Debug)] -pub struct FuriHalRegion { - pub country_code: [core::ffi::c_char; 4usize], - pub bands_count: u16, - pub bands: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_FuriHalRegion() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(FuriHalRegion)) - ); assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(FuriHalRegion)) + unsafe { ::core::ptr::addr_of!((*ptr).descriptor_callback) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_usbd_device), + "::", + stringify!(descriptor_callback) + ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).country_code) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, + 40usize, concat!( "Offset of field: ", - stringify!(FuriHalRegion), + stringify!(_usbd_device), "::", - stringify!(country_code) + stringify!(events) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bands_count) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).endpoint) as usize - ptr as usize }, + 104usize, concat!( "Offset of field: ", - stringify!(FuriHalRegion), + stringify!(_usbd_device), "::", - stringify!(bands_count) + stringify!(endpoint) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bands) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, + 168usize, concat!( "Offset of field: ", - stringify!(FuriHalRegion), + stringify!(_usbd_device), "::", - stringify!(bands) + stringify!(status) ) ); } -extern "C" { - #[doc = " Get Region Data."] - #[doc = ""] - #[doc = " Region data may be allocated in Flash or in RAM."] - #[doc = " Keep in mind that we don't do memory management on our side."] - #[doc = ""] - #[doc = " @return pointer 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"] - #[doc = ""] - #[doc = " @param region pointer to the FuriHalRegion"] - pub fn furi_hal_region_set(region: *mut FuriHalRegion); -} -extern "C" { - #[doc = " Check if region data provisioned"] - #[doc = ""] - #[doc = " @return true if provisioned, false otherwise"] - pub fn furi_hal_region_is_provisioned() -> bool; -} -extern "C" { - #[doc = " Get region name"] - #[doc = ""] - #[doc = " 2 letter Region code according to iso 3166 standard"] - #[doc = " There are 2 extra values that we use in special cases:"] - #[doc = " - \"00\" - developer edition, unlocked"] - #[doc = " - \"WW\" - world wide, region provisioned by default"] - #[doc = " - \"--\" - no provisioned region"] - #[doc = ""] - #[doc = " @return Pointer 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"] - #[doc = ""] - #[doc = " @param[in] frequency The frequency"] - #[doc = " @param value frequency in Hz"] - #[doc = ""] - #[doc = " @return true if allowed"] - pub fn furi_hal_region_is_frequency_allowed(frequency: u32) -> bool; -} -extern "C" { - #[doc = " Get band data for frequency"] - #[doc = ""] - #[doc = ""] - #[doc = ""] - #[doc = " @param[in] frequency The frequency"] - #[doc = ""] - #[doc = " @return { description_of_the_return_value }"] - pub fn furi_hal_region_get_band(frequency: u32) -> *const FuriHalRegionBand; -} -#[repr(C)] +#[doc = "\\brief Represents a USB device descriptor"] +#[doc = " \\details A device descriptor describes general information about a USB device. It includes"] +#[doc = " information that applies globally to the device and all of the device’s configurations. A USB"] +#[doc = " device has only one device descriptor. A high-speed capable device that has different device"] +#[doc = " information for full-speed and high-speed must also have a \\ref usb_qualifier_descriptor."] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] -pub struct FuriHalRtcDateTime { - #[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, +pub struct usb_device_descriptor { + #[doc = "<\\brief Size of the descriptor, in bytes."] + pub bLength: u8, + #[doc = "<\\brief \\ref USB_DTYPE_DEVICE Device descriptor."] + pub bDescriptorType: u8, + #[doc = "<\\brief BCD of the supported USB specification."] + pub bcdUSB: u16, + #[doc = "<\\brief USB device class."] + pub bDeviceClass: u8, + #[doc = "<\\brief USB device subclass."] + pub bDeviceSubClass: u8, + #[doc = "<\\brief USB device protocol."] + pub bDeviceProtocol: u8, + #[doc = "<\\brief Size of the control endpoint's bank in bytes."] + pub bMaxPacketSize0: u8, + #[doc = "<\\brief Vendor ID for the USB product."] + pub idVendor: u16, + #[doc = "<\\brief Unique product ID for the USB product."] + pub idProduct: u16, + #[doc = "<\\brief Product release (version) number."] + pub bcdDevice: u16, + #[doc = "<\\brief String index for the manufacturer's name."] + pub iManufacturer: u8, + #[doc = "<\\brief String index for the product name/details."] + pub iProduct: u8, + #[doc = "<\\brief String index for the product serial number."] + pub iSerialNumber: u8, + #[doc = "<\\brief Total number of configurations supported by the device."] + pub bNumConfigurations: u8, } #[test] -fn bindgen_test_layout_FuriHalRtcDateTime() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_usb_device_descriptor() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 10usize, - concat!("Size of: ", stringify!(FuriHalRtcDateTime)) + ::core::mem::size_of::(), + 18usize, + concat!("Size of: ", stringify!(usb_device_descriptor)) + ); + assert_eq!( + ::core::mem::align_of::(), + 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!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(FuriHalRtcDateTime)) + 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).hour) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).bDeviceProtocol) as usize - ptr as usize }, + 6usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(hour) + stringify!(bDeviceProtocol) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).minute) as usize - ptr as usize }, - 1usize, + unsafe { ::core::ptr::addr_of!((*ptr).bMaxPacketSize0) as usize - ptr as usize }, + 7usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(minute) + stringify!(bMaxPacketSize0) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).second) as usize - ptr as usize }, - 2usize, + unsafe { ::core::ptr::addr_of!((*ptr).idVendor) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(second) + stringify!(idVendor) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).day) as usize - ptr as usize }, - 3usize, + unsafe { ::core::ptr::addr_of!((*ptr).idProduct) as usize - ptr as usize }, + 10usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(day) + stringify!(idProduct) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).month) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).bcdDevice) as usize - ptr as usize }, + 12usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(month) + stringify!(bcdDevice) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).year) as usize - ptr as usize }, - 6usize, + unsafe { ::core::ptr::addr_of!((*ptr).iManufacturer) as usize - ptr as usize }, + 14usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(year) + stringify!(iManufacturer) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).weekday) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).iProduct) as usize - ptr as usize }, + 15usize, concat!( "Offset of field: ", - stringify!(FuriHalRtcDateTime), + stringify!(usb_device_descriptor), "::", - stringify!(weekday) + stringify!(iProduct) ) ); -} -pub const FuriHalRtcFlag_FuriHalRtcFlagDebug: FuriHalRtcFlag = 1; -pub const FuriHalRtcFlag_FuriHalRtcFlagFactoryReset: FuriHalRtcFlag = 2; -pub const FuriHalRtcFlag_FuriHalRtcFlagLock: FuriHalRtcFlag = 4; -pub const FuriHalRtcFlag_FuriHalRtcFlagC2Update: FuriHalRtcFlag = 8; -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 = "< Service value, do not use"] -pub const FuriHalRtcRegister_FuriHalRtcRegisterMAX: FuriHalRtcRegister = 7; -pub type FuriHalRtcRegister = core::ffi::c_uchar; -extern "C" { - #[doc = " Early deinitialization"] - pub fn furi_hal_rtc_deinit_early(); -} -extern "C" { - pub fn furi_hal_rtc_get_register(reg: FuriHalRtcRegister) -> u32; -} -extern "C" { - pub fn furi_hal_rtc_set_register(reg: FuriHalRtcRegister, value: u32); -} -extern "C" { - pub fn furi_hal_rtc_set_log_level(level: u8); -} -extern "C" { - pub fn furi_hal_rtc_get_log_level() -> u8; -} -extern "C" { - pub fn furi_hal_rtc_set_flag(flag: FuriHalRtcFlag); -} -extern "C" { - pub fn furi_hal_rtc_reset_flag(flag: FuriHalRtcFlag); -} -extern "C" { - pub fn furi_hal_rtc_is_flag_set(flag: FuriHalRtcFlag) -> bool; -} -extern "C" { - pub fn furi_hal_rtc_set_boot_mode(mode: FuriHalRtcBootMode); -} -extern "C" { - pub fn furi_hal_rtc_get_boot_mode() -> FuriHalRtcBootMode; -} -extern "C" { - pub fn furi_hal_rtc_set_heap_track_mode(mode: FuriHalRtcHeapTrackMode); -} -extern "C" { - pub fn furi_hal_rtc_get_heap_track_mode() -> FuriHalRtcHeapTrackMode; -} -extern "C" { - pub fn furi_hal_rtc_set_datetime(datetime: *mut FuriHalRtcDateTime); -} -extern "C" { - pub fn furi_hal_rtc_get_datetime(datetime: *mut FuriHalRtcDateTime); -} -extern "C" { - pub fn furi_hal_rtc_validate_datetime(datetime: *mut FuriHalRtcDateTime) -> bool; -} -extern "C" { - pub fn furi_hal_rtc_set_fault_data(value: u32); -} -extern "C" { - pub fn furi_hal_rtc_get_fault_data() -> u32; -} -extern "C" { - pub fn furi_hal_rtc_set_pin_fails(value: u32); -} -extern "C" { - pub fn furi_hal_rtc_get_pin_fails() -> u32; -} -extern "C" { - pub fn furi_hal_rtc_get_timestamp() -> u32; -} -extern "C" { - pub fn furi_hal_rtc_datetime_to_timestamp(datetime: *mut FuriHalRtcDateTime) -> u32; -} -extern "C" { - pub fn furi_hal_speaker_start(frequency: f32, volume: f32); -} -extern "C" { - pub fn furi_hal_speaker_set_volume(volume: f32); -} -extern "C" { - pub fn furi_hal_speaker_stop(); -} -extern "C" { - #[doc = " Set light value"] - #[doc = ""] - #[doc = " @param light Light"] - #[doc = " @param value light brightness [0-255]"] - pub fn furi_hal_light_set(light: Light, value: u8); -} -extern "C" { - #[doc = " Start hardware LED blinking mode"] - #[doc = ""] - #[doc = " @param light Light"] - #[doc = " @param brightness light brightness [0-255]"] - #[doc = " @param on_time LED on time in ms"] - #[doc = " @param 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"] - #[doc = ""] - #[doc = " @param light Light"] - pub fn furi_hal_light_blink_set_color(light: Light); -} -extern "C" { - #[doc = " Execute sequence"] - #[doc = ""] - #[doc = " @param 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"] -#[doc = ""] -#[doc = " @param key[in] device information type identifier"] -#[doc = " @param value[in] device information value"] -#[doc = " @param last[in] whether the passed key-value pair is the last one"] -#[doc = " @param 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, - ), ->; + 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 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, +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, + pub wakeup: ::core::option::Option, + pub suspend: ::core::option::Option, + 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_PropertyValueContext() { - const UNINIT: ::core::mem::MaybeUninit = +fn bindgen_test_layout_FuriHalUsbInterface() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(PropertyValueContext)) + ::core::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(FuriHalUsbInterface)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(PropertyValueContext)) + concat!("Alignment of ", stringify!(FuriHalUsbInterface)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).key) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).init) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(key) + stringify!(init) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).deinit) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(value) + stringify!(deinit) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).out) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).wakeup) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(out) + stringify!(wakeup) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sep) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).suspend) as usize - ptr as usize }, 24usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(sep) + stringify!(suspend) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).last) as usize - ptr as usize }, - 25usize, + unsafe { ::core::ptr::addr_of!((*ptr).dev_descr) as usize - ptr as usize }, + 32usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(last) + stringify!(dev_descr) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).context) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).str_manuf_descr) as usize - ptr as usize }, + 40usize, concat!( "Offset of field: ", - stringify!(PropertyValueContext), + stringify!(FuriHalUsbInterface), "::", - stringify!(context) + stringify!(str_manuf_descr) ) ); -} -extern "C" { - #[doc = " Builds key and value strings and outputs them via a callback function"] - #[doc = ""] - #[doc = " @param ctx[in] local property context"] - #[doc = " @param fmt[in] value format, set to NULL to bypass formatting"] - #[doc = " @param nparts[in] number of key parts (separated by character)"] - #[doc = " @param ...[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, - ... + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).str_prod_descr) as usize - ptr as usize }, + 48usize, + 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 }, + 56usize, + 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 }, + 64usize, + concat!( + "Offset of field: ", + stringify!(FuriHalUsbInterface), + "::", + stringify!(cfg_descr) + ) ); -} -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"] - #[doc = ""] - #[doc = " Verifies that:"] - #[doc = " - gauge is alive"] - #[doc = " - correct profile loaded"] - #[doc = " - self diagnostic status is good"] - #[doc = ""] - #[doc = " @return true if gauge is ok"] - pub fn furi_hal_power_gauge_is_ok() -> bool; -} -extern "C" { - #[doc = " Enter insomnia mode Prevents device from going to sleep"] - #[doc = " @warning Internally increases insomnia level Must be paired with"] - #[doc = " furi_hal_power_insomnia_exit"] - pub fn furi_hal_power_insomnia_enter(); -} -extern "C" { - #[doc = " Exit insomnia mode Allow device to go to sleep"] - #[doc = " @warning Internally decreases insomnia level. Must be paired with"] - #[doc = " furi_hal_power_insomnia_enter"] - pub fn furi_hal_power_insomnia_exit(); -} -extern "C" { - #[doc = " Check if sleep availble"] - #[doc = ""] - #[doc = " @return true if available"] - pub fn furi_hal_power_sleep_available() -> bool; -} -extern "C" { - #[doc = " Check if deep sleep availble"] - #[doc = ""] - #[doc = " @return true if available"] - pub fn furi_hal_power_deep_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"] - #[doc = ""] - #[doc = " @return remaining battery capacity in percents"] - pub fn furi_hal_power_get_pct() -> u8; -} -extern "C" { - #[doc = " Get battery health state in percents"] - #[doc = ""] - #[doc = " @return health in percents"] - pub fn furi_hal_power_get_bat_health_pct() -> u8; -} -extern "C" { - #[doc = " Get charging status"] - #[doc = ""] - #[doc = " @return true if charging"] - pub fn furi_hal_power_is_charging() -> bool; -} -extern "C" { - #[doc = " Get charge complete status"] - #[doc = ""] - #[doc = " @return true 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(); + #[doc = " USB device interface modes"] + pub static mut usb_cdc_single: FuriHalUsbInterface; } extern "C" { - #[doc = " OTG enable"] - pub fn furi_hal_power_enable_otg(); + pub static mut usb_cdc_dual: FuriHalUsbInterface; } extern "C" { - #[doc = " OTG disable"] - pub fn furi_hal_power_disable_otg(); + pub static mut usb_hid: FuriHalUsbInterface; } extern "C" { - #[doc = " Check OTG status and disable it if falt happened"] - pub fn furi_hal_power_check_otg_status(); + pub static mut usb_hid_u2f: FuriHalUsbInterface; } extern "C" { - #[doc = " Get OTG status"] + #[doc = " Set USB device configuration"] #[doc = ""] - #[doc = " @return true if enabled"] - pub fn furi_hal_power_is_otg_enabled() -> bool; + #[doc = " @param mode new USB device mode"] + #[doc = " @param ctx context passed to device mode init function"] + #[doc = " @return true - 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 battery charging voltage in V"] + #[doc = " Get USB device configuration"] #[doc = ""] - #[doc = " @return voltage in V"] - pub fn furi_hal_power_get_battery_charging_voltage() -> f32; + #[doc = " @return current USB device mode"] + pub fn furi_hal_usb_get_config() -> *mut FuriHalUsbInterface; } extern "C" { - #[doc = " Set battery charging voltage in V"] - #[doc = ""] - #[doc = " Invalid values will be clamped to the nearest valid value."] - #[doc = ""] - #[doc = " @param voltage[in] voltage in V"] - #[doc = ""] - #[doc = " @return voltage in V"] - pub fn furi_hal_power_set_battery_charging_voltage(voltage: f32); + #[doc = " Lock USB device mode switch"] + pub fn furi_hal_usb_lock(); } extern "C" { - #[doc = " Get remaining battery battery capacity in mAh"] - #[doc = ""] - #[doc = " @return capacity in mAh"] - pub fn furi_hal_power_get_battery_remaining_capacity() -> u32; + #[doc = " Unlock USB device mode switch"] + pub fn furi_hal_usb_unlock(); } extern "C" { - #[doc = " Get full charge battery capacity in mAh"] + #[doc = " Check if USB device mode switch locked"] #[doc = ""] - #[doc = " @return capacity in mAh"] - pub fn furi_hal_power_get_battery_full_capacity() -> u32; + #[doc = " @return lock state"] + pub fn furi_hal_usb_is_locked() -> bool; } extern "C" { - #[doc = " Get battery capacity in mAh from battery profile"] - #[doc = ""] - #[doc = " @return capacity in mAh"] - pub fn furi_hal_power_get_battery_design_capacity() -> u32; + #[doc = " Disable USB device"] + pub fn furi_hal_usb_disable(); } extern "C" { - #[doc = " Get battery voltage in V"] - #[doc = ""] - #[doc = " @param ic FuriHalPowerIc to get measurment"] - #[doc = ""] - #[doc = " @return voltage in V"] - pub fn furi_hal_power_get_battery_voltage(ic: FuriHalPowerIC) -> f32; + #[doc = " Enable USB device"] + pub fn furi_hal_usb_enable(); } extern "C" { - #[doc = " Get battery current in A"] - #[doc = ""] - #[doc = " @param ic FuriHalPowerIc to get measurment"] - #[doc = ""] - #[doc = " @return current in A"] - pub fn furi_hal_power_get_battery_current(ic: FuriHalPowerIC) -> f32; + #[doc = " Restart USB device"] + pub fn furi_hal_usb_reinit(); } +pub type HidStateCallback = + ::core::option::Option; extern "C" { - #[doc = " Get temperature in C"] - #[doc = ""] - #[doc = " @param ic FuriHalPowerIc to get measurment"] + #[doc = " Get USB HID connection state"] #[doc = ""] - #[doc = " @return temperature in C"] - pub fn furi_hal_power_get_battery_temperature(ic: FuriHalPowerIC) -> f32; + #[doc = " @return true / false"] + pub fn furi_hal_hid_is_connected() -> bool; } extern "C" { - #[doc = " Get USB voltage in V"] + #[doc = " Get USB HID keyboard leds state"] #[doc = ""] - #[doc = " @return voltage 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(); + #[doc = " @return leds state"] + pub fn furi_hal_hid_get_led_state() -> u8; } extern "C" { - #[doc = " Disable 3.3v on external gpio and sd card"] - pub fn furi_hal_power_disable_external_3_3v(); + #[doc = " Set USB HID connect/disconnect callback"] + #[doc = ""] + #[doc = " @param cb callback"] + #[doc = " @param ctx callback context"] + pub fn furi_hal_hid_set_state_callback(cb: HidStateCallback, ctx: *mut core::ffi::c_void); } extern "C" { - #[doc = " Enter supress charge mode."] + #[doc = " Set the following key to pressed state and send HID report"] #[doc = ""] - #[doc = " Use this function when your application need clean power supply."] - pub fn furi_hal_power_suppress_charge_enter(); + #[doc = " @param button key code"] + pub fn furi_hal_hid_kb_press(button: u16) -> bool; } extern "C" { - #[doc = " Exit supress charge mode"] - pub fn furi_hal_power_suppress_charge_exit(); + #[doc = " Set the following key to released state and send HID report"] + #[doc = ""] + #[doc = " @param button key code"] + pub fn furi_hal_hid_kb_release(button: u16) -> bool; } extern "C" { - #[doc = " Get power information"] + #[doc = " Clear all pressed keys and send HID report"] #[doc = ""] - #[doc = " @param[in] callback callback to provide with new data"] - #[doc = " @param[in] sep category separator character"] - #[doc = " @param[in] context 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, - ); + pub fn furi_hal_hid_kb_release_all() -> bool; } extern "C" { - #[doc = " Get power debug information"] + #[doc = " Set mouse movement and send HID report"] #[doc = ""] - #[doc = " @param[in] callback callback to provide with new data"] - #[doc = " @param[in] context context to pass to callback"] - pub fn furi_hal_power_debug_get( - callback: PropertyValueCallback, - context: *mut core::ffi::c_void, - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Version { - _unused: [u8; 0], + #[doc = " @param dx x coordinate delta"] + #[doc = " @param dy y coordinate delta"] + pub fn furi_hal_hid_mouse_move(dx: i8, dy: i8) -> bool; } extern "C" { - #[doc = " Get current running firmware version handle."] - #[doc = ""] - #[doc = " You can store it somewhere. But if you want to retrieve data, you have to use"] - #[doc = " 'version_*_get()' set of functions. Also, 'version_*_get()' imply to use this"] - #[doc = " handle if no handle (NULL_PTR) provided."] + #[doc = " Set mouse button to pressed state and send HID report"] #[doc = ""] - #[doc = " @return pointer to Version data."] - pub fn version_get() -> *const Version; + #[doc = " @param button key code"] + pub fn furi_hal_hid_mouse_press(button: u8) -> bool; } extern "C" { - #[doc = " Get git commit hash."] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] + #[doc = " Set mouse button to released state and send HID report"] #[doc = ""] - #[doc = " @return git hash"] - pub fn version_get_githash(v: *const Version) -> *const core::ffi::c_char; + #[doc = " @param button key code"] + pub fn furi_hal_hid_mouse_release(button: u8) -> bool; } extern "C" { - #[doc = " Get git branch."] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] + #[doc = " Set mouse wheel position and send HID report"] #[doc = ""] - #[doc = " @return git branch"] - pub fn version_get_gitbranch(v: *const Version) -> *const core::ffi::c_char; + #[doc = " @param delta number of scroll steps"] + pub fn furi_hal_hid_mouse_scroll(delta: i8) -> bool; } extern "C" { - #[doc = " Get number of commit in git branch."] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] + #[doc = " Set the following consumer key to pressed state and send HID report"] #[doc = ""] - #[doc = " @return number of commit"] - pub fn version_get_gitbranchnum(v: *const Version) -> *const core::ffi::c_char; + #[doc = " @param button key code"] + pub fn furi_hal_hid_consumer_key_press(button: u16) -> bool; } extern "C" { - #[doc = " Get build date."] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] + #[doc = " Set the following consumer key to released state and send HID report"] #[doc = ""] - #[doc = " @return build date"] - pub fn version_get_builddate(v: *const Version) -> *const core::ffi::c_char; + #[doc = " @param button key code"] + pub fn furi_hal_hid_consumer_key_release(button: u16) -> bool; } +pub const FuriHalUartId_FuriHalUartIdUSART1: FuriHalUartId = 0; +pub const FuriHalUartId_FuriHalUartIdLPUART1: FuriHalUartId = 1; +#[doc = " UART channels"] +pub type FuriHalUartId = core::ffi::c_uchar; +pub const UartIrqEvent_UartIrqEventRXNE: UartIrqEvent = 0; +#[doc = " UART events"] +pub type UartIrqEvent = core::ffi::c_uchar; extern "C" { - #[doc = " Get build version. Build version is last tag in git history."] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] - #[doc = ""] - #[doc = " @return build date"] - pub fn version_get_version(v: *const Version) -> *const core::ffi::c_char; + #[doc = " Init UART"] + #[doc = " Configures GPIO to UART function, сonfigures UART hardware, enables UART hardware"] + #[doc = " @param channel UART channel"] + #[doc = " @param baud baudrate"] + pub fn furi_hal_uart_init(channel: FuriHalUartId, baud: u32); } extern "C" { - #[doc = " Get hardware target this firmware was built for"] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] - #[doc = ""] - #[doc = " @return build date"] - pub fn version_get_target(v: *const Version) -> u8; + #[doc = " Deinit UART"] + #[doc = " Configures GPIO to analog, clears callback and callback context, disables UART hardware"] + #[doc = " @param channel UART channel"] + pub fn furi_hal_uart_deinit(channel: FuriHalUartId); } extern "C" { - #[doc = " Get flag indicating if this build is \"dirty\" (source code had uncommited changes)"] - #[doc = ""] - #[doc = " @param v pointer to Version data. NULL for currently running"] - #[doc = " software."] - #[doc = ""] - #[doc = " @return build date"] - pub fn version_get_dirty_flag(v: *const Version) -> bool; + #[doc = " Suspend UART operation"] + #[doc = " Disables UART hardware, settings and callbacks are preserved"] + #[doc = " @param channel UART channel"] + pub fn furi_hal_uart_suspend(channel: FuriHalUartId); } -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; -#[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"] - #[doc = ""] - #[doc = " @return true if target and real matches"] - pub fn furi_hal_version_do_i_belong_here() -> bool; + #[doc = " Resume UART operation"] + #[doc = " Resumes UART hardware from suspended state"] + #[doc = " @param channel UART channel"] + pub fn furi_hal_uart_resume(channel: FuriHalUartId); } extern "C" { - #[doc = " Get model name"] - #[doc = ""] - #[doc = " @return model name C-string"] - pub fn furi_hal_version_get_model_name() -> *const core::ffi::c_char; + #[doc = " Changes UART baudrate"] + #[doc = " @param channel UART channel"] + #[doc = " @param baud baudrate"] + pub fn furi_hal_uart_set_br(channel: FuriHalUartId, baud: u32); } extern "C" { - #[doc = " Get OTP version"] - #[doc = ""] - #[doc = " @return OTP Version"] - pub fn furi_hal_version_get_otp_version() -> FuriHalVersionOtpVersion; + #[doc = " Transmits data"] + #[doc = " @param channel UART channel"] + #[doc = " @param buffer data"] + #[doc = " @param buffer_size data size (in bytes)"] + pub fn furi_hal_uart_tx(channel: FuriHalUartId, buffer: *mut u8, buffer_size: usize); } extern "C" { - #[doc = " Get hardware version"] - #[doc = ""] - #[doc = " @return Hardware Version"] - pub fn furi_hal_version_get_hw_version() -> u8; + #[doc = " Sets UART event callback"] + #[doc = " @param channel UART channel"] + #[doc = " @param callback callback pointer"] + #[doc = " @param context callback context"] + pub fn furi_hal_uart_set_irq_cb( + channel: FuriHalUartId, + callback: ::core::option::Option< + unsafe extern "C" fn(event: UartIrqEvent, data: u8, context: *mut core::ffi::c_void), + >, + context: *mut core::ffi::c_void, + ); } extern "C" { - #[doc = " Get hardware target"] + #[doc = " Get device information"] #[doc = ""] - #[doc = " @return Hardware Target"] - pub fn furi_hal_version_get_hw_target() -> u8; + #[doc = " @param[in] callback callback to provide with new data"] + #[doc = " @param[in] sep category separator character"] + #[doc = " @param[in] context 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 = " Get hardware body"] + #[doc = " Get random value"] #[doc = ""] - #[doc = " @return Hardware Body"] - pub fn furi_hal_version_get_hw_body() -> u8; + #[doc = " @return random value"] + pub fn furi_hal_random_get() -> u32; } extern "C" { - #[doc = " Get hardware body color"] + #[doc = " Fill buffer with random data"] #[doc = ""] - #[doc = " @return Hardware Color"] - pub fn furi_hal_version_get_hw_color() -> FuriHalVersionColor; + #[doc = " @param buf buffer pointer"] + #[doc = " @param data buffer len"] + pub fn furi_hal_random_fill_buf(buf: *mut u8, len: u32); } extern "C" { - #[doc = " Get hardware connect"] + #[doc = " Transfer execution to address"] #[doc = ""] - #[doc = " @return Hardware Interconnect"] - pub fn furi_hal_version_get_hw_connect() -> u8; + #[doc = " @param[in] address pointer to new executable"] + pub fn furi_hal_switch(address: *mut core::ffi::c_void); } +#[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 hardware region"] + #[doc = " Get Locale measurement units"] #[doc = ""] - #[doc = " @return Hardware Region"] - pub fn furi_hal_version_get_hw_region() -> FuriHalVersionRegion; + #[doc = " @return The locale measurement units."] + pub fn locale_get_measurement_unit() -> LocaleMeasurementUnits; } extern "C" { - #[doc = " Get hardware region name"] + #[doc = " Set locale measurement units"] #[doc = ""] - #[doc = " @return Hardware Region name"] - pub fn furi_hal_version_get_hw_region_name() -> *const core::ffi::c_char; + #[doc = " @param[in] format The locale measurements units"] + pub fn locale_set_measurement_unit(format: LocaleMeasurementUnits); } extern "C" { - #[doc = " Get hardware display id"] + #[doc = " Convert Fahrenheit to Celsius"] #[doc = ""] - #[doc = " @return Display id"] - pub fn furi_hal_version_get_hw_display() -> FuriHalVersionDisplay; -} -extern "C" { - #[doc = " Get hardware timestamp"] + #[doc = " @param[in] temp_f The Temperature in Fahrenheit"] #[doc = ""] - #[doc = " @return Hardware Manufacture timestamp"] - pub fn furi_hal_version_get_hw_timestamp() -> u32; + #[doc = " @return The Temperature in Celsius"] + pub fn locale_fahrenheit_to_celsius(temp_f: f32) -> f32; } extern "C" { - #[doc = " Get pointer to target name"] + #[doc = " Convert Celsius to Fahrenheit"] #[doc = ""] - #[doc = " @return Hardware Name C-string"] - pub fn furi_hal_version_get_name_ptr() -> *const core::ffi::c_char; + #[doc = " @param[in] temp_c The Temperature in Celsius"] + #[doc = ""] + #[doc = " @return The Temperature in Fahrenheit"] + pub fn locale_celsius_to_fahrenheit(temp_c: f32) -> f32; } extern "C" { - #[doc = " Get pointer to target device name"] + #[doc = " Get Locale time format"] #[doc = ""] - #[doc = " @return Hardware Device Name C-string"] - pub fn furi_hal_version_get_device_name_ptr() -> *const core::ffi::c_char; + #[doc = " @return The locale time format."] + pub fn locale_get_time_format() -> LocaleTimeFormat; } extern "C" { - #[doc = " Get pointer to target ble local device name"] + #[doc = " Set Locale Time Format"] #[doc = ""] - #[doc = " @return Ble Device Name C-string"] - pub fn furi_hal_version_get_ble_local_device_name_ptr() -> *const core::ffi::c_char; + #[doc = " @param[in] format The Locale Time Format"] + pub fn locale_set_time_format(format: LocaleTimeFormat); } extern "C" { - #[doc = " Get BLE MAC address"] + #[doc = " Format time to furi string"] #[doc = ""] - #[doc = " @return pointer to BLE MAC address"] - pub fn furi_hal_version_get_ble_mac() -> *const u8; + #[doc = " @param[out] out_str The FuriString to store formatted time"] + #[doc = " @param[in] datetime Pointer to the datetime"] + #[doc = " @param[in] format The Locale Time Format"] + #[doc = " @param[in] show_seconds The show seconds flag"] + pub fn locale_format_time( + out_str: *mut FuriString, + datetime: *const FuriHalRtcDateTime, + format: LocaleTimeFormat, + show_seconds: bool, + ); } extern "C" { - #[doc = " Get address of version structure of firmware."] + #[doc = " Get Locale DateFormat"] #[doc = ""] - #[doc = " @return Address of firmware version structure."] - pub fn furi_hal_version_get_firmware_version() -> *const Version; + #[doc = " @return The Locale DateFormat."] + pub fn locale_get_date_format() -> LocaleDateFormat; } extern "C" { - #[doc = " Get platform UID size in bytes"] + #[doc = " Set Locale DateFormat"] #[doc = ""] - #[doc = " @return UID size in bytes"] - pub fn furi_hal_version_uid_size() -> usize; + #[doc = " @param[in] format The Locale DateFormat"] + pub fn locale_set_date_format(format: LocaleDateFormat); } extern "C" { - #[doc = " Get const pointer to UID"] + #[doc = " Format date to furi string"] #[doc = ""] - #[doc = " @return pointer to UID"] - pub fn furi_hal_version_uid() -> *const u8; + #[doc = " @param[out] out_str The FuriString to store formatted date"] + #[doc = " @param[in] datetime Pointer to the datetime"] + #[doc = " @param[in] format The format"] + #[doc = " @param[in] separator The separator"] + pub fn locale_format_date( + out_str: *mut FuriString, + datetime: *const FuriHalRtcDateTime, + format: LocaleDateFormat, + separator: *const core::ffi::c_char, + ); } -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 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 = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(GapEventData)) - ); - assert_eq!( - ::core::mem::align_of::(), - 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) - ) - ); +#[derive(Debug, Copy, Clone)] +pub struct NotificationApp { + _unused: [u8; 0], } #[repr(C)] -#[derive(Copy, Clone)] -pub struct GapEvent { - pub type_: GapEventType, - pub data: GapEventData, +#[derive(Debug, Copy, Clone)] +pub struct NotificationMessageDataSound { + pub frequency: f32, + pub volume: f32, } #[test] -fn bindgen_test_layout_GapEvent() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_NotificationMessageDataSound() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), + ::core::mem::size_of::(), 8usize, - concat!("Size of: ", stringify!(GapEvent)) + concat!("Size of: ", stringify!(NotificationMessageDataSound)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(GapEvent)) + concat!("Alignment of ", stringify!(NotificationMessageDataSound)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).frequency) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(GapEvent), + stringify!(NotificationMessageDataSound), "::", - stringify!(type_) + stringify!(frequency) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).volume) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(GapEvent), + stringify!(NotificationMessageDataSound), "::", - stringify!(data) + stringify!(volume) ) ); } -pub type GapEventCallback = ::core::option::Option< - unsafe extern "C" fn(event: GapEvent, context: *mut core::ffi::c_void) -> 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, +pub struct NotificationMessageDataLed { + pub value: u8, } #[test] -fn bindgen_test_layout_SerialServiceData() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_NotificationMessageDataLed() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(SerialServiceData)) + ::core::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(NotificationMessageDataLed)) ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(SerialServiceData)) + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(NotificationMessageDataLed)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).value) 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 }, - 8usize, - concat!( - "Offset of field: ", - stringify!(SerialServiceData), + stringify!(NotificationMessageDataLed), "::", - stringify!(size) + stringify!(value) ) ); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct SerialServiceEvent { - pub event: SerialServiceEventType, - pub data: SerialServiceData, +pub struct NotificationMessageDataVibro { + pub on: bool, } #[test] -fn bindgen_test_layout_SerialServiceEvent() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_NotificationMessageDataVibro() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(SerialServiceEvent)) + ::core::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(NotificationMessageDataVibro)) ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(SerialServiceEvent)) + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(NotificationMessageDataVibro)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).event) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).on) 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 }, - 8usize, - concat!( - "Offset of field: ", - stringify!(SerialServiceEvent), + stringify!(NotificationMessageDataVibro), "::", - stringify!(data) + stringify!(on) ) ); } -pub type SerialServiceEventCallback = ::core::option::Option< - unsafe extern "C" fn(event: SerialServiceEvent, context: *mut core::ffi::c_void) -> u16, ->; -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, +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct NotificationMessageDataDelay { + pub length: u32, } #[test] -fn bindgen_test_layout_BleGlueC2Info() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_NotificationMessageDataDelay() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 37usize, - concat!("Size of: ", stringify!(BleGlueC2Info)) + ::core::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(NotificationMessageDataDelay)) ); assert_eq!( - ::core::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(BleGlueC2Info)) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(NotificationMessageDataDelay)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).mode) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataDelay), "::", - stringify!(mode) + 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 = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).VersionMajor) as usize - ptr as usize }, - 1usize, + ::core::mem::size_of::(), + 12usize, concat!( - "Offset of field: ", - stringify!(BleGlueC2Info), - "::", - stringify!(VersionMajor) + "Size of: ", + stringify!(NotificationMessageDataForcedSettings) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).VersionMinor) as usize - ptr as usize }, - 2usize, + ::core::mem::align_of::(), + 4usize, concat!( - "Offset of field: ", - stringify!(BleGlueC2Info), - "::", - stringify!(VersionMinor) + "Alignment of ", + stringify!(NotificationMessageDataForcedSettings) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).VersionSub) as usize - ptr as usize }, - 3usize, + unsafe { ::core::ptr::addr_of!((*ptr).speaker_volume) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataForcedSettings), "::", - stringify!(VersionSub) + stringify!(speaker_volume) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).VersionBranch) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataForcedSettings), "::", - stringify!(VersionBranch) + stringify!(vibro) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).VersionReleaseType) as usize - ptr as usize }, - 5usize, + unsafe { ::core::ptr::addr_of!((*ptr).display_brightness) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataForcedSettings), "::", - stringify!(VersionReleaseType) + 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 = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram2B) as usize - ptr as usize }, + ::core::mem::size_of::(), 6usize, - concat!( - "Offset of field: ", - stringify!(BleGlueC2Info), - "::", - stringify!(MemorySizeSram2B) - ) + concat!("Size of: ", stringify!(NotificationMessageDataLedBlink)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram2A) as usize - ptr as usize }, - 7usize, + ::core::mem::align_of::(), + 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!(BleGlueC2Info), + stringify!(NotificationMessageDataLedBlink), "::", - stringify!(MemorySizeSram2A) + stringify!(on_time) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeSram1) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).period) as usize - ptr as usize }, + 2usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataLedBlink), "::", - stringify!(MemorySizeSram1) + stringify!(period) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).MemorySizeFlash) as usize - ptr as usize }, - 9usize, + unsafe { ::core::ptr::addr_of!((*ptr).color) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageDataLedBlink), "::", - stringify!(MemorySizeFlash) + 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 = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(NotificationMessageData)) + ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).StackType) as usize - ptr as usize }, - 10usize, + ::core::mem::align_of::(), + 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!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(StackType) + stringify!(sound) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).StackTypeString) as usize - ptr as usize }, - 11usize, + unsafe { ::core::ptr::addr_of!((*ptr).led) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(StackTypeString) + stringify!(led) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusVersionMajor) as usize - ptr as usize }, - 31usize, + unsafe { ::core::ptr::addr_of!((*ptr).led_blink) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(FusVersionMajor) + stringify!(led_blink) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusVersionMinor) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).vibro) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(FusVersionMinor) + stringify!(vibro) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusVersionSub) as usize - ptr as usize }, - 33usize, + unsafe { ::core::ptr::addr_of!((*ptr).delay) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(FusVersionSub) + stringify!(delay) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeSram2B) as usize - ptr as usize }, - 34usize, + unsafe { ::core::ptr::addr_of!((*ptr).forced_settings) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessageData), "::", - stringify!(FusMemorySizeSram2B) + 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 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 = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(NotificationMessage)) + ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeSram2A) as usize - ptr as usize }, - 35usize, + ::core::mem::align_of::(), + 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!(BleGlueC2Info), + stringify!(NotificationMessage), "::", - stringify!(FusMemorySizeSram2A) + stringify!(type_) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).FusMemorySizeFlash) as usize - ptr as usize }, - 36usize, + unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(BleGlueC2Info), + stringify!(NotificationMessage), "::", - stringify!(FusMemorySizeFlash) + stringify!(data) ) ); } -pub type BleGlueKeyStorageChangedCallback = ::core::option::Option< - unsafe extern "C" fn(change_addr_start: *mut u8, size: u16, context: *mut core::ffi::c_void), ->; +pub type NotificationSequence = [*const NotificationMessage; 0usize]; extern "C" { - #[doc = " Initialize start core2 and initialize transport"] - pub fn ble_glue_init(); + pub fn notification_message(app: *mut NotificationApp, sequence: *const NotificationSequence); } extern "C" { - #[doc = " Start Core2 Radio stack"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn ble_glue_start() -> bool; + pub fn notification_message_block( + app: *mut NotificationApp, + sequence: *const NotificationSequence, + ); } extern "C" { - #[doc = " Is core2 alive and at least FUS is running"] + #[doc = " @brief Send internal (apply to permanent layer) notification message. Think twice before use."] #[doc = ""] - #[doc = " @return true if core2 is alive"] - pub fn ble_glue_is_alive() -> bool; + #[doc = " @param app notification record content"] + #[doc = " @param sequence notification sequence"] + pub fn notification_internal_message( + app: *mut NotificationApp, + sequence: *const NotificationSequence, + ); } extern "C" { - #[doc = " Waits for C2 to reports its mode to callback"] + #[doc = " @brief Send internal (apply to permanent layer) notification message and wait for notification end. Think twice before use."] #[doc = ""] - #[doc = " @return true if it reported before reaching timeout"] - pub fn ble_glue_wait_for_c2_start(timeout: i32) -> bool; + #[doc = " @param app notification record content"] + #[doc = " @param sequence notification sequence"] + pub fn notification_internal_message_block( + app: *mut NotificationApp, + sequence: *const NotificationSequence, + ); } extern "C" { - pub fn ble_glue_get_c2_info() -> *const BleGlueC2Info; + pub static message_click: NotificationMessage; } extern "C" { - #[doc = " Is core2 radio stack present and ready"] - #[doc = ""] - #[doc = " @return true if present and ready"] - pub fn ble_glue_is_radio_stack_ready() -> bool; + pub static message_note_c0: NotificationMessage; } extern "C" { - #[doc = " Set callback for NVM in RAM changes"] - #[doc = ""] - #[doc = " @param[in] callback The callback to call on NVM change"] - #[doc = " @param context The context for callback"] - pub fn ble_glue_set_key_storage_changed_callback( - callback: BleGlueKeyStorageChangedCallback, - context: *mut core::ffi::c_void, - ); + pub static message_note_cs0: NotificationMessage; } extern "C" { - #[doc = " Stop SHCI thread"] - pub fn ble_glue_thread_stop(); + pub static message_note_d0: NotificationMessage; } extern "C" { - pub fn ble_glue_reinit_c2() -> bool; + pub static message_note_ds0: NotificationMessage; } -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"] - #[doc = ""] - #[doc = " @return true on radio stack start command"] - pub fn ble_glue_force_c2_mode(mode: BleGlueC2Mode) -> BleGlueCommandResult; + pub static message_note_e0: NotificationMessage; } extern "C" { - pub fn ble_app_init() -> bool; + pub static message_note_f0: NotificationMessage; } extern "C" { - pub fn ble_app_get_key_storage_buff(addr: *mut *mut u8, size: *mut u16); + pub static message_note_fs0: NotificationMessage; } extern "C" { - pub fn ble_app_thread_stop(); + pub static message_note_g0: NotificationMessage; } -pub const FuriHalBtSerialRpcStatus_FuriHalBtSerialRpcStatusNotActive: FuriHalBtSerialRpcStatus = 0; -pub const FuriHalBtSerialRpcStatus_FuriHalBtSerialRpcStatusActive: FuriHalBtSerialRpcStatus = 1; -pub type FuriHalBtSerialRpcStatus = core::ffi::c_uchar; -#[doc = " Serial service callback type"] -pub type FuriHalBtSerialCallback = SerialServiceEventCallback; extern "C" { - #[doc = " Start Serial Profile"] - pub fn furi_hal_bt_serial_start(); + pub static message_note_gs0: NotificationMessage; } extern "C" { - #[doc = " Stop Serial Profile"] - pub fn furi_hal_bt_serial_stop(); + pub static message_note_a0: NotificationMessage; } extern "C" { - #[doc = " Set Serial service events callback"] - #[doc = ""] - #[doc = " @param buffer_size Applicaition buffer size"] - #[doc = " @param calback FuriHalBtSerialCallback instance"] - #[doc = " @param context pointer to context"] - pub fn furi_hal_bt_serial_set_event_callback( - buff_size: u16, - callback: FuriHalBtSerialCallback, - context: *mut core::ffi::c_void, - ); + pub static message_note_as0: NotificationMessage; } extern "C" { - #[doc = " Set BLE RPC status"] - #[doc = ""] - #[doc = " @param status FuriHalBtSerialRpcStatus instance"] - pub fn furi_hal_bt_serial_set_rpc_status(status: FuriHalBtSerialRpcStatus); + pub static message_note_b0: NotificationMessage; } extern "C" { - #[doc = " Notify that application buffer is empty"] - pub fn furi_hal_bt_serial_notify_buffer_is_empty(); + pub static message_note_c1: NotificationMessage; } extern "C" { - #[doc = " Send data through BLE"] - #[doc = ""] - #[doc = " @param data data buffer"] - #[doc = " @param size data buffer size"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_bt_serial_tx(data: *mut u8, size: u16) -> bool; + pub static message_note_cs1: NotificationMessage; } -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; -pub const FuriHalBtProfile_FuriHalBtProfileSerial: FuriHalBtProfile = 0; -pub const FuriHalBtProfile_FuriHalBtProfileHidKeyboard: FuriHalBtProfile = 1; -pub const FuriHalBtProfile_FuriHalBtProfileNumber: FuriHalBtProfile = 2; -pub type FuriHalBtProfile = core::ffi::c_uchar; extern "C" { - #[doc = " Lock core2 state transition"] - pub fn furi_hal_bt_lock_core2(); + pub static message_note_d1: NotificationMessage; } extern "C" { - #[doc = " Lock core2 state transition"] - pub fn furi_hal_bt_unlock_core2(); + pub static message_note_ds1: NotificationMessage; } extern "C" { - #[doc = " Start radio stack"] - #[doc = ""] - #[doc = " @return true on successfull radio stack start"] - pub fn furi_hal_bt_start_radio_stack() -> bool; + pub static message_note_e1: NotificationMessage; } extern "C" { - #[doc = " Get radio stack type"] - #[doc = ""] - #[doc = " @return FuriHalBtStack instance"] - pub fn furi_hal_bt_get_radio_stack() -> FuriHalBtStack; + pub static message_note_f1: NotificationMessage; } extern "C" { - #[doc = " Check if radio stack supports BLE GAT/GAP"] - #[doc = ""] - #[doc = " @return true if supported"] - pub fn furi_hal_bt_is_ble_gatt_gap_supported() -> bool; + pub static message_note_fs1: NotificationMessage; } extern "C" { - #[doc = " Check if radio stack supports testing"] - #[doc = ""] - #[doc = " @return true if supported"] - pub fn furi_hal_bt_is_testing_supported() -> bool; + 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" { - #[doc = " Start BLE app"] - #[doc = ""] - #[doc = " @param profile FuriHalBtProfile instance"] - #[doc = " @param event_cb GapEventCallback instance"] - #[doc = " @param context pointer to context"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_bt_start_app( - profile: FuriHalBtProfile, - event_cb: GapEventCallback, - context: *mut core::ffi::c_void, - ) -> bool; + pub static message_note_e4: NotificationMessage; } extern "C" { - #[doc = " Reinitialize core2"] - #[doc = ""] - #[doc = " Also can be used to prepare core2 for stop modes"] - pub fn furi_hal_bt_reinit(); + pub static message_note_f4: NotificationMessage; } extern "C" { - #[doc = " Change BLE app"] - #[doc = " Restarts 2nd core"] - #[doc = ""] - #[doc = " @param profile FuriHalBtProfile instance"] - #[doc = " @param event_cb GapEventCallback instance"] - #[doc = " @param context pointer to context"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_bt_change_app( - profile: FuriHalBtProfile, - event_cb: GapEventCallback, - context: *mut core::ffi::c_void, - ) -> bool; + pub static message_note_fs4: NotificationMessage; } extern "C" { - #[doc = " Update battery level"] - #[doc = ""] - #[doc = " @param battery_level battery level"] - pub fn furi_hal_bt_update_battery_level(battery_level: u8); + pub static message_note_g4: NotificationMessage; } extern "C" { - #[doc = " Update battery power state"] - pub fn furi_hal_bt_update_power_state(); + pub static message_note_gs4: NotificationMessage; } extern "C" { - #[doc = " Checks if BLE state is active"] - #[doc = ""] - #[doc = " @return true if device is connected or advertising, false otherwise"] - pub fn furi_hal_bt_is_active() -> bool; + pub static message_note_a4: NotificationMessage; } extern "C" { - #[doc = " Start advertising"] - pub fn furi_hal_bt_start_advertising(); + pub static message_note_as4: NotificationMessage; } extern "C" { - #[doc = " Stop advertising"] - pub fn furi_hal_bt_stop_advertising(); + pub static message_note_b4: NotificationMessage; } extern "C" { - #[doc = " Get BT/BLE system component state"] - #[doc = ""] - #[doc = " @param[in] buffer FuriString* buffer to write to"] - pub fn furi_hal_bt_dump_state(buffer: *mut FuriString); + pub static message_note_c5: NotificationMessage; } extern "C" { - #[doc = " Get BT/BLE system component state"] - #[doc = ""] - #[doc = " @return true if core2 is alive"] - pub fn furi_hal_bt_is_alive() -> bool; + pub static message_note_cs5: NotificationMessage; } extern "C" { - #[doc = " Get key storage buffer address and size"] - #[doc = ""] - #[doc = " @param key_buff_addr pointer to store buffer address"] - #[doc = " @param 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); + pub static message_note_d5: NotificationMessage; } extern "C" { - #[doc = " Get SRAM2 hardware semaphore"] - #[doc = " @note Must be called before SRAM2 read/write operations"] - pub fn furi_hal_bt_nvm_sram_sem_acquire(); + pub static message_note_ds5: NotificationMessage; } extern "C" { - #[doc = " Release SRAM2 hardware semaphore"] - #[doc = " @note Must be called after SRAM2 read/write operations"] - pub fn furi_hal_bt_nvm_sram_sem_release(); + pub static message_note_e5: NotificationMessage; } extern "C" { - #[doc = " Clear key storage"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_bt_clear_white_list() -> bool; + pub static message_note_f5: NotificationMessage; } extern "C" { - #[doc = " Set key storage change callback"] - #[doc = ""] - #[doc = " @param callback BleGlueKeyStorageChangedCallback instance"] - #[doc = " @param context pointer to context"] - pub fn furi_hal_bt_set_key_storage_change_callback( - callback: BleGlueKeyStorageChangedCallback, - context: *mut core::ffi::c_void, - ); + pub static message_note_fs5: NotificationMessage; } extern "C" { - #[doc = " Start ble tone tx at given channel and power"] - #[doc = ""] - #[doc = " @param[in] channel The channel"] - #[doc = " @param[in] power The power"] - pub fn furi_hal_bt_start_tone_tx(channel: u8, power: u8); + pub static message_note_g5: NotificationMessage; } extern "C" { - #[doc = " Stop ble tone tx"] - pub fn furi_hal_bt_stop_tone_tx(); + pub static message_note_gs5: NotificationMessage; } extern "C" { - #[doc = " Start sending ble packets at a given frequency and datarate"] - #[doc = ""] - #[doc = " @param[in] channel The channel"] - #[doc = " @param[in] pattern The pattern"] - #[doc = " @param[in] datarate The datarate"] - pub fn furi_hal_bt_start_packet_tx(channel: u8, pattern: u8, datarate: u8); + pub static message_note_a5: NotificationMessage; } extern "C" { - #[doc = " Stop sending ble packets"] - #[doc = ""] - #[doc = " @return sent packet count"] - pub fn furi_hal_bt_stop_packet_test() -> u16; + pub static message_note_as5: NotificationMessage; } extern "C" { - #[doc = " Start receiving packets"] - #[doc = ""] - #[doc = " @param[in] channel RX channel"] - #[doc = " @param[in] datarate Datarate"] - pub fn furi_hal_bt_start_packet_rx(channel: u8, datarate: u8); + pub static message_note_b5: NotificationMessage; } extern "C" { - #[doc = " Set up the RF to listen to a given RF channel"] - #[doc = ""] - #[doc = " @param[in] channel RX channel"] - pub fn furi_hal_bt_start_rx(channel: u8); + pub static message_note_c6: NotificationMessage; } extern "C" { - #[doc = " Stop RF listenning"] - pub fn furi_hal_bt_stop_rx(); + pub static message_note_cs6: NotificationMessage; } extern "C" { - #[doc = " Get RSSI"] - #[doc = ""] - #[doc = " @return RSSI in dBm"] - pub fn furi_hal_bt_get_rssi() -> f32; + pub static message_note_d6: NotificationMessage; } extern "C" { - #[doc = " Get number of transmitted packets"] - #[doc = ""] - #[doc = " @return packet count"] - pub fn furi_hal_bt_get_transmitted_packets() -> u32; + pub static message_note_ds6: NotificationMessage; } extern "C" { - #[doc = " Check & switch C2 to given mode"] - #[doc = ""] - #[doc = " @param[in] mode mode to switch into"] - pub fn furi_hal_bt_ensure_c2_mode(mode: BleGlueC2Mode) -> bool; + pub static message_note_e6: NotificationMessage; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct LevelDuration { - pub level: u32, - pub duration: u32, +extern "C" { + pub static message_note_f6: NotificationMessage; } -#[test] -fn bindgen_test_layout_LevelDuration() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(LevelDuration)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(LevelDuration)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).level) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(LevelDuration), - "::", - stringify!(level) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).duration) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(LevelDuration), - "::", - stringify!(duration) - ) - ); +extern "C" { + pub static message_note_fs6: NotificationMessage; } -#[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; -#[doc = "< Isolate Radio from antenna"] -pub const FuriHalSubGhzPath_FuriHalSubGhzPathIsolate: FuriHalSubGhzPath = 0; -#[doc = "< Center Frquency: 433MHz. Path 1: SW1RF1-SW2RF2, LCLCL"] -pub const FuriHalSubGhzPath_FuriHalSubGhzPath433: FuriHalSubGhzPath = 1; -#[doc = "< Center Frquency: 315MHz. Path 2: SW1RF2-SW2RF1, LCLCLCL"] -pub const FuriHalSubGhzPath_FuriHalSubGhzPath315: FuriHalSubGhzPath = 2; -#[doc = "< Center Frquency: 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" { - #[doc = " Send device to sleep mode"] - pub fn furi_hal_subghz_sleep(); + pub static message_note_g6: NotificationMessage; } extern "C" { - #[doc = " Load registers from preset by preset name"] - #[doc = ""] - #[doc = " @param preset to load"] - pub fn furi_hal_subghz_load_preset(preset: FuriHalSubGhzPreset); + pub static message_note_gs6: NotificationMessage; } extern "C" { - #[doc = " Load custom registers from preset"] - #[doc = ""] - #[doc = " @param preset_data registers to load"] - pub fn furi_hal_subghz_load_custom_preset(preset_data: *mut u8); + pub static message_note_a6: NotificationMessage; } extern "C" { - #[doc = " Load registers"] - #[doc = ""] - #[doc = " @param data Registers data"] - pub fn furi_hal_subghz_load_registers(data: *mut u8); + pub static message_note_as6: NotificationMessage; } extern "C" { - #[doc = " Load PATABLE"] - #[doc = ""] - #[doc = " @param data 8 uint8_t values"] - pub fn furi_hal_subghz_load_patable(data: *const u8); + pub static message_note_b6: NotificationMessage; } extern "C" { - #[doc = " Write packet to FIFO"] - #[doc = ""] - #[doc = " @param data bytes array"] - #[doc = " @param size size"] - pub fn furi_hal_subghz_write_packet(data: *const u8, size: u8); + pub static message_note_c7: NotificationMessage; } extern "C" { - #[doc = " Check if recieve pipe is not empty"] - #[doc = ""] - #[doc = " @return true if not empty"] - pub fn furi_hal_subghz_rx_pipe_not_empty() -> bool; + pub static message_note_cs7: NotificationMessage; } extern "C" { - #[doc = " Check if recieved data crc is valid"] - #[doc = ""] - #[doc = " @return true if valid"] - pub fn furi_hal_subghz_is_rx_data_crc_valid() -> bool; + pub static message_note_d7: NotificationMessage; } extern "C" { - #[doc = " Read packet from FIFO"] - #[doc = ""] - #[doc = " @param data pointer"] - #[doc = " @param size size"] - pub fn furi_hal_subghz_read_packet(data: *mut u8, size: *mut u8); + pub static message_note_ds7: NotificationMessage; } extern "C" { - #[doc = " Flush rx FIFO buffer"] - pub fn furi_hal_subghz_flush_rx(); + pub static message_note_e7: NotificationMessage; +} +extern "C" { + pub static message_note_f7: NotificationMessage; +} +extern "C" { + pub static message_note_fs7: NotificationMessage; } extern "C" { - #[doc = " Flush tx FIFO buffer"] - pub fn furi_hal_subghz_flush_tx(); + pub static message_note_g7: NotificationMessage; } extern "C" { - #[doc = " Reset Issue reset command"] - #[doc = " @warning registers content will be lost"] - pub fn furi_hal_subghz_reset(); + pub static message_note_gs7: NotificationMessage; } extern "C" { - #[doc = " Switch to Idle"] - pub fn furi_hal_subghz_idle(); + pub static message_note_a7: NotificationMessage; } extern "C" { - #[doc = " Switch to Recieve"] - pub fn furi_hal_subghz_rx(); + pub static message_note_as7: NotificationMessage; } extern "C" { - #[doc = " Switch to Transmit"] - #[doc = ""] - #[doc = " @return true if the transfer is allowed by belonging to the region"] - pub fn furi_hal_subghz_tx() -> bool; + pub static message_note_b7: NotificationMessage; } extern "C" { - #[doc = " Get RSSI value in dBm"] - #[doc = ""] - #[doc = " @return RSSI value"] - pub fn furi_hal_subghz_get_rssi() -> f32; + pub static message_note_c8: NotificationMessage; } extern "C" { - #[doc = " Get LQI"] - #[doc = ""] - #[doc = " @return LQI value"] - pub fn furi_hal_subghz_get_lqi() -> u8; + pub static message_note_cs8: NotificationMessage; } extern "C" { - #[doc = " Check if frequency is in valid range"] - #[doc = ""] - #[doc = " @param value frequency in Hz"] - #[doc = ""] - #[doc = " @return true if frequncy is valid, otherwise false"] - pub fn furi_hal_subghz_is_frequency_valid(value: u32) -> bool; + pub static message_note_d8: NotificationMessage; } extern "C" { - #[doc = " Set frequency and path This function automatically selects antenna matching"] - #[doc = " network"] - #[doc = ""] - #[doc = " @param value frequency in Hz"] - #[doc = ""] - #[doc = " @return real frequency in herz"] - pub fn furi_hal_subghz_set_frequency_and_path(value: u32) -> u32; + pub static message_note_ds8: NotificationMessage; } extern "C" { - #[doc = " Set frequency"] - #[doc = ""] - #[doc = " @param value frequency in Hz"] - #[doc = ""] - #[doc = " @return real frequency in herz"] - pub fn furi_hal_subghz_set_frequency(value: u32) -> u32; + pub static message_note_e8: NotificationMessage; } extern "C" { - #[doc = " Set path"] - #[doc = ""] - #[doc = " @param path path to use"] - pub fn furi_hal_subghz_set_path(path: FuriHalSubGhzPath); + pub static message_note_f8: NotificationMessage; } -#[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"] - #[doc = ""] - #[doc = " @param callback FuriHalSubGhzCaptureCallback"] - #[doc = " @param context callback context"] - pub fn furi_hal_subghz_start_async_rx( - callback: FuriHalSubGhzCaptureCallback, - context: *mut core::ffi::c_void, - ); + pub static message_note_fs8: NotificationMessage; } extern "C" { - #[doc = " Disable signal timings capture Resets GPIO and TIM2"] - pub fn furi_hal_subghz_stop_async_rx(); + pub static message_note_g8: NotificationMessage; } -#[doc = " Async TX callback type"] -#[doc = " @param context callback context"] -#[doc = " @return LevelDuration"] -pub type FuriHalSubGhzAsyncTxCallback = - ::core::option::Option LevelDuration>; extern "C" { - #[doc = " Start async TX Initializes GPIO, TIM2 and DMA1 for signal output"] - #[doc = ""] - #[doc = " @param callback FuriHalSubGhzAsyncTxCallback"] - #[doc = " @param context callback context"] - #[doc = ""] - #[doc = " @return true 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; + pub static message_note_gs8: NotificationMessage; } extern "C" { - #[doc = " Wait for async transmission to complete"] - #[doc = ""] - #[doc = " @return true if TX complete"] - pub fn furi_hal_subghz_is_async_tx_complete() -> bool; + pub static message_note_a8: NotificationMessage; } extern "C" { - #[doc = " Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1"] - pub fn furi_hal_subghz_stop_async_tx(); + pub static message_note_as8: NotificationMessage; } extern "C" { - #[doc = " Turn on/off vibro"] - #[doc = ""] - #[doc = " @param[in] value new state"] - pub fn furi_hal_vibro_on(value: bool); + pub static message_note_b8: NotificationMessage; } -pub type FuriHalIbuttonEmulateCallback = - ::core::option::Option; extern "C" { - pub fn furi_hal_ibutton_emulate_start( - period: u32, - callback: FuriHalIbuttonEmulateCallback, - context: *mut core::ffi::c_void, - ); + #[doc = " Messages"] + pub static message_display_backlight_on: NotificationMessage; } extern "C" { - pub fn furi_hal_ibutton_emulate_set_next(period: u32); + pub static message_display_backlight_off: NotificationMessage; } extern "C" { - pub fn furi_hal_ibutton_emulate_stop(); + pub static message_display_backlight_enforce_on: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to normal mode (open collector), and sets it to float"] - pub fn furi_hal_ibutton_start_drive(); + pub static message_display_backlight_enforce_auto: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to normal mode (open collector), and clears pin EXTI interrupt."] - #[doc = " Used in EXTI interrupt context."] - pub fn furi_hal_ibutton_start_drive_in_isr(); + pub static message_red_255: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and sets it to float"] - pub fn furi_hal_ibutton_start_interrupt(); + pub static message_green_255: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and clears pin EXTI interrupt."] - #[doc = " Used in EXTI interrupt context."] - pub fn furi_hal_ibutton_start_interrupt_in_isr(); + pub static message_blue_255: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to analog mode, and sets it to float"] - pub fn furi_hal_ibutton_stop(); + pub static message_red_0: NotificationMessage; } extern "C" { - #[doc = " Attach interrupt callback to iButton pin"] - #[doc = " @param cb callback"] - #[doc = " @param context context"] - pub fn furi_hal_ibutton_add_interrupt(cb: GpioExtiCallback, context: *mut core::ffi::c_void); + pub static message_green_0: NotificationMessage; } extern "C" { - #[doc = " Remove interrupt callback from iButton pin"] - pub fn furi_hal_ibutton_remove_interrupt(); + pub static message_blue_0: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to low"] - pub fn furi_hal_ibutton_pin_low(); + pub static message_blink_start_10: NotificationMessage; } extern "C" { - #[doc = " Sets the pin to high (float in iButton pin modes)"] - pub fn furi_hal_ibutton_pin_high(); + pub static message_blink_start_100: NotificationMessage; } extern "C" { - #[doc = " Get pin level"] - #[doc = " @return true if level is high"] - #[doc = " @return false if level is low"] - pub fn furi_hal_ibutton_pin_get_level() -> bool; + pub static message_blink_stop: NotificationMessage; } extern "C" { - #[doc = " Config rfid pins to reset state"] - pub fn furi_hal_rfid_pins_reset(); + pub static message_blink_set_color_red: NotificationMessage; } extern "C" { - #[doc = " Config rfid pins to emulate state"] - pub fn furi_hal_rfid_pins_emulate(); + pub static message_blink_set_color_green: NotificationMessage; } extern "C" { - #[doc = " Config rfid pins to read state"] - pub fn furi_hal_rfid_pins_read(); + pub static message_blink_set_color_blue: NotificationMessage; } extern "C" { - #[doc = " Release rfid pull pin"] - pub fn furi_hal_rfid_pin_pull_release(); + pub static message_blink_set_color_cyan: NotificationMessage; } extern "C" { - #[doc = " Pulldown rfid pull pin"] - pub fn furi_hal_rfid_pin_pull_pulldown(); + pub static message_blink_set_color_magenta: NotificationMessage; } extern "C" { - #[doc = " Config rfid timer to read state"] - #[doc = ""] - #[doc = " @param freq timer frequency"] - #[doc = " @param duty_cycle timer duty cycle, 0.0-1.0"] - pub fn furi_hal_rfid_tim_read(freq: f32, duty_cycle: f32); + pub static message_blink_set_color_yellow: NotificationMessage; } extern "C" { - #[doc = " Start read timer"] - pub fn furi_hal_rfid_tim_read_start(); + pub static message_blink_set_color_white: NotificationMessage; } extern "C" { - #[doc = " Stop read timer"] - pub fn furi_hal_rfid_tim_read_stop(); + pub static message_delay_1: NotificationMessage; } extern "C" { - #[doc = " Config rfid timer to emulate state"] - #[doc = ""] - #[doc = " @param freq timer frequency"] - pub fn furi_hal_rfid_tim_emulate(freq: f32); + pub static message_delay_10: NotificationMessage; } -pub type FuriHalRfidEmulateCallback = - ::core::option::Option; extern "C" { - #[doc = " Start emulation timer"] - pub fn furi_hal_rfid_tim_emulate_start( - callback: FuriHalRfidEmulateCallback, - context: *mut core::ffi::c_void, - ); + pub static message_delay_25: NotificationMessage; } -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, - ); + pub static message_delay_50: NotificationMessage; } extern "C" { - pub fn furi_hal_rfid_tim_read_capture_stop(); + pub static message_delay_100: NotificationMessage; } -pub type FuriHalRfidDMACallback = - ::core::option::Option; 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, - ); + pub static message_delay_250: NotificationMessage; } extern "C" { - pub fn furi_hal_rfid_tim_emulate_dma_stop(); + pub static message_delay_500: NotificationMessage; } extern "C" { - #[doc = " Stop emulation timer"] - pub fn furi_hal_rfid_tim_emulate_stop(); + pub static message_delay_1000: NotificationMessage; } extern "C" { - #[doc = " Config rfid timers to reset state"] - pub fn furi_hal_rfid_tim_reset(); + pub static message_sound_off: NotificationMessage; } extern "C" { - #[doc = " Set emulation timer period"] - #[doc = ""] - #[doc = " @param period overall duration"] - pub fn furi_hal_rfid_set_emulate_period(period: u32); + pub static message_vibro_on: NotificationMessage; } extern "C" { - #[doc = " Set emulation timer pulse"] - #[doc = ""] - #[doc = " @param pulse duration of high level"] - pub fn furi_hal_rfid_set_emulate_pulse(pulse: u32); + pub static message_vibro_off: NotificationMessage; } extern "C" { - #[doc = " Set read timer period"] - #[doc = ""] - #[doc = " @param period overall duration"] - pub fn furi_hal_rfid_set_read_period(period: u32); + pub static message_do_not_reset: NotificationMessage; } extern "C" { - #[doc = " Set read timer pulse"] - #[doc = ""] - #[doc = " @param pulse duration of high level"] - pub fn furi_hal_rfid_set_read_pulse(pulse: u32); + pub static message_force_speaker_volume_setting_1f: NotificationMessage; } extern "C" { - #[doc = " Сhanges the configuration of the RFID timer \"on a fly\""] - #[doc = ""] - #[doc = " @param freq new frequency"] - #[doc = " @param duty_cycle new duty cycle"] - pub fn furi_hal_rfid_change_read_config(freq: f32, duty_cycle: f32); + pub static message_force_vibro_setting_on: NotificationMessage; } extern "C" { - #[doc = " Start/Enable comparator"] - pub fn furi_hal_rfid_comp_start(); + pub static message_force_vibro_setting_off: NotificationMessage; } extern "C" { - #[doc = " Stop/Disable comparator"] - pub fn furi_hal_rfid_comp_stop(); + pub static message_force_display_brightness_setting_1f: NotificationMessage; } -pub type FuriHalRfidCompCallback = - ::core::option::Option; extern "C" { - #[doc = " Set comparator callback"] - pub fn furi_hal_rfid_comp_set_callback( - callback: FuriHalRfidCompCallback, - context: *mut core::ffi::c_void, - ); + #[doc = " Message sequences"] + pub static sequence_reset_red: NotificationSequence; } -pub type ReturnCode = u16; extern "C" { - #[doc = " \\brief Calculate Timer"] - #[doc = ""] - #[doc = " This method calculates when the timer will be expired given the amount"] - #[doc = " time in milliseconds /a tOut."] - #[doc = " Once the timer has been calculated it will then be used to check when"] - #[doc = " it expires."] - #[doc = ""] - #[doc = " \\see timersIsExpired"] - #[doc = ""] - #[doc = " \\param[in] time : time/duration in Milliseconds for the timer"] - #[doc = ""] - #[doc = " \\return u32 : The new timer calculated based on the given time"] - #[doc = ""] - pub fn timerCalculateTimer(time: u16) -> u32; + pub static sequence_reset_green: NotificationSequence; } extern "C" { - #[doc = " \\brief Checks if a Timer is Expired"] - #[doc = ""] - #[doc = " This method checks if a timer has already expired."] - #[doc = " Based on the given timer previously calculated it checks if this timer"] - #[doc = " has already elapsed"] - #[doc = ""] - #[doc = " \\see timersCalculateTimer"] - #[doc = ""] - #[doc = " \\param[in] timer : the timer to check"] - #[doc = ""] - #[doc = " \\return true : timer has already expired"] - #[doc = " \\return false : timer is still running"] - #[doc = ""] - pub fn timerIsExpired(timer: u32) -> bool; + pub static sequence_reset_blue: NotificationSequence; } extern "C" { - pub fn powf(arg1: f32, arg2: f32) -> f32; + pub static sequence_reset_rgb: NotificationSequence; } extern "C" { - pub fn roundf(arg1: f32) -> f32; + pub static sequence_reset_display: NotificationSequence; } extern "C" { - pub fn scalbnf(arg1: f32, arg2: core::ffi::c_int) -> f32; + pub static sequence_reset_sound: NotificationSequence; } extern "C" { - #[doc = " \\brief RFAL Turn Field On and Start GT"] - #[doc = ""] - #[doc = " Turns the Field On, performing Initial Collision Avoidance"] - #[doc = ""] - #[doc = " After Field On, if GT was set before, it starts the GT timer to be"] - #[doc = " used on the following communications."] - #[doc = ""] - #[doc = " \\return ERR_RF_COLLISION : External field detected"] - #[doc = " \\return ERR_NONE : Field turned On"] - #[doc = ""] - #[doc = ""] - pub fn rfalFieldOnAndStartGT() -> ReturnCode; + pub static sequence_reset_vibro: NotificationSequence; } extern "C" { - #[doc = " \\brief RFAL Worker"] - #[doc = ""] - #[doc = " This runs RFAL layer, which drives the actual Transceive procedure"] - #[doc = " It MUST be executed frequently in order to execute the RFAL internal"] - #[doc = " states and perform the requested operations"] - #[doc = ""] - #[doc = ""] - pub fn rfalWorker(); + pub static sequence_set_vibro_on: NotificationSequence; } extern "C" { - #[doc = " \\brief Low Power Mode Start"] - #[doc = ""] - #[doc = " Sets the RF Chip in Low Power Mode."] - #[doc = " In this mode the RF Chip is placed in Low Power Mode, similar to Wake-up"] - #[doc = " mode but no operation nor period measurement is performed."] - #[doc = " Mode must be terminated by rfalLowPowerModeStop()"] - #[doc = ""] - #[doc = " \\return ERR_WRONG_STATE : Not initialized properly"] - #[doc = " \\return ERR_PARAM : Invalid parameter"] - #[doc = " \\return ERR_NONE : Done with no error"] - #[doc = ""] - #[doc = ""] - pub fn rfalLowPowerModeStart() -> ReturnCode; + #[doc = " Display: backlight wakeup"] + pub static sequence_display_backlight_on: NotificationSequence; } extern "C" { - #[doc = " \\brief Low Power Mode Stop"] - #[doc = ""] - #[doc = " Stops the Low Power Mode re-enabling the device"] - #[doc = ""] - #[doc = " \\return ERR_WRONG_STATE : Not initialized properly"] - #[doc = " \\return ERR_PARAM : Invalid parameter"] - #[doc = " \\return ERR_NONE : Done with no error"] - #[doc = ""] - #[doc = ""] - pub fn rfalLowPowerModeStop() -> ReturnCode; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct DigitalSignal { - pub start_level: bool, - pub edge_cnt: u32, - pub edges_max_cnt: u32, - pub edge_timings: *mut u32, - pub reload_reg_buff: *mut u32, + #[doc = " Display: backlight force off"] + pub static sequence_display_backlight_off: NotificationSequence; } -#[test] -fn bindgen_test_layout_DigitalSignal() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(DigitalSignal)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(DigitalSignal)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).start_level) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(DigitalSignal), - "::", - stringify!(start_level) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).edge_cnt) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(DigitalSignal), - "::", - stringify!(edge_cnt) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).edges_max_cnt) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(DigitalSignal), - "::", - stringify!(edges_max_cnt) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).edge_timings) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(DigitalSignal), - "::", - stringify!(edge_timings) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).reload_reg_buff) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(DigitalSignal), - "::", - stringify!(reload_reg_buff) - ) - ); +extern "C" { + #[doc = " Display: backlight force off after a delay of 1000ms"] + pub static sequence_display_backlight_off_delay_1000: NotificationSequence; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NfcaSignal { - pub one: *mut DigitalSignal, - pub zero: *mut DigitalSignal, - pub tx_signal: *mut DigitalSignal, +extern "C" { + #[doc = " Display: backlight always on lock"] + pub static sequence_display_backlight_enforce_on: NotificationSequence; } -#[test] -fn bindgen_test_layout_NfcaSignal() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(NfcaSignal)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(NfcaSignal)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).one) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(NfcaSignal), - "::", - stringify!(one) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).zero) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(NfcaSignal), - "::", - stringify!(zero) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_signal) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(NfcaSignal), - "::", - stringify!(tx_signal) - ) - ); +extern "C" { + #[doc = " Display: backlight always on unlock"] + pub static sequence_display_backlight_enforce_auto: NotificationSequence; } -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeDefault: FuriHalNfcTxRxType = 0; -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxNoCrc: FuriHalNfcTxRxType = 1; -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxKeepPar: FuriHalNfcTxRxType = 2; -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRaw: FuriHalNfcTxRxType = 3; -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTypeRxRaw: FuriHalNfcTxRxType = 4; -pub const FuriHalNfcTxRxType_FuriHalNfcTxRxTransparent: FuriHalNfcTxRxType = 5; -pub type FuriHalNfcTxRxType = core::ffi::c_uchar; -pub type FuriHalNfcEmulateCallback = ::core::option::Option< - unsafe extern "C" fn( - buff_rx: *mut u8, - buff_rx_len: u16, - buff_tx: *mut u8, - buff_tx_len: *mut u16, - flags: *mut u32, - context: *mut core::ffi::c_void, - ) -> bool, ->; -pub const FuriHalNfcType_FuriHalNfcTypeA: FuriHalNfcType = 0; -pub const FuriHalNfcType_FuriHalNfcTypeB: FuriHalNfcType = 1; -pub const FuriHalNfcType_FuriHalNfcTypeF: FuriHalNfcType = 2; -pub const FuriHalNfcType_FuriHalNfcTypeV: FuriHalNfcType = 3; -pub type FuriHalNfcType = core::ffi::c_uchar; -pub const FuriHalNfcInterface_FuriHalNfcInterfaceRf: FuriHalNfcInterface = 0; -pub const FuriHalNfcInterface_FuriHalNfcInterfaceIsoDep: FuriHalNfcInterface = 1; -pub const FuriHalNfcInterface_FuriHalNfcInterfaceNfcDep: FuriHalNfcInterface = 2; -pub type FuriHalNfcInterface = core::ffi::c_uchar; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct FuriHalNfcDevData { - pub type_: FuriHalNfcType, - pub interface: FuriHalNfcInterface, - pub uid_len: u8, - pub uid: [u8; 10usize], - pub cuid: u32, - pub atqa: [u8; 2usize], - pub sak: u8, +extern "C" { + pub static sequence_charging: NotificationSequence; } -#[test] -fn bindgen_test_layout_FuriHalNfcDevData() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(FuriHalNfcDevData)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(FuriHalNfcDevData)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).interface) as usize - ptr as usize }, - 1usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(interface) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).uid_len) as usize - ptr as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(uid_len) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).uid) as usize - ptr as usize }, - 3usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(uid) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).cuid) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(cuid) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).atqa) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(atqa) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sak) as usize - ptr as usize }, - 22usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcDevData), - "::", - stringify!(sak) - ) - ); +extern "C" { + pub static sequence_charged: NotificationSequence; } -pub type FuriHalNfcTxRxSniffCallback = ::core::option::Option< - unsafe extern "C" fn( - data: *mut u8, - bits: u16, - crc_dropped: bool, - context: *mut core::ffi::c_void, - ), ->; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct FuriHalNfcTxRxContext { - pub tx_data: [u8; 512usize], - pub tx_parity: [u8; 64usize], - pub tx_bits: u16, - pub rx_data: [u8; 512usize], - pub rx_parity: [u8; 64usize], - pub rx_bits: u16, - pub tx_rx_type: FuriHalNfcTxRxType, - pub nfca_signal: *mut NfcaSignal, - pub sniff_tx: FuriHalNfcTxRxSniffCallback, - pub sniff_rx: FuriHalNfcTxRxSniffCallback, - pub sniff_context: *mut core::ffi::c_void, +extern "C" { + pub static sequence_not_charging: NotificationSequence; } -#[test] -fn bindgen_test_layout_FuriHalNfcTxRxContext() { - const UNINIT: ::core::mem::MaybeUninit = - ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 1192usize, - concat!("Size of: ", stringify!(FuriHalNfcTxRxContext)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(FuriHalNfcTxRxContext)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_data) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(tx_data) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_parity) as usize - ptr as usize }, - 512usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(tx_parity) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_bits) as usize - ptr as usize }, - 576usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(tx_bits) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).rx_data) as usize - ptr as usize }, - 578usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(rx_data) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).rx_parity) as usize - ptr as usize }, - 1090usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(rx_parity) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).rx_bits) as usize - ptr as usize }, - 1154usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(rx_bits) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).tx_rx_type) as usize - ptr as usize }, - 1156usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(tx_rx_type) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).nfca_signal) as usize - ptr as usize }, - 1160usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(nfca_signal) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sniff_tx) as usize - ptr as usize }, - 1168usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(sniff_tx) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sniff_rx) as usize - ptr as usize }, - 1176usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(sniff_rx) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).sniff_context) as usize - ptr as usize }, - 1184usize, - concat!( - "Offset of field: ", - stringify!(FuriHalNfcTxRxContext), - "::", - stringify!(sniff_context) - ) - ); +extern "C" { + pub static sequence_set_only_red_255: NotificationSequence; } extern "C" { - #[doc = " Check if nfc worker is busy"] - #[doc = ""] - #[doc = " @return true if busy"] - pub fn furi_hal_nfc_is_busy() -> bool; + pub static sequence_set_only_green_255: NotificationSequence; } extern "C" { - #[doc = " Check if nfc is initialized"] - #[doc = ""] - #[doc = " @return true if initialized"] - pub fn furi_hal_nfc_is_init() -> bool; + pub static sequence_set_only_blue_255: NotificationSequence; } extern "C" { - #[doc = " NFC field on"] - pub fn furi_hal_nfc_field_on(); + 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" { - #[doc = " NFC field off"] - pub fn furi_hal_nfc_field_off(); + pub static sequence_solid_yellow: NotificationSequence; } extern "C" { - #[doc = " NFC start sleep"] - pub fn furi_hal_nfc_start_sleep(); + pub static sequence_blink_blue_10: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_stop_cmd(); + pub static sequence_blink_red_10: NotificationSequence; } extern "C" { - #[doc = " NFC stop sleep"] - pub fn furi_hal_nfc_exit_sleep(); + pub static sequence_blink_green_10: NotificationSequence; } extern "C" { - #[doc = " NFC poll"] - #[doc = ""] - #[doc = " @param dev_list pointer to rfalNfcDevice buffer"] - #[doc = " @param dev_cnt pointer device count"] - #[doc = " @param timeout timeout in ms"] - #[doc = " @param deactivate deactivate flag"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_nfc_detect(nfc_data: *mut FuriHalNfcDevData, timeout: u32) -> bool; + pub static sequence_blink_yellow_10: NotificationSequence; } extern "C" { - #[doc = " Activate NFC-A tag"] - #[doc = ""] - #[doc = " @param timeout timeout in ms"] - #[doc = " @param cuid pointer to 32bit uid"] - #[doc = ""] - #[doc = " @return true on succeess"] - pub fn furi_hal_nfc_activate_nfca(timeout: u32, cuid: *mut u32) -> bool; + pub static sequence_blink_cyan_10: NotificationSequence; } extern "C" { - #[doc = " NFC listen"] - #[doc = ""] - #[doc = " @param uid pointer to uid buffer"] - #[doc = " @param uid_len uid length"] - #[doc = " @param atqa pointer to atqa"] - #[doc = " @param sak sak"] - #[doc = " @param activate_after_sak activate after sak flag"] - #[doc = " @param timeout timeout in ms"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_nfc_listen( - uid: *mut u8, - uid_len: u8, - atqa: *mut u8, - sak: u8, - activate_after_sak: bool, - timeout: u32, - ) -> bool; + pub static sequence_blink_magenta_10: NotificationSequence; } extern "C" { - #[doc = " Start Target Listen mode"] - #[doc = " @note RFAL free implementation"] - #[doc = ""] - #[doc = " @param nfc_data FuriHalNfcDevData instance"] - pub fn furi_hal_nfc_listen_start(nfc_data: *mut FuriHalNfcDevData); + pub static sequence_blink_red_100: NotificationSequence; } extern "C" { - #[doc = " Read data in Target Listen mode"] - #[doc = " @note Must be called only after furi_hal_nfc_listen_start()"] - #[doc = ""] - #[doc = " @param tx_rx FuriHalNfcTxRxContext instance"] - #[doc = " @param timeout_ms timeout im ms"] - #[doc = ""] - #[doc = " @return true on not empty receive"] - pub fn furi_hal_nfc_listen_rx(tx_rx: *mut FuriHalNfcTxRxContext, timeout_ms: u32) -> bool; + pub static sequence_blink_green_100: NotificationSequence; } extern "C" { - #[doc = " Set Target in Sleep state"] - pub fn furi_hal_nfc_listen_sleep(); + pub static sequence_blink_blue_100: NotificationSequence; } extern "C" { - #[doc = " Emulate NFC-A Target"] - #[doc = " @note RFAL based implementation"] - #[doc = ""] - #[doc = " @param uid NFC-A UID"] - #[doc = " @param uid_len NFC-A UID length"] - #[doc = " @param atqa NFC-A ATQA"] - #[doc = " @param sak NFC-A SAK"] - #[doc = " @param callback FuriHalNfcEmulateCallback instance"] - #[doc = " @param context pointer to context for callback"] - #[doc = " @param timeout timeout in ms"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_nfc_emulate_nfca( - uid: *mut u8, - uid_len: u8, - atqa: *mut u8, - sak: u8, - callback: FuriHalNfcEmulateCallback, - context: *mut core::ffi::c_void, - timeout: u32, - ) -> bool; + pub static sequence_blink_yellow_100: NotificationSequence; } extern "C" { - #[doc = " NFC data exchange"] - #[doc = ""] - #[doc = " @param tx_rx_ctx FuriHalNfcTxRxContext instance"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_nfc_tx_rx(tx_rx: *mut FuriHalNfcTxRxContext, timeout_ms: u16) -> bool; + pub static sequence_blink_cyan_100: NotificationSequence; } extern "C" { - #[doc = " NFC data full exhange"] - #[doc = ""] - #[doc = " @param tx_rx_ctx FuriHalNfcTxRxContext instance"] - #[doc = ""] - #[doc = " @return true on success"] - pub fn furi_hal_nfc_tx_rx_full(tx_rx: *mut FuriHalNfcTxRxContext) -> bool; + pub static sequence_blink_magenta_100: NotificationSequence; } extern "C" { - #[doc = " NFC deactivate and start sleep"] - pub fn furi_hal_nfc_sleep(); + pub static sequence_blink_white_100: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_stop(); + pub static sequence_blink_start_blue: NotificationSequence; } -#[doc = "< no error occurred"] -pub const FuriHalNfcReturn_FuriHalNfcReturnOk: FuriHalNfcReturn = 0; -#[doc = "< not enough memory to perform the requested operation"] -pub const FuriHalNfcReturn_FuriHalNfcReturnNomem: FuriHalNfcReturn = 1; -#[doc = "< device or resource busy"] -pub const FuriHalNfcReturn_FuriHalNfcReturnBusy: FuriHalNfcReturn = 2; -#[doc = "< generic IO error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIo: FuriHalNfcReturn = 3; -#[doc = "< error due to timeout"] -pub const FuriHalNfcReturn_FuriHalNfcReturnTimeout: FuriHalNfcReturn = 4; -pub const FuriHalNfcReturn_FuriHalNfcReturnRequest: FuriHalNfcReturn = 5; -#[doc = "< No message of desired type"] -pub const FuriHalNfcReturn_FuriHalNfcReturnNomsg: FuriHalNfcReturn = 6; -#[doc = "< Parameter error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnParam: FuriHalNfcReturn = 7; -#[doc = "< System error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnSystem: FuriHalNfcReturn = 8; -#[doc = "< Framing error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnFraming: FuriHalNfcReturn = 9; -#[doc = "< lost one or more received bytes"] -pub const FuriHalNfcReturn_FuriHalNfcReturnOverrun: FuriHalNfcReturn = 10; -#[doc = "< protocol error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnProto: FuriHalNfcReturn = 11; -#[doc = "< Internal Error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnInternal: FuriHalNfcReturn = 12; -#[doc = "< Call again"] -pub const FuriHalNfcReturn_FuriHalNfcReturnAgain: FuriHalNfcReturn = 13; -#[doc = "< memory corruption"] -pub const FuriHalNfcReturn_FuriHalNfcReturnMemCorrupt: FuriHalNfcReturn = 14; -#[doc = "< not implemented"] -pub const FuriHalNfcReturn_FuriHalNfcReturnNotImplemented: FuriHalNfcReturn = 15; -pub const FuriHalNfcReturn_FuriHalNfcReturnPcCorrupt: FuriHalNfcReturn = 16; -#[doc = "< error sending"] -pub const FuriHalNfcReturn_FuriHalNfcReturnSend: FuriHalNfcReturn = 17; -#[doc = "< indicates error detected but to be ignored"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIgnore: FuriHalNfcReturn = 18; -#[doc = "< indicates error in state machine (unexpected cmd)"] -pub const FuriHalNfcReturn_FuriHalNfcReturnSemantic: FuriHalNfcReturn = 19; -#[doc = "< indicates error in state machine (unknown cmd)"] -pub const FuriHalNfcReturn_FuriHalNfcReturnSyntax: FuriHalNfcReturn = 20; -#[doc = "< crc error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnCrc: FuriHalNfcReturn = 21; -#[doc = "< transponder not found"] -pub const FuriHalNfcReturn_FuriHalNfcReturnNotfound: FuriHalNfcReturn = 22; -pub const FuriHalNfcReturn_FuriHalNfcReturnNotunique: FuriHalNfcReturn = 23; -#[doc = "< requested operation not supported"] -pub const FuriHalNfcReturn_FuriHalNfcReturnNotsupp: FuriHalNfcReturn = 24; -#[doc = "< write error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnWrite: FuriHalNfcReturn = 25; -#[doc = "< fifo over or underflow error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnFifo: FuriHalNfcReturn = 26; -#[doc = "< parity error"] -pub const FuriHalNfcReturn_FuriHalNfcReturnPar: FuriHalNfcReturn = 27; -#[doc = "< transfer has already finished"] -pub const FuriHalNfcReturn_FuriHalNfcReturnDone: FuriHalNfcReturn = 28; -pub const FuriHalNfcReturn_FuriHalNfcReturnRfCollision: FuriHalNfcReturn = 29; -#[doc = "< lost one or more received bytes"] -pub const FuriHalNfcReturn_FuriHalNfcReturnHwOverrun: FuriHalNfcReturn = 30; -#[doc = "< device requested release"] -pub const FuriHalNfcReturn_FuriHalNfcReturnReleaseReq: FuriHalNfcReturn = 31; -#[doc = "< device requested sleep"] -pub const FuriHalNfcReturn_FuriHalNfcReturnSleepReq: FuriHalNfcReturn = 32; -#[doc = "< incorrent state for requested operation"] -pub const FuriHalNfcReturn_FuriHalNfcReturnWrongState: FuriHalNfcReturn = 33; -#[doc = "< blocking procedure reached maximum runs"] -pub const FuriHalNfcReturn_FuriHalNfcReturnMaxReruns: FuriHalNfcReturn = 34; -#[doc = "< operation aborted due to disabled configuration"] -pub const FuriHalNfcReturn_FuriHalNfcReturnDisabled: FuriHalNfcReturn = 35; -#[doc = "< expected hw do not match"] -pub const FuriHalNfcReturn_FuriHalNfcReturnHwMismatch: FuriHalNfcReturn = 36; -pub const FuriHalNfcReturn_FuriHalNfcReturnLinkLoss: FuriHalNfcReturn = 37; -#[doc = "< invalid or not initalized device handle"] -pub const FuriHalNfcReturn_FuriHalNfcReturnInvalidHandle: FuriHalNfcReturn = 38; -#[doc = "< Incomplete byte rcvd"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte: FuriHalNfcReturn = 40; -#[doc = "< Incomplete byte rcvd - 1 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte01: FuriHalNfcReturn = 41; -#[doc = "< Incomplete byte rcvd - 2 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte02: FuriHalNfcReturn = 42; -#[doc = "< Incomplete byte rcvd - 3 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte03: FuriHalNfcReturn = 43; -#[doc = "< Incomplete byte rcvd - 4 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte04: FuriHalNfcReturn = 44; -#[doc = "< Incomplete byte rcvd - 5 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte05: FuriHalNfcReturn = 45; -#[doc = "< Incomplete byte rcvd - 6 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte06: FuriHalNfcReturn = 46; -#[doc = "< Incomplete byte rcvd - 7 bit"] -pub const FuriHalNfcReturn_FuriHalNfcReturnIncompleteByte07: FuriHalNfcReturn = 47; -pub type FuriHalNfcReturn = core::ffi::c_uchar; -#[doc = "< No mode selected/defined"] -pub const FuriHalNfcMode_FuriHalNfcModeNone: FuriHalNfcMode = 0; -#[doc = "< Mode to perform as NFCA (ISO14443A) Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollNfca: FuriHalNfcMode = 1; -#[doc = "< Mode to perform as NFCA T1T (Topaz) Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollNfcaT1t: FuriHalNfcMode = 2; -#[doc = "< Mode to perform as NFCB (ISO14443B) Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollNfcb: FuriHalNfcMode = 3; -#[doc = "< Mode to perform as B' Calypso (Innovatron) (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollBPrime: FuriHalNfcMode = 4; -#[doc = "< Mode to perform as CTS Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollBCts: FuriHalNfcMode = 5; -#[doc = "< Mode to perform as NFCF (FeliCa) Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollNfcf: FuriHalNfcMode = 6; -#[doc = "< Mode to perform as NFCV (ISO15963) Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollNfcv: FuriHalNfcMode = 7; -#[doc = "< Mode to perform as PicoPass / iClass Poller (PCD)"] -pub const FuriHalNfcMode_FuriHalNfcModePollPicopass: FuriHalNfcMode = 8; -#[doc = "< Mode to perform as Active P2P (ISO18092) Initiator"] -pub const FuriHalNfcMode_FuriHalNfcModePollActiveP2p: FuriHalNfcMode = 9; -#[doc = "< Mode to perform as NFCA (ISO14443A) Listener (PICC)"] -pub const FuriHalNfcMode_FuriHalNfcModeListenNfca: FuriHalNfcMode = 10; -#[doc = "< Mode to perform as NFCA (ISO14443B) Listener (PICC)"] -pub const FuriHalNfcMode_FuriHalNfcModeListenNfcb: FuriHalNfcMode = 11; -#[doc = "< Mode to perform as NFCA (ISO15963) Listener (PICC)"] -pub const FuriHalNfcMode_FuriHalNfcModeListenNfcf: FuriHalNfcMode = 12; -#[doc = "< Mode to perform as Active P2P (ISO18092) Target"] -pub const FuriHalNfcMode_FuriHalNfcModeListenActiveP2p: FuriHalNfcMode = 13; -pub type FuriHalNfcMode = core::ffi::c_uchar; -#[doc = "< Bit Rate 106 kbit/s (fc/128)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate106: FuriHalNfcBitrate = 0; -#[doc = "< Bit Rate 212 kbit/s (fc/64)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate212: FuriHalNfcBitrate = 1; -#[doc = "< Bit Rate 424 kbit/s (fc/32)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate424: FuriHalNfcBitrate = 2; -#[doc = "< Bit Rate 848 kbit/s (fc/16)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate848: FuriHalNfcBitrate = 3; -#[doc = "< Bit Rate 1695 kbit/s (fc/8)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate1695: FuriHalNfcBitrate = 4; -#[doc = "< Bit Rate 3390 kbit/s (fc/4)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate3390: FuriHalNfcBitrate = 5; -#[doc = "< Bit Rate 6780 kbit/s (fc/2)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate6780: FuriHalNfcBitrate = 6; -#[doc = "< Bit Rate 13560 kbit/s (fc)"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate13560: FuriHalNfcBitrate = 7; -#[doc = "< Bit Rate 52.97 kbit/s (fc/256) Fast Mode VICC->VCD"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate52p97: FuriHalNfcBitrate = 235; -pub const FuriHalNfcBitrate_FuriHalNfcBitrate26p48: FuriHalNfcBitrate = 236; -#[doc = "< Bit Rate 1,66 kbit/s (fc/8192) NFCV VCD->VICC 1of256"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrate1p66: FuriHalNfcBitrate = 237; -#[doc = "< Value indicating to keep the same previous bit rate"] -pub const FuriHalNfcBitrate_FuriHalNfcBitrateKeep: FuriHalNfcBitrate = 255; -pub type FuriHalNfcBitrate = core::ffi::c_uchar; -extern "C" { - pub fn furi_hal_nfc_ll_set_mode( - mode: FuriHalNfcMode, - txBR: FuriHalNfcBitrate, - rxBR: FuriHalNfcBitrate, - ) -> FuriHalNfcReturn; +extern "C" { + pub static sequence_blink_start_red: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_set_guard_time(cycles: u32); + pub static sequence_blink_start_green: NotificationSequence; } -#[doc = "< No special error handling will be performed"] -pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingNone: FuriHalNfcErrorHandling = 0; -#[doc = "< Error handling set to perform as NFC compliant device"] -pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingNfc: FuriHalNfcErrorHandling = 1; -pub const FuriHalNfcErrorHandling_FuriHalNfcErrorHandlingEmvco: FuriHalNfcErrorHandling = 2; -pub type FuriHalNfcErrorHandling = core::ffi::c_uchar; extern "C" { - pub fn furi_hal_nfc_ll_set_error_handling(eHandling: FuriHalNfcErrorHandling); + pub static sequence_blink_start_yellow: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_set_fdt_listen(cycles: u32); + pub static sequence_blink_start_cyan: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_set_fdt_poll(FDTPoll: u32); + pub static sequence_blink_start_magenta: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_txrx_on(); + pub static sequence_blink_stop: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_txrx_off(); + pub static sequence_single_vibro: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_txrx( - txBuf: *mut u8, - txBufLen: u16, - rxBuf: *mut u8, - rxBufLen: u16, - actLen: *mut u16, - flags: u32, - fwt: u32, - ) -> FuriHalNfcReturn; + pub static sequence_double_vibro: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_txrx_bits( - txBuf: *mut u8, - txBufLen: u16, - rxBuf: *mut u8, - rxBufLen: u16, - actLen: *mut u16, - flags: u32, - fwt: u32, - ) -> FuriHalNfcReturn; + pub static sequence_success: NotificationSequence; } extern "C" { - pub fn furi_hal_nfc_ll_poll(); + pub static sequence_error: NotificationSequence; +} +extern "C" { + pub static sequence_audiovisual_alert: NotificationSequence; } -#[doc = "<\\brief Function has an error, STALLPID will be issued."] -pub const _usbd_respond_usbd_fail: _usbd_respond = 0; -#[doc = "<\\brief Function completes request accepted ZLP or data will be send."] -pub const _usbd_respond_usbd_ack: _usbd_respond = 1; -#[doc = "<\\brief Function is busy. NAK handshake."] -pub const _usbd_respond_usbd_nak: _usbd_respond = 2; -#[doc = "\\brief Reporting status results."] -pub type _usbd_respond = core::ffi::c_uchar; -#[doc = "\\brief Reporting status results."] -pub use self::_usbd_respond as usbd_respond; -#[doc = "\\brief Represents a USB device data."] -pub type usbd_device = _usbd_device; -#[doc = "\\brief Represents generic USB control request."] #[repr(C)] -#[derive(Debug)] -pub struct usbd_ctlreq { - #[doc = "<\\brief This bitmapped field identifies the characteristics of"] - #[doc = " the specific request."] - pub bmRequestType: u8, - #[doc = "<\\brief This field specifies the particular request."] - pub bRequest: u8, - #[doc = "<\\brief It is used to pass a parameter to the device, specific to"] - #[doc = " the request."] - pub wValue: u16, - #[doc = "<\\brief It is used to pass a parameter to the device, specific to"] - #[doc = " the request."] - pub wIndex: u16, - #[doc = "<\\brief This field specifies the length of the data transferred"] - #[doc = " during the second phase of the control transfer."] - pub wLength: u16, - #[doc = "<\\brief Data payload."] - pub data: __IncompleteArrayField, +#[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 current_charger: f32, + pub current_gauge: f32, + pub voltage_battery_charging: 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_usbd_ctlreq() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_PowerInfo() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(usbd_ctlreq)) + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(PowerInfo)) ); assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(usbd_ctlreq)) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(PowerInfo)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bmRequestType) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).gauge_is_ok) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(bmRequestType) + stringify!(gauge_is_ok) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bRequest) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).is_charging) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(bRequest) + stringify!(is_charging) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).wValue) as usize - ptr as usize }, - 2usize, + unsafe { ::core::ptr::addr_of!((*ptr).current_charger) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(wValue) + stringify!(current_charger) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).wIndex) as usize - ptr as usize }, - 4usize, + unsafe { ::core::ptr::addr_of!((*ptr).current_gauge) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(wIndex) + stringify!(current_gauge) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).wLength) as usize - ptr as usize }, - 6usize, + unsafe { ::core::ptr::addr_of!((*ptr).voltage_battery_charging) as usize - ptr as usize }, + 12usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(wLength) + stringify!(voltage_battery_charging) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).voltage_charger) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(usbd_ctlreq), + stringify!(PowerInfo), "::", - stringify!(data) + stringify!(voltage_charger) ) ); -} -#[doc = " USB device status data."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct usbd_status { - #[doc = "<\\brief Pointer to data buffer used for control requests."] - pub data_buf: *mut core::ffi::c_void, - #[doc = "<\\brief Pointer to current data for control request."] - pub data_ptr: *mut core::ffi::c_void, - #[doc = "<\\brief Count remained data for control request."] - pub data_count: u16, - #[doc = "<\\brief Size of the data buffer for control requests."] - pub data_maxsize: u16, - #[doc = "<\\brief Size of the control endpoint."] - pub ep0size: u8, - #[doc = "<\\brief Current device configuration number."] - pub device_cfg: u8, - #[doc = "<\\brief Current \\ref usbd_machine_state."] - pub device_state: u8, - #[doc = "<\\brief Current \\ref usbd_ctl_state."] - pub control_state: u8, -} -#[test] -fn bindgen_test_layout_usbd_status() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(usbd_status)) - ); assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(usbd_status)) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data_buf) as usize - ptr as usize }, - 0usize, + unsafe { ::core::ptr::addr_of!((*ptr).voltage_gauge) as usize - ptr as usize }, + 20usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(data_buf) + stringify!(voltage_gauge) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data_ptr) as usize - ptr as usize }, - 8usize, + unsafe { ::core::ptr::addr_of!((*ptr).voltage_vbus) as usize - ptr as usize }, + 24usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(data_ptr) + stringify!(voltage_vbus) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data_count) as usize - ptr as usize }, - 16usize, + unsafe { ::core::ptr::addr_of!((*ptr).capacity_remaining) as usize - ptr as usize }, + 28usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(data_count) + stringify!(capacity_remaining) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).data_maxsize) as usize - ptr as usize }, - 18usize, + unsafe { ::core::ptr::addr_of!((*ptr).capacity_full) as usize - ptr as usize }, + 32usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(data_maxsize) + stringify!(capacity_full) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep0size) as usize - ptr as usize }, - 20usize, + unsafe { ::core::ptr::addr_of!((*ptr).temperature_charger) as usize - ptr as usize }, + 36usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(ep0size) + stringify!(temperature_charger) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).device_cfg) as usize - ptr as usize }, - 21usize, + unsafe { ::core::ptr::addr_of!((*ptr).temperature_gauge) as usize - ptr as usize }, + 40usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(device_cfg) + stringify!(temperature_gauge) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).device_state) as usize - ptr as usize }, - 22usize, + unsafe { ::core::ptr::addr_of!((*ptr).charge) as usize - ptr as usize }, + 44usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(device_state) + stringify!(charge) ) ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).control_state) as usize - ptr as usize }, - 23usize, + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).health) as usize - ptr as usize }, + 45usize, concat!( "Offset of field: ", - stringify!(usbd_status), + stringify!(PowerInfo), "::", - stringify!(control_state) + stringify!(health) ) ); } -#[doc = "\\brief Generic USB device event callback for events and endpoints processing"] -#[doc = " \\param[in] dev pointer to USB device"] -#[doc = " \\param event \\ref USB_EVENTS \"USB event\""] -#[doc = " \\param ep active endpoint number"] -#[doc = " \\note endpoints with same indexes i.e. 0x01 and 0x81 shares same callback."] -pub type usbd_evt_callback = - ::core::option::Option; -#[doc = "\\brief USB control transfer completed callback function."] -#[doc = " \\param[in] dev pointer to USB device"] -#[doc = " \\param[in] req pointer to usb request structure"] -#[doc = " \\note usbd_device->complete_callback will be set to NULL after this callback completion."] -pub type usbd_rqc_callback = - ::core::option::Option; -#[doc = "\\brief USB control callback function."] -#[doc = " \\details Uses for the control request processing."] -#[doc = " Some requests will be handled by core if callback don't process it (returns FALSE)."] -#[doc = " If request was not processed STALL PID will be issued."] -#[doc = " - GET_CONFIGURATION"] -#[doc = " - SET_CONFIGURATION (passes to \\ref usbd_cfg_callback)"] -#[doc = " - GET_DESCRIPTOR (passes to \\ref usbd_dsc_callback)"] -#[doc = " - GET_STATUS"] -#[doc = " - SET_FEATURE, CLEAR_FEATURE (endpoints only)"] -#[doc = " - SET_ADDRESS"] -#[doc = " \\param[in] dev points to USB device"] -#[doc = " \\param[in] req points to usb control request"] -#[doc = " \\param[out] *callback USB control transfer completion callback, default is NULL (no callback)"] -#[doc = " \\return usbd_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 = "\\brief USB get descriptor callback function"] -#[doc = " \\details Called when GET_DESCRIPTOR request issued"] -#[doc = " \\param[in] req pointer to usb control request structure"] -#[doc = " \\param[in,out] address pointer to the descriptor in memory. Points to req->data by default. You"] -#[doc = " can use this buffer."] -#[doc = " \\param[in,out] dsize descriptor size. maximum buffer size by default."] -#[doc = " \\return usbd_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 = "\\brief USB set configuration callback function"] -#[doc = " \\details called when SET_CONFIGURATION request issued"] -#[doc = " \\param[in] dev pointer to USB device"] -#[doc = " \\param[in] cfg configuration number."] -#[doc = " \\note if config is 0 device endpoints should be de-configured"] -#[doc = " \\return TRUE if success"] -pub type usbd_cfg_callback = - ::core::option::Option usbd_respond>; -#[doc = "\\addtogroup USBD_HW"] -#[doc = " @{ */"] -#[doc = " \\return Hardware status and capabilities \\ref USBD_HW_CAPS"] -pub type usbd_hw_getinfo = ::core::option::Option u32>; -#[doc = "\\brief Enables or disables USB hardware"] -#[doc = " \\param enable Enables USB when TRUE disables otherwise."] -pub type usbd_hw_enable = ::core::option::Option; -#[doc = " Connects or disconnects USB hardware to/from usb host"] -#[doc = " \\param connect Connects USB to host if TRUE, disconnects otherwise"] -#[doc = " \\return lanes connection status."] -pub type usbd_hw_connect = ::core::option::Option u8>; -#[doc = "\\brief Sets USB hardware address"] -#[doc = " \\param address USB address"] -pub type usbd_hw_setaddr = ::core::option::Option; -#[doc = "\\brief Configures endpoint"] -#[doc = " \\param ep endpoint address. Use USB_EPDIR_ macros to set endpoint direction"] -#[doc = " \\param eptype endpoint type. Use USB_EPTYPE_* macros."] -#[doc = " \\param epsize endpoint size in bytes"] -#[doc = " \\return TRUE if success"] -pub type usbd_hw_ep_config = - ::core::option::Option bool>; -#[doc = "\\brief De-configures, cleans and disables endpoint"] -#[doc = " \\param ep endpoint index"] -#[doc = " \\note if you have two one-direction single-buffered endpoints with same index (i.e. 0x02 and 0x82)"] -#[doc = " both will be deconfigured."] -pub type usbd_hw_ep_deconfig = ::core::option::Option; -#[doc = "\\brief Reads data from OUT or control endpoint"] -#[doc = " \\param ep endpoint index, should belong to OUT or CONTROL endpoint."] -#[doc = " \\param buf pointer to read buffer"] -#[doc = " \\param blen size of the read buffer in bytes"] -#[doc = " \\return size of the actually received data, -1 on error."] -#[doc = " \\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, +extern "C" { + #[doc = " Power off device"] + pub fn power_off(power: *mut Power); +} +extern "C" { + #[doc = " Reboot device"] + #[doc = ""] + #[doc = " @param mode PowerBootMode"] + pub fn power_reboot(mode: PowerBootMode); +} +extern "C" { + #[doc = " Get power info"] + #[doc = ""] + #[doc = " @param power Power instance"] + #[doc = " @param info PowerInfo instance"] + pub fn power_get_info(power: *mut Power, info: *mut PowerInfo); +} +extern "C" { + #[doc = " Get power event pubsub handler"] + #[doc = ""] + #[doc = " @param power Power instance"] + #[doc = ""] + #[doc = " @return FuriPubSub instance"] + pub fn power_get_pubsub(power: *mut Power) -> *mut FuriPubSub; +} +extern "C" { + #[doc = " Check battery health"] + #[doc = ""] + #[doc = " @return true if battery is healthy"] + pub fn power_is_battery_healthy(power: *mut Power) -> 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 = "\\brief Writes data to IN or control endpoint"] -#[doc = " \\param ep endpoint index, hould belong to IN or CONTROL endpoint"] -#[doc = " \\param buf pointer to data buffer"] -#[doc = " \\param blen size of data will be written"] -#[doc = " \\return number 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 = " Callback to notify client that buffer is empty"] +pub type RpcBufferIsEmptyCallback = + ::core::option::Option; +#[doc = " Callback to notify transport layer that close_session command"] +#[doc = " is received. Any other actions lays on transport layer."] +#[doc = " No destruction or session close performed."] +pub type RpcSessionClosedCallback = + ::core::option::Option; +#[doc = " Callback to notify transport layer that session was closed"] +#[doc = " and all operations were finished"] +pub type RpcSessionTerminatedCallback = + ::core::option::Option; +extern "C" { + #[doc = " Open RPC session"] + #[doc = ""] + #[doc = " USAGE:"] + #[doc = " 1) rpc_session_open();"] + #[doc = " 2) rpc_session_set_context();"] + #[doc = " 3) rpc_session_set_send_bytes_callback();"] + #[doc = " 4) rpc_session_set_close_callback();"] + #[doc = " 5) while(1) {"] + #[doc = " rpc_session_feed();"] + #[doc = " }"] + #[doc = " 6) rpc_session_close();"] + #[doc = ""] + #[doc = ""] + #[doc = " @param rpc instance"] + #[doc = " @return pointer to RpcSession descriptor, or"] + #[doc = " NULL if RPC is busy and can't open session now"] + pub fn rpc_session_open(rpc: *mut Rpc) -> *mut RpcSession; +} +extern "C" { + #[doc = " Close RPC session"] + #[doc = " It is guaranteed that no callbacks will be called"] + #[doc = " as soon as session is closed. So no need in setting"] + #[doc = " callbacks to NULL after session close."] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + pub fn rpc_session_close(session: *mut RpcSession); +} +extern "C" { + #[doc = " Set session context for callbacks to pass"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param 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"] + #[doc = " WARN: It's forbidden to call RPC API within RpcSendBytesCallback"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param 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"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param callback callback to notify client that buffer is empty (can be NULL)"] + 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"] + #[doc = " WARN: It's forbidden to call RPC API within RpcSessionClosedCallback"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param 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"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param 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"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = " @param buffer buffer to provide to RPC service"] + #[doc = " @param size size of buffer"] + #[doc = " @param timeout max timeout to wait till all buffer will be consumed"] + #[doc = ""] + #[doc = " @return actually consumed bytes"] + pub fn rpc_session_feed( + session: *mut RpcSession, + buffer: *mut u8, + size: usize, + timeout: TickType_t, + ) -> usize; +} +extern "C" { + #[doc = " Get available size of RPC buffer"] + #[doc = ""] + #[doc = " @param session pointer to RpcSession descriptor"] + #[doc = ""] + #[doc = " @return bytes available in buffer"] + pub fn rpc_session_get_available_size(session: *mut RpcSession) -> usize; +} +pub const RpcAppSystemEvent_RpcAppEventSessionClose: RpcAppSystemEvent = 0; +pub const RpcAppSystemEvent_RpcAppEventAppExit: RpcAppSystemEvent = 1; +pub const RpcAppSystemEvent_RpcAppEventLoadFile: RpcAppSystemEvent = 2; +pub const RpcAppSystemEvent_RpcAppEventButtonPress: RpcAppSystemEvent = 3; +pub const RpcAppSystemEvent_RpcAppEventButtonRelease: RpcAppSystemEvent = 4; +pub type RpcAppSystemEvent = core::ffi::c_uchar; +pub type RpcAppSystemCallback = ::core::option::Option< + unsafe extern "C" fn(event: RpcAppSystemEvent, context: *mut core::ffi::c_void), >; -#[doc = " Stalls and unstalls endpoint"] -#[doc = " \\param ep endpoint address"] -#[doc = " \\param stall endpoint will be stalled if TRUE and unstalled otherwise."] -#[doc = " \\note Has no effect on inactive endpoints."] -pub type usbd_hw_ep_setstall = ::core::option::Option; -#[doc = "\\brief Checks endpoint for stalled state"] -#[doc = " \\param ep endpoint address"] -#[doc = " \\return TRUE if endpoint is stalled"] -pub type usbd_hw_ep_isstalled = ::core::option::Option bool>; -#[doc = "\\brief Polls USB hardware for the events"] -#[doc = " \\param[in] dev pointer to usb device structure"] -#[doc = " \\param 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), +pub type RpcAppSystemDataExchangeCallback = ::core::option::Option< + unsafe extern "C" fn(data: *const u8, data_size: usize, context: *mut core::ffi::c_void), >; -#[doc = "\\brief Gets frame number from usb hardware."] -pub type usbd_hw_get_frameno = ::core::option::Option u16>; -#[doc = "\\brief Makes a string descriptor contains unique serial number from hardware ID's"] -#[doc = " \\param[in] buffer pointer to buffer for the descriptor"] -#[doc = " \\return of the descriptor in bytes"] -pub type usbd_hw_get_serialno = - ::core::option::Option u16>; -#[doc = "\\brief Represents a hardware USB driver call table."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct usbd_driver { - #[doc = "<\\copybrief usbd_hw_getinfo"] - pub getinfo: usbd_hw_getinfo, - #[doc = "<\\copybrief usbd_hw_enable"] - pub enable: usbd_hw_enable, - #[doc = "<\\copybrief usbd_hw_connect"] - pub connect: usbd_hw_connect, - #[doc = "<\\copybrief usbd_hw_setaddr"] - pub setaddr: usbd_hw_setaddr, - #[doc = "<\\copybrief usbd_hw_ep_config"] - pub ep_config: usbd_hw_ep_config, - #[doc = "<\\copybrief usbd_hw_ep_deconfig"] - pub ep_deconfig: usbd_hw_ep_deconfig, - #[doc = "<\\copybrief usbd_hw_ep_read"] - pub ep_read: usbd_hw_ep_read, - #[doc = "<\\copybrief usbd_hw_ep_write"] - pub ep_write: usbd_hw_ep_write, - #[doc = "<\\copybrief usbd_hw_ep_setstall"] - pub ep_setstall: usbd_hw_ep_setstall, - #[doc = "<\\copybrief usbd_hw_ep_isstalled"] - pub ep_isstalled: usbd_hw_ep_isstalled, - #[doc = "<\\copybrief usbd_hw_poll"] - pub poll: usbd_hw_poll, - #[doc = "<\\copybrief usbd_hw_get_frameno"] - pub frame_no: usbd_hw_get_frameno, - #[doc = "<\\copybrief usbd_hw_get_serialno"] - pub get_serialno_desc: usbd_hw_get_serialno, +pub struct RpcAppSystem { + _unused: [u8; 0], +} +extern "C" { + pub fn rpc_system_app_set_callback( + rpc_app: *mut RpcAppSystem, + callback: RpcAppSystemCallback, + ctx: *mut core::ffi::c_void, + ); +} +extern "C" { + pub fn rpc_system_app_send_started(rpc_app: *mut RpcAppSystem); +} +extern "C" { + pub fn rpc_system_app_send_exited(rpc_app: *mut RpcAppSystem); +} +extern "C" { + pub fn rpc_system_app_get_data(rpc_app: *mut RpcAppSystem) -> *const core::ffi::c_char; +} +extern "C" { + pub fn rpc_system_app_confirm( + rpc_app: *mut RpcAppSystem, + event: RpcAppSystemEvent, + result: bool, + ); +} +extern "C" { + pub fn rpc_system_app_set_error_code(rpc_app: *mut RpcAppSystem, error_code: u32); +} +extern "C" { + pub fn rpc_system_app_set_error_text( + rpc_app: *mut RpcAppSystem, + error_text: *const core::ffi::c_char, + ); +} +extern "C" { + pub fn rpc_system_app_error_reset(rpc_app: *mut RpcAppSystem); +} +extern "C" { + pub fn rpc_system_app_set_data_exchange_callback( + rpc_app: *mut RpcAppSystem, + callback: RpcAppSystemDataExchangeCallback, + ctx: *mut core::ffi::c_void, + ); +} +extern "C" { + pub fn rpc_system_app_exchange_data( + rpc_app: *mut RpcAppSystem, + data: *const u8, + data_size: usize, + ); +} +#[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_usbd_driver() { - const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_FileInfo() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 104usize, - concat!("Size of: ", stringify!(usbd_driver)) + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(FileInfo)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(usbd_driver)) + concat!("Alignment of ", stringify!(FileInfo)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).getinfo) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(FileInfo), "::", - stringify!(getinfo) + stringify!(flags) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).enable) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(usbd_driver), - "::", - stringify!(enable) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).connect) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(usbd_driver), - "::", - stringify!(connect) - ) - ); - assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).setaddr) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(usbd_driver), + stringify!(FileInfo), "::", - stringify!(setaddr) + stringify!(size) ) ); +} +extern "C" { + #[doc = " Gets the error text from FS_Error"] + #[doc = " @param error_id error id"] + #[doc = " @return const char* error text"] + pub fn filesystem_api_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char; +} +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 error: FS_Error, +} +#[test] +fn bindgen_test_layout_SDInfo() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_config) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(usbd_driver), - "::", - stringify!(ep_config) - ) + ::core::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(SDInfo)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_deconfig) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(usbd_driver), - "::", - stringify!(ep_deconfig) - ) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(SDInfo)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_read) as usize - ptr as usize }, - 48usize, + unsafe { ::core::ptr::addr_of!((*ptr).fs_type) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(ep_read) + stringify!(fs_type) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_write) as usize - ptr as usize }, - 56usize, + unsafe { ::core::ptr::addr_of!((*ptr).kb_total) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(ep_write) + stringify!(kb_total) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_setstall) as usize - ptr as usize }, - 64usize, + unsafe { ::core::ptr::addr_of!((*ptr).kb_free) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(ep_setstall) + stringify!(kb_free) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).ep_isstalled) as usize - ptr as usize }, - 72usize, + unsafe { ::core::ptr::addr_of!((*ptr).cluster_size) as usize - ptr as usize }, + 12usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(ep_isstalled) + stringify!(cluster_size) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).poll) as usize - ptr as usize }, - 80usize, + unsafe { ::core::ptr::addr_of!((*ptr).sector_size) as usize - ptr as usize }, + 14usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(poll) + stringify!(sector_size) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).frame_no) as usize - ptr as usize }, - 88usize, + unsafe { ::core::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, + 16usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(frame_no) + stringify!(label) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).get_serialno_desc) as usize - ptr as usize }, - 96usize, + unsafe { ::core::ptr::addr_of!((*ptr).error) as usize - ptr as usize }, + 50usize, concat!( "Offset of field: ", - stringify!(usbd_driver), + stringify!(SDInfo), "::", - stringify!(get_serialno_desc) + stringify!(error) ) ); } -#[doc = "\\brief Represents a USB device data."] +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 = " Allocates and initializes a file descriptor"] + #[doc = " @return File*"] + pub fn storage_file_alloc(storage: *mut Storage) -> *mut File; +} +extern "C" { + #[doc = " Frees the file descriptor. Closes the file if it was open."] + pub fn storage_file_free(file: *mut File); +} +extern "C" { + #[doc = " Get storage pubsub."] + #[doc = " Storage will send StorageEvent messages."] + #[doc = " @param storage"] + #[doc = " @return FuriPubSub*"] + pub fn storage_get_pubsub(storage: *mut Storage) -> *mut FuriPubSub; +} +extern "C" { + #[doc = " Opens an existing file or create a new one."] + #[doc = " @param file pointer to file object."] + #[doc = " @param path path to file"] + #[doc = " @param access_mode access mode from FS_AccessMode"] + #[doc = " @param open_mode open mode from FS_OpenMode"] + #[doc = " @return success flag. You need to close the file even if the open operation failed."] + 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."] + #[doc = " @param file pointer to a file object, the file object will be freed."] + #[doc = " @return success flag"] + pub fn storage_file_close(file: *mut File) -> bool; +} +extern "C" { + #[doc = " Tells if the file is open"] + #[doc = " @param file pointer to a file object"] + #[doc = " @return bool true if file is open"] + pub fn storage_file_is_open(file: *mut File) -> bool; +} +extern "C" { + #[doc = " Tells if the file is a directory"] + #[doc = " @param file pointer to a file object"] + #[doc = " @return bool true if file is a directory"] + pub fn storage_file_is_dir(file: *mut File) -> bool; +} +extern "C" { + #[doc = " Reads bytes from a file into a buffer"] + #[doc = " @param file pointer to file object."] + #[doc = " @param buff pointer to a buffer, for reading"] + #[doc = " @param bytes_to_read how many bytes to read. Must be less than or equal to the size of the buffer."] + #[doc = " @return uint16_t how many bytes were actually read"] + pub fn storage_file_read( + file: *mut File, + buff: *mut core::ffi::c_void, + bytes_to_read: u16, + ) -> u16; +} +extern "C" { + #[doc = " Writes bytes from a buffer to a file"] + #[doc = " @param file pointer to file object."] + #[doc = " @param buff pointer to buffer, for writing"] + #[doc = " @param bytes_to_write how many bytes to write. Must be less than or equal to the size of the buffer."] + #[doc = " @return uint16_t how many bytes were actually written"] + pub fn storage_file_write( + file: *mut File, + buff: *const core::ffi::c_void, + bytes_to_write: u16, + ) -> u16; +} +extern "C" { + #[doc = " Moves the r/w pointer"] + #[doc = " @param file pointer to file object."] + #[doc = " @param offset offset to move the r/w pointer"] + #[doc = " @param from_start set an offset from the start or from the current position"] + #[doc = " @return success flag"] + pub fn storage_file_seek(file: *mut File, offset: u32, from_start: bool) -> bool; +} +extern "C" { + #[doc = " Gets the position of the r/w pointer"] + #[doc = " @param file pointer to file object."] + #[doc = " @return uint64_t position of the r/w pointer"] + pub fn storage_file_tell(file: *mut File) -> u64; +} +extern "C" { + #[doc = " Truncates the file size to the current position of the r/w pointer"] + #[doc = " @param file pointer to file object."] + #[doc = " @return bool success flag"] + pub fn storage_file_truncate(file: *mut File) -> bool; +} +extern "C" { + #[doc = " Gets the size of the file"] + #[doc = " @param file pointer to file object."] + #[doc = " @return uint64_t size of the file"] + pub fn storage_file_size(file: *mut File) -> u64; +} +extern "C" { + #[doc = " Checks that the r/w pointer is at the end of the file"] + #[doc = " @param file pointer to file object."] + #[doc = " @return bool success flag"] + pub fn storage_file_eof(file: *mut File) -> bool; +} +extern "C" { + #[doc = " @brief Check that file exists"] + #[doc = ""] + #[doc = " @param storage"] + #[doc = " @param path"] + #[doc = " @return true if file exists"] + pub fn storage_file_exists(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; +} +extern "C" { + #[doc = " Opens a directory to get objects from it"] + #[doc = " @param app pointer to the api"] + #[doc = " @param file pointer to file object."] + #[doc = " @param path path to directory"] + #[doc = " @return bool success flag. You need to close the directory even if the open operation failed."] + pub fn storage_dir_open(file: *mut File, path: *const core::ffi::c_char) -> bool; +} +extern "C" { + #[doc = " Close the directory. Also free file handle structure and point it to the NULL."] + #[doc = " @param file pointer to a file object."] + #[doc = " @return bool success flag"] + pub fn storage_dir_close(file: *mut File) -> bool; +} +extern "C" { + #[doc = " Reads the next object in the directory"] + #[doc = " @param file pointer to file object."] + #[doc = " @param fileinfo pointer to the read FileInfo, may be NULL"] + #[doc = " @param name pointer to name buffer, may be NULL"] + #[doc = " @param name_length name buffer length"] + #[doc = " @return success flag (if the next object does not exist, it also returns false and sets the file error id to FSE_NOT_EXIST)"] + pub fn storage_dir_read( + file: *mut File, + fileinfo: *mut FileInfo, + name: *mut core::ffi::c_char, + name_length: u16, + ) -> bool; +} +extern "C" { + #[doc = " Retrieves unix timestamp of last access"] + #[doc = ""] + #[doc = " @param storage The storage instance"] + #[doc = " @param path path to file/directory"] + #[doc = " @param timestamp the timestamp pointer"] + #[doc = ""] + #[doc = " @return FS_Error operation result"] + pub fn storage_common_timestamp( + storage: *mut Storage, + path: *const core::ffi::c_char, + timestamp: *mut u32, + ) -> FS_Error; +} +extern "C" { + #[doc = " Retrieves information about a file/directory"] + #[doc = " @param app pointer to the api"] + #[doc = " @param path path to file/directory"] + #[doc = " @param fileinfo pointer to the read FileInfo, may be NULL"] + #[doc = " @return FS_Error operation result"] + pub fn storage_common_stat( + storage: *mut Storage, + path: *const core::ffi::c_char, + fileinfo: *mut FileInfo, + ) -> FS_Error; +} +extern "C" { + #[doc = " Removes a file/directory from the repository, the directory must be empty and the file/directory must not be open"] + #[doc = " @param app pointer to the api"] + #[doc = " @param path"] + #[doc = " @return FS_Error operation result"] + pub fn storage_common_remove(storage: *mut Storage, path: *const core::ffi::c_char) + -> FS_Error; +} +extern "C" { + #[doc = " Renames file/directory, file/directory must not be open"] + #[doc = " @param app pointer to the api"] + #[doc = " @param old_path old path"] + #[doc = " @param new_path new path"] + #[doc = " @return FS_Error operation result"] + 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 file, file must not be open"] + #[doc = " @param app pointer to the api"] + #[doc = " @param old_path old path"] + #[doc = " @param new_path new path"] + #[doc = " @return FS_Error operation result"] + 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 one folder contents into another with rename of all conflicting files"] + #[doc = " @param app pointer to the api"] + #[doc = " @param old_path old path"] + #[doc = " @param new_path new path"] + #[doc = " @return FS_Error operation result"] + 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 = " Creates a directory"] + #[doc = " @param app pointer to the api"] + #[doc = " @param path directory path"] + #[doc = " @return FS_Error operation result"] + pub fn storage_common_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> FS_Error; +} +extern "C" { + #[doc = " Gets general information about the storage"] + #[doc = " @param app pointer to the api"] + #[doc = " @param fs_path the path to the storage of interest"] + #[doc = " @param total_space pointer to total space record, will be filled"] + #[doc = " @param free_space pointer to free space record, will be filled"] + #[doc = " @return FS_Error operation result"] + 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 = " Retrieves the error text from the error id"] + #[doc = " @param error_id error id"] + #[doc = " @return const char* error text"] + pub fn storage_error_get_desc(error_id: FS_Error) -> *const core::ffi::c_char; +} +extern "C" { + #[doc = " Retrieves the error id from the file object"] + #[doc = " @param file pointer to file object. Pointer must not point to NULL. YOU CANNOT RETRIEVE THE ERROR ID IF THE FILE HAS BEEN CLOSED"] + #[doc = " @return FS_Error error id"] + pub fn storage_file_get_error(file: *mut File) -> FS_Error; +} +extern "C" { + #[doc = " Retrieves the error text from the file object"] + #[doc = " @param file pointer to file object. Pointer must not point to NULL. YOU CANNOT RETRIEVE THE ERROR TEXT IF THE FILE HAS BEEN CLOSED"] + #[doc = " @return const char* error text"] + pub fn storage_file_get_error_desc(file: *mut File) -> *const core::ffi::c_char; +} +extern "C" { + #[doc = " Formats SD Card"] + #[doc = " @param api pointer to the api"] + #[doc = " @return FS_Error operation result"] + pub fn storage_sd_format(api: *mut Storage) -> FS_Error; +} +extern "C" { + #[doc = " Will unmount the SD card"] + #[doc = " @param api pointer to the api"] + #[doc = " @return FS_Error operation result"] + pub fn storage_sd_unmount(api: *mut Storage) -> FS_Error; +} +extern "C" { + #[doc = " Retrieves SD card information"] + #[doc = " @param api pointer to the api"] + #[doc = " @param info pointer to the info"] + #[doc = " @return FS_Error operation result"] + pub fn storage_sd_info(api: *mut Storage, info: *mut SDInfo) -> FS_Error; +} +extern "C" { + #[doc = " Retrieves SD card status"] + #[doc = " @param api pointer to the api"] + #[doc = " @return FS_Error operation result"] + pub fn storage_sd_status(api: *mut Storage) -> FS_Error; +} +#[doc = " Internal LFS Functions"] +pub type Storage_name_converter = + ::core::option::Option; +extern "C" { + #[doc = " Backs up internal storage to a tar archive"] + #[doc = " @param api pointer to the api"] + #[doc = " @param dstmane destination archive path"] + #[doc = " @return FS_Error operation result"] + pub fn storage_int_backup(api: *mut Storage, dstname: *const core::ffi::c_char) -> FS_Error; +} +extern "C" { + #[doc = " Restores internal storage from a tar archive"] + #[doc = " @param api pointer to the api"] + #[doc = " @param dstmane archive path"] + #[doc = " @param converter pointer to filename conversion function, may be NULL"] + #[doc = " @return FS_Error operation result"] + pub fn storage_int_restore( + api: *mut Storage, + dstname: *const core::ffi::c_char, + converter: Storage_name_converter, + ) -> FS_Error; +} +extern "C" { + #[doc = " Removes a file/directory, the directory must be empty and the file/directory must not be open"] + #[doc = " @param storage pointer to the api"] + #[doc = " @param path"] + #[doc = " @return true on success or if file/dir is not exist"] + pub fn storage_simply_remove(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; +} +extern "C" { + #[doc = " Recursively removes a file/directory, the directory can be not empty"] + #[doc = " @param storage pointer to the api"] + #[doc = " @param path"] + #[doc = " @return true on success or if file/dir is not exist"] + pub fn storage_simply_remove_recursive( + storage: *mut Storage, + path: *const core::ffi::c_char, + ) -> bool; +} +extern "C" { + #[doc = " Creates a directory"] + #[doc = " @param storage"] + #[doc = " @param path"] + #[doc = " @return true on success or if directory is already exist"] + pub fn storage_simply_mkdir(storage: *mut Storage, path: *const core::ffi::c_char) -> bool; +} +extern "C" { + #[doc = " @brief Get next free filename."] + #[doc = ""] + #[doc = " @param storage"] + #[doc = " @param dirname"] + #[doc = " @param filename"] + #[doc = " @param fileextension"] + #[doc = " @param nextfilename return name"] + #[doc = " @param max_len max len 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, + ); +} +#[doc = " @brief LPTIM Init structure definition"] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct _usbd_device { - #[doc = "<\\copybrief usbd_driver"] - pub driver: *const usbd_driver, - #[doc = "<\\copybrief usbd_ctl_callback"] - pub control_callback: usbd_ctl_callback, - #[doc = "<\\copybrief usbd_rqc_callback"] - pub complete_callback: usbd_rqc_callback, - #[doc = "<\\copybrief usbd_cfg_callback"] - pub config_callback: usbd_cfg_callback, - #[doc = "<\\copybrief usbd_dsc_callback"] - pub descriptor_callback: usbd_dsc_callback, - #[doc = "<\\brief array of the event callbacks."] - pub events: [usbd_evt_callback; 8usize], - #[doc = "<\\brief array of the endpoint callbacks."] - pub endpoint: [usbd_evt_callback; 8usize], - #[doc = "<\\copybrief usbd_status"] - pub status: usbd_status, +pub struct LL_LPTIM_InitTypeDef { + #[doc = "< Specifies the source of the clock used by the LPTIM instance."] + #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_CLK_SOURCE."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary"] + #[doc = "function @ref LL_LPTIM_SetClockSource()."] + pub ClockSource: u32, + #[doc = "< Specifies the prescaler division ratio."] + #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using using unitary"] + #[doc = "function @ref LL_LPTIM_SetPrescaler()."] + pub Prescaler: u32, + #[doc = "< Specifies the waveform shape."] + #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_WAVEFORM."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary"] + #[doc = "function @ref LL_LPTIM_ConfigOutput()."] + pub Waveform: u32, + #[doc = "< Specifies waveform polarity."] + #[doc = "This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_POLARITY."] + #[doc = ""] + #[doc = "This feature can be modified afterwards using unitary"] + #[doc = "function @ref LL_LPTIM_ConfigOutput()."] + pub Polarity: u32, } #[test] -fn bindgen_test_layout__usbd_device() { - const UNINIT: ::core::mem::MaybeUninit<_usbd_device> = ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_LL_LPTIM_InitTypeDef() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::<_usbd_device>(), - 192usize, - concat!("Size of: ", stringify!(_usbd_device)) - ); - assert_eq!( - ::core::mem::align_of::<_usbd_device>(), - 8usize, - 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 }, - 8usize, - 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 }, + ::core::mem::size_of::(), 16usize, - concat!( - "Offset of field: ", - stringify!(_usbd_device), - "::", - stringify!(complete_callback) - ) + concat!("Size of: ", stringify!(LL_LPTIM_InitTypeDef)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_usbd_device), - "::", - stringify!(config_callback) - ) + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(LL_LPTIM_InitTypeDef)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).descriptor_callback) as usize - ptr as usize }, - 32usize, + unsafe { ::core::ptr::addr_of!((*ptr).ClockSource) as usize - ptr as usize }, + 0usize, concat!( "Offset of field: ", - stringify!(_usbd_device), + stringify!(LL_LPTIM_InitTypeDef), "::", - stringify!(descriptor_callback) + stringify!(ClockSource) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).events) as usize - ptr as usize }, - 40usize, + unsafe { ::core::ptr::addr_of!((*ptr).Prescaler) as usize - ptr as usize }, + 4usize, concat!( "Offset of field: ", - stringify!(_usbd_device), + stringify!(LL_LPTIM_InitTypeDef), "::", - stringify!(events) + stringify!(Prescaler) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).endpoint) as usize - ptr as usize }, - 104usize, + unsafe { ::core::ptr::addr_of!((*ptr).Waveform) as usize - ptr as usize }, + 8usize, concat!( "Offset of field: ", - stringify!(_usbd_device), + stringify!(LL_LPTIM_InitTypeDef), "::", - stringify!(endpoint) + stringify!(Waveform) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, - 168usize, + unsafe { ::core::ptr::addr_of!((*ptr).Polarity) as usize - ptr as usize }, + 12usize, concat!( "Offset of field: ", - stringify!(_usbd_device), + stringify!(LL_LPTIM_InitTypeDef), "::", - stringify!(status) + stringify!(Polarity) ) ); } -#[doc = "\\brief Represents a USB device descriptor"] -#[doc = " \\details A device descriptor describes general information about a USB device. It includes"] -#[doc = " information that applies globally to the device and all of the device’s configurations. A USB"] -#[doc = " device has only one device descriptor. A high-speed capable device that has different device"] -#[doc = " information for full-speed and high-speed must also have a \\ref usb_qualifier_descriptor."] +extern "C" { + #[doc = " @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions"] + #[doc = " @{"] + pub fn LL_LPTIM_DeInit(LPTIMx: *mut LPTIM_TypeDef) -> ErrorStatus; +} +extern "C" { + pub fn LL_LPTIM_Init( + LPTIMx: *mut LPTIM_TypeDef, + LPTIM_InitStruct: *mut LL_LPTIM_InitTypeDef, + ) -> ErrorStatus; +} +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"] + #[doc = ""] + #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] + #[doc = " @param[in] freq Frequency in Hz"] + #[doc = " @param[in] duty Duty cycle value in %"] + pub fn furi_hal_pwm_start(channel: FuriHalPwmOutputId, freq: u32, duty: u8); +} +extern "C" { + #[doc = " Disable PWM channel"] + #[doc = ""] + #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] + pub fn furi_hal_pwm_stop(channel: FuriHalPwmOutputId); +} +extern "C" { + #[doc = " Set PWM channel parameters"] + #[doc = ""] + #[doc = " @param[in] channel PWM channel (FuriHalPwmOutputId)"] + #[doc = " @param[in] freq Frequency in Hz"] + #[doc = " @param[in] duty Duty cycle value in %"] + pub fn furi_hal_pwm_set_params(channel: FuriHalPwmOutputId, freq: u32, duty: u8); +} +pub const CC1101State_CC1101StateIDLE: CC1101State = 0; +#[doc = " IDLE state"] +pub const CC1101State_CC1101StateRX: CC1101State = 1; +#[doc = " Receive mode"] +pub const CC1101State_CC1101StateTX: CC1101State = 2; +#[doc = " Transmit mode"] +pub const CC1101State_CC1101StateFSTXON: CC1101State = 3; +#[doc = " Fast TX ready"] +pub const CC1101State_CC1101StateCALIBRATE: CC1101State = 4; +#[doc = " Frequency synthesizer calibration is running"] +pub const CC1101State_CC1101StateSETTLING: CC1101State = 5; +#[doc = " PLL is settling"] +pub const CC1101State_CC1101StateRXFIFO_OVERFLOW: CC1101State = 6; +#[doc = " RX FIFO has overflowed. Read out any useful data, then flush the FIFO with SFRX"] +pub const CC1101State_CC1101StateTXFIFO_UNDERFLOW: CC1101State = 7; +pub type CC1101State = core::ffi::c_uchar; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CC1101Status { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, +} +#[test] +fn bindgen_test_layout_CC1101Status() { + assert_eq!( + ::core::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(CC1101Status)) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CC1101Status)) + ); +} +impl CC1101Status { + #[inline] + pub fn FIFO_BYTES_AVAILABLE(&self) -> u8 { + unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } + } + #[inline] + pub fn set_FIFO_BYTES_AVAILABLE(&mut self, val: u8) { + unsafe { + let val: u8 = ::core::mem::transmute(val); + self._bitfield_1.set(0usize, 4u8, val as u64) + } + } + #[inline] + pub fn STATE(&self) -> CC1101State { + unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 3u8) as u8) } + } + #[inline] + pub fn set_STATE(&mut self, val: CC1101State) { + unsafe { + let val: u8 = ::core::mem::transmute(val); + self._bitfield_1.set(4usize, 3u8, val as u64) + } + } + #[inline] + pub fn CHIP_RDYn(&self) -> bool { + unsafe { ::core::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) } + } + #[inline] + pub fn set_CHIP_RDYn(&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( + FIFO_BYTES_AVAILABLE: u8, + STATE: CC1101State, + CHIP_RDYn: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 4u8, { + let FIFO_BYTES_AVAILABLE: u8 = unsafe { ::core::mem::transmute(FIFO_BYTES_AVAILABLE) }; + FIFO_BYTES_AVAILABLE as u64 + }); + __bindgen_bitfield_unit.set(4usize, 3u8, { + let STATE: u8 = unsafe { ::core::mem::transmute(STATE) }; + STATE as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let CHIP_RDYn: u8 = unsafe { ::core::mem::transmute(CHIP_RDYn) }; + CHIP_RDYn as u64 + }); + __bindgen_bitfield_unit + } +} +extern "C" { + #[doc = " Strobe command to the device"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param strobe - command to execute"] + #[doc = ""] + #[doc = " @return device status"] + pub fn cc1101_strobe(handle: *mut FuriHalSpiBusHandle, strobe: u8) -> CC1101Status; +} +extern "C" { + #[doc = " Write device register"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param reg - register"] + #[doc = " @param data - data to write"] + #[doc = ""] + #[doc = " @return device status"] + pub fn cc1101_write_reg(handle: *mut FuriHalSpiBusHandle, reg: u8, data: u8) -> CC1101Status; +} +extern "C" { + #[doc = " Read device register"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param reg - register"] + #[doc = " @param[out] data - pointer to data"] + #[doc = ""] + #[doc = " @return device status"] + pub fn cc1101_read_reg( + handle: *mut FuriHalSpiBusHandle, + reg: u8, + data: *mut u8, + ) -> CC1101Status; +} +extern "C" { + #[doc = " Reset"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_reset(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Get status"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = ""] + #[doc = " @return CC1101Status structure"] + pub fn cc1101_get_status(handle: *mut FuriHalSpiBusHandle) -> CC1101Status; +} +extern "C" { + #[doc = " Enable shutdown mode"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_shutdown(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Get raw RSSI value"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = ""] + #[doc = " @return rssi value"] + pub fn cc1101_get_rssi(handle: *mut FuriHalSpiBusHandle) -> u8; +} +extern "C" { + #[doc = " Calibrate oscillator"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_calibrate(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Switch to idle"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_switch_to_idle(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Switch to RX"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_switch_to_rx(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Switch to TX"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_switch_to_tx(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Flush RX FIFO"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_flush_rx(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Flush TX FIFO"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + pub fn cc1101_flush_tx(handle: *mut FuriHalSpiBusHandle); +} +extern "C" { + #[doc = " Set Frequency"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param value - frequency in herz"] + #[doc = ""] + #[doc = " @return real frequency that were synthesized"] + pub fn cc1101_set_frequency(handle: *mut FuriHalSpiBusHandle, value: u32) -> u32; +} +extern "C" { + #[doc = " Set Power Amplifier level table, ramp"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param value - array of power level values"] + pub fn cc1101_set_pa_table(handle: *mut FuriHalSpiBusHandle, value: *const u8); +} +extern "C" { + #[doc = " Write FIFO"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param data pointer to byte array"] + #[doc = " @param size write bytes count"] + #[doc = ""] + #[doc = " @return size, written bytes count"] + pub fn cc1101_write_fifo(handle: *mut FuriHalSpiBusHandle, data: *const u8, size: u8) -> u8; +} +extern "C" { + #[doc = " Read FIFO"] + #[doc = ""] + #[doc = " @param handle - pointer to FuriHalSpiHandle"] + #[doc = " @param data pointer to byte array"] + #[doc = " @param size bytes to read from fifo"] + #[doc = ""] + #[doc = " @return size, read bytes count"] + pub fn cc1101_read_fifo(handle: *mut FuriHalSpiBusHandle, data: *mut u8, size: *mut u8) -> u8; +} +#[doc = "\\brief Line Coding Structure"] #[repr(C, packed)] #[derive(Debug, Copy, Clone)] -pub struct usb_device_descriptor { - #[doc = "<\\brief Size of the descriptor, in bytes."] - pub bLength: u8, - #[doc = "<\\brief \\ref USB_DTYPE_DEVICE Device descriptor."] - pub bDescriptorType: u8, - #[doc = "<\\brief BCD of the supported USB specification."] - pub bcdUSB: u16, - #[doc = "<\\brief USB device class."] - pub bDeviceClass: u8, - #[doc = "<\\brief USB device subclass."] - pub bDeviceSubClass: u8, - #[doc = "<\\brief USB device protocol."] - pub bDeviceProtocol: u8, - #[doc = "<\\brief Size of the control endpoint's bank in bytes."] - pub bMaxPacketSize0: u8, - #[doc = "<\\brief Vendor ID for the USB product."] - pub idVendor: u16, - #[doc = "<\\brief Unique product ID for the USB product."] - pub idProduct: u16, - #[doc = "<\\brief Product release (version) number."] - pub bcdDevice: u16, - #[doc = "<\\brief String index for the manufacturer's name."] - pub iManufacturer: u8, - #[doc = "<\\brief String index for the product name/details."] - pub iProduct: u8, - #[doc = "<\\brief String index for the product serial number."] - pub iSerialNumber: u8, - #[doc = "<\\brief Total number of configurations supported by the device."] - pub bNumConfigurations: u8, +pub struct usb_cdc_line_coding { + #[doc = "<\\brief Data terminal rate, in bits per second."] + pub dwDTERate: u32, + #[doc = "<\\brief Stop bits."] + pub bCharFormat: u8, + #[doc = "<\\brief Parity."] + pub bParityType: u8, + #[doc = "<\\brief Data bits (5,6,7,8 or 16)."] + pub bDataBits: u8, } #[test] -fn bindgen_test_layout_usb_device_descriptor() { - const UNINIT: ::core::mem::MaybeUninit = +fn bindgen_test_layout_usb_cdc_line_coding() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 18usize, - concat!("Size of: ", stringify!(usb_device_descriptor)) + ::core::mem::size_of::(), + 7usize, + concat!("Size of: ", stringify!(usb_cdc_line_coding)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 1usize, - concat!("Alignment of ", stringify!(usb_device_descriptor)) + concat!("Alignment of ", stringify!(usb_cdc_line_coding)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bLength) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dwDTERate) 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!(usb_cdc_line_coding), "::", - stringify!(bcdUSB) + stringify!(dwDTERate) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bDeviceClass) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).bCharFormat) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", - stringify!(usb_device_descriptor), + stringify!(usb_cdc_line_coding), "::", - stringify!(bDeviceClass) + stringify!(bCharFormat) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bDeviceSubClass) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).bParityType) as usize - ptr as usize }, 5usize, concat!( "Offset of field: ", - stringify!(usb_device_descriptor), + stringify!(usb_cdc_line_coding), "::", - stringify!(bDeviceSubClass) + stringify!(bParityType) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).bDeviceProtocol) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).bDataBits) 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!(usb_cdc_line_coding), "::", - stringify!(bNumConfigurations) + stringify!(bDataBits) ) ); } -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 struct CdcCallbacks { + pub tx_ep_callback: + ::core::option::Option, + pub rx_ep_callback: + ::core::option::Option, + pub state_callback: + ::core::option::Option, + pub ctrl_line_callback: + ::core::option::Option, + pub config_callback: ::core::option::Option< + unsafe extern "C" fn(context: *mut core::ffi::c_void, config: *mut usb_cdc_line_coding), >, - pub deinit: ::core::option::Option, - pub wakeup: ::core::option::Option, - pub suspend: ::core::option::Option, - 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 = - ::core::mem::MaybeUninit::uninit(); +fn bindgen_test_layout_CdcCallbacks() { + const UNINIT: ::core::mem::MaybeUninit = ::core::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( - ::core::mem::size_of::(), - 72usize, - concat!("Size of: ", stringify!(FuriHalUsbInterface)) + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CdcCallbacks)) ); assert_eq!( - ::core::mem::align_of::(), + ::core::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(FuriHalUsbInterface)) + concat!("Alignment of ", stringify!(CdcCallbacks)) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).init) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).tx_ep_callback) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(FuriHalUsbInterface), + stringify!(CdcCallbacks), "::", - stringify!(init) + stringify!(tx_ep_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).deinit) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).rx_ep_callback) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(FuriHalUsbInterface), + stringify!(CdcCallbacks), "::", - stringify!(deinit) + stringify!(rx_ep_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).wakeup) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).state_callback) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(FuriHalUsbInterface), + stringify!(CdcCallbacks), "::", - stringify!(wakeup) + stringify!(state_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).suspend) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).ctrl_line_callback) as usize - ptr as usize }, 24usize, concat!( "Offset of field: ", - stringify!(FuriHalUsbInterface), + stringify!(CdcCallbacks), "::", - stringify!(suspend) + stringify!(ctrl_line_callback) ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).dev_descr) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).config_callback) as usize - ptr as usize }, 32usize, 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 }, - 40usize, - 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 }, - 48usize, - 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 }, - 56usize, - 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 }, - 64usize, - concat!( - "Offset of field: ", - stringify!(FuriHalUsbInterface), + stringify!(CdcCallbacks), "::", - stringify!(cfg_descr) + stringify!(config_callback) ) ); } 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" { - #[doc = " Set USB device configuration"] - #[doc = ""] - #[doc = " @param mode new USB device mode"] - #[doc = " @param ctx context passed to device mode init function"] - #[doc = " @return true - 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"] - #[doc = ""] - #[doc = " @return current 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"] - #[doc = ""] - #[doc = " @return lock 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; -extern "C" { - #[doc = " Get USB HID connection state"] - #[doc = ""] - #[doc = " @return true / false"] - pub fn furi_hal_hid_is_connected() -> bool; -} -extern "C" { - #[doc = " Get USB HID keyboard leds state"] - #[doc = ""] - #[doc = " @return leds state"] - pub fn furi_hal_hid_get_led_state() -> u8; -} -extern "C" { - #[doc = " Set USB HID connect/disconnect callback"] - #[doc = ""] - #[doc = " @param cb callback"] - #[doc = " @param 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"] - #[doc = ""] - #[doc = " @param 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"] - #[doc = ""] - #[doc = " @param button key code"] - pub fn furi_hal_hid_kb_release(button: u16) -> bool; -} -extern "C" { - #[doc = " Clear all pressed keys and send HID report"] - #[doc = ""] - pub fn furi_hal_hid_kb_release_all() -> bool; -} -extern "C" { - #[doc = " Set mouse movement and send HID report"] - #[doc = ""] - #[doc = " @param dx x coordinate delta"] - #[doc = " @param 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"] - #[doc = ""] - #[doc = " @param 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"] - #[doc = ""] - #[doc = " @param button key code"] - pub fn furi_hal_hid_mouse_release(button: u8) -> bool; -} -extern "C" { - #[doc = " Set mouse wheel position and send HID report"] - #[doc = ""] - #[doc = " @param delta number of scroll steps"] - pub fn furi_hal_hid_mouse_scroll(delta: i8) -> bool; + pub fn furi_hal_cdc_set_callbacks( + if_num: u8, + cb: *mut CdcCallbacks, + context: *mut core::ffi::c_void, + ); } extern "C" { - #[doc = " Set the following consumer key to pressed state and send HID report"] - #[doc = ""] - #[doc = " @param button key code"] - pub fn furi_hal_hid_consumer_key_press(button: u16) -> bool; + pub fn furi_hal_cdc_get_port_settings(if_num: u8) -> *mut usb_cdc_line_coding; } extern "C" { - #[doc = " Set the following consumer key to released state and send HID report"] - #[doc = ""] - #[doc = " @param button key code"] - pub fn furi_hal_hid_consumer_key_release(button: u16) -> bool; + pub fn furi_hal_cdc_get_ctrl_line_state(if_num: u8) -> u8; } extern "C" { - #[doc = " Get device information"] - #[doc = ""] - #[doc = " @param[in] callback callback to provide with new data"] - #[doc = " @param[in] sep category separator character"] - #[doc = " @param[in] context context to pass to callback"] - pub fn furi_hal_info_get( - callback: PropertyValueCallback, - sep: core::ffi::c_char, - context: *mut core::ffi::c_void, - ); + pub fn furi_hal_cdc_send(if_num: u8, buf: *mut u8, len: u16); } extern "C" { - #[doc = " Get random value"] - #[doc = ""] - #[doc = " @return random value"] - pub fn furi_hal_random_get() -> u32; + pub fn furi_hal_cdc_receive(if_num: u8, buf: *mut u8, max_len: u16) -> i32; } extern "C" { - #[doc = " Fill buffer with random data"] - #[doc = ""] - #[doc = " @param buf buffer pointer"] - #[doc = " @param data buffer len"] - pub fn furi_hal_random_fill_buf(buf: *mut u8, len: u32); + pub fn __errno() -> *mut core::ffi::c_int; } extern "C" { - #[doc = " Transfer execution to address"] - #[doc = ""] - #[doc = " @param[in] address pointer to new executable"] - pub fn furi_hal_switch(address: *mut core::ffi::c_void); + pub fn __clear_cache(arg1: *mut core::ffi::c_void, arg2: *mut core::ffi::c_void); } extern "C" { #[doc = " Start Hid Keyboard Profile"] @@ -20766,21 +21062,22 @@ extern "C" { } pub const LFRFIDProtocol_LFRFIDProtocolEM4100: LFRFIDProtocol = 0; pub const LFRFIDProtocol_LFRFIDProtocolH10301: LFRFIDProtocol = 1; -pub const LFRFIDProtocol_LFRFIDProtocolIndala26: LFRFIDProtocol = 2; -pub const LFRFIDProtocol_LFRFIDProtocolIOProxXSF: LFRFIDProtocol = 3; -pub const LFRFIDProtocol_LFRFIDProtocolAwid: LFRFIDProtocol = 4; -pub const LFRFIDProtocol_LFRFIDProtocolFDXA: LFRFIDProtocol = 5; -pub const LFRFIDProtocol_LFRFIDProtocolFDXB: LFRFIDProtocol = 6; -pub const LFRFIDProtocol_LFRFIDProtocolHidGeneric: LFRFIDProtocol = 7; -pub const LFRFIDProtocol_LFRFIDProtocolHidExGeneric: LFRFIDProtocol = 8; -pub const LFRFIDProtocol_LFRFIDProtocolPyramid: LFRFIDProtocol = 9; -pub const LFRFIDProtocol_LFRFIDProtocolViking: LFRFIDProtocol = 10; -pub const LFRFIDProtocol_LFRFIDProtocolJablotron: LFRFIDProtocol = 11; -pub const LFRFIDProtocol_LFRFIDProtocolParadox: LFRFIDProtocol = 12; -pub const LFRFIDProtocol_LFRFIDProtocolPACStanley: LFRFIDProtocol = 13; -pub const LFRFIDProtocol_LFRFIDProtocolKeri: LFRFIDProtocol = 14; -pub const LFRFIDProtocol_LFRFIDProtocolGallagher: LFRFIDProtocol = 15; -pub const LFRFIDProtocol_LFRFIDProtocolMax: LFRFIDProtocol = 16; +pub const LFRFIDProtocol_LFRFIDProtocolIdteck: LFRFIDProtocol = 2; +pub const LFRFIDProtocol_LFRFIDProtocolIndala26: LFRFIDProtocol = 3; +pub const LFRFIDProtocol_LFRFIDProtocolIOProxXSF: LFRFIDProtocol = 4; +pub const LFRFIDProtocol_LFRFIDProtocolAwid: LFRFIDProtocol = 5; +pub const LFRFIDProtocol_LFRFIDProtocolFDXA: LFRFIDProtocol = 6; +pub const LFRFIDProtocol_LFRFIDProtocolFDXB: LFRFIDProtocol = 7; +pub const LFRFIDProtocol_LFRFIDProtocolHidGeneric: LFRFIDProtocol = 8; +pub const LFRFIDProtocol_LFRFIDProtocolHidExGeneric: LFRFIDProtocol = 9; +pub const LFRFIDProtocol_LFRFIDProtocolPyramid: LFRFIDProtocol = 10; +pub const LFRFIDProtocol_LFRFIDProtocolViking: LFRFIDProtocol = 11; +pub const LFRFIDProtocol_LFRFIDProtocolJablotron: LFRFIDProtocol = 12; +pub const LFRFIDProtocol_LFRFIDProtocolParadox: LFRFIDProtocol = 13; +pub const LFRFIDProtocol_LFRFIDProtocolPACStanley: LFRFIDProtocol = 14; +pub const LFRFIDProtocol_LFRFIDProtocolKeri: LFRFIDProtocol = 15; +pub const LFRFIDProtocol_LFRFIDProtocolGallagher: LFRFIDProtocol = 16; +pub const LFRFIDProtocol_LFRFIDProtocolMax: LFRFIDProtocol = 17; pub type LFRFIDProtocol = core::ffi::c_uchar; extern "C" { pub static mut lfrfid_protocols: [*const ProtocolBase; 0usize]; @@ -23250,6 +23547,7 @@ pub struct NfcDevice { pub dev_data: NfcDeviceData, pub dev_name: [core::ffi::c_char; 23usize], pub load_path: *mut FuriString, + pub folder: *mut FuriString, pub format: NfcDeviceSaveFormat, pub shadow_file_exist: bool, pub loading_cb: NfcLoadingCallback, @@ -23261,7 +23559,7 @@ fn bindgen_test_layout_NfcDevice() { let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::(), - 4336usize, + 4344usize, concat!("Size of: ", stringify!(NfcDevice)) ); assert_eq!( @@ -23320,8 +23618,18 @@ fn bindgen_test_layout_NfcDevice() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).folder) as usize - ptr as usize }, 4312usize, + concat!( + "Offset of field: ", + stringify!(NfcDevice), + "::", + stringify!(folder) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, + 4320usize, concat!( "Offset of field: ", stringify!(NfcDevice), @@ -23331,7 +23639,7 @@ fn bindgen_test_layout_NfcDevice() { ); assert_eq!( unsafe { ::core::ptr::addr_of!((*ptr).shadow_file_exist) as usize - ptr as usize }, - 4313usize, + 4321usize, concat!( "Offset of field: ", stringify!(NfcDevice), @@ -23341,7 +23649,7 @@ fn bindgen_test_layout_NfcDevice() { ); assert_eq!( unsafe { ::core::ptr::addr_of!((*ptr).loading_cb) as usize - ptr as usize }, - 4320usize, + 4328usize, concat!( "Offset of field: ", stringify!(NfcDevice), @@ -23351,7 +23659,7 @@ fn bindgen_test_layout_NfcDevice() { ); assert_eq!( unsafe { ::core::ptr::addr_of!((*ptr).loading_cb_ctx) as usize - ptr as usize }, - 4328usize, + 4336usize, concat!( "Offset of field: ", stringify!(NfcDevice), @@ -26068,6 +26376,14 @@ extern "C" { version: u8, ) -> bool; } +extern "C" { + pub fn saved_struct_get_payload_size( + path: *const core::ffi::c_char, + magic: u8, + version: u8, + payload_size: *mut usize, + ) -> bool; +} extern "C" { #[doc = " Allocate string stream"] #[doc = " @return Stream*"] diff --git a/examples/dialog/Cargo.lock b/examples/dialog/Cargo.lock index b899918f..11b056fd 100644 --- a/examples/dialog/Cargo.lock +++ b/examples/dialog/Cargo.lock @@ -14,25 +14,25 @@ dependencies = [ [[package]] name = "flipperzero" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-alloc" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-rt" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-sys" -version = "0.5.0" +version = "0.6.0-alpha" diff --git a/examples/dialog/Cargo.toml b/examples/dialog/Cargo.toml index 4dc6a951..ac1fd12c 100644 --- a/examples/dialog/Cargo.toml +++ b/examples/dialog/Cargo.toml @@ -14,7 +14,7 @@ bench = false test = false [dependencies] -flipperzero = { version = "0.5.0", path = "../../crates/flipperzero", features = ["alloc"] } -flipperzero-alloc = { version = "0.5.0", path = "../../crates/alloc" } -flipperzero-sys = { version = "0.5.0", path = "../../crates/sys" } -flipperzero-rt = { version = "0.5.0", path = "../../crates/rt" } +flipperzero = { version = "0.6.0-alpha", path = "../../crates/flipperzero", features = ["alloc"] } +flipperzero-alloc = { version = "0.6.0-alpha", path = "../../crates/alloc" } +flipperzero-sys = { version = "0.6.0-alpha", path = "../../crates/sys" } +flipperzero-rt = { version = "0.6.0-alpha", path = "../../crates/rt" } diff --git a/examples/gui/Cargo.lock b/examples/gui/Cargo.lock index 53c01373..0d93b962 100644 --- a/examples/gui/Cargo.lock +++ b/examples/gui/Cargo.lock @@ -4,21 +4,21 @@ version = 3 [[package]] name = "flipperzero" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-rt" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-sys" -version = "0.5.0" +version = "0.6.0-alpha" [[package]] name = "gui" diff --git a/examples/gui/Cargo.toml b/examples/gui/Cargo.toml index b7eb5ff0..3a92c8cb 100644 --- a/examples/gui/Cargo.toml +++ b/examples/gui/Cargo.toml @@ -14,6 +14,6 @@ bench = false test = false [dependencies] -flipperzero = { version = "0.5.0", path = "../../crates/flipperzero" } -flipperzero-sys = { version = "0.5.0", path = "../../crates/sys" } -flipperzero-rt = { version = "0.5.0", path = "../../crates/rt" } +flipperzero = { version = "0.6.0-alpha", path = "../../crates/flipperzero" } +flipperzero-sys = { version = "0.6.0-alpha", path = "../../crates/sys" } +flipperzero-rt = { version = "0.6.0-alpha", path = "../../crates/rt" } diff --git a/examples/hello-rust/Cargo.lock b/examples/hello-rust/Cargo.lock index db4da008..376758dd 100644 --- a/examples/hello-rust/Cargo.lock +++ b/examples/hello-rust/Cargo.lock @@ -4,21 +4,21 @@ version = 3 [[package]] name = "flipperzero" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-rt" -version = "0.5.0" +version = "0.6.0-alpha" dependencies = [ "flipperzero-sys", ] [[package]] name = "flipperzero-sys" -version = "0.5.0" +version = "0.6.0-alpha" [[package]] name = "hello-rust" diff --git a/examples/hello-rust/Cargo.toml b/examples/hello-rust/Cargo.toml index 2fe2a0c3..79a7977a 100644 --- a/examples/hello-rust/Cargo.toml +++ b/examples/hello-rust/Cargo.toml @@ -14,6 +14,6 @@ bench = false test = false [dependencies] -flipperzero = { version = "0.5.0", path = "../../crates/flipperzero" } -flipperzero-sys = { version = "0.5.0", path = "../../crates/sys" } -flipperzero-rt = { version = "0.5.0", path = "../../crates/rt" } +flipperzero = { version = "0.6.0-alpha", path = "../../crates/flipperzero" } +flipperzero-sys = { version = "0.6.0-alpha", path = "../../crates/sys" } +flipperzero-rt = { version = "0.6.0-alpha", path = "../../crates/rt" }