PROCESS_THREAD(freakusb_process, ev, data_proc) { PROCESS_POLLHANDLER(freakusb_pollhandler()); PROCESS_BEGIN(); usb_init(); hw_init(); cdc_init(); /* TODO: Implement this when we decide to accept commands over the USB */ cdc_reg_rx_handler(test_avr_usb_rx_handler); /* hook the putchar function to the printf and use it for stdout */ stdout = &file_str; /* kick off the polling function */ process_poll(&freakusb_process); while (1) { PROCESS_YIELD(); } PROCESS_END(); }
int main() { usb_init(); hw_init(); // init the class driver here cdc_init(); // register the rx handler function with the cdc cdc_reg_rx_handler(rx); // and off we go... while (1) { usb_poll(); } }