diff options
Diffstat (limited to 'source/Concept/Framework/kicker.h')
-rw-r--r-- | source/Concept/Framework/kicker.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/source/Concept/Framework/kicker.h b/source/Concept/Framework/kicker.h new file mode 100644 index 0000000..fa9718e --- /dev/null +++ b/source/Concept/Framework/kicker.h @@ -0,0 +1,84 @@ +#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 |