functions to control motor operations
More...
|
typedef enum mbot_motor_state | mbot_motor_state |
|
typedef enum mbot_motor_pins | mbot_motor_pins |
|
|
enum | mbot_motor_state { OFF
, ON
} |
|
enum | mbot_motor_pins {
M0_EN = M0_PWM_PIN
, M0_PH = M0_DIR_PIN
, M1_EN = M1_PWM_PIN
, M1_PH = M1_DIR_PIN
,
M2_EN = M2_PWM_PIN
, M2_PH = M2_DIR_PIN
, M3_EN = M3_PWM_PIN
, M3_PH = M3_DIR_PIN
} |
|
functions to control motor operations
<mbot/motor/motor.h>
◆ mbot_motor_cleanup()
int mbot_motor_cleanup |
( |
uint8_t |
ch | ) |
|
Cleanup motor settings.
- Parameters
-
ch | Channel number of the motor |
- Returns
- int Returns MBOT_OK on success, MBOT_ERROR on failure
◆ mbot_motor_init()
int mbot_motor_init |
( |
uint8_t |
ch | ) |
|
Initialize motor with default frequency.
- Parameters
-
ch | Channel number of the motor |
- Returns
- int Returns MBOT_OK on success, MBOT_ERROR on failure
◆ mbot_motor_init_freq()
int mbot_motor_init_freq |
( |
uint8_t |
ch, |
|
|
uint16_t |
freq |
|
) |
| |
Initialize motor with specific frequency.
- Parameters
-
ch | Channel number of the motor |
freq | Frequency to set for the PWM slice |
- Returns
- int Returns MBOT_OK on success, MBOT_ERROR on failure
◆ mbot_motor_read_voltage()
float mbot_motor_read_voltage |
( |
| ) |
|
Returns voltage for motor driver read from ADC3 on Pico+ boards.
- Returns
- float motor driver voltage in volts
◆ mbot_motor_set_duty()
int mbot_motor_set_duty |
( |
uint8_t |
ch, |
|
|
float |
duty |
|
) |
| |
Set duty cycle for the motor using an int16_t value.
- Parameters
-
ch | Channel number of the motor |
duty | Duty cycle value to set |
- Returns
- int Returns MBOT_OK on success, MBOT_ERROR on failure
Set duty cycle for the motor using a float value
- Parameters
-
ch | Channel number of the motor |
duty | Duty cycle value to set |
- Returns
- int Returns MBOT_OK on success, MBOT_ERROR on failure