82 virtual bool run() = 0;
HapticStatus
Vibration playback status.
HapticActuatorType
Actuator type.
HapticMode
Generic haptic operating mode.
@ INTERNAL_TRIGGER
Play by selecting waveforms/effects and calling run()
uint16_t HapticEffectId
Haptic effect ID type.
Abstract base class for haptic drivers.
virtual uint32_t getF0() const
Get the measured resonant frequency (F0).
virtual bool isReady() const =0
Check if the driver is initialized and ready.
virtual bool playSequence()
Play the waveform sequence.
void setReady(bool ready)
Set ready state.
virtual bool stop()=0
Stop haptic playback immediately.
virtual bool calibrate()
Perform auto-calibration.
virtual bool setSequence(uint8_t slot, HapticEffectId effect)
Set a waveform in the sequence.
virtual bool needsCalibration() const
Check if calibration is needed.
virtual bool setMode(HapticMode mode)
Set the operating mode.
HapticBase(const char *name)
Constructor for derived classes.
virtual HapticCapabilities getCapabilities() const =0
Get device capabilities.
virtual HapticActuatorType getActuatorType() const =0
Get the actuator type.
virtual uint32_t getVbat()
Get the battery voltage.
virtual ~HapticBase()=default
virtual HapticStatus getStatus() const =0
Get current playback status.
virtual HapticMode getMode() const
Get the current operating mode.
virtual bool isPlaying() const =0
Check if haptic is currently playing.
virtual bool setGain(uint8_t gain)=0
Set the gain/amplitude (0x00 to 0xFF).
virtual bool setActuatorType(HapticActuatorType type)=0
Set the actuator type.
virtual bool clearSequence()
Clear the waveform sequence.
virtual void continuousVibration(uint32_t duration_ms, bool blocking=true)
Play a continuous vibration for specified duration.
virtual bool playEffect(HapticEffectId effect)=0
Play a haptic effect.
virtual uint8_t getChipID() const =0
Get the chip ID.
virtual bool run()=0
Start haptic playback.
virtual bool setRealtimeValue(uint8_t value)
Set RTP (real-time playback) value.
virtual void end()
Deinitialize the haptic driver and release resources.
virtual const char * getChipName() const =0
Get the chip name.
virtual bool playEffectAsync(HapticEffectId effect)
Play a haptic effect (non-blocking).
virtual uint8_t getGain() const =0
Get the current gain value.
virtual void vibrationUpdate()
Update vibration state (for non-blocking mode).
virtual void emergencyStop()
Emergency stop - stops all vibration immediately.