haptic 2.0.0.0
haptic.h File Reference

This file contains API for HAPTIC Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_pwm.h"

Go to the source code of this file.

Data Structures

struct  haptic_t
 Click ctx object definition. More...
 
struct  haptic_cfg_t
 Click configuration structure definition. More...
 

Macros

#define HAPTIC_MAP_MIKROBUS(cfg, mikrobus)
 
#define HAPTIC_RETVAL   uint8_t
 
#define HAPTIC_OK   0x00
 
#define HAPTIC_INIT_ERROR   0xFF
 
#define HAPTIC_I2C_ADDRESS   0x5A
 
#define HAPTIC_REG_STATUS   0x00
 
#define HAPTIC_REG_MODE   0x01
 
#define HAPTIC_REG_RTPIN   0x02
 
#define HAPTIC_REG_LIBRARY   0x03
 
#define HAPTIC_REG_WAVESEQ1   0x04
 
#define HAPTIC_REG_WAVESEQ2   0x05
 
#define HAPTIC_REG_WAVESEQ3   0x06
 
#define HAPTIC_REG_WAVESEQ4   0x07
 
#define HAPTIC_REG_WAVESEQ5   0x08
 
#define HAPTIC_REG_WAVESEQ6   0x09
 
#define HAPTIC_REG_WAVESEQ7   0x0A
 
#define HAPTIC_REG_WAVESEQ8   0x0B
 
#define HAPTIC_REG_GO   0x0C
 
#define HAPTIC_REG_OVERDRIVE   0x0D
 
#define HAPTIC_REG_SUSTAINPOS   0x0E
 
#define HAPTIC_REG_SUSTAINNEG   0x0F
 
#define HAPTIC_REG_BREAK   0x10
 
#define HAPTIC_REG_AUDIOCTRL   0x11
 
#define HAPTIC_REG_AUDIOMININ   0x12
 
#define HAPTIC_REG_AUDIOMAXIN   0x13
 
#define HAPTIC_REG_AUDIOMINOUT   0x14
 
#define HAPTIC_REG_AUDIOMAXOUT   0x15
 
#define HAPTIC_REG_RATEDV   0x16
 
#define HAPTIC_REG_CLAMPV   0x17
 
#define HAPTIC_REG_AUTOCALCOMP   0x18
 
#define HAPTIC_REG_AUTOCALEMF   0x19
 
#define HAPTIC_REG_FEEDBACK   0x1A
 
#define HAPTIC_REG_CONTROL1   0x1B
 
#define HAPTIC_REG_CONTROL2   0x1C
 
#define HAPTIC_REG_CONTROL3   0x1D
 
#define HAPTIC_REG_CONTROL4   0x1E
 
#define HAPTIC_REG_VBAT   0x21
 
#define HAPTIC_REG_LRARESON   0x22
 
#define HAPTIC_MODE_INTTRIG   0x00
 
#define HAPTIC_MODE_EXTTRIGEDGE   0x01
 
#define HAPTIC_MODE_EXTTRIGLVL   0x02
 
#define HAPTIC_MODE_PWMANALOG   0x03
 
#define HAPTIC_MODE_AUDIOVIBE   0x04
 
#define HAPTIC_MODE_REALTIME   0x05
 
#define HAPTIC_MODE_DIAGNOS   0x06
 
#define HAPTIC_MODE_AUTOCAL   0x07
 
#define HAPTIC_DEFAULT_MIN_INPUT   0x19
 
#define HAPTIC_DEFAULT_MAX_INPUT   0xFF
 

Functions

void haptic_cfg_setup (haptic_cfg_t *cfg)
 Config Object Initialization function.
 
HAPTIC_RETVAL haptic_init (haptic_t *ctx, haptic_cfg_t *cfg)
 Initialization function.
 
