1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-06-06 20:53:14 +02:00
cdf2018-principal/chef/src/motor.h

50 lines
820 B
C
Raw Normal View History

2018-05-06 08:14:51 +02:00
#ifndef __MOTOR_H__
#define __MOTOR_H__
#include <math.h>
#include <stdint.h>
#include "CF.h"
2018-05-09 09:57:11 +02:00
#include "dimensions.h"
2018-05-06 08:14:51 +02:00
2018-05-06 12:50:03 +02:00
#define INVERSE_L_MOTOR
// #define INVERSE_R_MOTOR
2018-05-10 10:08:56 +02:00
#define ENABLE_RATE_LIMITER
2018-05-09 09:57:11 +02:00
// V/s
2018-05-09 14:24:12 +02:00
#define RATE_LIMITER_UP 6
2018-05-10 10:08:56 +02:00
#define RATE_LIMITER_DOWN 24
2018-05-09 09:57:11 +02:00
2018-05-06 08:14:51 +02:00
#define TESTINATOR
// #define TLE5206
#define IN1 0
#define IN2 1
#define IN3 2
#define IN4 3
2018-05-09 09:57:11 +02:00
enum motorState {
running,
braking,
freewheeling
};
2018-05-06 08:14:51 +02:00
// Public
2018-05-09 09:57:11 +02:00
void configureMotor();
void deconfigureMotor();
2018-05-06 08:14:51 +02:00
void setMoteurTension(float lVolt, float rVolt);
void setPWMTension(float lVolt, float rVolt);
int brake();
int freewheel();
int stop();
// Private
2018-05-09 09:57:11 +02:00
void* TaskMotor(void* pData);
2018-05-06 08:14:51 +02:00
uint8_t moteurTensionToPWM(float V);
void setMoteurTensionRaw(float lVolt, float rVolt, bool lFor, bool rFor);
2018-05-09 09:57:11 +02:00
void rawFreewheel();
void rawBrake();
2018-05-06 08:14:51 +02:00
#endif