@@ -2,14 +2,18 @@ use crate::{structs::PossibleGroup, utils::signaled_mutex::SignaledMutex};
22use alloc:: { rc:: Rc , string:: String , vec:: Vec } ;
33use embassy_sync:: {
44 blocking_mutex:: raw:: { CriticalSectionRawMutex , NoopRawMutex } ,
5+ mutex:: Mutex ,
56 signal:: Signal ,
67} ;
78use embassy_time:: { Duration , Instant , Timer } ;
9+ use esp_hal:: aes:: Aes ;
810use esp_hal_wifimanager:: Nvs ;
911use serde:: { Deserialize , Serialize } ;
1012
11- pub static mut EPOCH_BASE : u64 = 0 ;
1213pub static mut SIGN_KEY : u32 = 0 ;
14+ pub static mut TRUST_SERVER : bool = false ;
15+
16+ pub static mut EPOCH_BASE : u64 = 0 ;
1317pub static mut SLEEP_STATE : bool = false ;
1418pub static mut DEEPER_SLEEP : bool = false ;
1519pub static mut OTA_STATE : bool = false ;
@@ -127,20 +131,22 @@ pub struct GlobalStateInner {
127131 pub update_progress : Signal < CriticalSectionRawMutex , u8 > ,
128132
129133 pub nvs : Nvs ,
134+ pub aes : Mutex < NoopRawMutex , Aes < ' static > > ,
130135
131136 #[ cfg( feature = "e2e" ) ]
132137 pub e2e : End2End ,
133138}
134139
135140impl GlobalStateInner {
136- pub fn new ( nvs : & Nvs ) -> Self {
141+ pub fn new ( nvs : & Nvs , aes : esp_hal :: peripherals :: AES < ' static > ) -> Self {
137142 Self {
138143 state : SignaledMutex :: new ( SignaledGlobalStateInner :: new ( ) ) ,
139144 timer_signal : Signal :: new ( ) ,
140145 show_battery : Signal :: new ( ) ,
141146 update_progress : Signal :: new ( ) ,
142147
143148 nvs : nvs. clone ( ) ,
149+ aes : Mutex :: new ( Aes :: new ( aes) ) ,
144150
145151 #[ cfg( feature = "e2e" ) ]
146152 e2e : End2End :: new ( ) ,
0 commit comments