-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
30 lines (26 loc) · 756 Bytes
/
mod.rs
File metadata and controls
30 lines (26 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pub mod battery;
#[cfg(debug_assertions)]
pub mod brownout;
mod error;
pub mod ext_drivers;
pub mod ledctl;
pub mod logging;
mod macros;
pub mod net;
pub mod nvs;
pub mod ota;
pub mod panic;
pub mod periph;
pub mod power;
pub mod usbctl;
pub use error::{OsError, ReportableError};
pub type OsResult<T> = ::std::result::Result<T, OsError>;
#[cfg(debug_assertions)]
/// Try and get the ESP-IDF version.
pub fn get_idf_version() -> Option<std::borrow::Cow<'static, str>> {
use std::{ffi::CStr, ptr::NonNull};
let version_str_ptr =
NonNull::new(unsafe { esp_idf_svc::sys::esp_get_idf_version().cast_mut() })?;
let version_str = unsafe { CStr::from_ptr(version_str_ptr.as_ptr().cast_const()) };
Some(version_str.to_string_lossy())
}