|
satnogs-rotator-firmware
|
Class that functions for interacting with a Motor Driver Carrier. More...
#include <motor.h>
Public Member Functions | |
| motor (uint8_t pwm_pin1, uint8_t pwm_pin2, uint8_t fb_pin, uint8_t en_pin, uint8_t sf_pin, uint16_t maxSpeed, uint16_t minSpeed) | |
| void | init_pin () |
| Initialize pins of DC motor driver. | |
| void | init_timer (uint8_t timer, uint16_t divisor) |
| Set timer frequency, for timers 0, 1, 2. | |
| void | enable () |
| Enable motor driver. | |
| void | disenable () |
| Disable motor driver. | |
| uint16_t | get_load () |
| Calculate the load of DC motor. | |
| uint8_t | get_fault () |
| Get the status flag of motor driver. | |
| void | move (int16_t speed) |
| Move the DC motor with constant voltage (~speed) | |
| void | stop () |
| Stop moving the DC motor. | |
| void | set_min (uint16_t min) |
| Update the minimum speed of DC motor. | |
| void | set_max (uint16_t max) |
| Update the maximum speed of DC motor. | |
Private Attributes | |
| uint8_t | _pwm_pin1 |
| uint8_t | _pwm_pin2 |
| uint8_t | _fb_pin |
| uint8_t | _en_pin |
| uint8_t | _sf_pin |
| int16_t | _maxSpeed |
| int16_t | _minSpeed |
Class that functions for interacting with a Motor Driver Carrier.
| pwm_pin1 | PWM pin, regulate the duty cycle |
| pwm_pin2 | PWM pin, regulate the duty cycle |
| fb_pin | Analog pin that measure the analog current-sense feedback |
| en_pin | Digital pin that enable and disable the motor driver |
| sf_pin | Digital pin that read if the motor driver works properly or not |
| maxSpeed | Set the maximum PWM value that the DC motor can handle, e.g. max 255 (8 bit timer) |
| minSpeed | Set the minimum PWM value that the DC motor can handle, e.g. min 5 (8-bit timer) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set timer frequency, for timers 0, 1, 2.
| timer | PWM frequency for D5 & D6, set timer 0 PWM frequency for D9 & D10, set timer 1 PWM frequency for D3 & D11, set timer 2 |
| divisor | For timer 0 divisor to 1 for PWM frequency of 62500.00 Hz divisor to 8 for PWM frequency of 7812.50 Hz divisor to 64 for PWM frequency of 976.56 Hz (The DEFAULT) divisor to 256 for PWM frequency of 244.14 Hz divisor to 1024 for PWM frequency of 61.04 Hz For timer 1 divisor to 1 for PWM frequency of 31372.55 Hz divisor to 8 for PWM frequency of 3921.16 Hz divisor to 64 for PWM frequency of 490.20 Hz (The DEFAULT) divisor to 256 for PWM frequency of 122.55 Hz divisor to 1024 for PWM frequency of 30.64 Hz For timer 2 divisor to 1 for PWM frequency of 31372.55 Hz divisor to 8 for PWM frequency of 3921.16 Hz divisor to 32 for PWM frequency of 980.39 Hz divisor to 64 for PWM frequency of 490.20 Hz (The DEFAULT) divisor to 128 for PWM frequency of 245.10 Hz divisor to 256 for PWM frequency of 122.55 Hz divisor to 1024 for PWM frequency of 30.64 Hz |
Definition at line 97 of file motor.h.
Referenced by setup().
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Definition at line 244 of file motor.h.
Referenced by disenable(), enable(), init_pin(), and motor().
|
private |
Definition at line 244 of file motor.h.
Referenced by get_load(), init_pin(), and motor().
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 244 of file motor.h.
Referenced by get_fault(), init_pin(), and motor().