silentstep4 2.1.0.0
|
API for configuring and manipulating Silent Step 4 Click driver. More...
Topics | |
Silent Step 4 Registers List | |
List of registers of Silent Step 4 Click driver. | |
Data Structures | |
struct | silentstep4_s |
Silent Step 4 Click context object. More... | |
struct | silentstep4_cfg_t |
Silent Step 4 Click configuration object. More... | |
Typedefs | |
typedef struct silentstep4_s | silentstep4_t |
Silent Step 4 Click context object. | |
Enumerations | |
enum | silentstep4_return_value_t { SILENTSTEP4_OK = 0 , SILENTSTEP4_ERROR = -1 } |
Silent Step 4 Click return value data. More... | |
Functions | |
void | silentstep4_cfg_setup (silentstep4_cfg_t *cfg) |
Silent Step 4 configuration object setup function. | |
err_t | silentstep4_init (silentstep4_t *ctx, silentstep4_cfg_t *cfg) |
Silent Step 4 initialization function. | |
err_t | silentstep4_default_cfg (silentstep4_t *ctx) |
Silent Step 4 default configuration function. | |
err_t | silentstep4_write_reg (silentstep4_t *ctx, uint8_t reg, uint32_t data_in) |
Silent Step 4 write reg function. | |
err_t | silentstep4_read_reg (silentstep4_t *ctx, uint8_t reg, uint32_t *data_out) |
Silent Step 4 read reg function. | |
err_t | silentstep4_pca_write_reg (silentstep4_t *ctx, uint8_t reg, uint8_t data_in) |
Silent Step 4 pca write reg function. | |
err_t | silentstep4_pca_read_reg (silentstep4_t *ctx, uint8_t reg, uint8_t *data_out) |
Silent Step 4 pca read reg function. | |
err_t | silentstep4_check_com (silentstep4_t *ctx) |
Silent Step 4 check com function. | |
err_t | silentstep4_get_en_pin (silentstep4_t *ctx, uint8_t *state) |
Silent Step 4 get en pin function. | |
err_t | silentstep4_set_en_pin (silentstep4_t *ctx, uint8_t state) |
Silent Step 4 set en pin function. | |
err_t | silentstep4_get_sleep_pin (silentstep4_t *ctx, uint8_t *state) |
Silent Step 4 get sleep pin function. | |
err_t | silentstep4_set_sleep_pin (silentstep4_t *ctx, uint8_t state) |
Silent Step 4 set sleep pin function. | |
err_t | silentstep4_get_diag0_pin (silentstep4_t *ctx, uint8_t *state) |
Silent Step 4 get diag0 pin function. | |
err_t | silentstep4_get_diag1_pin (silentstep4_t *ctx, uint8_t *state) |
Silent Step 4 get diag1 pin function. | |
err_t | silentstep4_get_ov_pin (silentstep4_t *ctx, uint8_t *state) |
Silent Step 4 get ov pin function. | |
err_t | silentstep4_enable_device (silentstep4_t *ctx) |
Silent Step 4 enable device function. | |
err_t | silentstep4_disable_device (silentstep4_t *ctx) |
Silent Step 4 disable device function. | |
void | silentstep4_set_direction (silentstep4_t *ctx, uint8_t dir) |
Silent Step 4 set direction function. | |
void | silentstep4_switch_direction (silentstep4_t *ctx) |
Silent Step 4 switch direction function. | |
void | silentstep4_reset_pca (silentstep4_t *ctx) |
Silent Step 4 reset device function. | |
void | silentstep4_set_rst_pin (silentstep4_t *ctx, uint8_t state) |
Silent Step 4 set rst pin function. | |
uint8_t | silentstep4_get_int_pin (silentstep4_t *ctx) |
Silent Step 4 get int pin function. | |
void | silentstep4_set_step_pin (silentstep4_t *ctx, uint8_t state) |
Silent Step 4 set step pin function. | |
err_t | silentstep4_set_toff (silentstep4_t *ctx, uint8_t toff) |
Silent Step 4 set toff function. | |
err_t | silentstep4_set_step_res (silentstep4_t *ctx, uint8_t mres) |
Silent Step 4 set step res function. | |
err_t | silentstep4_set_run_current (silentstep4_t *ctx, uint8_t irun) |
Silent Step 4 set run current function. | |
void | silentstep4_drive_motor (silentstep4_t *ctx, uint32_t steps, uint8_t speed) |
Silent Step 4 driver motor function. | |
Variables | |
digital_out_t | dir |
digital_out_t | rst |
digital_out_t | step |
digital_in_t | int_pin |
i2c_master_t | i2c |
spi_master_t | spi |
uint8_t | slave_address |
pin_name_t | chip_select |
pin_name_t | scl |
pin_name_t | sda |
pin_name_t | miso |
pin_name_t | mosi |
pin_name_t | sck |
pin_name_t | cs |
pin_name_t | dir |
pin_name_t | rst |
pin_name_t | step |
pin_name_t | int_pin |
uint32_t | i2c_speed |
uint8_t | i2c_address |
uint32_t | spi_speed |
spi_master_mode_t | spi_mode |
spi_master_chip_select_polarity_t | cs_polarity |
API for configuring and manipulating Silent Step 4 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
typedef struct silentstep4_s silentstep4_t |
Silent Step 4 Click context object.
Context object definition of Silent Step 4 Click driver.
void silentstep4_cfg_setup | ( | silentstep4_cfg_t * | cfg | ) |
Silent Step 4 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See silentstep4_cfg_t object definition for detailed explanation. |
err_t silentstep4_check_com | ( | silentstep4_t * | ctx | ) |
Silent Step 4 check com function.
This function checks the SPI communication by reading and verifying the device version.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_default_cfg | ( | silentstep4_t * | ctx | ) |
Silent Step 4 default configuration function.
This function executes a default configuration of Silent Step 4 click board.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_disable_device | ( | silentstep4_t * | ctx | ) |
Silent Step 4 disable device function.
This function disables the device by setting the ENABLE pin to high logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void silentstep4_drive_motor | ( | silentstep4_t * | ctx, |
uint32_t | steps, | ||
uint8_t | speed ) |
Silent Step 4 driver motor function.
This function drives the motor for the specific number of steps at the selected speed.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | steps | : Number of steps to rotate motor. |
[in] | speed | : Motor rotation speed:
|
err_t silentstep4_enable_device | ( | silentstep4_t * | ctx | ) |
Silent Step 4 enable device function.
This function enables the device by setting the ENABLE pin to low logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_get_diag0_pin | ( | silentstep4_t * | ctx, |
uint8_t * | state ) |
Silent Step 4 get diag0 pin function.
This function reads the diag0 pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_get_diag1_pin | ( | silentstep4_t * | ctx, |
uint8_t * | state ) |
Silent Step 4 get diag1 pin function.
This function reads the diag1 pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_get_en_pin | ( | silentstep4_t * | ctx, |
uint8_t * | state ) |
Silent Step 4 get en pin function.
This function reads the enable pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t silentstep4_get_int_pin | ( | silentstep4_t * | ctx | ) |
Silent Step 4 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
err_t silentstep4_get_ov_pin | ( | silentstep4_t * | ctx, |
uint8_t * | state ) |
Silent Step 4 get ov pin function.
This function reads the ov pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_get_sleep_pin | ( | silentstep4_t * | ctx, |
uint8_t * | state ) |
Silent Step 4 get sleep pin function.
This function reads the sleep pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_init | ( | silentstep4_t * | ctx, |
silentstep4_cfg_t * | cfg ) |
Silent Step 4 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See silentstep4_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_pca_read_reg | ( | silentstep4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Silent Step 4 pca read reg function.
This function reads data from the selected PCA9538A register by using I2C serial interface.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_pca_write_reg | ( | silentstep4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Silent Step 4 pca write reg function.
This function writes a desired data byte to the selected PCA9538A register by using I2C serial interface.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_read_reg | ( | silentstep4_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out ) |
Silent Step 4 read reg function.
This function reads 32-bit data from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See silentstep4_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 silentstep4_reset_pca | ( | silentstep4_t * | ctx | ) |
Silent Step 4 reset device function.
This function resets the PCA9538A device by toggling the RST pin.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
void silentstep4_set_direction | ( | silentstep4_t * | ctx, |
uint8_t | dir ) |
Silent Step 4 set direction function.
This function sets the motor direction by setting the DIR pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | dir | :
|
err_t silentstep4_set_en_pin | ( | silentstep4_t * | ctx, |
uint8_t | state ) |
Silent Step 4 set en pin function.
This function sets the enable pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void silentstep4_set_rst_pin | ( | silentstep4_t * | ctx, |
uint8_t | state ) |
Silent Step 4 set rst pin function.
This function sets the RST pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | state | :
|
err_t silentstep4_set_run_current | ( | silentstep4_t * | ctx, |
uint8_t | irun ) |
Silent Step 4 set run current function.
This function sets the motor run current bits in IHOLD_IRUN register.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | irun | : IRUN bits setting [0-31]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_set_sleep_pin | ( | silentstep4_t * | ctx, |
uint8_t | state ) |
Silent Step 4 set sleep pin function.
This function sets the sleep pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void silentstep4_set_step_pin | ( | silentstep4_t * | ctx, |
uint8_t | state ) |
Silent Step 4 set step pin function.
This function sets the STEP pin logic state.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | state | :
|
err_t silentstep4_set_step_res | ( | silentstep4_t * | ctx, |
uint8_t | mres ) |
Silent Step 4 set step res function.
This function sets the microstep resolution bits in CHOPCONF register.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
[in] | mres | : MRES bits setting:
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t silentstep4_set_toff | ( | silentstep4_t * | ctx, |
uint8_t | toff ) |
Silent Step 4 set toff function.
This function sets the off time and driver enable bits in CHOPCONF register.
[in] | ctx | : Click context object. See silentstep4_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 silentstep4_switch_direction | ( | silentstep4_t * | ctx | ) |
Silent Step 4 switch direction function.
This function switches the motor direction by toggling the DIR pin.
[in] | ctx | : Click context object. See silentstep4_t object definition for detailed explanation. |
err_t silentstep4_write_reg | ( | silentstep4_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in ) |
Silent Step 4 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 silentstep4_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. pin_name_t chip_select |
Chip select pin descriptor (used for SPI driver).
pin_name_t cs |
Chip select pin descriptor for SPI driver.
spi_master_chip_select_polarity_t cs_polarity |
Chip select pin polarity.
digital_out_t dir |
Direction control pin.
pin_name_t dir |
Direction control pin.
i2c_master_t i2c |
I2C driver object.
uint8_t i2c_address |
I2C slave address.
uint32_t i2c_speed |
I2C serial speed.
digital_in_t int_pin |
PCA9538A interrupt pin.
pin_name_t int_pin |
PCA9538A interrupt pin.
pin_name_t miso |
Master input - slave output pin descriptor for SPI driver.
pin_name_t mosi |
Master output - slave input pin descriptor for SPI driver.
digital_out_t rst |
PCA9538A reset pin.
pin_name_t rst |
PCA9538A reset pin.
pin_name_t sck |
Clock pin descriptor for SPI driver.
pin_name_t scl |
Clock pin descriptor for I2C driver.
pin_name_t sda |
Bidirectional data pin descriptor for I2C driver.
uint8_t slave_address |
Device slave address (used for I2C driver).
spi_master_t spi |
SPI driver object.
spi_master_mode_t spi_mode |
SPI master mode.
uint32_t spi_speed |
SPI serial speed.
digital_out_t step |
Step signal pin.
pin_name_t step |
Step signal pin.