summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/led.h
diff options
context:
space:
mode:
authormasterm <devnull@localhost>2007-02-15 21:33:05 +0100
committermasterm <devnull@localhost>2007-02-15 21:33:05 +0100
commit91b2508dc92a97802353bd2e96f2849c835f0b2a (patch)
treeafd641c692dbe1acd46a5d194302ae66879fe81d /source/Concept/Framework/led.h
parent8d7053ca84a48fe63736b1ae6225624da7b9be44 (diff)
downloadrc2007-soccer-91b2508dc92a97802353bd2e96f2849c835f0b2a.tar
rc2007-soccer-91b2508dc92a97802353bd2e96f2849c835f0b2a.zip
+++ many updates to sources
Diffstat (limited to 'source/Concept/Framework/led.h')
-rw-r--r--source/Concept/Framework/led.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/source/Concept/Framework/led.h b/source/Concept/Framework/led.h
new file mode 100644
index 0000000..f0f3982
--- /dev/null
+++ b/source/Concept/Framework/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