mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-01 03:18:12 +00:00
fix(core/rust): make rust crate compilable without UI
[no changelog]
This commit is contained in:
parent
dda281e78a
commit
4e31a9e20a
@ -1,7 +1,10 @@
|
||||
#[cfg(feature = "micropython")]
|
||||
mod micropython;
|
||||
|
||||
use crate::{error::Error, ui::event::BLEEvent};
|
||||
#[cfg(feature = "ui")]
|
||||
use crate::ui::event::BLEEvent;
|
||||
|
||||
use crate::error::Error;
|
||||
use core::mem::size_of;
|
||||
|
||||
use super::ffi;
|
||||
@ -23,6 +26,7 @@ fn prefix_utf8_bytes(text: &str, max_len: usize) -> &[u8] {
|
||||
&text.as_bytes()[..i]
|
||||
}
|
||||
|
||||
#[cfg(feature = "ui")]
|
||||
pub fn ble_parse_event(event: ffi::ble_event_t) -> BLEEvent {
|
||||
match event.type_ {
|
||||
ffi::ble_event_type_t_BLE_CONNECTED => BLEEvent::Connected,
|
||||
|
@ -18,7 +18,7 @@ pub mod button;
|
||||
#[cfg(feature = "touch")]
|
||||
pub mod touch;
|
||||
|
||||
#[cfg(feature = "hw_jpeg_decoder")]
|
||||
#[cfg(all(feature = "ui", feature = "hw_jpeg_decoder"))]
|
||||
pub mod jpegdec;
|
||||
pub mod model;
|
||||
pub mod random;
|
||||
@ -44,3 +44,9 @@ pub mod power_manager;
|
||||
|
||||
#[cfg(any(feature = "bootloader", feature = "prodtest"))]
|
||||
pub mod layout_buf;
|
||||
|
||||
#[cfg(feature = "nrf")]
|
||||
pub mod irq;
|
||||
|
||||
#[cfg(feature = "nrf")]
|
||||
pub mod nrf;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::ffi;
|
||||
|
||||
#[cfg(feature = "ui")]
|
||||
use crate::ui::event::PMEvent;
|
||||
|
||||
pub enum ChargingState {
|
||||
@ -8,6 +9,7 @@ pub enum ChargingState {
|
||||
Idle,
|
||||
}
|
||||
|
||||
#[cfg(feature = "ui")]
|
||||
pub fn pm_parse_event(event: ffi::pm_event_t) -> PMEvent {
|
||||
let mut pm_event = PMEvent::default();
|
||||
|
||||
|
@ -144,7 +144,6 @@ def add_rust_lib(*, env, build, profile, features, all_paths, build_dir):
|
||||
def cargo_build():
|
||||
lib_features = []
|
||||
lib_features.extend(features)
|
||||
lib_features.append("ui")
|
||||
|
||||
cargo_opts = [
|
||||
f"--target={RUST_TARGET}",
|
||||
|
@ -28,6 +28,7 @@ def init_ui(
|
||||
):
|
||||
conf = models.get_model_ui_conf(model)
|
||||
get_ui_module(model, stage).init_ui(stage, conf, rust_features)
|
||||
rust_features.append("ui")
|
||||
|
||||
|
||||
def get_ui_layout(model: str):
|
||||
|
Loading…
Reference in New Issue
Block a user