dcmotor20 2.0.0.0
DC Motor 20 Click Driver

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

Topics

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

Functions

void dcmotor20_cfg_setup (dcmotor20_cfg_t *cfg)
 DC Motor 20 configuration object setup function.
 
err_t dcmotor20_init (dcmotor20_t *ctx, dcmotor20_cfg_t *cfg)
 DC Motor 20 initialization function.
 
err_t dcmotor20_drive_motor (dcmotor20_t *ctx, uint8_t speed, uint32_t time_ms)
 DC Motor 20 drive motor function.
 
err_t dcmotor20_set_channel_mode (dcmotor20_t *ctx, uint8_t channel, uint8_t mode)
 DC Motor 20 set channel mode function.
 
void dcmotor20_set_standby_mode (dcmotor20_t *ctx)
 DC Motor 20 set standby mode function.
 

Detailed Description

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

◆ dcmotor20_cfg_setup()

void dcmotor20_cfg_setup ( dcmotor20_cfg_t * cfg)

DC Motor 20 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dcmotor20_drive_motor()

err_t dcmotor20_drive_motor ( dcmotor20_t * ctx,
uint8_t speed,
uint32_t time_ms )

DC Motor 20 drive motor function.

This function drives the motor for a certian time specified by time_ms at the desired speed. The motor channel and mode must be previously selected using the dcmotor20_set_channel_mode function.

Parameters
[out]ctx: Click context object. See dcmotor20_t object definition for detailed explanation.
[in]speed: Motor speed level [1-100].
[in]time_ms: Driving time in miliseconds.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor20_init()

err_t dcmotor20_init ( dcmotor20_t * ctx,
dcmotor20_cfg_t * cfg )

DC Motor 20 initialization function.

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

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

◆ dcmotor20_set_channel_mode()

err_t dcmotor20_set_channel_mode ( dcmotor20_t * ctx,
uint8_t channel,
uint8_t mode )

DC Motor 20 set channel mode function.

This function sets the active channel and mode which will be used by the dcmotor20_drive_motor function.

Parameters
[out]ctx: Click context object. See dcmotor20_t object definition for detailed explanation.
[in]channel: Active channel selection [1-3].
[in]mode: Mode selection [0-2].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor20_set_standby_mode()

void dcmotor20_set_standby_mode ( dcmotor20_t * ctx)

DC Motor 20 set standby mode function.

This function sets the chip to the standby mode which affects both channels.

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