summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework
diff options
context:
space:
mode:
authorsicarius <devnull@localhost>2007-02-18 18:59:00 +0100
committersicarius <devnull@localhost>2007-02-18 18:59:00 +0100
commitd1b1dea1fa769f4eed4262ae1ae2f1d15749e965 (patch)
treee74b46ab8a19b878a1bdfc90656ee93387be9f6e /source/Concept/Framework
parentda9860f9a414d8ab403496ac74a51afc5ad3e48b (diff)
downloadrc2007-soccer-d1b1dea1fa769f4eed4262ae1ae2f1d15749e965.tar
rc2007-soccer-d1b1dea1fa769f4eed4262ae1ae2f1d15749e965.zip
+++ Additional Codework
Diffstat (limited to 'source/Concept/Framework')
-rw-r--r--source/Concept/Framework/display.h185
-rw-r--r--source/Concept/Framework/distance_sensor.h71
-rw-r--r--source/Concept/Framework/dribbler.h118
-rw-r--r--source/Concept/Framework/engine.h124
-rw-r--r--source/Concept/Framework/io_module.h44
-rw-r--r--source/Concept/Framework/ir_sensor.h62
-rw-r--r--source/Concept/Framework/keyboard.h87
-rw-r--r--source/Concept/Framework/kicker.h84
-rw-r--r--source/Concept/Framework/led.h65
-rw-r--r--source/Concept/Framework/mouse_sensor.h203
-rw-r--r--source/Concept/Framework/position_tracker.h27
-rw-r--r--source/Concept/Framework/sensor.h27
12 files changed, 0 insertions, 1097 deletions
diff --git a/source/Concept/Framework/display.h b/source/Concept/Framework/display.h
deleted file mode 100644
index df18e62..0000000
--- a/source/Concept/Framework/display.h
+++ /dev/null
@@ -1,185 +0,0 @@
-#ifndef _DISPLAY_H
-#define _DISPLAY_H
-
-#include "stdafx.h"
-
-class Display : public IO_Module
-{
-public:
- Display()
- {
- this->parent = NULL;
- this->moduleId = 0;
- this->cursorVisible = false;
- this->illuminationEnabled = true;
- this->commandClear = 0;
- this->commandReturnCursor = 0;
- this->commandNewLine = 0;
- this->commandSetting = 0;
- this->settingCursorVisible = 0;
- this->settingIllumination = 0;
- this->settingCursorPosition = 0;
- }
-
- Display(uint32 displayId)
- {
- this->parent = NULL;
- this->moduleId = displayId;
- this->cursorVisible = false;
- this->illuminationEnabled = true;
-
- switch(displayId)
- {
- case IO_DISPLAY_MAIN:
- this->commandClear = 12;
- this->commandReturnCursor = 13;
- this->commandNewLine = 10;
- this->commandSetting = 27;
- this->settingCursorVisible = 67;
- this->settingIllumination = 76;
- this->settingCursorPosition = 79;
- msleep(500);
- uart1_init(103);//9600 BAUD at 16MHz Atmel
- sleep(2);
- break;
- default:
- this->commandClear = 0;
- this->commandReturnCursor = 0;
- this->commandNewLine = 0;
- this->commandSetting = 0;
- this->settingCursorVisible = 0;
- this->settingIllumination = 0;
- this->settingCursorPosition = 0;
- break;
- }
- }
-
-protected:
- bool cursorVisible;
- bool illuminationEnabled;
- //Commands
- uint8 commandClear;
- uint8 commandReturnCursor;
- uint8 commandNewLine;
- uint8 commandSetting;
- //Settings
- uint8 settingCursorVisible;
- uint8 settingIllumination;
- uint8 settingCursorPosition;
-
- void SendCommand(uint8 newCommand)
- {
- switch(moduleId)
- {
- case IO_DISPLAY_MAIN:
- uart1_putc(newCommand);
- break;
- default:
- break;
- }
- }
-
-public:
- void Print(char* newString)
- {
- switch(moduleId)
- {
- case IO_DISPLAY_MAIN:
- uart1_puts(newString);
- break;
- default:
- break;
- }
- }
-
- void Print(int32 newInteger)
- {
- char buffer[12];
- ltoa(newInteger, buffer, 10);
- Print(buffer);
- }
-
- void Print(char* newString, uint8 xPos, uint8 yPos)
- {
- SetCursorPosition(xPos, yPos);
- Print(newString);
- }
-
- void Print(int32 newInteger, uint8 xPos, uint8 yPos)
- {
- SetCursorPosition(xPos, yPos);
- Print(newInteger);
- }
-
- void Clear()
- {
- SendCommand(commandClear);
- }
-
- void ReturnCursor()
- {
- SendCommand(commandReturnCursor);
- }
-
- void NewLine()
- {
- SendCommand(commandNewLine);
- }
-
- bool GetCursorVisible()
- {
- return cursorVisible;
- }
-
- void SetCursorVisible(bool newStatus)
- {
- cursorVisible = newStatus;
-
- SendCommand(commandSetting);
- SendCommand(settingCursorVisible);
-
- if(cursorVisible)
- {
- SendCommand(1);
- }
- else
- {
- SendCommand(0);
- }
- }
-
- bool GetLightingEnabled()
- {
- return illuminationEnabled;
- }
-
- void SetLightingEnabled(bool newStatus)
- {
- illuminationEnabled = newStatus;
-
- SendCommand(commandSetting);
- SendCommand(settingIllumination);
-
- if(illuminationEnabled)
- {
- SendCommand(1);
- }
- else
- {
- SendCommand(0);
- }
- }
-
- void SetCursorPosition(uint8 newX, uint8 newY)
- {
- if(!newX || newX > 20) return;
- if(!newY || newY > 4) return;
-
- SendCommand(commandSetting);
- SendCommand(settingCursorPosition);
- SendCommand(newX);
- SendCommand(newY);
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/distance_sensor.h b/source/Concept/Framework/distance_sensor.h
deleted file mode 100644
index 832e556..0000000
--- a/source/Concept/Framework/distance_sensor.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef _DISTANCE_SENSOR_H
-#define _DISTANCE_SENSOR_H
-
-#include "stdafx.h"
-#include "sensor.h"
-
-class Distance_Sensor : public Sensor
-{
-public:
- Distance_Sensor()
- {
- 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
diff --git a/source/Concept/Framework/dribbler.h b/source/Concept/Framework/dribbler.h
deleted file mode 100644
index 64c045a..0000000
--- a/source/Concept/Framework/dribbler.h
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef _DRIBBLER_H
-#define _DRIBBLER_H
-
-#include "stdafx.h"
-
-class Dribbler : public IO_Module
-{
-public:
- Dribbler()
- {
- this->enabled = false;
- this->curSpeed = 0;
- this->parent = NULL;
- this->moduleId = 0;
- this->hardwarePort = NULL;
- this->portPower = NULL;
- this->pinForward = 0;
- this->pinReverse = 0;
- this->pinPower = 0;
- }
-
- Dribbler(uint32 dribblerId)
- {
- this->enabled = false;
- this->curSpeed = 1.0f;
- this->parent = NULL;
- this->moduleId = dribblerId;
-
- switch(dribblerId)
- {
- case IO_DRIBBLER_MAIN:
- this->hardwarePort = &PORTD;
- this->portPower = &PORTA;
- this->pinForward = (1 << 6);
- this->pinReverse = (1 << 7);
- this->pinPower = (1 << 5);
- break;
- default:
- this->hardwarePort = NULL;
- this->portPower = NULL;
- this->pinForward = 0;
- this->pinReverse = 0;
- this->pinPower = 0;
- break;
- }
-
- UpdateDirection();
- }
-
-protected:
- bool enabled;
- float curSpeed;
-
- //Hardware
- volatile uint8* hardwarePort;
- volatile uint8* portPower;
- uint8 pinForward;
- uint8 pinReverse;
- uint8 pinPower;
-
- void UpdateDirection()
- {
- if(enabled)
- {
- if(curSpeed > 0)
- {
- *hardwarePort |= pinForward;
- *hardwarePort &= ~pinReverse;
- }
- else if(curSpeed < 0)
- {
- *hardwarePort |= pinReverse;
- *hardwarePort &= ~pinForward;
- }
- else
- {
- *hardwarePort |= pinForward;
- *hardwarePort |= pinReverse;
- }
-
- *portPower |= pinPower;
- }
- else
- {
- *hardwarePort &= ~pinForward;
- *hardwarePort &= ~pinReverse;
-
- *portPower &= ~pinPower;
- }
- }
-
-public:
- float GetSpeed()
- {
- return curSpeed;
- }
-
- void SetSpeed(float newSpeed)
- {
- curSpeed = newSpeed;
-
- UpdateDirection();
- }
-
- bool GetEnabled()
- {
- return enabled;
- }
-
- void SetEnabled(bool newStatus)
- {
- enabled = newStatus;
-
- UpdateDirection();
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h
deleted file mode 100644
index 8dd284e..0000000
--- a/source/Concept/Framework/engine.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef _ENGINE_H
-#define _ENGINE_H
-
-#include "stdafx.h"
-
-class Engine : public IO_Module
-{
-public:
- Engine()
- {
- this->enabled = false;
- this->curSpeed = 0;
- this->parent = NULL;
- this->moduleId = 0;
- this->hardwarePort = NULL;
- this->pwmSpeed = NULL;
- this->pinForward = 0;
- this->pinReverse = 0;
- }
-
- Engine(uint32 engineId)
- {
- this->enabled = false;
- this->curSpeed = 0;
- this->parent = NULL;
- this->moduleId = engineId;
-
- switch(engineId)
- {
- case IO_ENGINE_DRIVE_LEFT:
- this->hardwarePort = &PORTB;
- this->pwmSpeed = &OCR1A;
- this->pinForward = (1 << 0);
- this->pinReverse = (1 << 1);
- break;
- case IO_ENGINE_DRIVE_BACK:
- this->hardwarePort = &PORTB;
- this->pwmSpeed = &OCR1B;
- this->pinForward = (1 << 2);
- this->pinReverse = (1 << 3);
- break;
- case IO_ENGINE_DRIVE_RIGHT:
- this->hardwarePort = &PORTD;
- this->pwmSpeed = &OCR3A;
- this->pinForward = (1 << 5);
- this->pinReverse = (1 << 4);
- break;
- default:
- this->hardwarePort = NULL;
- this->pwmSpeed = NULL;
- this->pinForward = 0;
- this->pinReverse = 0;
- break;
- }
-
- *this->pwmSpeed = 0;
- }
-
-protected:
- bool enabled;
- float curSpeed;
-
- //Hardware
- volatile uint8* hardwarePort;
- volatile uint16* pwmSpeed;
- uint8 pinForward;
- uint8 pinReverse;
-
- void UpdateDirection()
- {
- if(enabled)
- {
- if(curSpeed > 0)
- {
- *hardwarePort |= pinForward;
- *hardwarePort &= ~pinReverse;
- }
- else if(curSpeed < 0)
- {
- *hardwarePort |= pinReverse;
- *hardwarePort &= ~pinForward;
- }
- else
- {
- *hardwarePort |= pinForward;
- *hardwarePort |= pinReverse;
- }
- }
- else
- {
- *hardwarePort &= ~pinForward;
- *hardwarePort &= ~pinReverse;
- }
- }
-
-public:
- float GetSpeed()
- {
- return curSpeed;
- }
-
- void SetSpeed(float newSpeed)
- {
- curSpeed = newSpeed;
-
- *pwmSpeed = (abs((int16)(newSpeed / SPEED_PER_PWM)));
-
- UpdateDirection();
- }
-
- bool GetEnabled()
- {
- return enabled;
- }
-
- void SetEnabled(bool newStatus)
- {
- enabled = newStatus;
-
- UpdateDirection();
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/io_module.h b/source/Concept/Framework/io_module.h
deleted file mode 100644
index f1fecd3..0000000
--- a/source/Concept/Framework/io_module.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _MODULE_H
-#define _MODULE_H
-
-#include "defines.h"
-
-class Robot;
-
-class IO_Module
-{
-public:
- IO_Module()
- {
- this->parent = NULL;
- this->moduleId = 0;
- }
-
- IO_Module(uint32 moduleId)
- {
- this->parent = NULL;
- this->moduleId = moduleId;
- }
-
-protected:
- Robot* parent;
- uint32 moduleId;
-
-public:
- Robot* GetParent()
- {
- return parent;
- }
-
- void SetParent(Robot* newParent)
- {
- parent = newParent;
- }
-
- uint32 GetId()
- {
- return moduleId;
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/ir_sensor.h b/source/Concept/Framework/ir_sensor.h
deleted file mode 100644
index f267644..0000000
--- a/source/Concept/Framework/ir_sensor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _IR_SENSOR_H
-#define _IR_SENSOR_H
-
-#include "defines.h"
-#include "robot.h"
-#include "sensor.h"
-
-class IR_Sensor : public Sensor
-{
-public:
- IR_Sensor()
- {
- this->parent = NULL;
- this->moduleId = 0;
- }
-
- IR_Sensor(uint32 sensorId)
- {
- this->parent = NULL;
- this->moduleId = sensorId;
-
- switch(sensorId)
- {
- case IO_SENSOR_IR_0_DEG:
- this->channel = 0;
- break;
- case IO_SENSOR_IR_30_DEG:
- this->channel = 1;
- break;
- case IO_SENSOR_IR_60_DEG:
- this->channel = 2;
- break;
- case IO_SENSOR_IR_100_DEG:
- this->channel = 3;
- break;
- case IO_SENSOR_IR_180_DEG:
- this->channel = 4;
- break;
- case IO_SENSOR_IR_260_DEG:
- this->channel = 5;
- break;
- case IO_SENSOR_IR_300_DEG:
- this->channel = 6;
- break;
- case IO_SENSOR_IR_330_DEG:
- this->channel = 7;
- break;
- default:
- this->channel = 8;
- break;
- }
- }
-
-protected:
- //Hardware
- uint8 channel;
-
-public:
- uint16 GetIRIntensity();
-};
-
-#endif
diff --git a/source/Concept/Framework/keyboard.h b/source/Concept/Framework/keyboard.h
deleted file mode 100644
index d984586..0000000
--- a/source/Concept/Framework/keyboard.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef _KEYBOARD_H
-#define _KEYBOARD_H
-
-#include "stdafx.h"
-
-class Keyboard : public IO_Module
-{
-public:
- Keyboard()
- {
- this->parent = NULL;
- this->moduleId = 0;
- this->commandSetting = 0;
- this->settingClearBuffer = 0;
- }
-
- Keyboard(uint32 keyboardId)
- {
- this->parent = NULL;
- this->moduleId = keyboardId;
-
- switch(keyboardId)
- {
- case IO_KEYBOARD_MAIN:
- this->commandSetting = 27;
- this->settingClearBuffer = 123;
- break;
- default:
- this->commandSetting = 0;
- this->settingClearBuffer = 0;
- break;
- }
- }
-
-protected:
- //Commands
- uint8 commandSetting;
- //Settings
- uint8 settingClearBuffer;
-
- void SendCommand(uint8 newCommand)
- {
- switch(moduleId)
- {
- case IO_KEYBOARD_MAIN:
- uart1_putc(newCommand);
- break;
- default:
- break;
- }
- }
-
-public:
- uint8 GetInput()
- {
- uint16 input = uart1_getc();
-
- if(input == 0x100)//no data
- {
- return 0xEE;//empty
- }
- else if(input >= '0' && input <= '9')
- {
- return (uint8)(input - '0');
- }
- else if(input == '*')
- {
- return 10;
- }
- else if(input == '#')
- {
- return 11;
- }
- else
- {
- return 0xFF;//unknown
- }
- }
-
- void ClearKeyBuffer()
- {
- SendCommand(commandSetting);
- SendCommand(settingClearBuffer);
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/kicker.h b/source/Concept/Framework/kicker.h
deleted file mode 100644
index fa9718e..0000000
--- a/source/Concept/Framework/kicker.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#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
diff --git a/source/Concept/Framework/led.h b/source/Concept/Framework/led.h
deleted file mode 100644
index f0f3982..0000000
--- a/source/Concept/Framework/led.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#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
diff --git a/source/Concept/Framework/mouse_sensor.h b/source/Concept/Framework/mouse_sensor.h
deleted file mode 100644
index 8247693..0000000
--- a/source/Concept/Framework/mouse_sensor.h
+++ /dev/null
@@ -1,203 +0,0 @@
-#ifndef _MOUSE_SENSOR_H
-#define _MOUSE_SENSOR_H
-
-#include "stdafx.h"
-#include "sensor.h"
-
-class Mouse_Sensor : public Sensor
-{
-public:
- Mouse_Sensor()
- {
- this->parent = NULL;
- this->moduleId = 0;
- this->hardwarePort = NULL;
- this->hardwareDDR = NULL;
- this->hardwarePin = NULL;
- this->pinSDA = 0;
- this->pinSCK = 0;
- this->registerConfig = 0;
- this->registerPixelData = 0;
- this->registerSqual = 0;
- this->registerDeltaX = 0;
- this->registerDeltaY = 0;
- this->configReset = 0;
- this->configAwake = 0;
- this->newImage = false;
- }
-
- Mouse_Sensor(uint32 sensorId)
- {
- this->parent = NULL;
- this->moduleId = sensorId;
- this->newImage = false;
-
- switch(sensorId)
- {
- case IO_SENSOR_MOUSE_LEFT:
- this->hardwarePort = &PORTC;
- this->hardwareDDR = &DDRC;
- this->hardwarePin = &PINC;
- this->pinSDA = (1 << 4);
- this->pinSCK = (1 << 6);
- this->registerConfig = 0x00;
- this->registerPixelData = 0x08;
- this->registerSqual = 0x4;
- this->registerDeltaX = 0x3;
- this->registerDeltaY = 0x2;
- this->configReset = 0x80;
- this->configAwake = 0x01;
- break;
- case IO_SENSOR_MOUSE_RIGHT:
- this->hardwarePort = &PORTC;
- this->hardwareDDR = &DDRC;
- this->hardwarePin = &PINC;
- this->pinSDA = (1 << 5);
- this->pinSCK = (1 << 7);
- this->registerConfig = 0x00;
- this->registerPixelData = 0x08;
- this->registerSqual = 0x4;
- this->registerDeltaX = 0x3;
- this->registerDeltaY = 0x2;
- this->configReset = 0x80;
- this->configAwake = 0x01;
- break;
- default:
- this->hardwarePort = NULL;
- this->hardwareDDR = NULL;
- this->hardwarePin = NULL;
- this->pinSDA = 0;
- this->pinSCK = 0;
- this->registerConfig = 0;
- this->registerPixelData = 0;
- this->registerSqual = 0;
- this->registerDeltaX = 0;
- this->registerDeltaY = 0;
- this->configReset = 0;
- this->configAwake = 0;
- break;
- }
-
- msleep(100);
-
- *hardwareDDR |= pinSCK;
- *hardwarePort &= ~pinSCK;
-
- msleep(10);
-
- Write(registerConfig, configReset);
- Write(registerConfig, configAwake);
- }
-
-protected:
- //Hardware
- volatile uint8* hardwarePort;
- volatile uint8* hardwareDDR;
- volatile uint8* hardwarePin;
- uint8 pinSDA;
- uint8 pinSCK;
- bool newImage;
- //Registers and Settings
- uint8 registerConfig;
- uint8 registerPixelData;
- uint8 registerSqual;
- uint8 registerDeltaX;
- uint8 registerDeltaY;
- uint8 configReset;
- uint8 configAwake;
-
-public:
- void WriteByte(uint8 newByte)
- {
- *hardwareDDR |= pinSDA;//Set SDA output
-
- for(uint8 i = 0; i < 8; i++)
- {
- *hardwarePort &= ~pinSCK;//prepare SCK
-
- //write data
- *hardwarePort = (*hardwarePort & (~(*hardwarePin))) |
- ((newByte >> 7) * pinSDA);
-
- newByte = newByte << 1;//prepare next byte
- asm volatile("nop");
-
- *hardwarePort |= pinSCK;
- }
- }
-
- void Write(int8 adr, uint8 data)
- {
- WriteByte(adr | 0x80);
- WriteByte(data);
- usleep(100);
- }
-
- uint8 ReadByte()
- {
- uint8 data=0;
-
- *hardwareDDR &= ~pinSDA;//Set SDA input
-
- for(uint8 i = 0; i < 8; i++)
- {
- *hardwarePort &= ~pinSCK;//Prepare data
- data = data << 1;
-
- asm volatile("nop");
- *hardwarePort |= pinSCK;//Prepare for reading
-
- data |= (*hardwarePin & pinSDA) / pinSDA;
- }
-
- return data;
- }
-
- uint8 Read(uint8 adr)
- {
- WriteByte(adr);
- usleep(100);
-
- return ReadByte();
- }
-
- void ImagePrepare()
- {
- Write(registerConfig, configAwake);
- Write(registerPixelData, 0x00);
-
- newImage = true;
- }
-
- uint8 ImageRead()
- {
- uint8 pixel = Read(registerPixelData);
- if(newImage)
- {
- while (!(pixel & 0x80))//0x80 indicates first pixel
- {
- pixel=Read(registerPixelData);
- }
- newImage = false;
- }
-
- return pixel;
- }
-
- uint8 GetSqual()
- {
- return Read(registerSqual);
- }
-
- int8 GetXMovement()
- {
- return (int8)(Read(registerDeltaX));
- }
-
- int8 GetYMovement()
- {
- return (int8)(Read(registerDeltaY));
- }
-};
-
-#endif
diff --git a/source/Concept/Framework/position_tracker.h b/source/Concept/Framework/position_tracker.h
deleted file mode 100644
index 49c5d40..0000000
--- a/source/Concept/Framework/position_tracker.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _POSITION_TRACKER_H
-#define _POSITION_TRACKER_H
-
-#include "stdafx.h"
-
-class Position_Tracker : public IO_Module
-{
-public:
- Position_Tracker()
- {
- this->parent = NULL;
- this->moduleId = 0;
- }
-
- Position_Tracker(uint32 trackerId)
- {
- this->parent = NULL;
- this->moduleId = trackerId;
- }
-
-protected:
-
-public:
- void Update();
-};
-
-#endif
diff --git a/source/Concept/Framework/sensor.h b/source/Concept/Framework/sensor.h
deleted file mode 100644
index 62f2165..0000000
--- a/source/Concept/Framework/sensor.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _SENSOR_H
-#define _SENSOR_H
-
-#include "defines.h"
-#include "io_module.h"
-
-class Sensor : public IO_Module
-{
-public:
- Sensor()
- {
- this->parent = NULL;
- this->moduleId = 0;
- }
-
- Sensor(uint32 sensorId)
- {
- this->parent = NULL;
- this->moduleId = sensorId;
- }
-
-protected:
-
-public:
-};
-
-#endif