dcmotor22
2.0.0.0
|
API for configuring and manipulating DC Motor 22 Click driver. More...
Modules | |
DC Motor 22 Device Settings | |
Settings for registers of DC Motor 22 Click driver. | |
DC Motor 22 MikroBUS Map | |
MikroBUS pin mapping of DC Motor 22 Click driver. | |
Functions | |
void | dcmotor22_cfg_setup (dcmotor22_cfg_t *cfg) |
DC Motor 22 configuration object setup function. More... | |
err_t | dcmotor22_init (dcmotor22_t *ctx, dcmotor22_cfg_t *cfg) |
DC Motor 22 initialization function. More... | |
err_t | dcmotor22_default_cfg (dcmotor22_t *ctx) |
DC Motor 22 default configuration function. More... | |
err_t | dcmotor22_write_register (dcmotor22_t *ctx, uint8_t reg, uint32_t data_in) |
DC Motor 22 write register function. More... | |
err_t | dcmotor22_read_register (dcmotor22_t *ctx, uint8_t reg, uint32_t *data_out) |
DC Motor 22 read register function. More... | |
err_t | dcmotor22_adc_write_setup_byte (dcmotor22_t *ctx, uint8_t setup_byte) |
DC Motor 22 ADC write setup byte function. More... | |
err_t | dcmotor22_adc_write_config_byte (dcmotor22_t *ctx, uint8_t config_byte) |
DC Motor 22 ADC write config byte function. More... | |
err_t | dcmotor22_adc_set_channel (dcmotor22_t *ctx, uint8_t channel) |
DC Motor 22 ADC set channel function. More... | |
err_t | dcmotor22_adc_get_voltage (dcmotor22_t *ctx, float *voltage) |
DC Motor 22 ADC get voltage function. More... | |
err_t | dcmotor22_get_motor_current (dcmotor22_t *ctx, uint8_t motor_sel, float *current) |
DC Motor 22 get motor current function. More... | |
err_t | dcmotor22_set_motor_pwm (dcmotor22_t *ctx, uint8_t motor_sel, int16_t pwm_duty) |
DC Motor 22 set motor pwm function. More... | |
void | dcmotor22_enable_device (dcmotor22_t *ctx) |
DC Motor 22 enable device function. More... | |
void | dcmotor22_disable_device (dcmotor22_t *ctx) |
DC Motor 22 disable device function. More... | |
void | dcmotor22_reset_device (dcmotor22_t *ctx) |
DC Motor 22 reset device function. More... | |
void | dcmotor22_set_device_address (dcmotor22_t *ctx, uint8_t addr) |
DC Motor 22 set device address function. More... | |
uint8_t | dcmotor22_get_int_pin (dcmotor22_t *ctx) |
DC Motor 22 get int pin function. More... | |
API for configuring and manipulating DC Motor 22 Click driver.
err_t dcmotor22_adc_get_voltage | ( | dcmotor22_t * | ctx, |
float * | voltage | ||
) |
DC Motor 22 ADC get voltage function.
This function reads the voltage from the previously selected channel by using I2C serial interface.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[out] | voltage | : Voltage value [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_adc_set_channel | ( | dcmotor22_t * | ctx, |
uint8_t | channel | ||
) |
DC Motor 22 ADC set channel function.
This function sets the selected channel active by modifying the config byte.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | channel | : Channel number (0-1). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_adc_write_config_byte | ( | dcmotor22_t * | ctx, |
uint8_t | config_byte | ||
) |
DC Motor 22 ADC write config byte function.
This function writes a config byte to the ADC chip by using I2C serial interface.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | config_byte | : Config byte to be written ( the value will be stored in ctx->config_byte ). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_adc_write_setup_byte | ( | dcmotor22_t * | ctx, |
uint8_t | setup_byte | ||
) |
DC Motor 22 ADC write setup byte function.
This function writes a setup byte to the ADC chip by using I2C serial interface.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | setup_byte | : Setup byte to be written ( the value will be stored in ctx->setup_byte ). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor22_cfg_setup | ( | dcmotor22_cfg_t * | cfg | ) |
DC Motor 22 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See dcmotor22_cfg_t object definition for detailed explanation. |
err_t dcmotor22_default_cfg | ( | dcmotor22_t * | ctx | ) |
DC Motor 22 default configuration function.
This function executes a default configuration of DC Motor 22 click board.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor22_disable_device | ( | dcmotor22_t * | ctx | ) |
DC Motor 22 disable device function.
This function disables the device by setting the EN pin to LOW logic state.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
void dcmotor22_enable_device | ( | dcmotor22_t * | ctx | ) |
DC Motor 22 enable device function.
This function enables the device by setting the EN pin to HIGH logic state.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
uint8_t dcmotor22_get_int_pin | ( | dcmotor22_t * | ctx | ) |
DC Motor 22 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
err_t dcmotor22_get_motor_current | ( | dcmotor22_t * | ctx, |
uint8_t | motor_sel, | ||
float * | current | ||
) |
DC Motor 22 get motor current function.
This function reads the current consumption of the selected motor.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | motor_sel | : Motor selection
|
[out] | current | : Current value [A]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_init | ( | dcmotor22_t * | ctx, |
dcmotor22_cfg_t * | cfg | ||
) |
DC Motor 22 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See dcmotor22_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_read_register | ( | dcmotor22_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out | ||
) |
DC Motor 22 read register function.
This function reads 32-bit data from the selected register by using UART serial interface.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : 32-bit output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void dcmotor22_reset_device | ( | dcmotor22_t * | ctx | ) |
DC Motor 22 reset device function.
This function resets the device by toggling the EN pin state.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
void dcmotor22_set_device_address | ( | dcmotor22_t * | ctx, |
uint8_t | addr | ||
) |
DC Motor 22 set device address function.
This function sets the device address.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | addr | : Device address in range 0 to 3. |
err_t dcmotor22_set_motor_pwm | ( | dcmotor22_t * | ctx, |
uint8_t | motor_sel, | ||
int16_t | pwm_duty | ||
) |
DC Motor 22 set motor pwm function.
This function sets the PWM duty cycle of the selected motor.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | motor_sel | : Motor selection
|
[in] | pwm_duty | : PWM duty in range -255 to +255 [-100% to 100%]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t dcmotor22_write_register | ( | dcmotor22_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in | ||
) |
DC Motor 22 write register function.
This function writes a desired data to the selected register by using UART serial interface.
[in] | ctx | : Click context object. See dcmotor22_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | len | : 32-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.