Revision b2179a62 main.c

View differences:

main.c
19 19
#define DATA_GREEN_PIN 	PB3
20 20
#define DATA_RED_PIN 	PB1
21 21
#define OUTPUT_ENABLE_PIN PB2
22
// address lines - please note that the address lines have to be
23
// on the same port and in the current implementation are on 0-3
24
#define ADDRESS_PORT 	C
25
#define A0 		PC0
26
#define A1 		PC1
27
#define A2 		PC2
28
#define A3 		PC3
22 29

  
23 30
#define CONTROLLER_PORT   D
24 31
#define CONTROLLER_LEFT   PD7
......
141 148
int main(){
142 149
	// hardware init
143 150
	// clock, data and output enable
144
	DDR(WALLBOARD_PORT) = (1<<CLOCK_PIN) | (1<<DATA_RED_PIN) | (1<<DATA_GREEN_PIN) | (1<<OUTPUT_ENABLE_PIN);
151
	DDR(WALLBOARD_PORT) |= (1<<CLOCK_PIN) | (1<<DATA_RED_PIN) | (1<<DATA_GREEN_PIN) | (1<<OUTPUT_ENABLE_PIN);
145 152
	// gamepad (PD7 is for bootloadstart):
146 153
	// 7...4 left down right rotate
147 154
	//
......
149 156
	DDR(CONTROLLER_PORT) &= ~((1<<CONTROLLER_LEFT) | (1<<CONTROLLER_RIGHT) | (1<<CONTROLLER_DOWN) | (1<<CONTROLLER_ROTATE));
150 157
	PORT(CONTROLLER_PORT) |= (1<<CONTROLLER_LEFT) | (1<<CONTROLLER_RIGHT) | (1<<CONTROLLER_DOWN) | (1<<CONTROLLER_ROTATE);
151 158
	// address lines:
152
	DDR(C) = 0xff;
159
	DDR(ADDRESS_PORT) |= (1<<A3) | (1<<A2) | (1<<A1) | (1<<A0);
153 160

  
154 161
	// init player
155 162
	player[0].score = 0;
......
218 225
		_delay_us(80);
219 226
		ODE();
220 227
		_delay_us(1); // avoid ghosting
221
		PORT(C) = round+1;
228
		PORT(ADDRESS_PORT) = round+1;
222 229
	}
223 230
}
224 231

  

Also available in: Unified diff