dcmotor12
2.1.0.0
|
API for configuring and manipulating DC Motor 12 Click driver. More...
Modules | |
DC Motor 12 Registers List | |
List of registers of DC Motor 12 Click driver. | |
DC Motor 12 Registers Settings | |
Settings for registers of DC Motor 12 Click driver. | |
DC Motor 12 MikroBUS Map | |
MikroBUS pin mapping of DC Motor 12 Click driver. | |
Functions | |
void | dcmotor12_cfg_setup (dcmotor12_cfg_t *cfg) |
DC Motor 12 configuration object setup function. More... | |
err_t | dcmotor12_init (dcmotor12_t *ctx, dcmotor12_cfg_t *cfg) |
DC Motor 12 initialization function. More... | |
err_t | dcmotor12_default_cfg (dcmotor12_t *ctx) |
DC Motor 12 default configuration function. More... | |
err_t | dcmotor12_write_register (dcmotor12_t *ctx, uint8_t reg, uint32_t data_in) |
DC Motor 12 write register function. More... | |
err_t | dcmotor12_read_register (dcmotor12_t *ctx, uint8_t reg, uint32_t *data_out) |
DC Motor 12 read register function. More... | |
err_t | dcmotor12_pca9538a_write_register (dcmotor12_t *ctx, uint8_t reg, uint8_t data_in) |
DC Motor 12 pca9538a write register function. More... | |
err_t | dcmotor12_pca9538a_read_register (dcmotor12_t *ctx, uint8_t reg, uint8_t *data_out) |
DC Motor 12 pca9538a read register function. More... | |
void | dcmotor12_enter_sleep_mode (dcmotor12_t *ctx) |
DC Motor 12 enter sleep mode function. More... | |
void | dcmotor12_wake_up_device (dcmotor12_t *ctx) |
DC Motor 12 wake up device function. More... | |
uint8_t | dcmotor12_get_int_pin (dcmotor12_t *ctx) |
DC Motor 12 get int pin function. More... | |
void | dcmotor12_set_clk_pin (dcmotor12_t *ctx, uint8_t state) |
DC Motor 12 set clk pin function. More... | |
err_t | dcmotor12_set_en1_pin (dcmotor12_t *ctx, uint8_t state) |
DC Motor 12 set en1 pin function. More... | |
err_t | dcmotor12_get_en1_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get en1 pin function. More... | |
err_t | dcmotor12_set_en2_pin (dcmotor12_t *ctx, uint8_t state) |
DC Motor 12 set en2 pin function. More... | |
err_t | dcmotor12_get_en2_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get en2 pin function. More... | |
err_t | dcmotor12_set_cm_sel_pin (dcmotor12_t *ctx, uint8_t state) |
DC Motor 12 set cm sel pin function. More... | |
err_t | dcmotor12_get_cm_sel_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get cm sel pin function. More... | |
err_t | dcmotor12_get_diag1_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get diag1 pin function. More... | |
err_t | dcmotor12_get_diag2_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get diag2 pin function. More... | |
err_t | dcmotor12_get_sleep_pin (dcmotor12_t *ctx, uint8_t *state) |
DC Motor 12 get sleep pin function. More... | |
err_t | dcmotor12_read_an_pin_value (dcmotor12_t *ctx, uint16_t *data_out) |
DC Motor 12 read AN pin value function. More... | |
err_t | dcmotor12_read_an_pin_voltage (dcmotor12_t *ctx, float *data_out) |
DC Motor 12 read AN pin voltage level function. More... | |
err_t | dcmotor12_get_motor_current (dcmotor12_t *ctx, float *current) |
DC Motor 12 get motor current function. More... | |
err_t | dcmotor12_set_ch1_operation_mode (dcmotor12_t *ctx, uint8_t mode) |
DC Motor 12 set ch1 operation mode function. More... | |
err_t | dcmotor12_set_ch2_operation_mode (dcmotor12_t *ctx, uint8_t mode) |
DC Motor 12 set ch2 operation mode function. More... | |
err_t | dcmotor12_set_ch1_drive_frequency (dcmotor12_t *ctx, uint16_t drv_freq) |
DC Motor 12 set ch1 drive frequency function. More... | |
err_t | dcmotor12_set_ch2_drive_frequency (dcmotor12_t *ctx, uint16_t drv_freq) |
DC Motor 12 set ch2 drive frequency function. More... | |
err_t | dcmotor12_set_ch1_duty_period (dcmotor12_t *ctx, uint16_t duty_period) |
DC Motor 12 set ch1 duty period function. More... | |
err_t | dcmotor12_set_ch2_duty_period (dcmotor12_t *ctx, uint16_t duty_period) |
DC Motor 12 set ch1 duty period function. More... | |
API for configuring and manipulating DC Motor 12 Click driver.
void dcmotor12_cfg_setup | ( | dcmotor12_cfg_t * | cfg | ) |
DC Motor 12 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See dcmotor12_cfg_t object definition for detailed explanation. |
err_t dcmotor12_default_cfg | ( | dcmotor12_t * | ctx | ) |
DC Motor 12 default configuration function.
This function executes a default configuration of DC Motor 12 click board.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor12_enter_sleep_mode | ( | dcmotor12_t * | ctx | ) |
DC Motor 12 enter sleep mode function.
This function sets the device to sleep mode by setting the SLP pin to low logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
err_t dcmotor12_get_cm_sel_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get cm sel pin function.
This function reads the cm sel pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_get_diag1_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get diag1 pin function.
This function reads the diag1 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_get_diag2_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get diag2 pin function.
This function reads the diag2 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_get_en1_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get en1 pin function.
This function reads the en1 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_get_en2_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get en2 pin function.
This function reads the en2 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t dcmotor12_get_int_pin | ( | dcmotor12_t * | ctx | ) |
DC Motor 12 get int pin function.
This function returns the PCA9538A INT pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
err_t dcmotor12_get_motor_current | ( | dcmotor12_t * | ctx, |
float * | current | ||
) |
DC Motor 12 get motor current function.
This function reads the motor current consumption.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | current | : Current value [A]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_get_sleep_pin | ( | dcmotor12_t * | ctx, |
uint8_t * | state | ||
) |
DC Motor 12 get sleep pin function.
This function reads the sleep pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_init | ( | dcmotor12_t * | ctx, |
dcmotor12_cfg_t * | cfg | ||
) |
DC Motor 12 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See dcmotor12_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_pca9538a_read_register | ( | dcmotor12_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out | ||
) |
DC Motor 12 pca9538a read register function.
This function reads data from the selected PCA9538A register by using I2C serial interface.
[in] | ctx | : Click context object. See dcmotor12_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 dcmotor12_pca9538a_write_register | ( | dcmotor12_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in | ||
) |
DC Motor 12 pca9538a write register function.
This function writes a desired data byte to the selected PCA9538A register by using I2C serial interface.
[in] | ctx | : Click context object. See dcmotor12_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 dcmotor12_read_an_pin_value | ( | dcmotor12_t * | ctx, |
uint16_t * | data_out | ||
) |
DC Motor 12 read AN pin value function.
This function reads results of AD conversion of the AN pin.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | data_out | : Output ADC result. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_read_an_pin_voltage | ( | dcmotor12_t * | ctx, |
float * | data_out | ||
) |
DC Motor 12 read AN pin voltage level function.
This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[out] | data_out | : Output voltage level of the analog pin [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_read_register | ( | dcmotor12_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out | ||
) |
DC Motor 12 read register function.
This function reads a 24-bit data from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See dcmotor12_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 dcmotor12_set_ch1_drive_frequency | ( | dcmotor12_t * | ctx, |
uint16_t | drv_freq | ||
) |
DC Motor 12 set ch1 drive frequency function.
This function sets the raw drive frequency of the channel 1.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | drv_freq | : Raw drive frequency (0-2047). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_ch1_duty_period | ( | dcmotor12_t * | ctx, |
uint16_t | duty_period | ||
) |
DC Motor 12 set ch1 duty period function.
This function sets the duty period of the channel 1.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | duty_period | : Duty period (0-2047). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_ch1_operation_mode | ( | dcmotor12_t * | ctx, |
uint8_t | mode | ||
) |
DC Motor 12 set ch1 operation mode function.
This function sets the operation mode of the channel 1.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | mode | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_ch2_drive_frequency | ( | dcmotor12_t * | ctx, |
uint16_t | drv_freq | ||
) |
DC Motor 12 set ch2 drive frequency function.
This function sets the raw drive frequency of the channel 2.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | drv_freq | : Raw drive frequency (0-2047). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_ch2_duty_period | ( | dcmotor12_t * | ctx, |
uint16_t | duty_period | ||
) |
DC Motor 12 set ch1 duty period function.
This function sets the duty period of the channel 1.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | duty_period | : Duty period (0-2047). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_ch2_operation_mode | ( | dcmotor12_t * | ctx, |
uint8_t | mode | ||
) |
DC Motor 12 set ch2 operation mode function.
This function sets the operation mode of the channel 2.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | mode | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor12_set_clk_pin | ( | dcmotor12_t * | ctx, |
uint8_t | state | ||
) |
DC Motor 12 set clk pin function.
This function sets the CLK pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t dcmotor12_set_cm_sel_pin | ( | dcmotor12_t * | ctx, |
uint8_t | state | ||
) |
DC Motor 12 set cm sel pin function.
This function sets the cm sel pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_en1_pin | ( | dcmotor12_t * | ctx, |
uint8_t | state | ||
) |
DC Motor 12 set en1 pin function.
This function sets the en1 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor12_set_en2_pin | ( | dcmotor12_t * | ctx, |
uint8_t | state | ||
) |
DC Motor 12 set en2 pin function.
This function sets the en2 pin logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor12_wake_up_device | ( | dcmotor12_t * | ctx | ) |
DC Motor 12 wake up device function.
This function wakes up the device from sleep by setting the SLP pin to high logic state.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
err_t dcmotor12_write_register | ( | dcmotor12_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in | ||
) |
DC Motor 12 write register function.
This function writes a 24-bit data to the selected register by using SPI serial interface and checks if it is written correctly.
[in] | ctx | : Click context object. See dcmotor12_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 24-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.