2020-01-30 09:28:01 +00:00
|
|
|
#include "./motor.h"
|
2020-01-31 09:36:36 +00:00
|
|
|
#include "include/config.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
|
|
|
|
void motorInit()
|
|
|
|
{
|
|
|
|
pinMode(Config::MotorPinSleep, OUTPUT);
|
|
|
|
digitalWrite(Config::MotorPinSleep, LOW);
|
|
|
|
|
|
|
|
pinMode(Config::MotorPinPWM, OUTPUT);
|
|
|
|
digitalWrite(Config::MotorPinPWM, LOW);
|
|
|
|
|
|
|
|
pinMode(Config::MotorPinDirection, OUTPUT);
|
|
|
|
pinMode(Config::MotorPinCurrentSensing, INPUT);
|
|
|
|
}
|
2020-01-30 09:28:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
void motorStart(MotorDirection direction)
|
|
|
|
{
|
2020-01-31 09:36:36 +00:00
|
|
|
digitalWrite(Config::MotorPinDirection, direction == MotorDirection::Up ? HIGH : LOW);
|
|
|
|
digitalWrite(Config::MotorPinSleep, HIGH);
|
|
|
|
digitalWrite(Config::MotorPinPWM, HIGH);
|
2020-01-30 09:28:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void motorStop()
|
|
|
|
{
|
2020-01-31 09:36:36 +00:00
|
|
|
digitalWrite(Config::MotorPinPWM, LOW);
|
|
|
|
digitalWrite(Config::MotorPinSleep, LOW);
|
2020-01-30 09:28:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-01 15:55:33 +00:00
|
|
|
bool motorIsOvercurrent()
|
2020-01-30 09:28:01 +00:00
|
|
|
{
|
2020-02-01 15:55:33 +00:00
|
|
|
// TODO: implement motorIsOvercurrent
|
2020-01-30 09:28:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|