Exemple #1
0
/**
 * \brief Configure hardware blocks used by the test suite.
 *
 */
static void periph_init(void)
{
#       if dg_configBLACK_ORCA_MB_REV == BLACK_ORCA_MB_REV_A
#               define UART_TX_PORT    HW_GPIO_PORT_1
#               define UART_TX_PIN     HW_GPIO_PIN_0
#               define UART_RX_PORT    HW_GPIO_PORT_1
#               define UART_RX_PIN     HW_GPIO_PIN_5
#elif dg_configBLACK_ORCA_MB_REV == BLACK_ORCA_MB_REV_B
#               define UART_TX_PORT    HW_GPIO_PORT_1
#               define UART_TX_PIN     HW_GPIO_PIN_3
#               define UART_RX_PORT    HW_GPIO_PORT_2
#               define UART_RX_PIN     HW_GPIO_PIN_3
#       else
#               error "Unknown value for dg_configBLACK_ORCA_MB_REV!"
#       endif


#if LOADER_UART
#if LOADER_UART == 2
        hw_gpio_set_pin_function(UART_TX_PORT, UART_TX_PIN, HW_GPIO_MODE_OUTPUT,
                                                                        HW_GPIO_FUNC_UART2_TX);
        hw_gpio_set_pin_function(UART_RX_PORT, UART_RX_PIN, HW_GPIO_MODE_INPUT,
                                                                        HW_GPIO_FUNC_UART2_RX);
#else
        hw_gpio_set_pin_function(UART_TX_PORT, UART_TX_PIN, HW_GPIO_MODE_OUTPUT,
                                                                        HW_GPIO_FUNC_UART_TX);
        hw_gpio_set_pin_function(UART_RX_PORT, UART_RX_PIN, HW_GPIO_MODE_INPUT,
                                                                        HW_GPIO_FUNC_UART_RX);
#endif

        hw_uart_init(UART_ID, &uart_cfg);
#endif
}
Exemple #2
0
/* Public Functions */
void hw_init(void)
{
    hw_mcg_init();
    hw_gpio_init();
    hw_uart_init();
    hw_rtc_init();
    hw_rand_init();
}
Exemple #3
0
int main(void)
{
    /* Bring up processor */
	cpu_init();
    watchdog_init();

#ifdef CONFIG_HW_LED_ALIVE_CHECK
    /* Bring up low level LED */
    hw_led_init();
#endif
#ifdef CONFIG_HW_UART
    /* Bring up low level hardware UART */
    hw_uart_init();
#endif
    /* Setup timer for tick counting */
    tick_init();

    /* Bring up high level LED */
    led_init();

    /* Bring up console */
    console_init();

#ifdef CONFIG_DEBUG_RESET_REASON
    /* Report reason for last reset */
    console_puts_P(PSTR("Reset cause:"));
    console_puthex8(MCUSR);
    console_newline();
#endif

    /* Set default LED pattern */
    led_set_seq(LED_SEQ_SINE);

#ifdef CONFIG_USBDEV
    usbdev_init(USBMODE_DEFAULT);
#endif

    /* HiZ bus mode selected by default */
    bus_init(&bus_hiz);

    /* Enable interrupts */
    cpu_enable_int();

    while(1)
	{
        driver_tick();
	}
}