void auto_init(void) { #ifdef MODULE_BOARD_DISPLAY extern void lcd_init(); lcd_init(); DEBUG("DISP OK"); #endif #ifdef MODULE_DISPLAY_PUTCHAR extern void init_display_putchar(); init_display_putchar(); DEBUG("DISP OK"); #endif #ifdef MODULE_HWTIMER DEBUG("Auto init hwtimer module.\n"); hwtimer_init(); #endif #ifdef MODULE_VTIMER DEBUG("Auto init vtimer module.\n"); vtimer_init(); #endif #ifdef MODULE_UART0 DEBUG("Auto init uart0 module.\n"); board_uart0_init(); #endif #ifdef MODULE_RTC DEBUG("Auto init rtc module.\n"); rtc_init(); rtc_enable(); #endif #ifdef MODULE_SHT11 DEBUG("Auto init SHT11 module.\n"); sht11_init(); #endif #ifdef MODULE_GPIOINT DEBUG("Auto init gpioint module.\n"); gpioint_init(); #endif #ifdef MODULE_CC110X DEBUG("Auto init CC1100 module.\n"); cc1100_init(); #endif #ifdef MODULE_LTC4150 DEBUG("Auto init ltc4150 module.\n"); ltc4150_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); MCI_initialize(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); profiling_init(); #endif main(); }
int main(void) { printf("6LoWPAN\n"); vtimer_init(); posix_open(uart0_handler_pid, 0); //struct tm now; //rtc_get_localtime(&now); //srand((unsigned int)now.tm_sec); //uint8_t random = rand() % 256; //printf("address: %d\n", random); shell_t shell; shell_init(&shell, shell_commands, uart0_readc, uart0_putc); shell_run(&shell); return 0; }
/** * @print register */ void print_register(char reg, int num_bytes) { vtimer_init(); char buf_return[num_bytes]; int ret; gpio_clear(CS_PIN); vtimer_usleep(1); ret = spi_transfer_regs(SPI_PORT, (CMD_R_REGISTER | (REGISTER_MASK & reg)), 0, buf_return, num_bytes); gpio_set(CS_PIN); if (ret < 0) { printf("Error in read access\n"); } else { if (num_bytes < 2) { printf("0x%x returned: ", reg); for (int i = 0; i < num_bytes; i++) { prtbin(buf_return[i]); } } else { printf("0x%x returned: ", reg); for (int i = 0; i < num_bytes; i++) { printf("%x ", buf_return[i]); } printf("\n\n"); } } }
T_VOID Fwl_TimerInit(T_VOID) { vtimer_init(); }