All pastes #510584 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-25 23:08 UTC
rendered paste body
byte GetPosition(unsigned char *joystick_rpt);   //function prototype



GetPosition(joystick_report);             //function call

GetPosition(unsigned char *joystick_rpt)     //Function
{
	int position = 0;
	unsigned char old_position = 0; 
	unsigned char currrent_position = 0;

	if(old_position != PORTB & 0xC0)
	{
			
		position++;	
		old_position = PORTB & 0xC0;
		
		joystick_report[2] = position & 0x00ff;
		joystick_report[1] = position >> 8;

		
	}
	
	return 1;
}