stepper5 2.1.0.0
|
API for configuring and manipulating Stepper 5 Click driver. More...
Topics | |
Stepper 5 Registers List | |
List of registers of Stepper 5 Click driver. | |
Stepper 5 Device Settings | |
Settings for registers of Stepper 5 Click driver. | |
Stepper 5 MikroBUS Map | |
MikroBUS pin mapping of Stepper 5 Click driver. | |
Functions | |
void | stepper5_cfg_setup (stepper5_cfg_t *cfg) |
Stepper 5 configuration object setup function. | |
err_t | stepper5_init (stepper5_t *ctx, stepper5_cfg_t *cfg) |
Stepper 5 initialization function. | |
err_t | stepper5_default_cfg (stepper5_t *ctx) |
Stepper 5 default configuration function. | |
void | stepper5_write_reg (stepper5_t *ctx, uint8_t reg, uint32_t data_in) |
Stepper 5 write reg function. | |
err_t | stepper5_read_reg (stepper5_t *ctx, uint8_t reg, uint32_t *data_out) |
Stepper 5 read reg function. | |
err_t | stepper5_check_com (stepper5_t *ctx) |
Stepper 5 check com function. | |
void | stepper5_enable_device (stepper5_t *ctx) |
Stepper 5 enable device function. | |
void | stepper5_disable_device (stepper5_t *ctx) |
Stepper 5 disable device function. | |
void | stepper5_set_direction (stepper5_t *ctx, uint8_t dir) |
Stepper 5 set direction function. | |
void | stepper5_switch_direction (stepper5_t *ctx) |
Stepper 5 switch direction function. | |
void | stepper5_set_step_pin (stepper5_t *ctx, uint8_t state) |
Stepper 5 set step pin function. | |
uint8_t | stepper5_get_diag_pin (stepper5_t *ctx) |
Stepper 5 get diag pin function. | |
uint8_t | stepper5_get_index_pin (stepper5_t *ctx) |
Stepper 5 get index pin function. | |
err_t | stepper5_set_toff (stepper5_t *ctx, uint8_t toff) |
Stepper 5 set toff function. | |
err_t | stepper5_set_step_res (stepper5_t *ctx, uint8_t mres) |
Stepper 5 set step res function. | |
err_t | stepper5_set_run_current (stepper5_t *ctx, uint8_t irun) |
Stepper 5 set run current function. | |
void | stepper5_drive_motor (stepper5_t *ctx, uint32_t steps, uint8_t speed) |
Stepper 5 driver motor function. | |
API for configuring and manipulating Stepper 5 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void stepper5_cfg_setup | ( | stepper5_cfg_t * | cfg | ) |
Stepper 5 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See stepper5_cfg_t object definition for detailed explanation. |
err_t stepper5_check_com | ( | stepper5_t * | ctx | ) |
Stepper 5 check com function.
This function checks the UART communication by reading and verifying the device version.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t stepper5_default_cfg | ( | stepper5_t * | ctx | ) |
Stepper 5 default configuration function.
This function executes a default configuration of Stepper 5 click board.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void stepper5_disable_device | ( | stepper5_t * | ctx | ) |
Stepper 5 disable device function.
This function disables the device by setting the ENABLE pin to high logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
void stepper5_drive_motor | ( | stepper5_t * | ctx, |
uint32_t | steps, | ||
uint8_t | speed ) |
Stepper 5 driver motor function.
This function drives the motor for the specific number of steps at the selected speed.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | steps | : Number of steps to rotate motor. |
[in] | speed | : Motor rotation speed:
|
void stepper5_enable_device | ( | stepper5_t * | ctx | ) |
Stepper 5 enable device function.
This function enables the device by setting the ENABLE pin to low logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
uint8_t stepper5_get_diag_pin | ( | stepper5_t * | ctx | ) |
Stepper 5 get diag pin function.
This function returns the DIAG pin logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
uint8_t stepper5_get_index_pin | ( | stepper5_t * | ctx | ) |
Stepper 5 get index pin function.
This function returns the INDEX pin logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
err_t stepper5_init | ( | stepper5_t * | ctx, |
stepper5_cfg_t * | cfg ) |
Stepper 5 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See stepper5_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t stepper5_read_reg | ( | stepper5_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out ) |
Stepper 5 read reg function.
This function reads 32-bit data from the selected register by using UART serial interface.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read 32-bit data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void stepper5_set_direction | ( | stepper5_t * | ctx, |
uint8_t | dir ) |
Stepper 5 set direction function.
This function sets the motor direction by setting the DIR pin logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | dir | :
|
err_t stepper5_set_run_current | ( | stepper5_t * | ctx, |
uint8_t | irun ) |
Stepper 5 set run current function.
This function sets the motor run current bits in IHOLD_IRUN register.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | irun | : IRUN bits setting [0-31]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void stepper5_set_step_pin | ( | stepper5_t * | ctx, |
uint8_t | state ) |
Stepper 5 set step pin function.
This function sets the STEP pin logic state.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | state | :
|
err_t stepper5_set_step_res | ( | stepper5_t * | ctx, |
uint8_t | mres ) |
Stepper 5 set step res function.
This function sets the microstep resolution bits in CHOPCONF register.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | mres | : MRES bits setting:
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t stepper5_set_toff | ( | stepper5_t * | ctx, |
uint8_t | toff ) |
Stepper 5 set toff function.
This function sets the off time and driver enable bits in CHOPCONF register.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | toff | : TOFF bits setting [0-15]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void stepper5_switch_direction | ( | stepper5_t * | ctx | ) |
Stepper 5 switch direction function.
This function switches the motor direction by toggling the DIR pin.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
void stepper5_write_reg | ( | stepper5_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in ) |
Stepper 5 write reg function.
This function writes a desired 32-bit data to the selected register by using UART serial interface.
[in] | ctx | : Click context object. See stepper5_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 32-bit data to be written. |