diff options
author | sicarius <devnull@localhost> | 2007-02-18 01:14:00 +0100 |
---|---|---|
committer | sicarius <devnull@localhost> | 2007-02-18 01:14:00 +0100 |
commit | 3c3c628b617dc53f0b7b59285c7d67888074c33d (patch) | |
tree | 1d1848b37d14036542e7b704440f4eb4f4d8ef7b /source/Concept/Framework/modules/output/led.h | |
parent | 803027cbb45ebe01e4f8b427a7cc95728d6e5f47 (diff) | |
download | rc2007-soccer-3c3c628b617dc53f0b7b59285c7d67888074c33d.tar rc2007-soccer-3c3c628b617dc53f0b7b59285c7d67888074c33d.zip |
+++ Additional Codework
Diffstat (limited to 'source/Concept/Framework/modules/output/led.h')
-rwxr-xr-x | source/Concept/Framework/modules/output/led.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/source/Concept/Framework/modules/output/led.h b/source/Concept/Framework/modules/output/led.h new file mode 100755 index 0000000..08e7466 --- /dev/null +++ b/source/Concept/Framework/modules/output/led.h @@ -0,0 +1,65 @@ +#ifndef _LED_H
+#define _LED_H
+
+#include "../../stdafx.h"
+
+class Led : public IO_Module
+{
+public:
+ Led()
+ {
+ this->enabled = false;
+ this->parent = NULL;
+ this->moduleId = 0;
+ this->hardwarePort = NULL;
+ this->pinPower = 0;
+ }
+
+ Led(uint32 ledId)
+ {
+ this->enabled = false;
+ this->parent = NULL;
+ this->moduleId = ledId;
+
+ switch(ledId)
+ {
+ case IO_LED_MAIN:
+ this->hardwarePort = &PORTB;
+ this->pinPower = (1 << 1);
+ break;
+ default:
+ this->hardwarePort = NULL;
+ this->pinPower = 0;
+ break;
+ }
+ }
+
+protected:
+ bool enabled;
+
+ //Hardware
+ volatile uint8* hardwarePort;
+ uint8 pinPower;
+
+public:
+ bool GetEnabled()
+ {
+ return enabled;
+ }
+
+ void SetEnabled(bool newStatus)
+ {
+ enabled = newStatus;
+
+ if(enabled)
+ {
+ *hardwarePort &= ~pinPower;
+ }
+ else
+ {
+ *hardwarePort |= pinPower;
+ }
+ }
+};
+
+#endif |