X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f1199200e167a737a4676378da184387e543830c..d11ed10c5314c44dc01c06954d1d73d4894cbff8:/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h index acb5b8b3e..8f4194816 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -28,6 +28,11 @@ this software. */ +/** \file + * + * Header file for KeyboardHostWithParser.c. + */ + #ifndef _KEYBOARD_HOST_H_ #define _KEYBOARD_HOST_H_ @@ -38,43 +43,38 @@ #include #include - #include // Library Version Information - #include // ANSI Terminal Escape Codes - #include // USB Functionality - #include // Serial stream driver - #include // LEDs driver - #include // Simple scheduler for task management + #include + #include + #include + #include + #include + #include - #include "ConfigDescriptor.h" - #include "HIDReport.h" - /* Macros: */ - /** Pipe number for the keyboard report data pipe */ - #define KEYBOARD_DATAPIPE 1 + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 - /* Enums: */ - /** Enum for the possible status codes for passing to the UpdateStatus() function. */ - enum KeyboardHostWithParser_StatusCodes_t - { - Status_USBNotReady = 0, /**< USB is not ready (disconnected from a USB device) */ - Status_USBEnumerating = 1, /**< USB interface is enumerating */ - Status_USBReady = 2, /**< USB interface is connected and ready */ - Status_EnumerationError = 3, /**< Software error while enumerating the attached USB device */ - Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */ - Status_Busy = 5, /**< Busy dumping HID report items to the serial port */ - }; + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) - /* Task Definitions: */ - TASK(USB_Keyboard_Host); + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) - /* Function Prototypes: */ - void EVENT_USB_HostError(const uint8_t ErrorCode); - void EVENT_USB_DeviceAttached(void); - void EVENT_USB_DeviceUnattached(void); - void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); - void EVENT_USB_DeviceEnumerationComplete(void); + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /** HID Report Descriptor Usage Page value for a desktop keyboard */ + #define USAGE_PAGE_KEYBOARD 0x07 - void UpdateStatus(uint8_t CurrentStatus); - void ProcessKeyboardReport(uint8_t* KeyboardReport); + /* Function Prototypes: */ + void SetupHardware(void); + + void EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + + bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* CurrentItem); #endif