1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-26 16:38:12 +00:00

feat(core/bootloader): add separate bootloader-entry haptic effect

[no changelog]
This commit is contained in:
tychovrahe 2025-05-27 11:55:14 +02:00 committed by TychoVrahe
parent a688bae64b
commit b8b2d7cf13
3 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,10 @@
#define PRESS_EFFECT_AMPLITUDE 25 #define PRESS_EFFECT_AMPLITUDE 25
// Duration of the button press effect // Duration of the button press effect
#define PRESS_EFFECT_DURATION 10 #define PRESS_EFFECT_DURATION 10
// Amplitude of the bootloader entry effect
#define BOOTLOADER_ENTRY_EFFECT_AMPLITUDE 100
// Duration of the bootloader entry effect
#define BOOTLOADER_ENTRY_EFFECT_DURATION 300
// Actuator configuration // Actuator configuration
#include HAPTIC_ACTUATOR #include HAPTIC_ACTUATOR
@ -346,6 +350,10 @@ bool haptic_play(haptic_effect_t effect) {
case HAPTIC_HOLD_TO_CONFIRM: case HAPTIC_HOLD_TO_CONFIRM:
return haptic_play_lib(DOUBLE_CLICK_60); return haptic_play_lib(DOUBLE_CLICK_60);
break; break;
case HAPTIC_BOOTLOADER_ENTRY:
return haptic_play_rtp(BOOTLOADER_ENTRY_EFFECT_AMPLITUDE,
BOOTLOADER_ENTRY_EFFECT_DURATION);
break;
default: default:
break; break;
} }

View File

@ -26,6 +26,8 @@ typedef enum {
HAPTIC_BUTTON_PRESS = 0, HAPTIC_BUTTON_PRESS = 0,
// Effect at the end of hold-to-confirm action // Effect at the end of hold-to-confirm action
HAPTIC_HOLD_TO_CONFIRM = 1, HAPTIC_HOLD_TO_CONFIRM = 1,
// Bootloader entry
HAPTIC_BOOTLOADER_ENTRY = 2,
} haptic_effect_t; } haptic_effect_t;
#ifdef KERNEL_MODE #ifdef KERNEL_MODE

View File

@ -159,7 +159,7 @@ static secbool boot_sequence(secbool manufacturing_mode) {
uint32_t elapsed = systick_ms() - press_start; uint32_t elapsed = systick_ms() - press_start;
if (elapsed >= 3000 && !bld_locked) { if (elapsed >= 3000 && !bld_locked) {
#ifdef USE_HAPTIC #ifdef USE_HAPTIC
haptic_play(HAPTIC_BUTTON_PRESS); haptic_play(HAPTIC_BOOTLOADER_ENTRY);
#endif #endif
bld_locked = true; bld_locked = true;
} else if ((elapsed >= 1000 || manufacturing_mode == sectrue) && } else if ((elapsed >= 1000 || manufacturing_mode == sectrue) &&