|
servo2 2.1.0.0
|
API for configuring and manipulating Servo 2 Click driver. More...
Topics | |
| Servo 2 PWM Settings | |
| Settings for configuration of Servo 2 Click driver. | |
| Servo 2 MikroBUS Map | |
| MikroBUS pin mapping of Servo 2 Click driver. | |
Functions | |
| void | servo2_cfg_setup (servo2_cfg_t *cfg) |
| Servo 2 configuration object setup function. | |
| err_t | servo2_init (servo2_t *ctx, servo2_cfg_t *cfg) |
| Servo 2 initialization function. | |
| err_t | servo2_set_duty_cycle (servo2_t *ctx, float duty_cycle) |
| Servo 2 sets PWM duty cycle. | |
| err_t | servo2_pwm_stop (servo2_t *ctx) |
| Servo 2 stop PWM module. | |
| err_t | servo2_pwm_start (servo2_t *ctx) |
| Servo 2 start PWM module. | |
| void | servo2_write_data (servo2_t *ctx, uint8_t *data_in, uint8_t len) |
| Servo 2 write data function. | |
| void | servo2_set_sclk_pin (servo2_t *ctx, uint8_t state) |
| Servo 2 set SCLK pin function. | |
| void | servo2_set_sin_pin (servo2_t *ctx, uint8_t state) |
| Servo 2 set SIN pin function. | |
| void | servo2_set_xlat_pin (servo2_t *ctx, uint8_t state) |
| Servo 2 set XLAT pin function. | |
| void | servo2_set_blank_pin (servo2_t *ctx, uint8_t state) |
| Servo 2 set BLANK pin function. | |
| uint8_t | servo2_get_sout_pin (servo2_t *ctx) |
| Servo 2 get SOUT pin state function. | |
| uint8_t | servo2_get_xerr_pin (servo2_t *ctx) |
| Servo 2 get XERR pin state function. | |
| err_t | servo2_set_channel_pwm (servo2_t *ctx, uint8_t ch_num, uint16_t pwm_out) |
| Servo 2 set channel PWM function. | |
| err_t | servo2_set_angle (servo2_t *ctx, uint8_t ch_num, uint8_t angle) |
| Servo 2 set angle function. | |
| void | servo2_update_output (servo2_t *ctx) |
| Servo 2 update output function. | |
API for configuring and manipulating Servo 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void servo2_cfg_setup | ( | servo2_cfg_t * | cfg | ) |
Servo 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See servo2_cfg_t object definition for detailed explanation. |
| uint8_t servo2_get_sout_pin | ( | servo2_t * | ctx | ) |
Servo 2 get SOUT pin state function.
This function returns the logic state of the SOUT (serial output) pin.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| uint8_t servo2_get_xerr_pin | ( | servo2_t * | ctx | ) |
Servo 2 get XERR pin state function.
This function returns the logic state of the XERR (error) pin.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| err_t servo2_init | ( | servo2_t * | ctx, |
| servo2_cfg_t * | cfg ) |
Servo 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See servo2_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t servo2_pwm_start | ( | servo2_t * | ctx | ) |
Servo 2 start PWM module.
This function starts the PWM module output.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t servo2_pwm_stop | ( | servo2_t * | ctx | ) |
Servo 2 stop PWM module.
This function stops the PWM module output.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t servo2_set_angle | ( | servo2_t * | ctx, |
| uint8_t | ch_num, | ||
| uint8_t | angle ) |
Servo 2 set angle function.
This function sets the servo angle for a specific channel or all channels.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | ch_num | : Channel number (0-15 or all channels). |
| [in] | angle | : Servo angle in degrees (0-180). |
0 - Success, -1 - Error. | void servo2_set_blank_pin | ( | servo2_t * | ctx, |
| uint8_t | state ) |
Servo 2 set BLANK pin function.
This function sets the BLANK pin to the specified logic state.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | state | : Pin logic state. |
| err_t servo2_set_channel_pwm | ( | servo2_t * | ctx, |
| uint8_t | ch_num, | ||
| uint16_t | pwm_out ) |
Servo 2 set channel PWM function.
This function sets the PWM output for a specific channel or all channels.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | ch_num | : Channel number (0-15 or all channels). |
| [in] | pwm_out | : PWM output value. |
0 - Success, -1 - Error. | err_t servo2_set_duty_cycle | ( | servo2_t * | ctx, |
| float | duty_cycle ) |
Servo 2 sets PWM duty cycle.
This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | duty_cycle | : PWM duty cycle. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void servo2_set_sclk_pin | ( | servo2_t * | ctx, |
| uint8_t | state ) |
Servo 2 set SCLK pin function.
This function sets the SCLK (serial clock) pin to the specified logic state.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | state | : Pin logic state. |
| void servo2_set_sin_pin | ( | servo2_t * | ctx, |
| uint8_t | state ) |
Servo 2 set SIN pin function.
This function sets the SIN (serial input) pin to the specified logic state.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | state | : Pin logic state. |
| void servo2_set_xlat_pin | ( | servo2_t * | ctx, |
| uint8_t | state ) |
Servo 2 set XLAT pin function.
This function sets the XLAT (latch) pin to the specified logic state.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | state | : Pin logic state. |
| void servo2_update_output | ( | servo2_t * | ctx | ) |
Servo 2 update output function.
This function updates the PWM output values for all channels by writing them to the device.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| void servo2_write_data | ( | servo2_t * | ctx, |
| uint8_t * | data_in, | ||
| uint8_t | len ) |
Servo 2 write data function.
This function writes data to the device via the serial interface, updates the internal registers, and starts the PWM for grayscale data output.
| [in] | ctx | : Click context object. See servo2_t object definition for detailed explanation. |
| [in] | data_in | : Pointer to the data to write. |
| [in] | len | : Number of bytes to write. |