usb.h 545 B

12345678910111213141516
  1. /* Minimal polled USB CDC-ACM device stack for ATmega8U2 (no LUFA, no interrupts) */
  2. #ifndef USB_H
  3. #define USB_H
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. #define USB_PACKET 64
  7. void usb_init(void);
  8. void usb_task(void); /* call often: reset + EP0 handling */
  9. bool usb_ready(void); /* true once host configured device */
  10. uint8_t usb_rx(uint8_t *buf); /* copy one OUT packet (<=64B), 0=none */
  11. void usb_tx(const uint8_t *buf, uint8_t n); /* send one IN packet (<=64B), drops on timeout */
  12. #endif