summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/engine.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/engine.h')
-rw-r--r--source/Concept/Framework/engine.h32
1 files changed, 3 insertions, 29 deletions
diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h
index 2d8c409..0e7cf8c 100644
--- a/source/Concept/Framework/engine.h
+++ b/source/Concept/Framework/engine.h
@@ -14,10 +14,8 @@ public:
this->moduleId = 0;
this->hardwarePort = NULL;
this->pwmSpeed = NULL;
- this->pwmPort = NULL;
this->pinForward = 0;
this->pinReverse = 0;
- this->pinPwm = 0;
}
Engine(uint32 engineId)
@@ -26,9 +24,6 @@ public:
this->curSpeed = 0;
this->parent = NULL;
this->moduleId = engineId;
- this->pwmSpeed = NULL;
- this->pwmPort = NULL;
- this->pinPwm = 0;
switch(engineId)
{
@@ -38,25 +33,18 @@ public:
this->pinForward = (1 << 0);
this->pinReverse = (1 << 1);
break;
- case IO_ENGINE_DRIVE_RIGHT:
+ case IO_ENGINE_DRIVE_BACK:
this->hardwarePort = &PORTB;
this->pwmSpeed = &OCR1B;
this->pinForward = (1 << 2);
this->pinReverse = (1 << 3);
break;
- case IO_ENGINE_DRIVE_BACK:
+ case IO_ENGINE_DRIVE_RIGHT:
this->hardwarePort = &PORTD;
this->pwmSpeed = &OCR3A;
this->pinForward = (1 << 5);
this->pinReverse = (1 << 4);
break;
- case IO_ENGINE_DRIBBLER:
- this->hardwarePort = &PORTD;
- this->pwmPort = &PORTA;
- this->pinForward = (1 << 6);
- this->pinReverse = (1 << 7);
- this->pinPwm = (1 << 5);
- break;
default:
this->hardwarePort = NULL;
this->pwmSpeed = NULL;
@@ -77,9 +65,6 @@ protected:
volatile uint16* pwmSpeed;
uint8 pinForward;
uint8 pinReverse;
- //Dribbler only
- volatile uint8* pwmPort;
- uint8 pinPwm;
void UpdateDirection()
{
@@ -118,18 +103,7 @@ public:
{
curSpeed = newSpeed;
- if(pwmSpeed)
- {
- *pwmSpeed = abs(newSpeed / SPEED_PER_PWM);
- }
- else if(pwmPort && (uint16)(abs(newSpeed / SPEED_PER_PWM)))
- {
- *pwmPort |= pinPwm;
- }
- else if(pwmPort)
- {
- *pwmPort &= ~pinPwm;
- }
+ *pwmSpeed = abs(newSpeed / SPEED_PER_PWM);
UpdateDirection();
}