dcmotor16 2.0.0.0
DC Motor 16 Click Driver

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

Topics

 DC Motor 16 Registers Settings
 Settings for registers of DC Motor 16 Click driver.
 
 DC Motor 16 MikroBUS Map
 MikroBUS pin mapping of DC Motor 16 Click driver.
 

Functions

void dcmotor16_cfg_setup (dcmotor16_cfg_t *cfg)
 DC Motor 16 configuration object setup function.
 
err_t dcmotor16_init (dcmotor16_t *ctx, dcmotor16_cfg_t *cfg)
 DC Motor 16 initialization function.
 
err_t dcmotor16_generic_write (dcmotor16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DC Motor 16 data writing function.
 
err_t dcmotor16_generic_read (dcmotor16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DC Motor 16 data reading function.
 
void dcmotor16_set_direction (dcmotor16_t *ctx, uint8_t dir)
 Set motor direction.
 
void dcmotor16_ctrl_fwd_pin (dcmotor16_t *ctx, uint8_t state)
 Control FWD pin.
 
void dcmotor16_ctrl_rev_pin (dcmotor16_t *ctx, uint8_t state)
 Control REV pin.
 
void dcmotor16_ctrl_vref (dcmotor16_t *ctx, uint16_t value)
 Control motor VRef (speed).
 
void dcmotor16_stop (dcmotor16_t *ctx)
 Motor stop.
 

Detailed Description

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

◆ dcmotor16_cfg_setup()

void dcmotor16_cfg_setup ( dcmotor16_cfg_t * cfg)

DC Motor 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dcmotor16_ctrl_fwd_pin()

void dcmotor16_ctrl_fwd_pin ( dcmotor16_t * ctx,
uint8_t state )

Control FWD pin.

This function controls the state of the FWD pin.

Parameters
[out]ctx: Click context object. See dcmotor16_t object definition for detailed explanation.
[in]state: Pin State ( 1 - ACTIVE / 0 - DEACTIVE )
Returns
Nothing.

◆ dcmotor16_ctrl_rev_pin()

void dcmotor16_ctrl_rev_pin ( dcmotor16_t * ctx,
uint8_t state )

Control REV pin.

This function controls the state of the REV pin.

Parameters
[out]ctx: Click context object. See dcmotor16_t object definition for detailed explanation.
[in]state: Pin State ( 1 - ACTIVE / 0 - DEACTIVE )
Returns
Nothing.

◆ dcmotor16_ctrl_vref()

void dcmotor16_ctrl_vref ( dcmotor16_t * ctx,
uint16_t value )

Control motor VRef (speed).

This function sets the VRef value used for this click board.

Parameters
[out]ctx: Click context object. See dcmotor16_t object definition for detailed explanation.
[in]value: Motor Vref ( 0x0000 to 0x0100 )
Returns
Nothing.

◆ dcmotor16_generic_read()

err_t dcmotor16_generic_read ( dcmotor16_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

DC Motor 16 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dcmotor16_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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dcmotor16_generic_write()

err_t dcmotor16_generic_write ( dcmotor16_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

DC Motor 16 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dcmotor16_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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dcmotor16_init()

err_t dcmotor16_init ( dcmotor16_t * ctx,
dcmotor16_cfg_t * cfg )

DC Motor 16 initialization function.

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

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

◆ dcmotor16_set_direction()

void dcmotor16_set_direction ( dcmotor16_t * ctx,
uint8_t dir )

Set motor direction.

This function sets the direction of the motor.

Parameters
[out]ctx: Click context object. See dcmotor16_t object definition for detailed explanation.
[in]dir: Motor direction ( FORWARD / BACKWARD )
Returns
Nothing.

◆ dcmotor16_stop()

void dcmotor16_stop ( dcmotor16_t * ctx)

Motor stop.

This function stops the motor.

Parameters
[out]ctx: Click context object. See dcmotor16_t object definition for detailed explanation.
Returns
Nothing.