Subversion Repositories group.electronics

Rev

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

Rev 108 Rev 109
Line 204... Line 204...
204
	if (rotary.direction && rotary.timer == 0) {
204
	if (rotary.direction && rotary.timer == 0) {
205
		rotary.direction = 0x00;
205
		rotary.direction = 0x00;
206
		rotary.timer = ROTARY_OFF_TIME;
206
		rotary.timer = ROTARY_OFF_TIME;
207
	}
207
	}
208
	
208
	
209
	if (rotary.timer == 0) {
209
	if (rotary.timer != 0) {
210
		if (rotary.direction == 1) {
210
		if (rotary.direction == 1) {
211
			reportJoystick.rot1a = 1; 
211
			reportJoystick.rot1a = 1; 
212
		} else if (rotary.direction == 2) {
212
		} else if (rotary.direction == 2) {
213
			reportJoystick.rot1b = 1; 
213
			reportJoystick.rot1b = 1; 
214
		}
214
		}
Line 293... Line 293...
293
 */
293
 */
294
void pcInterrupt(uint8_t pcint) {
294
void pcInterrupt(uint8_t pcint) {
295
		
295
		
296
        switch (pcint) {
296
        switch (pcint) {
297
                case 0: pcInt[pcint].current = PINB; break;
297
                case 0: pcInt[pcint].current = PINB; break;
298
                case 1: pcInt[pcint].current = PIND; break;
298
                case 1: pcInt[pcint].current = PINC; break;
299
                case 2: pcInt[pcint].current = PINC; break;
299
                case 2: pcInt[pcint].current = PIND; break;
300
        }
300
        }
301
        
301
        
302
        pcInt[pcint].mask = pcInt[pcint].current ^ pcInt[pcint].last;
302
        pcInt[pcint].mask = pcInt[pcint].current ^ pcInt[pcint].last;
303
        pcInt[pcint].last = pcInt[pcint].current;
303
        pcInt[pcint].last = pcInt[pcint].current;
304
 
304
 
305
 
305
 
306
        // If rot stat is not 0, we havn't sent
-
 
307
        //  our last results yet. Skip this click.
306
        //  Dont continue if we already have a button press going out
308
        if (rotary.direction != 0) {
307
        if (rotary.direction != 0 && rotary.timer == 0) {
309
                pcInt[pcint].mask = 0;
308
                pcInt[pcint].mask = 0;
310
                return;
309
                return;
311
        }
310
        }
312
        // Check which pin caused the interrupt. If they both
311
        // Check which pin caused the interrupt. If they both
313
        //  equal 0, the pin that interrupted is the direction
312
        //  equal 0, the pin that interrupted is the direction
Line 318... Line 317...
318
					if (rotary.timer == 0) {
317
					if (rotary.timer == 0) {
319
                        rotary.direction = 1;
318
                        rotary.direction = 1;
320
						rotary.timer = ROTARY_ON_TIME;
319
						rotary.timer = ROTARY_ON_TIME;
321
					}
320
					}
322
 
321
 
-
 
322
 
323
        } else if (rbi(pcInt[pcint].current, PCINT16) == 0 
323
        } else if (rbi(pcInt[pcint].current, PCINT16) == 0 
324
                && rbi(pcInt[pcint].current, PCINT17) == 0 
324
                && rbi(pcInt[pcint].current, PCINT17) == 0 
325
                && rbi(pcInt[pcint].mask, PCINT17) ) {
325
                && rbi(pcInt[pcint].mask, PCINT17) ) {
326
					
326
					
327
					if (rotary.timer == 0) {
327
					if (rotary.timer == 0) {