00001 #include "SensorOnlyMode.h"
00002 #include "global.h"
00003 #include <avr/interrupt.h>
00004 #include <avr/signal.h>
00005
00006 volatile int wheel1 = 0;
00007 volatile int wheel2 = 0;
00008
00009 extern Smartbuffer interruptbuff;
00010 extern int softwareMode;
00011
00012
00014 SIGNAL(SIG_INTERRUPT0) {
00015
00016 cli();
00017
00018 register unsigned char pd = PIND;
00019
00020 if (( (pd & (1<<PIND6))>=1 && (pd & (1<<PIND2))==0 ) ||
00021 ( (pd & (1<<PIND6))==0 && (pd & (1<<PIND2))>=1 )
00022 ) {
00023 if (softwareMode == SENSOR_MODE) {
00024 wheel1++;
00025 } else if (wheel1 < 127) {
00026 wheel1++;
00027 }
00028
00029 } else {
00030 if (softwareMode == SENSOR_MODE) {
00031 wheel1--;
00032 } else if (wheel1 > -127) {
00033 wheel1--;
00034 }
00035 }
00036
00037 sei();
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085