67 lines
2.4 KiB
C
67 lines
2.4 KiB
C
/* Name: usb.h by Kai Lauterbach
|
|
* Based on Project: hid-custom-rq example
|
|
* Revision: $Id: main.c 790 2010-05-30 21:00:26Z cs $
|
|
* Author: Christian Starkjohann
|
|
* Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
|
|
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
|
* This
|
|
*/
|
|
|
|
#ifndef __usb_h__
|
|
#define __usb_h__
|
|
|
|
#include "globals.h"
|
|
|
|
/*
|
|
This example should run on most AVRs with only little changes. No special
|
|
hardware resources except INT0 are used. You may have to change usbconfig.h for
|
|
different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or
|
|
at least be connected to INT0 as well.
|
|
We assume that an LED is connected to port B bit 0. If you connect it to a
|
|
different port or bit, change the macros below:
|
|
*/
|
|
|
|
#include <avr/interrupt.h> /* for sei() */
|
|
//#include <avr/io.h>
|
|
//#include <avr/wdt.h>
|
|
#include <util/delay.h> /* for _delay_ms() */
|
|
//#include <avr/pgmspace.h> /* required by usbdrv.h */
|
|
|
|
#include "usbconfig.h"
|
|
#include "usbdrv.h"
|
|
#include "requests.h" /* The custom request numbers we use */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
/* ----------------------------- USB interface ----------------------------- */
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */
|
|
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
|
|
0x09, 0x01, // USAGE (Vendor Usage 1)
|
|
0xa1, 0x01, // COLLECTION (Application)
|
|
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
|
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
|
0x75, 0x08, // REPORT_SIZE (8)
|
|
0x95, 0x01, // REPORT_COUNT (1)
|
|
0x09, 0x00, // USAGE (Undefined)
|
|
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
|
|
0xc0 // END_COLLECTION
|
|
};
|
|
/* The descriptor above is a dummy only, it silences the drivers. The report
|
|
* it describes consists of one byte of undefined data.
|
|
* We don't transfer our data through HID reports, we use custom requests
|
|
* instead.
|
|
*/
|
|
|
|
void init_usb(void);
|
|
|
|
//volatile uint8_t x;
|
|
//volatile uint8_t y;
|
|
//volatile uint8_t z;
|
|
|
|
// usb buffer
|
|
//extern uint8_t buffer[3][3][3]; // Framebuffer
|
|
//extern uint8_t cube[3][3][3]; // Framebuffer
|
|
|
|
#endif // __usb_h__
|
|
|