Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Main program entry point. This routine contains the overall program flow, including initial
- * setup of all components and the main program loop.
- */
- int main(void)
- {
- SetupHardware();
- /* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */
- CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
- sei();
- DDRB = 0; //input
- DDRD = 0; //input
- PORTB = 0xFF; //on
- PORTD = 0; //off
- for (;;)
- {
- while(fgetc(&USBSerialStream) != 'x'); //wait for x
- DDRB = gethex();
- DDRD = gethex();
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }
- /* V1
- DDRB = 0xFF; //output
- DDRD = 0xFF;
- PORTB = 0; //off
- PORTD = 0;
- for (;;)
- {
- while(fgetc(&USBSerialStream) != 'x'); //wait for x
- PORTB = gethex();
- PORTD = gethex();
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }*/
- /*
- //OLD code
- for (;;)
- {
- switch(fgetc(&USBSerialStream)) {
- case 'a': PORTD |= (1<<2); break;
- case 'b': PORTD &= ~(1<<2); break;
- case 'c': PORTD |= (1<<3); break;
- case 'd': PORTD &= ~(1<<3); break;
- }
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
- }*/
- }
Add Comment
Please, Sign In to add comment