dcmotor29 2.1.0.0
dcmotor29.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  dcmotor29_t
 DC Motor 29 Click context object. More...
 
struct  dcmotor29_cfg_t
 DC Motor 29 Click configuration object. More...
 

Macros

#define DCMOTOR29_REG_DEVICE_ID   0x00
 DC Motor 29 description register.
 
#define DCMOTOR29_REG_FAULT_SUMMARY   0x01
 
#define DCMOTOR29_REG_STATUS1   0x02
 
#define DCMOTOR29_REG_STATUS2   0x03
 
#define DCMOTOR29_REG_COMMAND   0x08
 
#define DCMOTOR29_REG_SPI_IN   0x09
 
#define DCMOTOR29_REG_CONFIG1   0x0A
 
#define DCMOTOR29_REG_CONFIG2   0x0B
 
#define DCMOTOR29_REG_CONFIG3   0x0C
 
#define DCMOTOR29_REG_CONFIG4   0x0D
 
#define DCMOTOR29_REG_INPUT_PORT   0x00
 
#define DCMOTOR29_REG_OUTPUT_PORT   0x01
 
#define DCMOTOR29_REG_POLARITY_INV   0x02
 
#define DCMOTOR29_REG_CONFIG   0x03
 
#define DCMOTOR29_CLR_FLT_CMD   0x80
 DC Motor 29 description setting.
 
#define DCMOTOR29_SPI_IN_UNLOCK_CMD   0x10
 
#define DCMOTOR29_SPI_IN_LOCK_CMD   0x08
 
#define DCMOTOR29_REG_UNLOCK_CMD   0x01
 
#define DCMOTOR29_REG_LOCK_CMD   0x02
 
#define DCMOTOR29_NONE_PIN   0x00
 DC Motor 29 pin setting.
 
#define DCMOTOR29_IN2_PIN   0x01
 
#define DCMOTOR29_DOF_PIN   0x02
 
#define DCMOTOR29_FLT_PIN   0x04
 
#define DCMOTOR29_ALL_PIN   0x07
 
#define DCMOTOR29_READ_REG_MASK   0x40
 DC Motor 29 read register.
 
#define DCMOTOR29_DRVOFF_ON   0x01
 DC Motor 29 DRVOFF pin setting.
 
#define DCMOTOR29_DRVOFF_OFF   0x00
 
#define DCMOTOR29_PIN_STATE_HIGH   0x01
 DC Motor 29 pin setting.
 
#define DCMOTOR29_PIN_STATE_LOW   0x00
 
#define DCMOTOR29_S_EN_DEVOFF_MASK   0x08
 DC Motor 29 SPI_IN Register setting.
 
#define DCMOTOR29_S_EN_DEVOFF2_MASK   0x04
 
#define DCMOTOR29_S_EN_IN1_MASK   0x02
 
#define DCMOTOR29_S_EN_IN2_MASK   0x01
 
#define DCMOTOR29_S_EN_NONE   0x00
 
#define DCMOTOR29_EN_OLA   0x80
 DC Motor 29 CONFIG1 Register setting.
 
#define DCMOTOR29_VMOV_SEL_DISABLED   0x60
 
#define DCMOTOR29_VMOV_SEL_18V   0x40
 
#define DCMOTOR29_VMOV_SEL_28V   0x20
 
#define DCMOTOR29_VMOV_SEL_35V   0x00
 
#define DCMOTOR29_SSC_DISABLE   0x10
 
#define DCMOTOR29_OCP_RETRY   0x08
 
#define DCMOTOR29_TSD_RETRY   0x04
 
#define DCMOTOR29_VMOV_RETRY   0x02
 
#define DCMOTOR29_OLA_RETRY   0x01
 
#define DCMOTOR29_TOF_50_US   0xC0
 DC Motor 29 CONFIG3 Register setting.
 
#define DCMOTOR29_TOF_40_US   0x80
 
#define DCMOTOR29_TOF_30_US   0x40
 
#define DCMOTOR29_TOF_20_US   0x00
 
#define DCMOTOR29_S_SR_50_V_US   0x1C
 
#define DCMOTOR29_S_SR_38_V_US   0x18
 
#define DCMOTOR29_S_SR_26_V_US   0x14
 
