summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/input
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/modules/input')
-rwxr-xr-xsource/Concept/Framework/modules/input/distance_sensor.c12
-rwxr-xr-xsource/Concept/Framework/modules/input/mouse_sensor.h16
2 files changed, 14 insertions, 14 deletions
diff --git a/source/Concept/Framework/modules/input/distance_sensor.c b/source/Concept/Framework/modules/input/distance_sensor.c
index 977784f..508eeed 100755
--- a/source/Concept/Framework/modules/input/distance_sensor.c
+++ b/source/Concept/Framework/modules/input/distance_sensor.c
@@ -9,24 +9,24 @@ float Distance_Sensor::GetDistance()
*hardwareDDR |= pin;//Set pin output
*hardwarePort |= pin;//Activate port
usleep(10);//Wait for 10µs
- //*hardwarePort &= ~pin;//Deactivate port
+ *hardwarePort &= ~pin;//Deactivate port
*hardwareDDR &= ~pin;//Set pin input
- (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 1", 4, 1);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 1", 4, 1);
//Wait for response
- while(!(PINC & pin)){asm volatile("nop");}
+ for(int i=0;(!(PINC & pin))&&(i < 1000);i++) {asm volatile("nop");}
- (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 2", 4, 1);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 2", 4, 1);
//Calculate duration of response
- while(*hardwarePin & pin)
+ while((*hardwarePin & pin)&&(result < 300000))
{
result++;
asm volatile("nop");
}
- (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 3", 4, 1);
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print("pre 3", 4, 1);
return (float(result) * DISTANCE_PER_VALUE);
}
diff --git a/source/Concept/Framework/modules/input/mouse_sensor.h b/source/Concept/Framework/modules/input/mouse_sensor.h
index 30f9d53..460e387 100755
--- a/source/Concept/Framework/modules/input/mouse_sensor.h
+++ b/source/Concept/Framework/modules/input/mouse_sensor.h
@@ -42,9 +42,9 @@ public:
this->pinSCK = (1 << 6);
this->registerConfig = 0x00;
this->registerPixelData = 0x08;
- this->registerSqual = 0x4;
- this->registerDeltaX = 0x3;
- this->registerDeltaY = 0x2;
+ this->registerSqual = 0x04;
+ this->registerDeltaX = 0x03;
+ this->registerDeltaY = 0x02;
this->configReset = 0x80;
this->configAwake = 0x01;
break;
@@ -52,13 +52,13 @@ public:
this->hardwarePort = &PORTC;
this->hardwareDDR = &DDRC;
this->hardwarePin = &PINC;
- this->pinSDA = (1 << 5);
- this->pinSCK = (1 << 7);
+ this->pinSDA = (1 << 7);
+ this->pinSCK = (1 << 5);
this->registerConfig = 0x00;
this->registerPixelData = 0x08;
- this->registerSqual = 0x4;
- this->registerDeltaX = 0x3;
- this->registerDeltaY = 0x2;
+ this->registerSqual = 0x04;
+ this->registerDeltaX = 0x03;
+ this->registerDeltaY = 0x02;
this->configReset = 0x80;
this->configAwake = 0x01;
break;