diff -r 2405aff29a51 -r f4e250d5402b blackbox/lowlevel.c --- a/blackbox/lowlevel.c Tue Nov 15 12:51:04 2011 +0100 +++ b/blackbox/lowlevel.c Wed Nov 16 12:29:09 2011 +0100 @@ -42,10 +42,18 @@ } void init_hardware(void) { + // reset all ports to input, no pullup + DDRA = 0; PORTA = 0; + DDRB = 0; PORTB = 0; + DDRC = 0; PORTC = 0; + DDRD = 0; PORTD = 0; + + RS232_init(); // initialize RS485 interface RS232_puts_p(PSTR("CARRERA beta loading\n")); initADC(); + SFIOR = 0; // set LED output DDR(LED1_PORT) |= _BV(LED1); @@ -59,11 +67,17 @@ // switch pull-ups SW_FUEL_PORT |= _BV(SW_FUEL); + SW_START_PORT |= _BV(SW_START); + SW_PACECAR_PORT |= _BV(SW_PACECAR); + // control outputs + DDR(LAP_COUNTER_PORT) |= _BV(LAP_COUNTER); + + // setup rail control //RAIL_DETECT_PORT |= _BV(RAIL_DETECT); // enable internal pull-up DDR(RAIL_POWER_PORT) |= _BV(RAIL_POWER); - + // display init sequence on LEDs LED(1, 1); _delay_ms(50); LED(2, 1); _delay_ms(50); LED(3, 1); _delay_ms(50); @@ -82,15 +96,13 @@ // setup data bit timer - TCCR2 = (1<