Subversion Repositories group.electronics

Rev

Rev 40 | Rev 62 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 40 Rev 60
Line 8... Line 8...
8
#include <usbdrv.h>
8
#include <usbdrv.h>
9
 
9
 
10
#include <stdlib.h>
10
#include <stdlib.h>
11
#include <string.h>
11
#include <string.h>
12
 
12
 
-
 
13
#include "util.h"
13
#include "wire.h"
14
#include "wire.h"
14
#include "config.h"
15
#include "config.h"
15
#include "hiddesc.h"
16
#include "hiddesc.h"
16
 
17
 
17
#define ROTS_ATTACHED	1
18
#define ROTS_ATTACHED	1
Line 39... Line 40...
39
#define MOD_GUI_RIGHT       (1<<7)
40
#define MOD_GUI_RIGHT       (1<<7)
40
 
41
 
41
 
42
 
42
void doInt(uint8_t pcint);
43
void doInt(uint8_t pcint);
43
uint8_t getKey(void);
44
uint8_t getKey(void);
44
uint8_t analogRead(uint8_t pin);
-
 
45
 
45
 
46
volatile uint8_t pcIntCurr[3] = {0,0,0};
46
volatile uint8_t pcIntCurr[3] = {0,0,0};
47
volatile uint8_t pcIntLast[3] = {0,0,0};
47
volatile uint8_t pcIntLast[3] = {0,0,0};
48
volatile uint8_t pcIntMask[3] = {0,0,0};
48
volatile uint8_t pcIntMask[3] = {0,0,0};
49
 
49
 
Line 304... Line 304...
304
 
304
 
305
    }
305
    }
306
  }
306
  }
307
}
307
}
308
 
308
 
309
uint8_t analogRead(uint8_t pin) {
-
 
310
	ADMUX = (1<<ADLAR) | (1<<REFS0) | (0<<REFS1) | (pin & 0x0f);
-
 
311
	ADCSRA |= (1<<ADSC);		// Start converting
-
 
312
 
-
 
313
	while (((ADCSRA >> ADSC) & 1)) {}	//Wait until conversion finished
-
 
314
	uint8_t result = ADCH;
-
 
315
	//ADCSRA |= (0<<ADSC);		// Stop converting
-
 
316
 
-
 
317
	return result;
-
 
318
}
-
 
319
 
-
 
320
uint8_t getKey() {
309
uint8_t getKey() {
321
	uint8_t col, row = 0;
310
	uint8_t col, row = 0;
322
	uint8_t key = 0;
311
	uint8_t key = 0;
323
	uint8_t n = 1;
312
	uint8_t n = 1;
324
 
313