Synergia AVR 0.1
|
00001 /* 00002 Copyright (c) 2011 Grzegorz Hajdukiewicz 00003 00004 Permission is hereby granted, free of charge, to any person obtaining 00005 a copy of this software and associated documentation files (the 00006 "Software"), to deal in the Software without restriction, including 00007 without limitation the rights to use, copy, modify, merge, publish, 00008 distribute, sublicense, and/or sell copies of the Software, and to 00009 permit persons to whom the Software is furnished to do so, subject to 00010 the following conditions: 00011 00012 The above copyright notice and this permission notice shall be 00013 included in all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00016 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00018 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00019 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00020 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00021 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 #define SDIO 1 //SDIO PIN 00025 #define SCK 0 //SCK PIN 00026 #define M_PORT PORTB //MOUSE PORT 00027 #define M_DDR DDRB //MOUSE PORT DDR 00028 #define M_PIN PINB //MOUSE PIN 00029 00030 #ifndef _MOUSE_H_ 00031 #define _MOUSE_H_ 00032 00050 struct PosDelta{ 00051 char x; 00052 char y; 00053 }; 00054 00062 struct MouseData{ 00063 char qual; 00064 }; 00065 00066 00067 00075 class MOUSE{ 00076 00077 public: 00082 MOUSE(); 00083 00090 char read(char addr); 00091 00098 void write(char addr, char data); 00099 00106 MOUSE & operator >> (PosDelta &delta); 00107 00114 MOUSE & operator >> (MouseData &data); 00115 00116 private: 00117 00118 //set clock state 00119 void sck(char state); 00120 00121 }; 00122 00123 #endif