dcmotor24 2.1.0.0
dcmotor24.h File Reference

This file contains API for DC Motor 24 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"
#include "drv_pwm.h"

Go to the source code of this file.

Data Structures

struct  dcmotor24_t
 DC Motor 24 Click context object. More...
 
struct  dcmotor24_cfg_t
 DC Motor 24 Click configuration object. More...
 

Macros

#define DCMOTOR24_CFG_DR   0x0002u
 DC Motor 24 configuration protocol (CFG_REG) setting.
 
#define DCMOTOR24_CFG_CL_2p5A   0x0000u
 
#define DCMOTOR24_CFG_CL_4A   0x0004u
 
#define DCMOTOR24_CFG_CL_6p6A   0x0008u
 
#define DCMOTOR24_CFG_CL_8p6A   0x000Cu
 
#define DCMOTOR24_CFG_CL_MASK   0x000Cu
 
#define DCMOTOR24_CFG_VSR   0x0100u
 
#define DCMOTOR24_CFG_ISR   0x0200u
 
#define DCMOTOR24_CFG_ISR_DIS   0x0400u
 
#define DCMOTOR24_CFG_OL_ON   0x0800u
 
#define DCMOTOR24_DIA_OL_OFF   0x0001u
 DC Motor 24 diagnostics protocol (DIA_REG) setting.
 
#define DCMOTOR24_DIA_OL_ON   0x0002u
 
#define DCMOTOR24_DIA_VS_UV   0x0004u
 
#define DCMOTOR24_DIA_VDD_OV   0x0008u
 
#define DCMOTOR24_DIA_ILIM   0x0010u
 
#define DCMOTOR24_DIA_TWARN   0x0020u
 
#define DCMOTOR24_DIA_TSD   0x0040u
 
#define DCMOTOR24_DIA_ACT   0x0080u
 
#define DCMOTOR24_DIA_OC_LS1   0x0100u
 
#define DCMOTOR24_DIA_OC_LS2   0x0200u
 
#define DCMOTOR24_DIA_OC_HS1   0x0400u
 
#define DCMOTOR24_DIA_OC_HS2   0x0800u
 
#define DCMOTOR24_DIA_SGND_OFF   0x4000u
 
#define DCMOTOR24_DIA_SBAT_OFF   0x8000u
 
#define DCMOTOR24_DIR_REVERSE   0
 DC Motor 24 direction setting.
 
#define DCMOTOR24_DIR_FORWARD   1
 
#define DCMOTOR24_DEF_FREQ   5000
 DC Motor 24 default PWM frequency.
 
#define DCMOTOR24_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DCMOTOR24_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DCMOTOR24_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  dcmotor24_return_value_t { DCMOTOR24_OK = 0 , DCMOTOR24_ERROR = -1 }
 DC Motor 24 Click return value data. More...
 

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

This file contains API for DC Motor 24 Click Driver.

Enumeration Type Documentation

◆ dcmotor24_return_value_t

DC Motor 24 Click return value data.

Predefined enum values for driver return values.

Enumerator
DCMOTOR24_OK 
DCMOTOR24_ERROR