1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-08-04 12:56:25 +00:00

fix(core): fix async pmic variable reading [no changelog]

This commit is contained in:
kopecdav 2025-05-06 14:31:45 +02:00 committed by kopecdav
parent 17031852cf
commit b3e76e557e
2 changed files with 8 additions and 3 deletions

View File

@ -228,7 +228,12 @@ pm_status_t pm_turn_on(void) {
}
// Poll until at least single PMIC measurement is done
while(drv->pmic_last_update_ms == 0){};
uint32_t pmic_last_update_ms;
do{
irq_key_t irq_key = irq_lock();
pmic_last_update_ms = drv->pmic_last_update_ms;
irq_unlock(irq_key);
} while(pmic_last_update_ms == 0);
// Check if device has enough power to startup
if(drv->pmic_data.usb_status == 0x0 &&

View File

@ -89,8 +89,8 @@ typedef struct {
// Power source hardware state
npm1300_report_t pmic_data;
stwlc38_report_t wireless_data;
volatile uint32_t pmic_last_update_ms;
volatile uint32_t pmic_sampling_period_ms;
uint32_t pmic_last_update_ms;
uint32_t pmic_sampling_period_ms;
bool pmic_measurement_ready;
// Power source logical state