vibromotor3 2.0.0.0
Vibro Motor 3 Click Driver

API for configuring and manipulating Vibro Motor 3 Click driver. More...

Topics

 Vibro Motor 3 Registers List
 List of registers of Vibro Motor 3 Click driver.
 
 Vibro Motor 3 Registers Settings
 Settings for registers of Vibro Motor 3 Click driver.
 
 Vibro Motor 3 MikroBUS Map
 MikroBUS pin mapping of Vibro Motor 3 Click driver.
 

Functions

void vibromotor3_cfg_setup (vibromotor3_cfg_t *cfg)
 Vibro Motor 3 configuration object setup function.
 
err_t vibromotor3_init (vibromotor3_t *ctx, vibromotor3_cfg_t *cfg)
 Vibro Motor 3 initialization function.
 
err_t vibromotor3_default_cfg (vibromotor3_t *ctx)
 Vibro Motor 3 default configuration function.
 
err_t vibromotor3_generic_write (vibromotor3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Vibro Motor 3 I2C writing function.
 
err_t vibromotor3_generic_read (vibromotor3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Vibro Motor 3 I2C reading function.
 
err_t vibromotor3_set_duty_cycle (vibromotor3_t *ctx, float duty_cycle)
 Vibro Motor 3 sets PWM duty cycle.
 
err_t vibromotor3_pwm_stop (vibromotor3_t *ctx)
 Vibro Motor 3 stop PWM module.
 
err_t vibromotor3_pwm_start (vibromotor3_t *ctx)
 Vibro Motor 3 start PWM module.
 
void vibromotor3_enable (vibromotor3_t *ctx, uint8_t state)
 Enable the device function.
 
void vibromotor3_write_byte (vibromotor3_t *ctx, uint8_t reg, uint8_t wr_data)
 Generic write the byte of data function.
 
uint8_t vibromotor3_read_byte (vibromotor3_t *ctx, uint8_t reg)
 Generic read the byte of data function.
 
void vibromotor3_set_mode (vibromotor3_t *ctx, uint8_t mode_sel)
 Sets the desired mode function.
 
void vibromotor3_soft_rst (vibromotor3_t *ctx)
 Reset function.
 
void vibromotor3_stb_mode (vibromotor3_t *ctx, uint8_t state)
 Software standby mode.
 
uint8_t vibromotor3_get_stat (vibromotor3_t *ctx)
 Get status register value function.
 
void vibromotor3_set_rtp_input (vibromotor3_t *ctx, uint8_t data_in)
 Sets the desired input for RTP mode function.
 
void vibromotor3_set_state_hi_z (vibromotor3_t *ctx, uint8_t state)
 Set the devices in HI-Z state function.
 
void vibromotor3_set_library (vibromotor3_t *ctx, uint8_t lib_sel)
 Set the desired vibrating patterns library.
 
void vibromotor3_start_motor (vibromotor3_t *ctx, uint8_t state)
 Starts or stops moving the motor function.
 
void vibromotor3_set_ovdr_offset (vibromotor3_t *ctx, uint8_t data_in)
 Sets overdrive offset function.
 
void vibromotor3_set_sustain_offset_pos (vibromotor3_t *ctx, uint8_t data_in)
 Sets sustain offset - positive function.
 
void vibromotor3_set_sustain_offset_neg (vibromotor3_t *ctx, uint8_t data_in)
 Sets sustain offset - negative function.
 
void vibromotor3_set_brake_time_offset (vibromotor3_t *ctx, uint8_t data_in)
 Sets brake time offset function.
 
void vibromotor3_set_rated_volt (vibromotor3_t *ctx, uint8_t data_in)
 Sets the reference voltage function.
 
void vibromotor3_set_ovdrv_clamp_volt (vibromotor3_t *ctx, uint8_t data_in)
 Sets a clamp function.
 
uint8_t vibromotor3_get_calib_res_comp (vibromotor3_t *ctx)
 Reads the voltage-compensation function.
 
float vibromotor3_get_supply_volt_val (vibromotor3_t *ctx)
 Reading of the supply voltage function.
 
float vibromotor3_get_lra_resonance_period (vibromotor3_t *ctx)
 Reads the measurement of the LRA resonance period function.
 
void vibromotor3_set_lra_mode (vibromotor3_t *ctx, uint8_t state)
 Sets the device in LRA mode function.
 
void vibromotor3_set_brake_factor (vibromotor3_t *ctx, uint8_t brk_fac)
 Set brake factor function.
 
void vibromotor3_set_loop_gain (vibromotor3_t *ctx, uint8_t gain)
 Selects a loop gain function.
 
void vibromotor3_set_input (vibromotor3_t *ctx, uint8_t data_in)
 Sets the input to PWM or analog function.
 
void vibromotor3_enable_ac_coulping (vibromotor3_t *ctx)
 Applies a 0.9-V common mode voltage function.
 

Detailed Description

API for configuring and manipulating Vibro Motor 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ vibromotor3_cfg_setup()

void vibromotor3_cfg_setup ( vibromotor3_cfg_t * cfg)

Vibro Motor 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See vibromotor3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ vibromotor3_default_cfg()

err_t vibromotor3_default_cfg ( vibromotor3_t * ctx)

Vibro Motor 3 default configuration function.

This function executes a default configuration of Vibro Motor 3 click board.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ vibromotor3_enable()

void vibromotor3_enable ( vibromotor3_t * ctx,
uint8_t state )

Enable the device function.

The function is used to enable or disable the device.

Parameters
[out]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]state: 8-bit value that defines the state of the device
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) turns the device on, "VIBROMOTOR3_PROPERTY_DISABLE"(0) turns the device off.

