Revision a0ab2c33 main.c

View differences:

main.c
27 27
#define A2 		PC2
28 28
#define A3 		PC3
29 29

  
30
#define CONTROLLER_PORT   D
31
#define CONTROLLER_LEFT   PD7
32
#define CONTROLLER_RIGHT  PD6
33
#define CONTROLLER_DOWN   PD5
34
#define CONTROLLER_ROTATE PD4
30
#define CONTROLLER0_PORT   D
31
#define CONTROLLER0_LEFT   PD7
32
#define CONTROLLER0_RIGHT  PD6
33
#define CONTROLLER0_DOWN   PD5
34
#define CONTROLLER0_ROTATE PD4
35 35

  
36 36
// control mappings for atari joystick
37 37
#define LEFT   0b0001
......
153 153
	// 7...4 left down right rotate
154 154
	//
155 155
	// move > rotate > down
156
	DDR(CONTROLLER_PORT) &= ~((1<<CONTROLLER_LEFT) | (1<<CONTROLLER_RIGHT) | (1<<CONTROLLER_DOWN) | (1<<CONTROLLER_ROTATE));
157
	PORT(CONTROLLER_PORT) |= (1<<CONTROLLER_LEFT) | (1<<CONTROLLER_RIGHT) | (1<<CONTROLLER_DOWN) | (1<<CONTROLLER_ROTATE);
156
	DDR(CONTROLLER0_PORT) &= ~((1<<CONTROLLER0_LEFT) | (1<<CONTROLLER0_RIGHT) | (1<<CONTROLLER0_DOWN) | (1<<CONTROLLER0_ROTATE));
157
	PORT(CONTROLLER0_PORT) |= (1<<CONTROLLER0_LEFT) | (1<<CONTROLLER0_RIGHT) | (1<<CONTROLLER0_DOWN) | (1<<CONTROLLER0_ROTATE);
158 158
	// address lines:
159 159
	DDR(ADDRESS_PORT) |= (1<<A3) | (1<<A2) | (1<<A1) | (1<<A0);
160 160

  
......
172 172
				drawGameArea((player_t*)&player[playerNumber]);
173 173
				if(delay%20 == 0){
174 174
					handleGamepadInput((player_t*)&player[playerNumber],
175
								((~PIN(CONTROLLER_PORT))&
176
									( (1<<CONTROLLER_LEFT)
177
									| (1<<CONTROLLER_DOWN)
178
									| (1<<CONTROLLER_RIGHT)
179
									| (1<<CONTROLLER_ROTATE))
175
								((~PIN(CONTROLLER0_PORT))&
176
									( (1<<CONTROLLER0_LEFT)
177
									| (1<<CONTROLLER0_DOWN)
178
									| (1<<CONTROLLER0_RIGHT)
179
									| (1<<CONTROLLER0_ROTATE))
180 180
								)>>4);
181 181
				}
182 182
			}

Also available in: Unified diff