... | ... | @@ -183,9 +183,33 @@ This module enables to control the powertrain on the HighDriveUnit featuring two |
|
|
|
|
|
### Module documentation
|
|
|
#### typedef struct HDU_POWERTRAIN_MotorValues
|
|
|
This struct contains the dutyCycle of a motor from -100% to 100% and the 16-bit ADC values for currentSense and backEMF. There is one instance for each motor.
|
|
|
This struct contains the dutyCycle of a motor from -100% to 100% related to rotation direction and the 16-bit ADC values for currentSense and backEMF. There is one instance for each motor.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_init(uint32_t frequencyHz)
|
|
|
initializes the powertrain with a pwm frequency in Hz (about 3 kHz recommended). Both motors will be enabled during initialization.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_updateMotorValuesX()
|
|
|
updates all values in the MotorValues struct for motor A or B.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_updateMotorValues()
|
|
|
updates all values in the MotorValues struct for motor A and B.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_enable()
|
|
|
enables both motors by setting the enable pin high.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_disable()
|
|
|
enables both motors by setting the enable pin low.
|
|
|
|
|
|
#### HDU_POWERTRAIN_setDutycycleMotX(int dutyCycle)
|
|
|
sets the dutycycle of motor A or B from -100% to 100% related to rotation direction.
|
|
|
|
|
|
#### void HDU_POWERTRAIN_setDutycycles(int dutyCycleA, int dutyCycleB)
|
|
|
sets the dutycytles of motor A and B from -100% to 100% related to rotation direction.
|
|
|
|
|
|
#### uint16_t HDU_POWERTRAIN_readCsX()
|
|
|
reads the 16-bit current sense value of motor A or B.
|
|
|
|
|
|
#### uint16_t HDU_POWERTRAIN_readBemfX()
|
|
|
reads the 16-bit back emf value of motor A or B.
|
|
|
|
|
|
## Servo control (HDU_SERVO.h) |
|
|
\ No newline at end of file |