PebbleOS
Loading...
Searching...
No Matches
Enumerations | Functions
Vibe patterns

Vibration motor sequencing and strength control. More...

Enumerations

enum  VibePatternOwner {
  VibePatternOwner_Other = 0 , VibePatternOwner_App , VibePatternOwner_Notification , VibePatternOwner_PhoneCall ,
  VibePatternOwner_Alarm
}
 Source that started a vibe pattern. More...
 

Functions

void vibes_init ()
 Initialize the service.
 
int32_t vibes_get_vibe_strength (void)
 Get the strength the motor is currently driven at.
 
uint32_t vibes_get_time_since_last_vibe_ms (void)
 Get the time since the motor was last active.
 
int32_t vibes_get_default_vibe_strength (void)
 Get the default strength, used by on/off pattern steps.
 
void vibes_set_default_vibe_strength (int32_t vibe_strength_default)
 Set the default strength, from the vibration strength setting.
 
void vibe_service_set_enabled (bool enable)
 Runlevel hook.
 
void vibe_pattern_set_owner (VibePatternOwner owner)
 Set the owner of the next pattern.
 
void vibe_pattern_clear_for_owner (VibePatternOwner owner)
 Stop the current pattern if owned by owner.
 

Detailed Description

Vibration motor sequencing and strength control.

Plays queued patterns of (duration, strength) steps on the vibration motor. Strengths range from -100 to 100, 0 being off. Each pattern has an owner, so cancellation can be scoped: a notification dismiss must not stop an alarm vibe.

Kernel code tags the next pattern before starting it, and later clears only its own:

vibes_long_pulse();
...
vibe_pattern_clear_for_owner(VibePatternOwner_Alarm);
void vibe_pattern_set_owner(VibePatternOwner owner)
Set the owner of the next pattern.
@ VibePatternOwner_Alarm
Alarm vibes.
Definition vibe_pattern.h:41

Enumeration Type Documentation

◆ VibePatternOwner

Source that started a vibe pattern.

Enumerator
VibePatternOwner_Other 

Untagged kernel vibes, the default.

VibePatternOwner_App 

Vibes started by the app task; cleared on app cleanup.

VibePatternOwner_Notification 

Notification vibes.

VibePatternOwner_PhoneCall 

Phone call vibes.

VibePatternOwner_Alarm 

Alarm vibes.

Function Documentation

◆ vibe_pattern_clear_for_owner()

void vibe_pattern_clear_for_owner ( VibePatternOwner  owner)

Stop the current pattern if owned by owner.

Does nothing otherwise.

Parameters
ownerOwner whose pattern to stop.

◆ vibe_pattern_set_owner()

void vibe_pattern_set_owner ( VibePatternOwner  owner)

Set the owner of the next pattern.

Consumed when the first step of the next pattern is queued. Without it, patterns from the app task are owned by VibePatternOwner_App and others by VibePatternOwner_Other.

Parameters
ownerOwner of the next pattern.

◆ vibe_service_set_enabled()

void vibe_service_set_enabled ( bool  enable)

Runlevel hook.

Turns the motor off before disabling. Patterns do not drive the motor while disabled.

Parameters
enableTrue to enable vibrations.

◆ vibes_get_default_vibe_strength()

int32_t vibes_get_default_vibe_strength ( void  )

Get the default strength, used by on/off pattern steps.

Returns
Strength, -100 to 100.

◆ vibes_get_time_since_last_vibe_ms()

uint32_t vibes_get_time_since_last_vibe_ms ( void  )

Get the time since the motor was last active.

Measured from when it was last turned on, or last turned off. Used to suppress false shake and tap detections caused by vibration.

Returns
Milliseconds, or UINT32_MAX if the motor has not run since boot.

◆ vibes_get_vibe_strength()

int32_t vibes_get_vibe_strength ( void  )

Get the strength the motor is currently driven at.

Returns
Strength, -100 to 100, 0 when off.

◆ vibes_init()

void vibes_init ( )

Initialize the service.

◆ vibes_set_default_vibe_strength()

void vibes_set_default_vibe_strength ( int32_t  vibe_strength_default)

Set the default strength, from the vibration strength setting.

Parameters
vibe_strength_defaultStrength, -100 to 100.