Skip to content

Commit ea3b032

Browse files
committed
add build flags to bao-console
two flags are added: with-pddb - puts the PDDB commands into the console battery-readout - turns on the periodic battery readout
1 parent 4bc762e commit ea3b032

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

services/bao-console/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ hosted-baosec = [
5050
"cramium-hal/hosted-baosec",
5151
]
5252
usb = []
53-
pddbtest = []
53+
battery-readout = []
54+
with-pddb = []
55+
pddbtest = ["with-pddb"]
5456
test-rekey = []
5557
autobasis = ["rand_chacha", "rand"]
5658
modal-testing = ["ux-api", "modals/modal-testing"]

services/bao-console/src/cmds.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ use trng_cmd::*;
8787
mod usb;
8888
#[cfg(feature = "usb")]
8989
use usb::*;
90+
#[cfg(feature = "with-pddb")]
9091
mod pddb;
92+
#[cfg(feature = "with-pddb")]
9193
use pddb::*;
9294

9395
pub struct CmdEnv {
@@ -97,6 +99,7 @@ pub struct CmdEnv {
9799
trng_cmd: TrngCmd,
98100
#[cfg(feature = "usb")]
99101
usb: Usb,
102+
#[cfg(feature = "with-pddb")]
100103
pddb_cmd: PddbCmd,
101104
}
102105
impl CmdEnv {
@@ -120,6 +123,7 @@ impl CmdEnv {
120123
},
121124
#[cfg(feature = "usb")]
122125
usb: Usb::new(),
126+
#[cfg(feature = "with-pddb")]
123127
pddb_cmd: PddbCmd::new(),
124128
}
125129
}
@@ -142,6 +146,7 @@ impl CmdEnv {
142146
&mut console_cmd,
143147
#[cfg(feature = "usb")]
144148
&mut self.usb,
149+
#[cfg(feature = "with-pddb")]
145150
&mut self.pddb_cmd,
146151
];
147152

services/bao-console/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn main() {
108108
modals::tests::spawn_test();
109109
}
110110

111-
#[cfg(not(feature = "hosted-baosec"))]
111+
#[cfg(feature = "battery-readout")]
112112
{
113113
use cramium_api::I2cApi;
114114
let mut i2c = cram_hal_service::I2c::new();
@@ -126,7 +126,7 @@ fn main() {
126126
}
127127
}
128128
}
129-
#[cfg(feature = "hosted-baosec")]
129+
#[cfg(any(feature = "hosted-baosec", not(feature = "battery-readout")))]
130130
loop {
131131
tt.sleep_ms(2_000).ok();
132132
}

0 commit comments

Comments
 (0)