1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-24 07:28:34 +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
// Duration of the button press effect
#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
#include HAPTIC_ACTUATOR
@ -346,6 +350,10 @@ bool haptic_play(haptic_effect_t effect) {
case HAPTIC_HOLD_TO_CONFIRM:
return haptic_play_lib(DOUBLE_CLICK_60);
break;
case HAPTIC_BOOTLOADER_ENTRY:
return haptic_play_rtp(BOOTLOADER_ENTRY_EFFECT_AMPLITUDE,
BOOTLOADER_ENTRY_EFFECT_DURATION);
break;
default:
break;
}

View File

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

View File

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