dcmotor15 2.0.0.0
DC Motor 15 Click Driver

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

Topics

 DC Motor 15 MikroBUS Map
 MikroBUS pin mapping of DC Motor 15 Click driver.
 

Macros

#define DCMOTOR15_RIPROP_OHM   1500
 DC Motor 15 IPROPI values.
 
#define DCMOTOR15_AIPROP_AMP   0.000455
 

Functions

void dcmotor15_cfg_setup (dcmotor15_cfg_t *cfg)
 DC Motor 15 configuration object setup function.
 
err_t dcmotor15_init (dcmotor15_t *ctx, dcmotor15_cfg_t *cfg)
 DC Motor 15 initialization function.
 
void dcmotor15_default_cfg (dcmotor15_t *ctx)
 DC Motor 15 default configuration function.
 
err_t dcmotor15_read_an_pin_value (dcmotor15_t *ctx, uint16_t *data_out)
 DC Motor 15 read IPR pin value function.
 
err_t dcmotor15_read_an_pin_voltage (dcmotor15_t *ctx, float *data_out)
 DC Motor 15 read IPR pin voltage level function.
 
void dcmotor15_set_slp_pin_state (dcmotor15_t *ctx, uint8_t state)
 DC Motor 15 set SLP pin state function.
 
void dcmotor15_set_in1_pin_state (dcmotor15_t *ctx, uint8_t state)
 DC Motor 15 set IN1 pin state function.
 
void dcmotor15_set_in2_pin_state (dcmotor15_t *ctx, uint8_t state)
 DC Motor 15 set IN2 pin state function.
 
uint8_t dcmotor15_fault_check (dcmotor15_t *ctx)
 DC Motor 15 get FLT pin state function.
 
void dcmotor15_forward (dcmotor15_t *ctx)
 DC Motor 15 drive forward function.
 
void dcmotor15_reverse (dcmotor15_t *ctx)
 DC Motor 15 drive reverse function.
 
void dcmotor15_brake (dcmotor15_t *ctx)
 DC Motor 15 brake function.
 
void dcmotor15_stop (dcmotor15_t *ctx)
 DC Motor 15 stop function.
 
float dcmotor15_get_current (dcmotor15_t *ctx, uint16_t num_of_conv)
 DC Motor 15 get current function.
 

Detailed Description

API for configuring and manipulating DC Motor 15 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Macro Definition Documentation

◆ DCMOTOR15_AIPROP_AMP

#define DCMOTOR15_AIPROP_AMP   0.000455

◆ DCMOTOR15_RIPROP_OHM

#define DCMOTOR15_RIPROP_OHM   1500

DC Motor 15 IPROPI values.

Specified IPROPI values of DC Motor 15 Click driver.

Function Documentation

◆ dcmotor15_brake()

void dcmotor15_brake ( dcmotor15_t * ctx)

DC Motor 15 brake function.

This function pulls the motor brake.

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

◆ dcmotor15_cfg_setup()

void dcmotor15_cfg_setup ( dcmotor15_cfg_t * cfg)

DC Motor 15 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dcmotor15_default_cfg()

void dcmotor15_default_cfg ( dcmotor15_t * ctx)

DC Motor 15 default configuration function.

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

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ dcmotor15_fault_check()

uint8_t dcmotor15_fault_check ( dcmotor15_t * ctx)

DC Motor 15 get FLT pin state function.

This function returns the FLT pin logic state.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ dcmotor15_forward()

void dcmotor15_forward ( dcmotor15_t * ctx)

DC Motor 15 drive forward function.

This function drives the motor forward.

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

◆ dcmotor15_get_current()

float dcmotor15_get_current ( dcmotor15_t * ctx,
uint16_t num_of_conv )

DC Motor 15 get current function.

This function reads the motor current consumption by performing analog to digital read of IPR pin.

Parameters
[in]ctx: Click context object.
[in]num_of_conv: Number of ADC conversions to be performed. See dcmotor15_t object definition for detailed explanation.
Returns
Current value in Amps.
Note
None.

◆ dcmotor15_init()

err_t dcmotor15_init ( dcmotor15_t * ctx,
dcmotor15_cfg_t * cfg )

DC Motor 15 initialization function.

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

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

◆ dcmotor15_read_an_pin_value()

err_t dcmotor15_read_an_pin_value ( dcmotor15_t * ctx,
uint16_t * data_out )

DC Motor 15 read IPR pin value function.

This function reads results of AD conversion of the IPR pin.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor15_read_an_pin_voltage()

err_t dcmotor15_read_an_pin_voltage ( dcmotor15_t * ctx,
float * data_out )

DC Motor 15 read IPR pin voltage level function.

This function reads results of AD conversion of the IPR pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ dcmotor15_reverse()

void dcmotor15_reverse ( dcmotor15_t * ctx)

DC Motor 15 drive reverse function.

This function drives the motor in reverse.

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

◆ dcmotor15_set_in1_pin_state()

void dcmotor15_set_in1_pin_state ( dcmotor15_t * ctx,
uint8_t state )

DC Motor 15 set IN1 pin state function.

This function sets the IN1 pin to a desired state.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ dcmotor15_set_in2_pin_state()

void dcmotor15_set_in2_pin_state ( dcmotor15_t * ctx,
uint8_t state )

DC Motor 15 set IN2 pin state function.

This function sets the IN2 pin to a desired state.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ dcmotor15_set_slp_pin_state()

void dcmotor15_set_slp_pin_state ( dcmotor15_t * ctx,
uint8_t state )

DC Motor 15 set SLP pin state function.

This function sets the SLP pin to a desired state.

Parameters
[in]ctx: Click context object. See dcmotor15_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ dcmotor15_stop()

void dcmotor15_stop ( dcmotor15_t * ctx)

DC Motor 15 stop function.

This function stops the motor, the click goes to sleep mode, the motor is disconnected.

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