stepper21 2.1.0.0
stepper21.h File Reference

This file contains API for Stepper 21 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  stepper21_t
 Stepper 21 Click context object. More...
 
struct  stepper21_cfg_t
 Stepper 21 Click configuration object. More...
 

Macros

#define STEPPER21_REG_INPUT   0x00
 Stepper 21 PCA9538A registers.
 
#define STEPPER21_REG_OUTPUT   0x01
 
#define STEPPER21_REG_POLARITY   0x02
 
#define STEPPER21_REG_CONFIG   0x03
 
#define STEPPER21_PIN_SLEEP   0x01
 Stepper 21 PCA9538A pin mask.
 
#define STEPPER21_PIN_FAULT   0x02
 
#define STEPPER21_PIN_DECAY   0x04
 
#define STEPPER21_PIN_ENABLE   0x08
 
#define STEPPER21_PIN_HOME   0x10
 
#define STEPPER21_PIN_MODE0   0x20
 
#define STEPPER21_PIN_MODE1   0x40
 
#define STEPPER21_PIN_MODE2   0x80
 
#define STEPPER21_DEFAULT_CONFIG   0x16
 Stepper 21 PCA9538A pin direction config.
 
#define STEPPER21_DIR_CCW   0
 Stepper 21 direction setting.
 
#define STEPPER21_DIR_CW   1
 
#define STEPPER21_PIN_STATE_LOW   0
 Stepper 21 pin logic state setting.
 
#define STEPPER21_PIN_STATE_HIGH   1
 
#define STEPPER21_PIN_STATE_OPEN   2
 
#define STEPPER21_MODE_FULL_STEP   0x00
 Stepper 21 step resolution setting.
 
#define STEPPER21_MODE_HALF_STEP   0x01
 
#define STEPPER21_MODE_QUARTER_STEP   0x02
 
#define STEPPER21_MODE_1_OVER_8   0x03
 
#define STEPPER21_MODE_1_OVER_16   0x04
 
#define STEPPER21_MODE_1_OVER_32   0x05
 
#define STEPPER21_MODE_MASK   0x07
 
#define STEPPER21_SPEED_VERY_SLOW   0
 Stepper 21 device speed settings.
 
#define STEPPER21_SPEED_SLOW   1
 
#define STEPPER21_SPEED_MEDIUM   2
 
#define STEPPER21_SPEED_FAST   3
 
#define STEPPER21_SPEED_VERY_FAST   4
 
#define STEPPER21_DEVICE_ADDRESS_A1A0_00   0x70
 Stepper 21 device address setting.
 
#define STEPPER21_DEVICE_ADDRESS_A1A0_01   0x71
 
#define STEPPER21_DEVICE_ADDRESS_A1A0_10   0x72
 
#define STEPPER21_DEVICE_ADDRESS_A1A0_11   0x73
 
#define STEPPER21_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  stepper21_return_value_t { STEPPER21_OK = 0 , STEPPER21_ERROR = -1 }
 Stepper 21 Click return value data. More...
 

Functions

void stepper21_cfg_setup (stepper21_cfg_t *cfg)
 Stepper 21 configuration object setup function.
 
err_t stepper21_init (stepper21_t *ctx, stepper21_cfg_t *cfg)
 Stepper 21 initialization function.
 
err_t stepper21_default_cfg (stepper21_t *ctx)
 Stepper 21 default configuration function.
 
err_t stepper21_write_register (stepper21_t *ctx, uint8_t reg, uint8_t data_in)
 Stepper 21 write register function.
 
err_t stepper21_read_register (stepper21_t *ctx, uint8_t reg, uint8_t *data_out)
 Stepper 21 read register function.
 
err_t stepper21_get_step_mode (stepper21_t *ctx, uint8_t *mode)
 Stepper 21 get step mode function.
 
err_t stepper21_set_step_mode (stepper21_t *ctx, uint8_t mode)
 Stepper 21 set step mode function.
 
err_t stepper21_get_sleep_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get sleep pin function.
 
err_t stepper21_set_sleep_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set sleep pin function.
 
err_t stepper21_get_fault_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get fault pin function.
 
err_t stepper21_get_decay_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get decay pin function.
 
err_t stepper21_set_decay_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set decay pin function.
 
err_t stepper21_get_enable_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get enable pin function.
 
err_t stepper21_set_enable_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set enable pin function.
 
err_t stepper21_get_home_pin (stepper21_t *ctx, uint8_t *state)
 Stepper 21 get home pin function.
 
void stepper21_drive_motor (stepper21_t *ctx, uint32_t steps, uint8_t speed)
 Stepper 21 driver motor function.
 
err_t stepper21_enable_device (stepper21_t *ctx)
 Stepper 21 enable device function.
 
err_t stepper21_disable_device (stepper21_t *ctx)
 Stepper 21 disable device function.
 
void stepper21_set_direction (stepper21_t *ctx, uint8_t dir)
 Stepper 21 set direction function.
 
void stepper21_switch_direction (stepper21_t *ctx)
 Stepper 21 switch direction function.
 
void stepper21_set_rst_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set rst pin function.
 
void stepper21_reset_device (stepper21_t *ctx)
 Stepper 21 reset device function.
 
uint8_t stepper21_get_int_pin (stepper21_t *ctx)
 Stepper 21 get int pin function.
 
void stepper21_set_step_pin (stepper21_t *ctx, uint8_t state)
 Stepper 21 set step pin function.
 

Detailed Description

This file contains API for Stepper 21 Click Driver.

Enumeration Type Documentation

◆ stepper21_return_value_t

Stepper 21 Click return value data.

Predefined enum values for driver return values.

Enumerator
STEPPER21_OK 
STEPPER21_ERROR