haptic4 2.1.0.0
|
API for configuring and manipulating Haptic 4 Click driver. More...
Topics | |
Haptic 4 Registers List | |
List of registers of Haptic 4 Click driver. | |
Haptic 4 Registers Settings | |
Settings for registers of Haptic 4 Click driver. | |
Haptic 4 MikroBUS Map | |
MikroBUS pin mapping of Haptic 4 Click driver. | |
Functions | |
void | haptic4_cfg_setup (haptic4_cfg_t *cfg) |
Haptic 4 configuration object setup function. | |
err_t | haptic4_init (haptic4_t *ctx, haptic4_cfg_t *cfg) |
Haptic 4 initialization function. | |
err_t | haptic4_default_cfg (haptic4_t *ctx) |
Haptic 4 default configuration function. | |
err_t | haptic4_generic_write (haptic4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Haptic 4 I2C writing function. | |
err_t | haptic4_generic_read (haptic4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Haptic 4 I2C reading function. | |
err_t | haptic4_write_register (haptic4_t *ctx, uint8_t reg, uint8_t data_in) |
Haptic 4 write register function. | |
err_t | haptic4_read_register (haptic4_t *ctx, uint8_t reg, uint8_t *data_out) |
Haptic 4 read register function. | |
err_t | haptic4_write_register_bits (haptic4_t *ctx, uint8_t reg, uint8_t mask, uint8_t data_in) |
Haptic 4 write register bits function. | |
err_t | haptic4_check_communication (haptic4_t *ctx) |
Haptic 4 check communication function. | |
void | haptic4_set_gp0 (haptic4_t *ctx, uint8_t pin_state) |
Haptic 4 set GP0 pin state function. | |
void | haptic4_set_gp1 (haptic4_t *ctx, uint8_t pin_state) |
Haptic 4 set GP1 pin state function. | |
void | haptic4_set_gp2 (haptic4_t *ctx, uint8_t pin_state) |
Haptic 4 set GP2 pin state function. | |
uint8_t | haptic4_get_int_pin (haptic4_t *ctx) |
Haptic 4 get INT pin function. | |
err_t | haptic4_set_actuator_type (haptic4_t *ctx, uint8_t type) |
Haptic 4 set actuator type function. | |
err_t | haptic4_set_actuator_abs_volt (haptic4_t *ctx, float abs_volt) |
Haptic 4 set actuator abs volt function. | |
err_t | haptic4_set_actuator_nom_volt (haptic4_t *ctx, float nom_volt) |
Haptic 4 set actuator nom volt function. | |
err_t | haptic4_set_actuator_imax (haptic4_t *ctx, float max_curr) |
Haptic 4 set actuator imax function. | |
err_t | haptic4_set_actuator_impedance (haptic4_t *ctx, float impedance) |
Haptic 4 set actuator impedance function. | |
err_t | haptic4_set_actuator_lra_freq (haptic4_t *ctx, float frequency) |
Haptic 4 set actuator lra freq function. | |
err_t | haptic4_set_operation_mode (haptic4_t *ctx, uint8_t op_mode) |
Haptic 4 set operation mode function. | |
err_t | haptic4_set_freq_track (haptic4_t *ctx, uint8_t freq_track_en) |
Haptic 4 set freq track function. | |
err_t | haptic4_set_acceleration_mode (haptic4_t *ctx, uint8_t accel_en) |
Haptic 4 set accel mode function. | |
err_t | haptic4_set_vibration_level (haptic4_t *ctx, float level) |
Haptic 4 set vibration level function. | |
err_t | haptic4_get_vibration_level (haptic4_t *ctx, float *level) |
Haptic 4 get vibration level function. | |
API for configuring and manipulating Haptic 4 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void haptic4_cfg_setup | ( | haptic4_cfg_t * | cfg | ) |
Haptic 4 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See haptic4_cfg_t object definition for detailed explanation. |
err_t haptic4_check_communication | ( | haptic4_t * | ctx | ) |
Haptic 4 check communication function.
This function checks the communication by reading and verifying the chip ID.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_default_cfg | ( | haptic4_t * | ctx | ) |
Haptic 4 default configuration function.
This function executes a default configuration of Haptic 4 click board.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_generic_read | ( | haptic4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Haptic 4 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 haptic4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_generic_write | ( | haptic4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Haptic 4 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 haptic4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t haptic4_get_int_pin | ( | haptic4_t * | ctx | ) |
Haptic 4 get INT pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
err_t haptic4_get_vibration_level | ( | haptic4_t * | ctx, |
float * | level ) |
Haptic 4 get vibration level function.
This function reads the motor vibration level.
[in] | ctx | : Click context object. See haptic4_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 haptic4_init | ( | haptic4_t * | ctx, |
haptic4_cfg_t * | cfg ) |
Haptic 4 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See haptic4_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_read_register | ( | haptic4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Haptic 4 read register function.
This function reads a desired data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_acceleration_mode | ( | haptic4_t * | ctx, |
uint8_t | accel_en ) |
Haptic 4 set accel mode function.
This function sets the accel mode bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | accel_en | : Selected accel mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_set_actuator_abs_volt | ( | haptic4_t * | ctx, |
float | abs_volt ) |
Haptic 4 set actuator abs volt function.
This function sets the actuator absolute maximum voltage.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_actuator_imax | ( | haptic4_t * | ctx, |
float | max_curr ) |
Haptic 4 set actuator imax function.
This function sets the actuator max current rating.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_actuator_impedance | ( | haptic4_t * | ctx, |
float | impedance ) |
Haptic 4 set actuator impedance function.
This function sets the actuator impedance.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_actuator_lra_freq | ( | haptic4_t * | ctx, |
float | frequency ) |
Haptic 4 set actuator lra freq function.
This function sets the actuator LRA frequency.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_actuator_nom_volt | ( | haptic4_t * | ctx, |
float | nom_volt ) |
Haptic 4 set actuator nom volt function.
This function sets the actuator nominal voltage.
[in] | ctx | : Click context object. See haptic4_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 haptic4_set_actuator_type | ( | haptic4_t * | ctx, |
uint8_t | type ) |
Haptic 4 set actuator type function.
This function sets the actuator type bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | type | : Selected actuator type. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_set_freq_track | ( | haptic4_t * | ctx, |
uint8_t | freq_track_en ) |
Haptic 4 set freq track function.
This function sets the frequency tracking bits in TOP CFG1 register.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | freq_track_en | : Selected frequency tracking mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void haptic4_set_gp0 | ( | haptic4_t * | ctx, |
uint8_t | pin_state ) |
Haptic 4 set GP0 pin state function.
This function is used to set GP0 pin state.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | pin_state | : Pin state. |
void haptic4_set_gp1 | ( | haptic4_t * | ctx, |
uint8_t | pin_state ) |
Haptic 4 set GP1 pin state function.
This function is used to set GP1 pin state.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | pin_state | : Pin state. |
void haptic4_set_gp2 | ( | haptic4_t * | ctx, |
uint8_t | pin_state ) |
Haptic 4 set GP2 pin state function.
This function is used to set GP2 pin state.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | pin_state | : Pin state. |
err_t haptic4_set_operation_mode | ( | haptic4_t * | ctx, |
uint8_t | op_mode ) |
Haptic 4 set operation mode function.
This function sets the operation mode bits in TOP CTL1 register.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | op_mode | : Selected operation mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_set_vibration_level | ( | haptic4_t * | ctx, |
float | level ) |
Haptic 4 set vibration level function.
This function sets the motor vibration level.
[in] | ctx | : Click context object. See haptic4_t object definition for detailed explanation. |
[in] | level | : Vibration level in percentage from 0.0 (or -1.0 if accel mode is disabled) to 1.0. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t haptic4_write_register | ( | haptic4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Haptic 4 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See haptic4_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 haptic4_write_register_bits | ( | haptic4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | data_in ) |
Haptic 4 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 haptic4_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.