◆ vibromotor3_enable_ac_coulping()

void vibromotor3_enable_ac_coulping ( vibromotor3_t * ctx)

Applies a 0.9-V common mode voltage function.

Function applies a 0.9-V common mode voltage to the IN/TRIG pin.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
Nothing.

◆ vibromotor3_generic_read()

err_t vibromotor3_generic_read ( vibromotor3_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Vibro Motor 3 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_generic_write()

err_t vibromotor3_generic_write ( vibromotor3_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Vibro Motor 3 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_get_calib_res_comp()

uint8_t vibromotor3_get_calib_res_comp ( vibromotor3_t * ctx)

Reads the voltage-compensation function.

Function gets the voltage-compensation result after execution of auto calibration.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
res 8-bit value contained in the register

◆ vibromotor3_get_lra_resonance_period()

float vibromotor3_get_lra_resonance_period ( vibromotor3_t * ctx)

Reads the measurement of the LRA resonance period function.

Function gets the measurement of the LRA resonance period.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
res float LRA resonance period

◆ vibromotor3_get_stat()

uint8_t vibromotor3_get_stat ( vibromotor3_t * ctx)

Get status register value function.

The function is used to read the value from the status register.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
result 8-bit device status data
Note
Status register holds device identifier, result of the auto-calibration routine and the diagnostic routine, status for the feedback controller, overtemperature and overcurrent detection flags.

◆ vibromotor3_get_supply_volt_val()

float vibromotor3_get_supply_volt_val ( vibromotor3_t * ctx)

Reading of the supply voltage function.

Function does a real-time reading of the supply voltage at the VDD pin.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
res float voltage on VDD pin

◆ vibromotor3_init()

err_t vibromotor3_init ( vibromotor3_t * ctx,
vibromotor3_cfg_t * cfg )

Vibro Motor 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See vibromotor3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_pwm_start()

err_t vibromotor3_pwm_start ( vibromotor3_t * ctx)

Vibro Motor 3 start PWM module.

This function starts the PWM moudle output.

Parameters
[out]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_pwm_stop()

err_t vibromotor3_pwm_stop ( vibromotor3_t * ctx)

Vibro Motor 3 stop PWM module.

This function stops the PWM moudle output.

Parameters
[out]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_read_byte()

uint8_t vibromotor3_read_byte ( vibromotor3_t * ctx,
uint8_t reg )

Generic read the byte of data function.

The function is used to read 8-bit data from the target 8-bit register address.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]reg: 8-bit register address.
Returns
8-bit output data.
Nothing.

◆ vibromotor3_set_brake_factor()

void vibromotor3_set_brake_factor ( vibromotor3_t * ctx,
uint8_t brk_fac )

Set brake factor function.

Function selects the feedback gain ratio between braking gain and driving gain.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]brk_fac: Value that defines brake factor
Returns
Nothing.
Note
Available brake factors : 0: Braking disabled 1: 1x 2: 2x 3: 3x 4: 4x 6: 6x 8: 8x 16: 16x

