73ad4d9fd9
routine fixed.
71 lines
2.4 KiB
C
71 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 <avr/eeprom.h>
|
|
|
|
#ifndef EEMEM
|
|
#define EEMEM __attribute__ ((section (".eeprom")))
|
|
#endif
|
|
|
|
#include "globals.h"
|
|
|
|
//#include "type.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 "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);
|
|
|
|
extern uint32_t eep_anim[32] EEMEM;
|
|
|
|
// usb buffer
|
|
extern uint32_t frame; // Framebuffer
|
|
extern uint8_t delay_max; // delay in ISR aufrufen
|
|
extern uint8_t mode; // FW mode
|
|
|
|
//extern cube_t *cube;
|
|
extern void loadEEPROMFrame(uint8_t f);
|
|
|
|
#endif // __usb_h__
|
|
|