Ejemplo n.º 1
0
void platform_periph_setup()
{
//	datalink_setup();
	motors_setup();
	rc_setup();
 	led_driver_setup();
	vn200_setup();
}
Ejemplo n.º 2
0
void setup_hw(void)
{
    /*
     * power savings !
     *
     * total optimized power consumption of the cpu module: 2.2mA
     * incl. status LED (PWMed)
     *
     * the MBI5168 LED drivers take about 15mA each in idle mode :-(
     *
     */

    // turn all pins to inputs (default anyway) + pull-up on
    // saved about another 0.5mA on my board
    PORTA = 0xFF;
    PORTB = 0xFF;

    /*
     * now configure the pins we actually need
     */
    DDRB |= _BV(PB0);	// display enable pin as output
    PORTB |= _BV(PB0);	// pullup on

    DDRB |= _BV(PB2);   // led pin as output
    PORTB |= _BV(PB2);  // led on

    // USI stuff
    DDRB |= _BV(PB1);   // latch pin as output
    PORTB &= ~_BV(PB1);	// latch low

    DDRA |= _BV(PA5);	// as output (DO)
    DDRA |= _BV(PA4);	// as output (USISCK)
    DDRA &= ~_BV(PA6);	// as input (DI)
    PORTA |= _BV(PA6);	// pullup on (DI)

    // only for debugging
    // DDRA |= _BV(PA2);   // as output
    // PORTA &= _BV(PA2);  // set LOW
    // DDRA |= _BV(PA3);   // as output
    // PORTA &= _BV(PA3);  // set LOW
    // DDRA |= _BV(PA7);   // as output
    // PORTA &= _BV(PA7);  // set LOW

    /*
     * setup ADC
     *
     * using single conversion mode
     * --> setup in adc_read() for every conversion necessary!
     *
     */
    PORTA &= ~_BV(PA1); // internal pull-up off on switches pin

    /*
     * getting ready
     */
    system_ticker_setup();
    led_driver_setup(); // disable for adc_test()
    #ifdef USE_SOFT_UART
    soft_uart_setup();
    #endif

    sei(); // turn global irq flag on
    #ifdef DEBUG
    signal_reset(); // needs the system_ticker to run and sei() as well !
    #endif
}