void haptic_generic_write (haptic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void haptic_generic_read (haptic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void haptic_enable (haptic_t *ctx)
 Enable the device function.
 
void haptic_disable (haptic_t *ctx)
 Disable the device function.
 
void haptic_write_byte (haptic_t *ctx, uint8_t reg_address, uint8_t write_data)
 Generic write the byte of data function.
 
uint8_t haptic_read_byte (haptic_t *ctx, uint8_t reg_address)
 Generic read the byte of data function.
 
void haptic_set_mode (haptic_t *ctx, uint8_t sel_mode)
 Sets the Haptic click to desired mode function.
 
void haptic_soft_reset (haptic_t *ctx)
 Resets all the registers function.
 
uint8_t haptic_get_status (haptic_t *ctx)
 Get status register value function.
 
void haptic_set_rtp_input (haptic_t *ctx, uint8_t input)
 Sets the desired input for RTP mode function.
 
void haptic_set_state_hi (haptic_t *ctx)
 Generic read function.
 
uint8_t haptic_set_library (haptic_t *ctx, uint8_t library)
 Sets the desired library of vibrating patterns to read function.
 
void haptic_start_motor (haptic_t *ctx)
 Starts moving the motor function.
 
void haptic_set_overdrive_offset (haptic_t *ctx, uint8_t temp_data)
 Sets overdrive offset function.
 
void haptic_set_sustain_offset_positive (haptic_t *ctx, uint8_t temp_data)
 Sets desired sustain offset - positive function.
 
void haptic_set_sustain_offset_negative (haptic_t *ctx, uint8_t temp_data)
 Sets desired sustain offset - negative function.
 
void haptic_set_brake_time_offset (haptic_t *ctx, uint8_t temp_data)
 Sets desired brake time offset function.
 
void haptic_set_audio_minimum_input (haptic_t *ctx, uint8_t temp_data)
 Sets minimum input for audio to vibe mode function.
 
void haptic_set_audio_maximum_input (haptic_t *ctx, uint8_t temp_data)
 Sets maximum input for audio to vibe mode function.
 
void haptic_set_audio_minimum_output (haptic_t *ctx, uint8_t temp_data)
 Sets minimum output for audio to vibe mode function.
 
void haptic_set_audio_maximum_output (haptic_t *ctx, uint8_t temp_data)
 Sets maximum output for audio to vibe mode function.
 
void haptic_set_rated_voltage (haptic_t *ctx, uint8_t temp_data)
 Sets the reference voltage function.
 
void haptic_set_overdrive_clamp_voltage (haptic_t *ctx, uint8_t temp_data)
 Sets a clamp function.
 
uint8_t haptic_set_audio_peak_time (haptic_t *ctx, uint8_t temp_data)
 Sets the peak detection time function.
 
uint8_t haptic_set_audio_low_pass_filter (haptic_t *ctx, uint8_t temp_data)
 Sets the low-pass filter frequency function.
 
uint8_t haptic_get_calibration_result_comp (haptic_t *ctx)
 Reads the voltage-compensation function.
 
uint8_t haptic_get_calibration_result_emf (haptic_t *ctx)
 Reads the rated back - EMF function.
 
uint8_t haptic_get_supply_voltage_value (haptic_t *ctx)
 Reading of the supply voltage function.
 
uint8_t haptic_get_lra_resonance_period (haptic_t *ctx)
 Reads the measurement of the LRA resonance period function.
 
void haptic_set_to_erm_mode (haptic_t *ctx)
 Sets the Haptic click in ERM mode function.
 
void haptic_set_to_lra_mode (haptic_t *ctx)
 Sets the Haptic click in LRA mode function.
 
uint8_t haptic_setBrakeFactor (haptic_t *ctx, uint8_t brake_factor)
 Sets the feedback gain ratio function.
 
uint8_t haptic_set_loop_gain (haptic_t *ctx, uint8_t gain)
 Selects a loop gain function.
 
void haptic_set_input_to_analog (haptic_t *ctx)
 Sets the input to analog function.
 
void haptic_set_input_to_pwm (haptic_t *ctx)
 Sets the input for PWM control function.
 
void haptic_set_sequence (haptic_t *ctx, uint8_t temp_data)
 Sets the waveform identifier function.
 
void haptic_enable_ac_coulping (haptic_t *ctx)
 Applies a 0.9-V common mode voltage function.
 
void haptic_set_duty_cycle (haptic_t *ctx, float duty_cycle)
 Generic sets PWM duty cycle.
 
void haptic_pwm_stop (haptic_t *ctx)
 Stop PWM module.
 
void haptic_pwm_start (haptic_t *ctx)
 Start PWM module.
 

Detailed Description

This file contains API for HAPTIC Click driver.