This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
rc2007-soccer/source/Concept/Framework/modules/output/kicker.h

85 lines
1.4 KiB
C
Raw Normal View History

2007-02-18 00:14:00 +00:00
#ifndef _KICKER_H
#define _KICKER_H
#include "../../stdafx.h"
class Kicker : public IO_Module
{
public:
Kicker()
{
this->enabled = false;
this->parent = NULL;
this->moduleId = 0;
this->portPower = NULL;
this->portForward = NULL;
this->portReverse = NULL;
this->pinPower = 0;
this->pinForward = 0;
this->pinReverse = 0;
}
Kicker(uint32 kickerId)
{
this->enabled = false;
this->parent = NULL;
this->moduleId = kickerId;
switch(kickerId)
{
case IO_KICKER_MAIN:
this->portPower = &PORTG;
this->portForward = &PORTA;
this->portReverse = &PORTE;
this->pinPower = (1 << 3);
this->pinForward = (1 << 2);
this->pinReverse = (1 << 6);
break;
default:
this->portPower = NULL;
this->portForward = NULL;
this->portReverse = NULL;
this->pinPower = 0;
this->pinForward = 0;
this->pinReverse = 0;
break;
}
*this->portForward |= this->pinForward;
*this->portReverse &= ~this->pinReverse;
}
protected:
bool enabled;
//Hardware
volatile uint8* portPower;
volatile uint8* portForward;
volatile uint8* portReverse;
uint8 pinPower;
uint8 pinForward;
uint8 pinReverse;
public:
bool GetEnabled()
{
return enabled;
}
void SetEnabled(bool newStatus)
{
enabled = newStatus;
if(enabled)
{
*portPower |= pinPower;
}
else
{
*portPower &= ~pinPower;
}
}
};
#endif