Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
60 #define STEPPER17_REG_INPUT_PORT0 0x00
61 #define STEPPER17_REG_INPUT_PORT1 0x01
62 #define STEPPER17_REG_OUTPUT_PORT0 0x02
63 #define STEPPER17_REG_OUTPUT_PORT1 0x03
64 #define STEPPER17_REG_POLARITY_INVERSION_PORT0 0x04
65 #define STEPPER17_REG_POLARITY_INVERSION_PORT1 0x05
66 #define STEPPER17_REG_CONFIGUARTION_PORT0 0x06
67 #define STEPPER17_REG_CONFIGUARTION_PORT1 0x07
85 #define STEPPER17_MODE_SLEEP 0x00
86 #define STEPPER17_MODE_NORMAL 0x80
92 #define STEPPER17_STEP_FULL 0x00
93 #define STEPPER17_STEP_HALF_A 0x04
94 #define STEPPER17_STEP_HALF_B 0x02
95 #define STEPPER17_STEP_QUARTER 0x06
96 #define STEPPER17_STEP_1DIV8 0x01
97 #define STEPPER17_STEP_1DIV16 0x05
98 #define STEPPER17_STEP_1DIV32 0x07
104 #define STEPPER17_DECAY_MIXED 0x00
105 #define STEPPER17_DECAY_SLOW 0x08
106 #define STEPPER17_DECAY_FAST 0x10
107 #define STEPPER17_DECAY_ADMD 0x18
113 #define STEPPER17_TORQUE_100PCT 0x00
114 #define STEPPER17_TORQUE_75PCT 0x20
115 #define STEPPER17_TORQUE_50PCT 0x40
116 #define STEPPER17_TORQUE_25PCT 0x60
123 #define STEPPER17_SET_DEV_ADDR 0x20
130 #define STEPPER17_DEF_FREQ 1500
148 #define STEPPER17_MAP_MIKROBUS( cfg, mikrobus ) \
149 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
150 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
151 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
152 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
153 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
154 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
155 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
174 digital_in_t int_pin;
183 uint8_t slave_address;
205 uint32_t dev_pwm_freq;
479 #endif // STEPPER17_H
Definition: stepper17.h:214
stepper17_return_value_t
Stepper 17 Click return value data.
Definition: stepper17.h:212
uint8_t stepper17_get_electrical_angle(stepper17_t *ctx)
Reads MO pin state.
Stepper 17 Click context object.
Definition: stepper17.h:163
err_t stepper17_set_duty_cycle(stepper17_t *ctx, float duty_cycle)
Stepper 17 sets PWM duty cycle.
err_t stepper17_generic_read(stepper17_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Stepper 17 I2C reading function.
uint8_t stepper17_get_int_state(stepper17_t *ctx)
Gets interrupt state.
err_t stepper17_mode(stepper17_t *ctx, uint8_t mode)
Mode setting.
uint8_t stepper17_get_error(stepper17_t *ctx)
Reads error output.
void stepper17_reset_electrical_angle(stepper17_t *ctx)
Reset electrical angle to initial state.
err_t stepper17_init(stepper17_t *ctx, stepper17_cfg_t *cfg)
Stepper 17 initialization function.
err_t stepper17_pwm_start(stepper17_t *ctx)
Stepper 17 start PWM module.
Definition: stepper17.h:215
err_t stepper17_torque_setting(stepper17_t *ctx, uint8_t torque)
Torque setting.
err_t stepper17_generic_write(stepper17_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Stepper 17 I2C writing function.
err_t stepper17_default_cfg(stepper17_t *ctx)
Stepper 17 default configuration function.
void stepper17_set_en_state(stepper17_t *ctx, uint8_t state)
Enable stepping motor output.
err_t stepper17_decay_function(stepper17_t *ctx, uint8_t decay)
Decay period setting.
Stepper 17 Click configuration object.
Definition: stepper17.h:191
void stepper17_set_dir_state(stepper17_t *ctx, uint8_t state)
Direction control.
void stepper17_set_rst_state(stepper17_t *ctx, uint8_t state)
Set reset pin state.
void stepper17_cfg_setup(stepper17_cfg_t *cfg)
Stepper 17 configuration object setup function.
err_t stepper17_pwm_stop(stepper17_t *ctx)
Stepper 17 stop PWM module.
err_t stepper17_step_resolution(stepper17_t *ctx, uint8_t resolution)
Step resolution setting.