dcmotor24 2.1.0.0
DC Motor 24 Click Driver

API for configuring and manipulating DC Motor 24 Click driver. More...

Topics

 DC Motor 24 Settings
 Settings of DC Motor 24 Click driver.
 
 DC Motor 24 MikroBUS Map
 MikroBUS pin mapping of DC Motor 24 Click driver.
 

Functions

void dcmotor24_cfg_setup (dcmotor24_cfg_t *cfg)
 DC Motor 24 configuration object setup function.
 
err_t dcmotor24_init (dcmotor24_t *ctx, dcmotor24_cfg_t *cfg)
 DC Motor 24 initialization function.
 
err_t dcmotor24_default_cfg (dcmotor24_t *ctx)
 DC Motor 24 default configuration function.
 
err_t dcmotor24_write_config (dcmotor24_t *ctx, uint16_t config_word)
 DC Motor 24 write config function.
 
err_t dcmotor24_read_diag (dcmotor24_t *ctx, uint16_t *diag)
 DC Motor 24 read diag function.
 
void dcmotor24_set_direction (dcmotor24_t *ctx, uint8_t dir)
 DC Motor 24 set direction function.
 
void dcmotor24_switch_direction (dcmotor24_t *ctx)
 DC Motor 24 switch direction function.
 
void dcmotor24_enable_output (dcmotor24_t *ctx)
 DC Motor 24 enable output function.
 
void dcmotor24_disable_output (dcmotor24_t *ctx)
 DC Motor 24 disable output function.
 
err_t dcmotor24_set_duty_cycle (dcmotor24_t *ctx, float duty_cycle)
 DC Motor 24 sets PWM duty cycle.
 
err_t dcmotor24_pwm_stop (dcmotor24_t *ctx)
 DC Motor 24 stop PWM module.
 
err_t dcmotor24_pwm_start (dcmotor24_t *ctx)
 DC Motor 24 start PWM module.
 

Detailed Description

API for configuring and manipulating DC Motor 24 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

◆ dcmotor24_cfg_setup()

void dcmotor24_cfg_setup ( dcmotor24_cfg_t * cfg)

DC Motor 24 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dcmotor24_default_cfg()

err_t dcmotor24_default_cfg ( dcmotor24_t * ctx)

DC Motor 24 default configuration function.

This function executes a default configuration of DC Motor 24 click board.

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

◆ dcmotor24_disable_output()

void dcmotor24_disable_output ( dcmotor24_t * ctx)

DC Motor 24 disable output function.

This function disables the output by setting the EN pin to low logic state.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ dcmotor24_enable_output()

void dcmotor24_enable_output ( dcmotor24_t * ctx)

DC Motor 24 enable output function.

This function enables the output by setting the EN pin to high logic state.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ dcmotor24_init()

err_t dcmotor24_init ( dcmotor24_t * ctx,
dcmotor24_cfg_t * cfg )

DC Motor 24 initialization function.

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

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

◆ dcmotor24_pwm_start()

err_t dcmotor24_pwm_start ( dcmotor24_t * ctx)

DC Motor 24 start PWM module.

This function starts the PWM module output.

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

◆ dcmotor24_pwm_stop()

err_t dcmotor24_pwm_stop ( dcmotor24_t * ctx)

DC Motor 24 stop PWM module.

This function stops the PWM module output.

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

◆ dcmotor24_read_diag()

err_t dcmotor24_read_diag ( dcmotor24_t * ctx,
uint16_t * diag )

DC Motor 24 read diag function.

This function reads a diagnostics word by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
[out]diag: Diagnostics word from DIA_REG.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor24_set_direction()

void dcmotor24_set_direction ( dcmotor24_t * ctx,
uint8_t dir )

DC Motor 24 set direction function.

This function sets the motor direction.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
[in]dir
  • 0 - Reverse,
  • 1 - Forward.
Returns
None.
Note
None.

◆ dcmotor24_set_duty_cycle()

err_t dcmotor24_set_duty_cycle ( dcmotor24_t * ctx,
float duty_cycle )

DC Motor 24 sets PWM duty cycle.

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

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

◆ dcmotor24_switch_direction()

void dcmotor24_switch_direction ( dcmotor24_t * ctx)

DC Motor 24 switch direction function.

This function switches the direction by toggling the DIR pin state.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ dcmotor24_write_config()

err_t dcmotor24_write_config ( dcmotor24_t * ctx,
uint16_t config_word )

DC Motor 24 write config function.

This function writes a desired configuration word by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dcmotor24_t object definition for detailed explanation.
[in]config_word: Configuration word for CFG_REG.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.