Пример #1
0
/*---------------------------------------------------------------------------*/
void
board_init()
{
  antenna_sw_config();
  configure_unused_pins();
}
Пример #2
0
/**
 * \brief Main routine for the Re-Mote platform
 */
int
main(void)
{
    nvic_init();
    ioc_init();
    sys_ctrl_init();
    clock_init();
    lpm_init();
    rtimer_init();
    gpio_init();

    leds_init();
    fade(LEDS_RED);

    process_init();

    watchdog_init();
    SENSORS_ACTIVATE(button_sensor);

    /*
     * Character I/O Initialisation.
     * When the UART receives a character it will call serial_line_input_byte to
     * notify the core. The same applies for the USB driver.
     *
     * If slip-arch is also linked in afterwards (e.g. if we are a border router)
     * it will overwrite one of the two peripheral input callbacks. Characters
     * received over the relevant peripheral will be handled by
     * slip_input_byte instead
     */
#if UART_CONF_ENABLE
    uart_init(0);
    uart_init(1);
    uart_set_input(SERIAL_LINE_CONF_UART, serial_line_input_byte);
#endif

#if USB_SERIAL_CONF_ENABLE
    usb_serial_init();
    usb_serial_set_input(serial_line_input_byte);
#endif

    serial_line_init();

    INTERRUPTS_ENABLE();
    fade(LEDS_BLUE);

    PUTS(CONTIKI_VERSION_STRING);
    PUTS(BOARD_STRING);

    PRINTF(" Net: ");
    PRINTF("%s\n", NETSTACK_NETWORK.name);
    PRINTF(" MAC: ");
    PRINTF("%s\n", NETSTACK_MAC.name);
    PRINTF(" RDC: ");
    PRINTF("%s\n", NETSTACK_RDC.name);

    /* Initialise the H/W RNG engine. */
    random_init(0);

    udma_init();

    process_start(&etimer_process, NULL);
    ctimer_init();

    set_rf_params();
    netstack_init();

#if NETSTACK_CONF_WITH_IPV6
    memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
    queuebuf_init();
    process_start(&tcpip_process, NULL);
#endif /* NETSTACK_CONF_WITH_IPV6 */

    antenna_sw_config();

    process_start(&sensors_process, NULL);

    SENSORS_ACTIVATE(button_sensor);

    energest_init();
    ENERGEST_ON(ENERGEST_TYPE_CPU);

    autostart_start(autostart_processes);

    watchdog_start();
    fade(LEDS_GREEN);

    while(1) {
        uint8_t r;
        do {
            /* Reset watchdog and handle polls and events */
            watchdog_periodic();

            r = process_run();
        } while(r > 0);

        /* We have serviced all pending events. Enter a Low-Power mode. */
        lpm_enter();
    }
}