Bluetooth buzzing and the watch's own unit settings. More...
Files | |
| file | src/c/pebble/system/units/units.c |
| The SDK-facing units facade. Reads the clock for .beats and forwards the rest to the pure lib cores, clock/beats and units/distance. | |
| file | src/c/pebble/system/units/units.h |
| Swatch internet time in .beats, and distance formatting in miles or kilometres. | |
| file | src/c/pebble/system/vibe/vibe.c |
| The haptic feedback wrapper implementation. | |
| file | src/c/pebble/system/vibe/vibe.h |
| The haptic feedback wrapper. | |
Enumerations | |
| enum | VibePulse { VibePulseShort , VibePulseLong , VibePulseDouble } |
| Defines the available haptic pulse patterns. More... | |
Functions | |
| int | units_swatch_beats (void) |
| The current swatch internet time, in .beats. | |
| uint32_t | units_ms_until_next_beat (void) |
| Milliseconds until the next .beats boundary. | |
| void | units_format_distance (char *buffer, size_t size, int meters, bool miles) |
| Formats a distance as "N.N MI" or "N.N KM". | |
| void | units_format_distance_value (char *buffer, size_t size, int meters, bool miles) |
| Formats a distance as just "N.N", with no unit suffix, rounded to a tenth. | |
| const char * | units_distance_unit (bool miles) |
| The unit label for the current distance mode, "MI" or "KM". | |
| 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. | |
| 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. | |
Bluetooth buzzing and the watch's own unit settings.
The odds and ends that belong to the watch itself rather than to any one face.
| enum VibePulse |
| const char * units_distance_unit | ( | bool | miles | ) |
The unit label for the current distance mode, "MI" or "KM".
| miles | Miles if true, otherwise km. |
| void units_format_distance | ( | char * | buffer, |
| size_t | size, | ||
| int | meters, | ||
| bool | miles ) |
Formats a distance as "N.N MI" or "N.N KM".
| [out] | buffer | Where the formatted distance is written. |
| size | The size of buffer. | |
| meters | The distance, in metres. | |
| miles | Formats as miles if true, otherwise km. |
| void units_format_distance_value | ( | char * | buffer, |
| size_t | size, | ||
| int | meters, | ||
| bool | miles ) |
Formats a distance as just "N.N", with no unit suffix, rounded to a tenth.
Pair with units_distance_unit when the unit wants its own small-font slot.
| [out] | buffer | Where the formatted distance is written. |
| size | The size of buffer. | |
| meters | The distance, in metres. | |
| miles | Formats as miles if true, otherwise km. |
| uint32_t units_ms_until_next_beat | ( | void | ) |
Milliseconds until the next .beats boundary.
| int units_swatch_beats | ( | void | ) |
The current swatch internet time, in .beats.
| 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.
| connected | True when the link just came up, false when it just dropped. |
| 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.
| choice | A VibeChoice value (VIBE_NONE / VIBE_SHORT / VIBE_LONG / VIBE_DOUBLE). |
| 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.
The firmware copies each duration into its own vibe queue when the pattern is queued, so the array only has to last for the call. A stack array is fine.
| durations | The on and off times in milliseconds. The first entry is a buzz. |
| num_segments | How many entries the durations array has. |
| 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.
More than one ticker can tick inside minute 0, so it remembers when the hour that last buzzed began and buzzes each real hour once, including the hour the clocks repeat when they fall back. On a .beats clock the face sets hourly in its TimeConfig, so a tick lands in minute 0 at all.
The first call after launch only remembers its hour. Subscribing to a tick sends one tick straight away, so a face opened in minute 0 would otherwise buzz an hour that already buzzed before the wearer left it. A face that was not running at the top of the hour, such as one closed for an app, then stays silent until the next hour, which beats a second buzz on every return in minute 0.
| tick | The time of the tick, normally time_store_tm(). |
| choice | A VibeChoice value, normally the Hourly Vibration setting. VIBE_NONE stays silent. |
| void vibe_pulse | ( | VibePulse | pulse | ) |
Fire a pulse unless in quiet time.
| pulse | The pulse pattern to fire. |