13 #ifndef TLE94112_MOTOR_HPP_
14 #define TLE94112_MOTOR_HPP_
28 #define TLE94112_MAX_SPEED 255
38 #define TLE94112MOTOR_MAX_CONNECTORS 4
209 void stop(uint8_t force=255);
229 void start(int16_t speed);
263 void rampSpeed(int16_t speed, uint16_t slope);
338 void _performSpeedStepping(int16_t start_speed, int16_t ramp_delta_speed, int16_t num_steps, uint16_t steptime);
PWMFreq
enum for the frequencies of a PWM channel
Definition: tle94112.hpp:96
@ TLE_FREQ80HZ
Definition: tle94112.hpp:97
PWMChannel
enum for the PWM channels of a halfbridge on TLE94112
Definition: tle94112.hpp:78
@ TLE_NOPWM
Definition: tle94112.hpp:79
HalfBridge
enum for the halfbridges on a TLE94112
Definition: tle94112.hpp:71
@ TLE_NOHB
Definition: tle94112.hpp:72
represents a basic TLE94112
Definition: tle94112.hpp:67
void begin(void)
finishes configuration and enables motor controls
Definition: tle94112-motor.cpp:33
eMode mMode
current operation mode
Definition: tle94112-motor.hpp:312
void setPwmFreq(Tle94112Motor::ePolarity pol, Tle94112::PWMFreq freq)
Sets the PWM frequency for driving a motor connector.
Definition: tle94112-motor.cpp:140
uint8_t mSpeed
value of the current motor speed
Definition: tle94112-motor.hpp:318
Connector_t mConnectors[2]
array of motor connectors
Definition: tle94112-motor.hpp:286
ePolarity
Enum to select polarity of a motor connector.
Definition: tle94112-motor.hpp:58
@ HIGHSIDE
Definition: tle94112-motor.hpp:60
@ LOWSIDE
Definition: tle94112-motor.hpp:59
Tle94112 * mDriver
Tle94112 instance acting as output driver.
Definition: tle94112-motor.hpp:309
Tle94112::PWMChannel channel
Definition: tle94112-motor.hpp:280
Tle94112Motor(Tle94112 &driver)
Construct a new Tle94112Motor object.
Definition: tle94112-motor.cpp:20
void setPwm(Tle94112Motor::ePolarity pol, Tle94112::PWMChannel channel)
Sets the PWM channel to be used for a motor connector.
Definition: tle94112-motor.cpp:119
~Tle94112Motor()
Destroy the Tle94112Motor object.
Definition: tle94112-motor.cpp:28
void _performSpeedStepping(int16_t start_speed, int16_t ramp_delta_speed, int16_t num_steps, uint16_t steptime)
private function needed by rampSpeed
Definition: tle94112-motor.cpp:369
int16_t getSpeed(void)
Returns the motor's current speed setting.
Definition: tle94112-motor.cpp:307
void disconnect(Tle94112::HalfBridge connector)
disconnects a single halfbridge output from a motor connector
Definition: tle94112-motor.cpp:100
Tle94112::PWMFreq freq
Definition: tle94112-motor.hpp:281
void initConnector(Tle94112Motor::ePolarity pol, Tle94112::PWMChannel channel, Tle94112::HalfBridge out1, Tle94112::HalfBridge out2, Tle94112::HalfBridge out3, Tle94112::HalfBridge out4)
configures most important settings for one motor connector
Definition: tle94112-motor.cpp:49
void setSpeed(int16_t speed)
equivalent to start()
Definition: tle94112-motor.cpp:242
void rampSpeed(int16_t speed, uint16_t slope)
function to gradually change the motors speed
Definition: tle94112-motor.cpp:323
void connect(Tle94112Motor::ePolarity pol, Tle94112::HalfBridge connector)
connects a single halfbridge output to a motor connector
Definition: tle94112-motor.cpp:83
void coast()
releases the motor without driving or active breaking
Definition: tle94112-motor.cpp:160
void start(int16_t speed)
starts the motor with a certain speed in a certain direction
Definition: tle94112-motor.cpp:235
void setActiveFreeWheeling(Tle94112Motor::ePolarity pol, uint8_t active_fw)
Enables or disables active freewheeling.
Definition: tle94112-motor.cpp:150
uint32_t _measureSetSpeedDuration(int16_t speed, int16_t start_speed)
private function needed by rampSpeed
Definition: tle94112-motor.cpp:351
uint8_t active_fw
Definition: tle94112-motor.hpp:282
Tle94112::HalfBridge halfbridges[TLE94112MOTOR_MAX_CONNECTORS]
Definition: tle94112-motor.hpp:279
eMode
enum for motor operation modes
Definition: tle94112-motor.hpp:269
@ FORWARD
Definition: tle94112-motor.hpp:271
@ STOP
Definition: tle94112-motor.hpp:273
@ COAST
Definition: tle94112-motor.hpp:270
@ BACKWARD
Definition: tle94112-motor.hpp:272
uint8_t mEnabled
flag indicating if motor controls are enabled
Definition: tle94112-motor.hpp:315
struct Tle94112Motor::Connector_t * Connector_p
void stop(uint8_t force=255)
actively breaks the motor to stop it
Definition: tle94112-motor.cpp:182
void end(void)
disables motor controls and switches back to configuration mode
Definition: tle94112-motor.cpp:41
struct representing one motor connector
Definition: tle94112-motor.hpp:278
represents a motor connected to a TLE94112
Definition: tle94112-motor.hpp:51
#define TLE94112MOTOR_MAX_CONNECTORS
maximum number of Tle94112 outputs per motor connector
Definition: tle94112-motor.hpp:38