Loading...
Searching...
No Matches
vibe.c File Reference

The haptic feedback wrapper implementation. More...

Functions

void vibe_pulse (VibePulse pulse)
 Fire a pulse unless in quiet time.
void vibe_custom (const uint32_t *durations, uint32_t num_segments)
 Buzz a custom on and off rhythm unless in quiet time. The durations are milliseconds that alternate buzz then pause then buzz and so on, starting on a buzz. Lets a caller play a little tune that the three canned pulses cannot.
void vibe_choice (uint8_t choice)
 Fire the pattern named by a VibeChoice (VIBE_NONE stays silent). The caller resolves the choice from wherever it likes, so the lib never has to know which setting it came from.
void vibe_bt_transition (bool connected)
 The default bluetooth-transition buzz: fire the pattern the user picked in settings for a connect or disconnect. A face installs this as system_store's vibe policy so the store itself never has to know about settings or buzzing.
static time_t current_hour_start (void)
 When the current local hour began.
void vibe_hourly (const struct tm *tick, uint8_t choice)
 Buzz once at the top of each hour. A face calls this from its time callback on every tick, and it buzzes on the first tick of each hour's minute 0.

Variables

static HourLatch s_hour_latch = HOUR_LATCH_EMPTY
 the hour the hourly buzz last fired for
static bool s_hourly_seeded
 whether the first call has remembered its hour

Detailed Description

The haptic feedback wrapper implementation.

Function Documentation

◆ current_hour_start()

time_t current_hour_start ( void )
static

When the current local hour began.

It reads the clock once and breaks that same reading apart. Pairing a fresh time(NULL) with an older tick's minutes and seconds would give one hour two starts whenever a second turns over between them.

Returns
The start of the current hour, as seconds since the epoch.