haptic2 2.0.0.0
HAPTIC 2 Click Driver

API for configuring and manipulating HAPTIC 2 Click driver. More...

Topics

 HAPTIC 2 PWM Settings
 Settings for configuration of HAPTIC 2 Click driver.
 
 HAPTIC 2 MikroBUS Map
 MikroBUS pin mapping of HAPTIC 2 Click driver.
 
 Haptic2_cfg
 

Functions

void haptic2_cfg_setup (haptic2_cfg_t *cfg)
 HAPTIC 2 configuration object setup function.
 
err_t haptic2_init (haptic2_t *ctx, haptic2_cfg_t *cfg)
 HAPTIC 2 initialization function.
 
err_t haptic2_default_cfg (haptic2_t *ctx)
 HAPTIC 2 default configuration function.
 
err_t haptic2_set_duty_cycle (haptic2_t *ctx, float duty_ratio)
 HAPTIC 2 sets PWM duty cycle.
 
err_t haptic2_pwm_stop (haptic2_t *ctx)
 HAPTIC 2 stop PWM module.
 
err_t haptic2_pwm_start (haptic2_t *ctx)
 HAPTIC 2 start PWM module.
 

Detailed Description

API for configuring and manipulating HAPTIC 2 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

◆ haptic2_cfg_setup()

void haptic2_cfg_setup ( haptic2_cfg_t * cfg)

HAPTIC 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ haptic2_default_cfg()

err_t haptic2_default_cfg ( haptic2_t * ctx)

HAPTIC 2 default configuration function.

This function executes a default configuration of HAPTIC 2 click board.

Parameters
[in]ctx: Click context object. See haptic2_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.

◆ haptic2_init()

err_t haptic2_init ( haptic2_t * ctx,
haptic2_cfg_t * cfg )

HAPTIC 2 initialization function.

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

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

◆ haptic2_pwm_start()

err_t haptic2_pwm_start ( haptic2_t * ctx)

HAPTIC 2 start PWM module.

This function starts the PWM moudle output.

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

◆ haptic2_pwm_stop()

err_t haptic2_pwm_stop ( haptic2_t * ctx)

HAPTIC 2 stop PWM module.

This function stops the PWM moudle output.

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

◆ haptic2_set_duty_cycle()

err_t haptic2_set_duty_cycle ( haptic2_t * ctx,
float duty_ratio )

HAPTIC 2 sets PWM duty cycle.

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

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