Skip to content

Commit

Permalink
fixup! fix(core): fix tamper setting
Browse files Browse the repository at this point in the history
  • Loading branch information
TychoVrahe committed Mar 3, 2025
1 parent 231f59d commit 559a446
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/embed/sys/tamper/inc/sys/tamper.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// as well as external tamper input if it's available on the device

// Initializes the tamper detection
void tamper_init(void);
bool tamper_init(void);

// Get status of external tamper inputs
uint8_t tamper_external_read(void);
Expand Down
12 changes: 9 additions & 3 deletions core/embed/sys/tamper/stm32u5/tamper.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ HAL_StatusTypeDef clk_init(uint32_t source) {
return HAL_OK;
}

void tamper_init(void) {
bool tamper_init(void) {
#ifdef USE_LSE
clk_init(RCC_RTCCLKSOURCE_LSE);
HAL_StatusTypeDef res = clk_init(RCC_RTCCLKSOURCE_LSE);
#else
clk_init(RCC_RTCCLKSOURCE_LSI);
HAL_StatusTypeDef res = clk_init(RCC_RTCCLKSOURCE_LSI);
#endif

if (res != HAL_OK) {
return false;
}

// Enable RTC peripheral (tampers are part of it)
__HAL_RCC_RTC_ENABLE();
__HAL_RCC_RTCAPB_CLK_ENABLE();
Expand Down Expand Up @@ -163,6 +167,8 @@ void tamper_init(void) {
// Enable TAMP interrupt at NVIC controller
NVIC_SetPriority(TAMP_IRQn, IRQ_PRI_HIGHEST);
NVIC_EnableIRQ(TAMP_IRQn);

return true;
}

uint8_t tamper_external_read(void) {
Expand Down

0 comments on commit 559a446

Please sign in to comment.