◆ vibromotor3_set_brake_time_offset()

void vibromotor3_set_brake_time_offset ( vibromotor3_t * ctx,
uint8_t data_in )

Sets brake time offset function.

Function sets the desired brake time offset.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired brake time offset
Returns
Nothing.

◆ vibromotor3_set_duty_cycle()

err_t vibromotor3_set_duty_cycle ( vibromotor3_t * ctx,
float duty_cycle )

Vibro Motor 3 sets PWM duty cycle.

This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).

Parameters
[out]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]duty_ratio: PWM duty_ratio.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ vibromotor3_set_input()

void vibromotor3_set_input ( vibromotor3_t * ctx,
uint8_t data_in )

Sets the input to PWM or analog function.

The function is used to select the input mode for the IN/TRIG(PWM) pin.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]state: 8-bit value that defines the input mode
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) sets PWM input mode, "VIBROMOTOR3_PROPERTY_DISABLE"(0) sets analog input mode.

◆ vibromotor3_set_library()

void vibromotor3_set_library ( vibromotor3_t * ctx,
uint8_t lib_sel )

Set the desired vibrating patterns library.

Function is used to set waveform library selection value.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]lib_sel: Value that defines selected library
Returns
Nothing.
Note
Available libraryes : 0: Empty 1: TS2200 Library A 2: TS2200 Library B 3: TS2200 Library C 4: TS2200 Library D 5: TS2200 Library E 6: LRA Library

◆ vibromotor3_set_loop_gain()

void vibromotor3_set_loop_gain ( vibromotor3_t * ctx,
uint8_t gain )

Selects a loop gain function.

Function selects a loop gain for the feedback control.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]gain: Value that defines a loop gain
Returns
Nothing.
Note
Available loop gains : 0: Low 1: Medium 2: High 3: Very High

◆ vibromotor3_set_lra_mode()

void vibromotor3_set_lra_mode ( vibromotor3_t * ctx,
uint8_t state )

Sets the device in LRA mode function.

The function is used to sets the device in LRA mode.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]state: 8-bit value that defines the device's mode
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) enables the LRA mode, "VIBROMOTOR3_PROPERTY_DISABLE"(0) enables the ERM Mode(NOT supported!!!).

◆ vibromotor3_set_mode()

void vibromotor3_set_mode ( vibromotor3_t * ctx,
uint8_t mode_sel )

Sets the desired mode function.

Function is used to apply the desired mode.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]mode_sel: Value that defines selected mode
Returns
Nothing.
Note
Available modes : 0: Internal trigger - Waveforms are fired by setting the GO bit in register VIBROMOTOR3_REG_GO. 1: External trigger (edge mode) - A rising edge on the IN/TRIG pin sets the GO Bit. A second rising edge on the IN/TRIG pin cancels the waveform if the second rising edge occurs before the GO bit has cleared. 2: External trigger (level mode) - The GO bit follows the state of the external trigger. A rising edge on the IN/TRIG pin sets the GO bit, and a falling edge sends a cancel. If the GO bit is already in the appropriate state, no change occurs. 3: PWM input and analog input - A PWM or analog signal is accepted at the IN/TRIG pin and used as the driving source. The device actively drives the actuator while in this mode. The PWM or analog input selection occurs by using the N_PWM_ANALOG bit. 4: Audio-to-vibe - An AC-coupled audio signal is accepted at the IN/TRIG pin. The device converts the audio signal into meaningful haptic vibration. The AC_COUPLE and N_PWM_ANALOG bits should also be set. 5: Real-time playback (RTP mode) - The device actively drives the actuator with the contents of the RTP_INPUT bits in register VIBROMOTOR3_RT_PB_IN. 6: Diagnostics - Set the device in this mode to perform a diagnostic test on the actuator. The user must set the GO bit to start the test. The test is complete when the GO bit self-clears. Results are stored in the DIAG_RESULT bit in register VIBROMOTOR3_STATUS. 7: Auto calibration - Set the device in this mode to auto calibrate the device for the actuator. Before starting the calibration, the user must set the all required input parameters. The user must set the GO bit to start the calibration. Calibration is complete when the GO bit self-clears.

