silentstep 2.1.0.0
|
API for configuring and manipulating Silent Step Click driver. More...
Topics | |
Silent Step Registers List | |
List of registers of Silent Step Click driver. | |
Silent Step Registers Settings | |
Settings for registers of Silent Step Click driver. | |
Silent Step MikroBUS Map | |
MikroBUS pin mapping of Silent Step Click driver. | |
Functions | |
void | silentstep_cfg_setup (silentstep_cfg_t *cfg) |
Silent Step configuration object setup function. | |
err_t | silentstep_init (silentstep_t *ctx, silentstep_cfg_t *cfg) |
Silent Step initialization function. | |
err_t | silentstep_default_cfg (silentstep_t *ctx) |
Silent Step default configuration function. | |
err_t | silentstep_write_reg (silentstep_t *ctx, uint8_t reg, uint32_t data_in) |
Silent Step write reg function. | |
err_t | silentstep_read_reg (silentstep_t *ctx, uint8_t reg, uint32_t *data_out) |
Silent Step read reg function. | |
err_t | silentstep_check_com (silentstep_t *ctx) |
Silent Step check com function. | |
void | silentstep_set_direction (silentstep_t *ctx, uint8_t dir) |
Silent Step set direction function. | |
void | silentstep_switch_direction (silentstep_t *ctx) |
Silent Step switch direction function. | |
void | silentstep_set_spm_pin (silentstep_t *ctx, uint8_t state) |
Silent Step set spm pin function. | |
void | silentstep_set_sdm_pin (silentstep_t *ctx, uint8_t state) |
Silent Step set sdm pin function. | |
void | silentstep_set_step_pin (silentstep_t *ctx, uint8_t state) |
Silent Step set step pin function. | |
err_t | silentstep_set_toff (silentstep_t *ctx, uint8_t toff) |
Silent Step set toff function. | |
err_t | silentstep_set_step_res (silentstep_t *ctx, uint8_t mres) |
Silent Step set step res function. | |
err_t | silentstep_set_run_current (silentstep_t *ctx, uint8_t irun) |
Silent Step set run current function. | |
void | silentstep_drive_motor (silentstep_t *ctx, uint32_t steps, uint8_t speed) |
Silent Step driver motor function. | |
API for configuring and manipulating Silent Step Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void silentstep_cfg_setup | ( | silentstep_cfg_t * | cfg | ) |
Silent Step configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See silentstep_cfg_t object definition for detailed explanation. |
err_t silentstep_check_com | ( | silentstep_t * | ctx | ) |
Silent Step check com function.
This function checks the SPI communication by reading and verifying the device version.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep_default_cfg | ( | silentstep_t * | ctx | ) |
Silent Step default configuration function.
This function executes a default configuration of Silent Step click board.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void silentstep_drive_motor | ( | silentstep_t * | ctx, |
uint32_t | steps, | ||
uint8_t | speed ) |
Silent Step driver motor function.
This function drives the motor for the specific number of steps at the selected speed.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | steps | : Number of steps to rotate motor. |
[in] | speed | : Motor rotation speed:
|
err_t silentstep_init | ( | silentstep_t * | ctx, |
silentstep_cfg_t * | cfg ) |
Silent Step initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See silentstep_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep_read_reg | ( | silentstep_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out ) |
Silent Step read reg function.
This function reads 32-bit data from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See silentstep_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 silentstep_set_direction | ( | silentstep_t * | ctx, |
uint8_t | dir ) |
Silent Step set direction function.
This function sets the motor direction by setting the DIR pin logic state.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | dir | :
|
err_t silentstep_set_run_current | ( | silentstep_t * | ctx, |
uint8_t | irun ) |
Silent Step set run current function.
This function sets the motor run current bits in IHOLD_IRUN register.
[in] | ctx | : Click context object. See silentstep_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 silentstep_set_sdm_pin | ( | silentstep_t * | ctx, |
uint8_t | state ) |
Silent Step set sdm pin function.
This function sets the SDM pin logic state.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | state | :
|
void silentstep_set_spm_pin | ( | silentstep_t * | ctx, |
uint8_t | state ) |
Silent Step set spm pin function.
This function sets the SPM pin logic state.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | state | :
|
void silentstep_set_step_pin | ( | silentstep_t * | ctx, |
uint8_t | state ) |
Silent Step set step pin function.
This function sets the STEP pin logic state.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | state | :
|
err_t silentstep_set_step_res | ( | silentstep_t * | ctx, |
uint8_t | mres ) |
Silent Step set step res function.
This function sets the microstep resolution bits in CHOPCONF register.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | mres | : MRES bits setting:
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep_set_toff | ( | silentstep_t * | ctx, |
uint8_t | toff ) |
Silent Step set toff function.
This function sets the off time and driver enable bits in CHOPCONF register.
[in] | ctx | : Click context object. See silentstep_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 silentstep_switch_direction | ( | silentstep_t * | ctx | ) |
Silent Step switch direction function.
This function switches the motor direction by toggling the DIR pin.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
err_t silentstep_write_reg | ( | silentstep_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in ) |
Silent Step write reg function.
This function writes a desired 32-bit data to the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See silentstep_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 32-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.