haptic3 2.0.0.0
|
API for configuring and manipulating HAPTIC 3 Click driver. More...
Topics | |
HAPTIC 3 Registers List | |
List of registers of HAPTIC 3 Click driver. | |
HAPTIC 3 Registers Settings | |
Settings for registers of HAPTIC 3 Click driver. | |
HAPTIC 3 MikroBUS Map | |
MikroBUS pin mapping of HAPTIC 3 Click driver. | |
Functions | |
void | haptic3_cfg_setup (haptic3_cfg_t *cfg) |
HAPTIC 3 configuration object setup function. | |
err_t | haptic3_init (haptic3_t *ctx, haptic3_cfg_t *cfg) |
HAPTIC 3 initialization function. | |
err_t | haptic3_default_cfg (haptic3_t *ctx) |
HAPTIC 3 default configuration function. | |
err_t | haptic3_generic_write (haptic3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
HAPTIC 3 I2C writing function. | |
err_t | haptic3_generic_read (haptic3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
HAPTIC 3 I2C reading function. | |
err_t | haptic3_write_register (haptic3_t *ctx, uint8_t reg, uint8_t data_in) |
HAPTIC 3 write register function. | |
err_t | haptic3_read_register (haptic3_t *ctx, uint8_t reg, uint8_t *data_out) |
HAPTIC 3 read register function. | |
err_t | haptic3_write_register_bits (haptic3_t *ctx, uint8_t reg, uint8_t mask, uint8_t data_in) |
HAPTIC 3 write register bits function. | |
err_t | haptic3_check_communication (haptic3_t *ctx) |
HAPTIC 3 check communication function. | |
void | haptic3_enable_device (haptic3_t *ctx) |
HAPTIC 3 enable device function. | |
void | haptic3_disable_device (haptic3_t *ctx) |
HAPTIC 3 disable device function. | |
uint8_t | haptic3_get_int_pin (haptic3_t *ctx) |
HAPTIC 3 get INT pin function. | |
err_t | haptic3_set_actuator_type (haptic3_t *ctx, uint8_t type) |
HAPTIC 3 set actuator type function. | |
err_t | haptic3_set_actuator_abs_volt (haptic3_t *ctx, float abs_volt) |
HAPTIC 3 set actuator abs volt function. | |
err_t | haptic3_set_actuator_nom_volt (haptic3_t *ctx, float nom_volt) |
HAPTIC 3 set actuator nom volt function. | |
err_t | haptic3_set_actuator_imax (haptic3_t *ctx, float max_curr) |
HAPTIC 3 set actuator imax function. | |
err_t | haptic3_set_actuator_impedance (haptic3_t *ctx, float impedance) |
HAPTIC 3 set actuator impedance function. | |
err_t | haptic3_set_actuator_lra_freq (haptic3_t *ctx, float frequency) |
HAPTIC 3 set actuator lra freq function. | |
err_t | haptic3_set_operation_mode (haptic3_t *ctx, uint8_t op_mode) |
HAPTIC 3 set operation mode function. | |
err_t | haptic3_set_freq_track (haptic3_t *ctx, uint8_t freq_track_en) |
HAPTIC 3 set freq track function. | |
err_t | haptic3_set_acceleration_mode (haptic3_t *ctx, uint8_t accel_en) |
HAPTIC 3 set acceleration mode function. | |
err_t | haptic3_set_vibration_level (haptic3_t *ctx, float level) |
HAPTIC 3 set vibration level function. | |
err_t | haptic3_get_vibration_level (haptic3_t *ctx, float *level) |
HAPTIC 3 get vibration level function. | |
API for configuring and manipulating HAPTIC 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void haptic3_cfg_setup | ( | haptic3_cfg_t * | cfg | ) |
HAPTIC 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See haptic3_cfg_t object definition for detailed explanation. |
err_t haptic3_check_communication | ( | haptic3_t * | ctx | ) |
HAPTIC 3 check communication function.
This function checks the communication by reading and verifying the chip ID.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_default_cfg | ( | haptic3_t * | ctx | ) |
HAPTIC 3 default configuration function.
This function executes a default configuration of HAPTIC 3 click board.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
0
- Success, -1
- Error.void haptic3_disable_device | ( | haptic3_t * | ctx | ) |
HAPTIC 3 disable device function.
This function disables the device by setting the EN pin to low logic state.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
void haptic3_enable_device | ( | haptic3_t * | ctx | ) |
HAPTIC 3 enable device function.
This function enables the device by setting the EN pin to high logic state.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
err_t haptic3_generic_read | ( | haptic3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
HAPTIC 3 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic3_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. |
0
- Success, -1
- Error.err_t haptic3_generic_write | ( | haptic3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
HAPTIC 3 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic3_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. |
0
- Success, -1
- Error.uint8_t haptic3_get_int_pin | ( | haptic3_t * | ctx | ) |
HAPTIC 3 get INT pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
err_t haptic3_get_vibration_level | ( | haptic3_t * | ctx, |
float * | level ) |
HAPTIC 3 get vibration level function.
This function reads the motor vibration level.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[out] | level | : Vibration level in percentage from 0.0 (or -1.0 if acceleration mode is disabled) to 1.0. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_init | ( | haptic3_t * | ctx, |
haptic3_cfg_t * | cfg ) |
HAPTIC 3 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See haptic3_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t haptic3_read_register | ( | haptic3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
HAPTIC 3 read register function.
This function reads a desired data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_acceleration_mode | ( | haptic3_t * | ctx, |
uint8_t | accel_en ) |
HAPTIC 3 set acceleration mode function.
This function sets the acceleration mode bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | accel_en | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_abs_volt | ( | haptic3_t * | ctx, |
float | abs_volt ) |
HAPTIC 3 set actuator abs volt function.
This function sets the actuator absolute maximum voltage.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | abs_volt | : Voltage in range of 0.0 to 6.0 V. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_imax | ( | haptic3_t * | ctx, |
float | max_curr ) |
HAPTIC 3 set actuator imax function.
This function sets the actuator max current rating.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | max_curr | : Current in range of 28.6 to 251.8 mA. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_impedance | ( | haptic3_t * | ctx, |
float | impedance ) |
HAPTIC 3 set actuator impedance function.
This function sets the actuator impedance.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | impedance | : Impedance in range of 4.0 to 50.0 Ohm. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_lra_freq | ( | haptic3_t * | ctx, |
float | frequency ) |
HAPTIC 3 set actuator lra freq function.
This function sets the actuator LRA frequency.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | frequency | : Frequency in range of 0.0 to 300.0 Hz. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_nom_volt | ( | haptic3_t * | ctx, |
float | nom_volt ) |
HAPTIC 3 set actuator nom volt function.
This function sets the actuator nominal voltage.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | nom_volt | : Voltage in range of 0.0 to 6.0 V. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_actuator_type | ( | haptic3_t * | ctx, |
uint8_t | type ) |
HAPTIC 3 set actuator type function.
This function sets the actuator type bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | type | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_freq_track | ( | haptic3_t * | ctx, |
uint8_t | freq_track_en ) |
HAPTIC 3 set freq track function.
This function sets the frequency tracking bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | freq_track_en | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_operation_mode | ( | haptic3_t * | ctx, |
uint8_t | op_mode ) |
HAPTIC 3 set operation mode function.
This function sets the operation mode bits in TOP CTL1 register.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | op_mode | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_set_vibration_level | ( | haptic3_t * | ctx, |
float | level ) |
HAPTIC 3 set vibration level function.
This function sets the motor vibration level.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | level | : Vibration level in percentage from 0.0 (or -1.0 if acceleration mode is disabled) to 1.0. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_write_register | ( | haptic3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
HAPTIC 3 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic3_write_register_bits | ( | haptic3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | data_in ) |
HAPTIC 3 write register bits function.
This function writes a desired data bits to the bits specified with mask of the selected register.
[in] | ctx | : Click context object. See haptic3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | mask | : Mask of bits to be changed. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.