#define DCMOTOR29_S_SR_20_V_US   0x10
 
#define DCMOTOR29_S_SR_14_V_US   0x0C
 
#define DCMOTOR29_S_SR_9_8V_US   0x08
 
#define DCMOTOR29_S_SR_5_V_US   0x04
 
#define DCMOTOR29_S_SR_1_5V_US   0x00
 
#define DCMOTOR29_S_MODE_PWM   0x03
 
#define DCMOTOR29_S_MODE_INDEPENDENT   0x01
 
#define DCMOTOR29_S_MODE_PH_EN   0x00
 
#define DCMOTOR29_DRIVE_MOTOR_CW   0x00
 DC Motor 29 motor states setting.
 
#define DCMOTOR29_DRIVE_MOTOR_CCW   0x01
 
#define DCMOTOR29_DRIVE_MOTOR_BRAKE   0x02
 
#define DCMOTOR29_DRIVE_MOTOR_COASTING   0x03
 
#define DCMOTOR29_DEVICE_ADDRESS_A1A0_00   0x70
 DC Motor 29 device address setting.
 
#define DCMOTOR29_DEVICE_ADDRESS_A1A0_01   0x71
 
#define DCMOTOR29_DEVICE_ADDRESS_A1A0_10   0x72
 
#define DCMOTOR29_DEVICE_ADDRESS_A1A0_11   0x73
 
#define DCMOTOR29_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DCMOTOR29_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DCMOTOR29_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  dcmotor29_return_value_t { DCMOTOR29_OK = 0 , DCMOTOR29_ERROR = -1 }
 DC Motor 29 Click return value data. More...
 

Functions

void dcmotor29_cfg_setup (dcmotor29_cfg_t *cfg)
 DC Motor 29 configuration object setup function.
 
err_t dcmotor29_init (dcmotor29_t *ctx, dcmotor29_cfg_t *cfg)
 DC Motor 29 initialization function.
 
err_t dcmotor29_default_cfg (dcmotor29_t *ctx)
 DC Motor 29 default configuration function.
 
err_t dcmotor29_generic_write (dcmotor29_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DC Motor 29 data writing function.
 
err_t dcmotor29_generic_read (dcmotor29_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DC Motor 29 data reading function.
 
void dcmotor29_set_in1_pin (dcmotor29_t *ctx, uint8_t pin_state)
 DC Motor 29 set IN1 pin function.
 
void dcmotor29_set_rst_pin (dcmotor29_t *ctx, uint8_t pin_state)
 DC Motor 29 set RST pin function.
 
uint8_t dcmotor29_get_ip_pin (dcmotor29_t *ctx)
 DC Motor 29 get IP pin function.
 
uint8_t dcmotor29_get_int_pin (dcmotor29_t *ctx)
 DC Motor 29 get INT pin function.
 
err_t dcmotor29_register_write (dcmotor29_t *ctx, uint8_t reg, uint8_t data_in)
 DC Motor 29 data register writing function.
 
err_t dcmotor29_register_read (dcmotor29_t *ctx, uint8_t reg, uint8_t *data_out)
 DC Motor 29 data register reading function.
 
err_t dcmotor29_port_expander_write (dcmotor29_t *ctx, uint8_t reg, uint8_t data_in)
 DC Motor 29 port ecpander write register function.
 
err_t dcmotor29_port_expander_read (dcmotor29_t *ctx, uint8_t reg, uint8_t *data_out)
 DC Motor 29 port ecpander read register function.
 
err_t dcmotor29_set_pins (dcmotor29_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 DC Motor 29 set pins function.
 
err_t dcmotor29_drvoff_state (dcmotor29_t *ctx, uint8_t drvoff_state)
 DC Motor 29 control drvoff function.
 
err_t dcmotor29_drive_motor (dcmotor29_t *ctx, uint8_t state)
 DC Motor 29 drive motor function.
 

Detailed Description

This file contains API for DC Motor 29 Click Driver.

Enumeration Type Documentation

◆ dcmotor29_return_value_t

DC Motor 29 Click return value data.

Predefined enum values for driver return values.

Enumerator
DCMOTOR29_OK 
DCMOTOR29_ERROR