diff options
author | sicarius <devnull@localhost> | 2007-02-17 01:35:01 +0100 |
---|---|---|
committer | sicarius <devnull@localhost> | 2007-02-17 01:35:01 +0100 |
commit | 4a2ba4b7105d168932163cbd07a062fdf2ba00e9 (patch) | |
tree | 1891a3eab64be1ae1a31e1b882ad9e6ce356620e /source/Concept/Framework/distance_sensor.h | |
parent | 37d4d23f1dca88b6d074fb09739c9ae071551694 (diff) | |
download | rc2007-soccer-4a2ba4b7105d168932163cbd07a062fdf2ba00e9.tar rc2007-soccer-4a2ba4b7105d168932163cbd07a062fdf2ba00e9.zip |
+++ enhanced framework hardware interface
Diffstat (limited to 'source/Concept/Framework/distance_sensor.h')
-rw-r--r-- | source/Concept/Framework/distance_sensor.h | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/source/Concept/Framework/distance_sensor.h b/source/Concept/Framework/distance_sensor.h index 7690ab4..832e556 100644 --- a/source/Concept/Framework/distance_sensor.h +++ b/source/Concept/Framework/distance_sensor.h @@ -1,7 +1,7 @@ #ifndef _DISTANCE_SENSOR_H
#define _DISTANCE_SENSOR_H
-//#include "stdafx.h"
+#include "stdafx.h"
#include "sensor.h"
class Distance_Sensor : public Sensor
@@ -11,17 +11,61 @@ public: {
this->parent = NULL;
this->moduleId = 0;
+ this->hardwarePort = NULL;
+ this->hardwareDDR = NULL;
+ this->hardwarePin = NULL;
+ this->pin = 0;
}
Distance_Sensor(uint32 sensorId)
{
this->parent = NULL;
this->moduleId = sensorId;
+
+ switch(sensorId)
+ {
+ case IO_SENSOR_DISTANCE_0_DEG:
+ this->hardwarePort = &PORTC;
+ this->hardwareDDR = &DDRC;
+ this->hardwarePin = &PINC;
+ this->pin = (1 << 0);
+ break;
+ case IO_SENSOR_DISTANCE_90_DEG:
+ this->hardwarePort = &PORTC;
+ this->hardwareDDR = &DDRC;
+ this->hardwarePin = &PINC;
+ this->pin = (1 << 1);
+ break;
+ case IO_SENSOR_DISTANCE_180_DEG:
+ this->hardwarePort = &PORTC;
+ this->hardwareDDR = &DDRC;
+ this->hardwarePin = &PINC;
+ this->pin = (1 << 2);
+ break;
+ case IO_SENSOR_DISTANCE_270_DEG:
+ this->hardwarePort = &PORTC;
+ this->hardwareDDR = &DDRC;
+ this->hardwarePin = &PINC;
+ this->pin = (1 << 3);
+ break;
+ default:
+ this->hardwarePort = NULL;
+ this->hardwareDDR = NULL;
+ this->hardwarePin = NULL;
+ this->pin = 0;
+ break;
+ }
}
protected:
+ //Hardware
+ volatile uint8* hardwarePort;
+ volatile uint8* hardwareDDR;
+ volatile uint8* hardwarePin;
+ uint8 pin;
public:
+ float GetDistance();
};
#endif |