SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
HapticDefs.hpp File Reference

@license MIT License More...

#include <stdint.h>
Include dependency graph for HapticDefs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HapticCapabilities
 Device capability flags. More...
 

Typedefs

using HapticEffectId = uint16_t
 Haptic effect ID type.
 

Enumerations

enum class  HapticActuatorType : uint8_t { ERM = 0 , LRA = 1 }
 Actuator type. More...
 
enum class  HapticMode : uint8_t {
  INTERNAL_TRIGGER , EXT_TRIGGER_EDGE , EXT_TRIGGER_LEVEL , PWM_ANALOG ,
  AUDIO_TO_VIBE , REAL_TIME_PLAYBACK , DIAGNOSTICS , AUTO_CALIBRATE ,
  STANDBY
}
 Generic haptic operating mode. More...
 
enum class  HapticStatus : uint8_t {
  IDLE = 0 , PLAYING = 1 , PAUSED = 2 , CALIBRATING = 3 ,
  ERROR = 4 , STANDBY = 5
}
 Vibration playback status. More...
 
enum class  HapticPreset : uint8_t {
  CLICK , DOUBLE_CLICK , TRIPLE_CLICK , LONG_VIBRATION ,
  BUZZ , STRONG_BUZZ , TAP , HEAVY_TAP ,
  PULSE , RAMP_UP , RAMP_DOWN , WAVE ,
  RAINBOW
}
 Preset haptic effect types for common use cases. More...
 

Detailed Description

@license MIT License

Copyright (c) 2026 lewis he

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
Lewis He (lewis.nosp@m.he@o.nosp@m.utloo.nosp@m.k.co.nosp@m.m)
Date
2026-03-10

Definition in file HapticDefs.hpp.

Typedef Documentation

◆ HapticEffectId

using HapticEffectId = uint16_t

Haptic effect ID type.

For chips like DRV2605, this maps to ROM waveform index. For AW862xx, this maps to RAM waveform slot.

Definition at line 62 of file HapticDefs.hpp.

Enumeration Type Documentation

◆ HapticActuatorType

enum class HapticActuatorType : uint8_t
strong

Actuator type.

Enumerator
ERM 

Eccentric Rotating Mass motor.

LRA 

Linear Resonant Actuator.

Definition at line 37 of file HapticDefs.hpp.

◆ HapticMode

enum class HapticMode : uint8_t
strong

Generic haptic operating mode.

Enumerator
INTERNAL_TRIGGER 

Play by selecting waveforms/effects and calling run()

EXT_TRIGGER_EDGE 

External trigger on edge (pin interrupt)

EXT_TRIGGER_LEVEL 

External trigger on level (pin state)

PWM_ANALOG 

PWM or analog input drive.

AUDIO_TO_VIBE 

Audio input to vibration.

REAL_TIME_PLAYBACK 

RTP mode (direct drive value)

DIAGNOSTICS 

Diagnostics mode.

AUTO_CALIBRATE 

Auto-calibration mode.

STANDBY 

Standby mode.

Definition at line 45 of file HapticDefs.hpp.

◆ HapticPreset

enum class HapticPreset : uint8_t
strong

Preset haptic effect types for common use cases.

These provide a unified way to play common effects across different haptic driver chips.

Enumerator
CLICK 

Short click/tick.

DOUBLE_CLICK 

Double click.

TRIPLE_CLICK 

Triple click.

LONG_VIBRATION 

Continuous vibration.

BUZZ 

Medium buzz.

STRONG_BUZZ 

Strong buzz.

TAP 

Light tap.

HEAVY_TAP 

Heavy tap.

PULSE 

Pulsed vibration.

RAMP_UP 

Gradually increasing intensity.

RAMP_DOWN 

Gradually decreasing intensity.

WAVE 

Wave-like pattern.

RAINBOW 

Multi-frequency effect.

Definition at line 109 of file HapticDefs.hpp.

◆ HapticStatus

enum class HapticStatus : uint8_t
strong

Vibration playback status.

Enumerator
IDLE 

Not playing.

PLAYING 

Currently playing.

PAUSED 

Playback paused.

CALIBRATING 

Calibrating.

ERROR 

Error state.

STANDBY 

Standby mode.

Definition at line 67 of file HapticDefs.hpp.