Header file for motor control structure and interface functions.
More...
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "stm32f4xx_hal.h"
Go to the source code of this file.
|
| void | set_duty (motor_t *p_mot, int32_t duty) |
| | Sets the duty cycle and direction of the motor.
|
| void | enable (motor_t *p_mot) |
| | Enables the motor by setting both channels to maximum.
|
| void | disable (motor_t *p_mot) |
| | Disables the motor by setting both channels to zero.
|
| void | go_to (motor_t *p_mot, int k_p, int where, int from) |
| | Uses proportional control to move motor to a target.
|
Header file for motor control structure and interface functions.
- Author
- Kai De La Cruz
Created on: May 29, 2025
◆ disable()
Disables the motor by setting both channels to zero.
- Parameters
-
| p_mot | Pointer to motor object |
Disables the motor by setting both channels to zero.
- Parameters
-
| p_mot | Pointer to the motor structure |
◆ enable()
Enables the motor by setting both channels to maximum.
- Parameters
-
| p_mot | Pointer to motor object |
Enables the motor by setting both channels to maximum.
- Parameters
-
| p_mot | Pointer to the motor structure |
◆ go_to()
| void go_to |
( |
motor_t * | p_mot, |
|
|
int | k_p, |
|
|
int | where, |
|
|
int | from ) |
Uses proportional control to move motor to a target.
- Parameters
-
| p_mot | Pointer to motor object |
| k_p | Proportional gain |
| where | Target position |
| from | Current position |
Uses proportional control to move motor to a target.
- Parameters
-
| p_mot | Pointer to the motor structure |
| k_p | Proportional gain |
| where | Target position |
| from | Current position |
◆ set_duty()
| void set_duty |
( |
motor_t * | p_mot, |
|
|
int32_t | duty ) |
Sets the duty cycle and direction of the motor.
- Parameters
-
| p_mot | Pointer to motor object |
| duty | Duty cycle (-100 to 100) |
Sets the duty cycle and direction of the motor.
- Parameters
-
| p_mot | Pointer to the motor structure |
| duty | Desired duty cycle (-100 to 100 percent) |