2011-10-15 11:31:44 +02:00
|
|
|
/* 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__
|
|
|
|
|
2011-12-10 11:46:58 +01:00
|
|
|
#include <avr/eeprom.h>
|
|
|
|
|
|
|
|
#ifndef EEMEM
|
|
|
|
#define EEMEM __attribute__ ((section (".eeprom")))
|
|
|
|
#endif
|
|
|
|
|
2011-10-19 00:04:59 +02:00
|
|
|
#include "globals.h"
|
|
|
|
|
2011-12-18 13:47:06 +01:00
|
|
|
//#include "type.h"
|
2011-12-17 22:03:57 +01:00
|
|
|
|
2011-10-15 11:31:44 +02:00
|
|
|
/*
|
|
|
|
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 "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);
|
|
|
|
|
2011-12-18 19:35:47 +01:00
|
|
|
extern uint32_t eep_anim[32] EEMEM;
|
2011-12-10 11:46:58 +01:00
|
|
|
|
2011-10-19 00:04:59 +02:00
|
|
|
// usb buffer
|
2011-12-18 22:16:32 +01:00
|
|
|
extern uint32_t frame; // Framebuffer
|
|
|
|
extern uint8_t delay_max; // delay in ISR aufrufen
|
|
|
|
extern uint8_t mode; // FW mode
|
2011-12-17 22:03:57 +01:00
|
|
|
|
|
|
|
//extern cube_t *cube;
|
2011-12-18 22:16:32 +01:00
|
|
|
extern void loadEEPROMFrame(uint8_t f);
|
2011-10-15 11:31:44 +02:00
|
|
|
|
|
|
|
#endif // __usb_h__
|
|
|
|
|