◆ vibromotor3_set_ovdr_offset()

void vibromotor3_set_ovdr_offset ( vibromotor3_t * ctx,
uint8_t data_in )

Sets overdrive offset function.

Function sets the desired overdrive offset.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired overdrive offset
Returns
Nothing.

◆ vibromotor3_set_ovdrv_clamp_volt()

void vibromotor3_set_ovdrv_clamp_volt ( vibromotor3_t * ctx,
uint8_t data_in )

Sets a clamp function.

Function sets a clamp so that the automatic overdrive is bounded.

Parameters
[in]data_in: 8-bit desired imput value
Returns
Nothing.

◆ vibromotor3_set_rated_volt()

void vibromotor3_set_rated_volt ( vibromotor3_t * ctx,
uint8_t data_in )

Sets the reference voltage function.

Function sets the reference voltage for full-scale output during closed-loop.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired value represetning the voltage
Returns
Nothing.

◆ vibromotor3_set_rtp_input()

void vibromotor3_set_rtp_input ( vibromotor3_t * ctx,
uint8_t data_in )

Sets the desired input for RTP mode function.

Function sets the desired Real-Time Playback Input.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired input for RTP mode
Returns
Nothing.

◆ vibromotor3_set_state_hi_z()

void vibromotor3_set_state_hi_z ( vibromotor3_t * ctx,
uint8_t state )

Set the devices in HI-Z state function.

The function is used to enable or disable the HI-Z state.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]state: 8-bit value that defines the HI-Z state
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) enables the HI-Z state, "VIBROMOTOR3_PROPERTY_DISABLE"(0) disables the HI-Z state.

◆ vibromotor3_set_sustain_offset_neg()

void vibromotor3_set_sustain_offset_neg ( vibromotor3_t * ctx,
uint8_t data_in )

Sets sustain offset - negative function.

Function sets the desired sustain offset - negative.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired negative sustain offset
Returns
Nothing.

◆ vibromotor3_set_sustain_offset_pos()

void vibromotor3_set_sustain_offset_pos ( vibromotor3_t * ctx,
uint8_t data_in )

Sets sustain offset - positive function.

Function sets the desired sustain offset - positive.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]data_in: 8-bit desired positive sustain offset
Returns
Nothing.

◆ vibromotor3_soft_rst()

void vibromotor3_soft_rst ( vibromotor3_t * ctx)

Reset function.

The function is used to perform software reset.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
Returns
Nothing.

◆ vibromotor3_start_motor()

void vibromotor3_start_motor ( vibromotor3_t * ctx,
uint8_t state )

Starts or stops moving the motor function.

The function is used to start or stop the motor.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]state: 8-bit value that defines the motor's state
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) starts moving the motor, "VIBROMOTOR3_PROPERTY_DISABLE"(0) stops moving the motor.

◆ vibromotor3_stb_mode()

void vibromotor3_stb_mode ( vibromotor3_t * ctx,
uint8_t state )

Software standby mode.

The function is used to enable or disable the standby mode.

Parameters
[in]state: 8-bit value that defines the state of the standby mode
Returns
Nothing.
Note
"VIBROMOTOR3_PROPERTY_ENABLE"(1) enables the standby mode, "VIBROMOTOR3_PROPERTY_DISABLE"(0) disables the standby mode.

◆ vibromotor3_write_byte()

void vibromotor3_write_byte ( vibromotor3_t * ctx,
uint8_t reg,
uint8_t wr_data )

Generic write the byte of data function.

The function is used to write 8-bit data to the target 8-bit register address.

Parameters
[in]ctx: Click context object. See vibromotor3_t object definition for detailed explanation.
[in]reg: 8-bit register address.
[in]wr_data: 8-bit input data.
Returns
Nothing.