Moved all source to the trunk directory.

This commit is contained in:
Dean Camera 2009-02-23 07:08:22 +00:00
commit 6a10d6b465
88 changed files with 15575 additions and 0 deletions

View file

@ -0,0 +1,22 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \page Page_BuildLibrary Building as a Linkable Library
*
* The LUFA library can be built as a proper linkable library (with the extention .a) under AVR-GCC, so that
* the library does not need to be recompiled with each revision of a user project. Instructions for creating
* a library from a given source tree can be found in the AVR-GCC user manual included in the WinAVR install
* /Docs/ directory.
*
* However, building the library is <b>not recommended</b>, as the static (compile-time) options will be
* unable to be changed without a recompilation of the LUFA code. Therefore, if the library is to be built
* from the LUFA source, it should be made to be application-specific and compiled with the static options
* that are required for each project (which should be recorded along with the library).
*
* Normal library use has the library components compiled in at the same point as the application code, as
* demonstrated in the library demos and applications. This is the preferred method, as the library is recompiled
* each time to ensure that all static options for a particular application are applied.
*/

400
LUFA/ChangeLog.txt Normal file
View file

@ -0,0 +1,400 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \page Page_ChangeLog Project Changelog
*
* \section Sec_ChangeLogXXXXXX Version XXXXXX
*
* - Added new BluetoothHost demo
* - Changed AVRISP Programmer descriptors to use a newly allocated 0x204F PID value
* - Fixed MagStripe project configuration descriptor containing an unused (blank) endpoint descriptor
* - Incorporated makefile changes by Denver Gingerich to retain compatibility with stock (non-WinAVR) AVR-GCC installations
* - Fixed makefile EEPROM programming targets programming FLASH data in addition to EEPROM data
* - LUFA devices now enumerate correctly with LUFA hosts
* - Fixed Configuration Descriptor search routine freezing when a comparitor returned a failure
* - Removed HID report item serial dump in the MouseHostWithParser and KeyboardHostWithParser - useful only for debugging, and
* slowed down the enumeration of HID devices too much
* - Increased the number of bits per track which can be read in the MagStripe project to 20480 when compiled for the AT90USBXXX6/7
* - Fixed KeyboardMouse demo discarding the wIndex value in the REQ_GetReport request
*
* \section Sec_ChangeLog090209 Version 090209
*
* - PWM timer mode in AudioOut demo changed to Fast PWM for speed
* - Updated Magstripe project to work with the latest hardware revision
* - Fixed library not responding to the BCERRI flag correctly in host mode, leading to device lockups
* - Fixed library handling Get Descriptor requests when not addressed as standard requests to the device or interface
* - Fixed serious data corruption issue in MassStorage demo dataflash write routine
* - Added new NO_CLEARSET_FEATURE_REQUEST compile time token
* - USB task now restores previous global interrupt state after execution, rather than forcing global interrupts to be enabled
* - Fixed USB_DeviceEnumerationComplete event firing after each configuration change, rather than once after the initial configuration
* - Added ENDPOINT_DOUBLEBANK_SUPPORTED() macros to Endpoint.h, altered ENDPOINT_MAX_SIZE() to allow user to specify endpoint
* - ENDPOINT_MAX_ENDPOINTS changed to ENDPOINT_TOTAL_ENDPOINTS, PIPE_MAX_PIPES changed to PIPE_TOTAL_PIPES
* - Endpoint and Pipe non-control stream functions now ensure endpoint or pipe is ready before reading or writing
* - Changed Teensy bootloader to use a watchdog reset when exiting rather than a software jump
* - Fixed integer promotion error in MassStorage and MassStorageHost demos, corrupting read/write transfers
* - SPI_SendByte is now SPI_TransferByte, added new SPI_SendByte and SPI_ReceiveByte functions for fast one-way transfer
* - MassStorage demo changed to use new fast one-way SPI transfers to increase throughput
* - MassStorage handling of Mass Storage Reset class request improved
* - Altered MassStorage demo dataflash block read code for speed
* - Added USB_IsSuspended global flag
* - Simplified internal Dual Mode (OTG) USB library code to reduce code size
* - Extended stream timeout period to 100ms from 50ms
* - Mass Storage Host demo commands now all return an error code from the Pipe_Stream_RW_ErrorCodes_t enum
* - Added SubErrorCode parameter to the USB_DeviceEnumerationFailed event
* - VBUS drop interrupt now disabled during the manual-to-auto VBUS delivery handoff
* - Simplified low level backend so that device/host mode initialization uses the same code paths
* - Added workaround for faulty Mass Storage devices which do not implement the required GET_MAX_LUN request
* - Removed buggy Telnet application from the RNDIS demo
* - Moved Mass Storage class requests in the Mass Storage Host demo to wrapper functions in MassStoreCommands.c
* - Fixed incorrect SCSI command size value in the Request Sense command in MassStoreCommands.c
* - Added SetProtocol request to HID class non-parser Mouse and Keyboard demos to force devices to use the correct Boot Protocol
* - Added new "dfu" and "flip" programming targets to project makefiles
* - HID_PARSE_Sucessful enum member typo corrected to HID_PARSE_Successful
* - Changed COLLECTION item strucutres in the HID descriptor parser to include the collection's Usage Page value
* - Serial driver now sets Tx line as output, enables pullup on Rx line
* - Fixed smaller USB AVRs raising multiple connection and disconnection events when NO_LIMITED_CONTROLLER_CONNECT is disabled
* - Added HOST_DEVICE_SETTLE_DELAY_MS to give the host delay after a device is connected before it is enumerated
* - Fixed KeyboardHostWithParser demo linking against the wrong global variables
* - Completed doxygen documentation of remaining library bootloaders, demos and projects
* - Fixed incorrect bootloader start address in the TeensyHID bootloader
* - Added HWB button whole-disk ASCII dump functionality to MassStoreHost demo
* - Replaced printf_P(PSTR("%c"), {Variable}) calls with putchar(<Variable>) for speed and size savings
* - Serial driver now accepts baud rates over 16-bits in size, added double speed flag option
* - Fixed incorrect callback abort return value in Pipe.c
* - Added new flip-ee and dfu-ee makefile targets (courtesy of Opendous Inc.)
* - Removed reboot-on-disconnect code from the TeensyHID bootloader, caused problems on some systems
* - Fixed AudioOutput and AudioInput demos looping on the endpoint data, rather than processing a sample at a time and returning
* each time the task runs to allow for other tasks to execute
* - Added support for the Atmel ATAVRUSBRF01 board
* - Added AVRISP Programmer Project, courtesy of Opendous Inc.
* - Fixed CDC Host demo not searching through both CDC interfaces for endpoints
* - Fixed incorrect Product String descriptor length in the DFU class bootloader
*
* \section Sec_ChangeLog081224 Version 081224
*
* - MyUSB name changed to LUFA, the Lightweight USB Framework for AVRs
* - Fixed Mass Storage Host demo's MassStore_SendCommand() delay in the incorrect place
* - Fixed USBtoSerial demo not calling ReconfigureUSART() after a change in the line encoding
* - Fixed infinite loop in host mode Host-to-Device control transfers with data stages
* - HID report parser now supports devices with multiple reports in one interface via Report IDs
* - Fixed RZUSBSTICK board LED driver header incorrect macro definition order causing compile errors
* - Calling USB_Init() when the USB interface is already configured now forces a complete interface reset
* and re-enumeration - fixes MyUSB DFU bootloader not switching to app code correctly when soft reset used
* - Fixed "No newline at end of file" warning when stream callbacks are enabled
* - DFU bootloader now uses fixed signature bytes per device, rather than reading them out dynamically for size
* - Added new FIXED_CONTROL_ENDPOINT_SIZE and USE_SINGLE_DEVICE_CONFIGURATION switches to statically define certain values to
* reduce compiled binary size
* - Added new NO_LIMITED_CONTROLLER_CONNECT switch to prevent the library from trying to determine bus connection
* state from the suspension and wake up events on the smaller USB AVRs
* - Added summary of all library compile time tokens to the documentation
* - Added overview of the LUFA scheduler to the documentation
* - Removed MANUAL_PLL_CONTROL compile time token, replaced with a mask for the USB_Init() Options parameter
* - CDC bootloader now uses the correct non-far or far versions of the pgm_* functions depending on if RAMPZ is defined
* - Doxygen documentation now contains documentation on all the projects, bootloaders and most demos included with the library
* - CDC bootloader now runs user application when USB disconnected rather than waiting for a hard reset
* - MouseHostWithParser and KeyboardHostWithParser now support multiple-report devices
* - RNDIS demo can now close connections correctly using the new TCP_APP_CLOSECONNECTION() macro - used in Webserver
* - Fixed the DFU bootloader, no longer freezes up when certain files are programmed into an AVR, made reading/writing faster
* - Fixed mouse/joystick up/down movements reversed - HID mouse X/Y coordinates use a left-handed coordinate system, not a normal
* right-handed system
* - Added stub code to the CDC and USBtoSerial demos showing how to read and set the RS-232 handshake lines - not currently used in
* the demos, but the example code and supporting defines are now in place
* - Interrupts are now disabled when processing a control request in device mode, to avoid exceeding the strict control request
* timing requirements.
* - All demos now use a central StatusUpdate() function rather than direct calls to the board LED functions, so that the demos can
* easily be altered to show different LED combinations (or do something else entirely) as the demo's status changes
* - Removed LED commands from the CDC bootloader, unused by most AVR910 programming software
* - Fixed RNDIS demo ICMP ping requests echoing back incorrect data
* - Added DHCP server code to RNDIS demo, allowing for hands-free autoconfiguration on any PC
* - Fixed DFU bootloader PID value for the ATMEGA16U4 AVR
* - Endpoint and Pipe configuration functions now return an error code indicating success or failure
* - USB Reset in device mode now resets and disables all device endpoints
* - Added intermediate states to the host mode state machine, reducing the USB task blocking time to no more than 1ms explicitly per
* invocation when in host mode
* - Added support for the ATMEGA32U6 microcontroller
* - Added STATIC_ENDPOINT_CONFIGURATION compile time option, enabled in the bootloaders to minimize space usage
* - Removed redudant code from the USB device GetStatus() chapter 9 processing routine
* - Added new TeensyHID bootloader, compatible with the Teensy HID protocol (http://www.pjrc.com/teensy/)
* - Versions are now numbered by release dates, rather than arbitrary major/minor revision numbers
* - USB_RemoteWakeupEnabled is now correctly set and cleared by SetFeature and ClearFeature requests from the host
* - Changed prototype of GetDescriptor, so that it now returns the descriptor size (or zero if the descriptor doesn't exist)
* rather than passing the size back to the caller through a parameter and returning a boolean
*
* \section Sec_ChangeLog153 Version 1.5.3 - Released 2nd October, 2008
*
* - Fixed CDC bootloader using pgmspace macros for some descriptors inappropriately
* - Updated all Mouse and Keyboard device demos to include boot protocol support (now works in BIOS)
* - Renamed bootloader directories to remove spaces, which were causing build problems on several OSes
* - Removed serial number strings from all but the MassStore demo where it is required - users were not
* modifing the code to either ommit the descriptor or use a unique serial per device causing problems
* when multiple units of the same device were plugged in at the same time
* - AudioOutput and AudioInput demos now correctly silence endpoints when not enabled by the host
* - Added KeyboardMouse demo (Keyboard and Mouse functionality combined into a single demo)
* - Added DriverStubs directory to house board level driver templates, to make MyUSB compatible custom board
* driver creation easier
* - Extended MassStorage demo to support multiple LUNs, 2 by default
* - Fixed incorrect device address mask, preventing the device from enumerating with addresses larger than 63
* - Fixed incorrect data direction mask in the GetStatus standard request, preventing it from being handled
* - Fixed incorrect GetStatus standard request for endpoints, now returns the endpoint STALL status correctly
* - Added in new USB_RemoteWakeupEnabled and USB_CurrentlySelfPowered flags rather than using fixed values
* - Added DualCDC demo to demonstrate the use of Interface Association Descriptors
* - Added pipe NAK detection and clearing API
* - Added pipe status change (NAK, STALL, etc.) interrupt API
* - Fixed MassStorageHost demo so that it no longer freezes randomly when issuing several commands in a row
* - Host demos configuration descriptor routines now return a unique error code when the returned data does
* not have a valid configuration descriptor header
* - Added Endpoint_WaitUntilReady() and Pipe_WaitUntilReady() functions
* - Stream functions now have software timeouts, timeout period can be set by the USB_STREAM_TIMEOUT_MS token
* - All demos now pass the USB.org automated Chapter 9 device compliance tests
* - All HID demos now pass the USB.org automated HID compliance tests
* - Polling interval of the interrupt endpoint in the CDC based demos changed to 0xFF to fix problems on Linux systems
* - Changed stream functions to accept a new callback function, with NO_STREAM_CALLBACKS used to disable all callbacks
* - Mass Storage demo dataflash management routines changed to use the endpoint stream functions
* - Added AVRStudio project files for each demo in addition to the existing Programmer's Notepad master project file
* - Re-added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes
* are reflected in the hardware (change was previously lost)
*
*
* \section Sec_ChangeLog152 Version 1.5.2 - Released 31st July, 2008
*
* - Fixed SwapEndian_32() function in Common.h so that it now works correctly (wrong parameter types)
* - Updated RNDIS demo - notification endpoint is no longer blocking so that it works with faulty Linux RNDIS
* implementations (where the notification endpoint is ignored in favour of polling the control endpoint)
* - Fixed incorrect Vendor Description string return size in RNDIS demo for the OID_GEN_VENDOR_DESCRIPTION OID token
* - Added very basic TCP/IP stack and HTTP/TELNET servers to RNDIS demo
* - Fixed DFU bootloader exit causing programming software to complain about failed writes
* - Fixed DFU bootloader EEPROM programming mode wiping first flash page
* - Fixed Clear/Set Feature device standard request processing code (fixing MassStorage demo in the process)
* - Added support for the ATMEGA16U4 AVR microcontroller
* - Library licence changed from LGPLv3 to MIT license
*
*
* \section Sec_ChangeLog151 Version 1.5.1 - Released 31st July, 2008
*
* - Changed host demos to enable the host function task on the firing of the USB_DeviceEnumerationComplete event
* rather than the USB_DeviceAttached event
* - HID Usage Stack now forcefully cleared after an IN/OUT/FEATURE item has been completely processed to remove
* any referenced but not created usages
* - Changed USB_INT_DisableAllInterrupts() and USB_INT_ClearAllInterrupts(), USB_Host_GetNextDescriptorOfType(),
* USB_Host_GetNextDescriptorOfTypeBefore(), USB_Host_GetNextDescriptorOfTypeAfter() to normal functions (from inline)
* - Fixed USBtoSerial demo not sending data, only receiving
* - Fixed main makefile to make all by default, fixed MagStripe directory case to prevent case-sensitive path problems
* - ConfigDescriptor functions made normal, instead of static inline
* - Pipe/Endpoint *_Ignore_* functions changed to *_Discard_*, old names still present as aliases
* - Fixed ENDPOINT_MAX_SIZE define to be correct on limited USB controller AVRs
* - Changed endpoint and pipe size translation routines to use previous IF/ELSE IF cascade code, new algorithmic
* approach was buggy and caused problems
* - Bootloaders now compile with -fno-inline-small-functions option to reduce code size
* - Audio demos now use correct endpoint sizes for full and limited controller USB AVRs, double banking in all cases
* to be in line with the specification (isochronous endpoints MUST be double banked)
* - Added Interface Association descriptor to StdDescriptors.h, based on the relevant USB2.0 ECN
* - Fixed MIDI demo, corrected Audio Streaming descriptor to follow the MIDI-specific AS structure
* - Fixed HID class demo descriptors so that the HID interface's protocol is 0x00 (required for non-boot protocol HID
* devices) to prevent problems on hosts expecting the boot protocol functions to be supported
* - Added read/write control stream functions to Endpoint.h
* - Fixed AudioOut demo not setting port pins to inputs on USB disconnect properly
* - Added RNDISEthernet demo application
*
*
* \section Sec_ChangeLog150 Version 1.5.0 - Released 10 June, 2008
*
* - Fixed MIDI demo, now correctly waits for the endpoint to be ready between multiple note messages
* - Added CDC Host demo application
* - Added KeyboardFullInt demo application
* - Endpoint and Pipe creation routines now mask endpoint/pipe size with the size mask, to remove transaction
* size bits not required for the routines (improves compatibility with devices)
* - Fixed AudioInput demo - now correctly sends sampled audio to the host PC
* - Fixed AudioOutput demo oncemore -- apparently Windows requires endpoint packets to be >=192 bytes
* - Shrunk round-robbin scheduler code slightly via the use of struct pointers rather than array indexes
* - Fixed off-by-one error when determining if the Usage Stack is full inside the HID Report parser
* - Renamed Magstripe.h to MagstripeHW.h and moved driver out of the library and into the MagStripe demo folder
* - Added preprocessor checks to enable C linkage on the library components when used with a C++ compiler
* - Added Still Image Host demo application
* - The USB device task now restores the previously selected endpoint, allowing control requests to be transparently
* handled via interrupts while other endpoints are serviced through polling
* - Fixed device signature being sent in reverse order in the CDC bootloader
* - Host demos now have a seperate ConfigDescriptor.c/.h file for configuration descriptor processing
* - HostWithParser demos now have a seperate HIDReport.c/.h file for HID report processing and dumping
* - Removed non-mandatory commands from MassStorage demo to save space, fixed SENSE ResponseCode value
* - CDC demos now send empty packets after sending a full one to prevent buffering issues on the host
* - Updated demo descriptors to use VID/PID values donated by Atmel
* - Added DoxyGen documentation to the source files
* - Fixed Serial_IsCharRecieved() definition, was previously reversed
* - Removed seperate USB_Descriptor_Language_t descriptor, USB_Descriptor_String_t is used instead
* - Removed unused Device Qualifier descriptor structure
* - Renamed the USB_CreateEndpoints event to the more appropriate USB_ConfigurationChanged
* - Fixed MassStorageHost demo reading in the block data in reverse
* - Removed outdated typedefs in StdRequestType.h, superceeded by the macro masks
* - Corrected OTG.h is now included when the AVR supports both Host and Device modes, for creating OTG products
* - USB_DeviceEnumerationComplete event is now also fired when in device mode and the host has finished its enumeration
* - Interrupt driven demos now properly restore previously selected endpoint when ISR is complete
* - USB_HOST_TIMEOUT_MS is now overridable in the user project makefile to a custom fixed timeout value
* - Renamed USB_Host_SOFGeneration_* macros to more friendly USB_Host_SuspendBus(), USB_Host_ResumeBus()
* and USB_Host_IsBusSuspended()
* - Renamed *_*_Is* macros to *_Is* to make all flag checking macros consistant, Pipe_SetInterruptFreq() is now
* Pipe_SetInterruptPeriod() to use the correct terminology
* - UnicodeString member of USB_Descriptor_String_t struct changed to an ordinary int array type, so that the GCC
* Unicode strings (prefixed with an L before the opening quotation mark) can be used instead of explicit arrays
* of ASCII characters
* - Fixed Endpoint/Pipes being configured incorrectly if the maximum endpoint/pipe size for the selected USB AVR
* model was given as the bank size
* - HID device demos now use a true raw array for the HID report descriptor rather than a struct wrapped array
* - Added VERSION_BCD() macro, fixed reported HID and USB version numbers in demo descriptors
* - Cleaned up GetDescriptor device chapter 9 handler function
* - Added GET_REPORT class specific request to HID demos to make them complaint to the HID class
* - Cleaned up setting of USB_IsInitialized and USB_IsConnected values to only when needed
* - Removed Atomic.c and ISRMacro.h; the library was already only compatible with recent avr-lib-c for other reasons
* - All demos and library functions now use USB standardized names for the USB data (bRequest, wLength, etc.)
* - Added USE_NONSTANDARD_DESCRIPTOR_NAMES token to switch back to the non-standard descriptor element names
*
*
* \section Sec_ChangeLog141 Version 1.4.1 - Released 5 May, 2008
*
* - Enhanced KeyboardWithParser demo, now prints out pressed alphanumeric characters like the standard demo
* - Fixed MassStorage demo, read/writes using non mode-10 commands now work correctly
* - Corrected version number in Version.h
*
*
* \section Sec_ChangeLog140 Version 1.4.0 - Released 5 May, 2008
*
* - Added HID Report Parser API to the library
* - Added Mouse and Keyboard host demo applications, using the new HID report parser engine
* - Added MouseFullInt demo, which demonstrates a fully interrupt (including control requests) mouse device
* - Fixed incorrect length value in the audio control descriptor of the AudioOutput and AudioInput demos
* - Added MIDI device demo application to the library
* - Fixed problem preventing USB devices from being resumed from a suspended state
* - Added new CDC class bootloader to the library, based on the AVR109 bootloader protocol
* - Added header to each demo application indicating the mode, class, subclass, standards used and supported speed
* - Functions expecting endpoint/pipe numbers are no longer automatically masked against ENDPOINT_EPNUM_MASK or
* PIPE_PIPENUM_MASK - this should be manually added to code which requires it
* - Fixed DFU class bootloader - corrected frequency of flash page writes, greatly reducing programming time
* - Renamed AVR_HOST_GetDeviceConfigDescriptor() to USB_Host_GetDeviceConfigDescriptor() and AVR_HOST_GetNextDescriptor()
* to USB_Host_GetNextDescriptor()
* - Added new USB_Host_GetNextDescriptorOfTypeBefore() and USB_Host_GetNextDescriptorOfTypeAfter() routines
* - Moved configuration descriptor routines to MyUSB/Drivers/USB/Class/, new accompanying ConfigDescriptors.c file
* - Added new configuration descriptor comparator API for more powerful descriptor parsing, updated host demos to use the
* new comparator API
* - Fixed MassStorageHost demo capacity printout, and changed data read/write mode from little-endian to the correct
* big-endian for SCSI devices
* - Fixed macro/function naming consistancy; USB_HOST is now USB_Host, USB_DEV is now USB_Device
* - Added better error reporting to host demos
* - Added 10 microsecond delay after addressing devices in host mode, to prevent control stalls
*
*
* \section Sec_ChangeLog132 Version 1.3.2 - Released April 1st, 2008
*
* - Added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes
* are reflected in the hardware
* - Fixed CDC and USBtoSerial demos - Stream commands do not work for control endpoints, and the
* GetLineCoding request had an incorrect RequestType mask preventing it from being processed
* - Improved reliability of the USBtoSerial demo, adding a busy wait while the buffer is full
* - Device control endpoint size is now determined from the device's descriptors rather than being fixed
* - Seperated out SPI code into new SPI driver in AT90USBXXX driver directory
* - Bootloader now returns correct PID for the selected USB AVR model, not just the AT90USB128X PID
* - Added support for the RZUSBSTICK board
* - Bicolour driver removed in favour of generic LEDs driver
* - Added support for the ATMEGA32U4 AVR
* - Added MANUAL_PLL_CONTROL compile time option to prevent the USB library from manipulating the PLL
*
*
* \section Sec_ChangeLog131 Version 1.3.1 - Released March 19th 2008
*
* - Fixed USB to Serial demo - class value in the descriptors was incorrect
* - Control endpoint size changed from 64 bytes to 8 bytes to save on USB FIFO RAM and to allow low
* speed mode devices to enumerate properly
* - USB to Serial demo data endpoints changed to dual-banked 16 byte to allow the demo to work
* on USB AVRs with limited USB FIFO RAM
* - Changed demo endpoint numbers to use endpoints 3 and 4 for double banking, to allow limited
* USB device controller AVRs (AT90USB162, AT90USB82) to function correctly
* - Updated Audio Out demo to use timer 1 for AVRs lacking a timer 3 for the PWM output
* - Fixed incorrect USB_DEV_OPT_HIGHSPEED entry in the Mass Storage device demo makefile
* - Optimized Mass Storage demo for a little extra transfer speed
* - Added LED indicators to the Keyboard demo for Caps Lock, Num Lock and Scroll Lock
* - Added Endpoint_Read_Stream, Endpoint_Write_Stream, Pipe_Read_Stream and Pipe_Write_Stream functions
* (including Big and Little Endian variants)
* - Made Dataflash functions inline for speed, removed now empty Dataflash.c driver file
* - Added new SetSystemClockPrescaler() macro - thanks to Joerg Wunsch
* - Fixed Endpoint_ClearStall() to function correctly on full USB controller AVRs (AT90USBXXX6/7)
* - Endpoint_Setup_In_Clear() and Endpoint_Setup_Out_Clear() no longer set FIFOCON, in line with the
* directives in the datasheet
* - Fixed PLL prescaler defines for all AVR models and frequencies
* - Fixed ENDPOINT_INT_IN and ENDPOINT_INT_OUT definitions
* - Added interrupt driven keyboard and mouse device demos
* - Combined USB_Device_ClearFeature and USB_Device_SetFeature requests into a single routine for code
* size savings
* - Added missing Pipe_GetCurrentPipe() macro to Pipe.h
*
*
* \section Sec_ChangeLog130 Version 1.3.0 - Released March 7th 2008
*
* - Unneccesary control endpoint config removed from device mode
* - Fixed device standard request interpreter accidentally processing some class-specific requests
* - Added USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS compile time options to instruct the library
* to use descriptors stored in RAM or EEPROM rather than flash memory
* - All demos now disable watchdog on startup, in case it has been enabled by fuses or the bootloader
* - USB_DEV_OPT_LOWSPEED option now works correctly
* - Added ability to set the USB options statically for a binary size reduction via the USE_STATIC_OPTIONS
* compile time define
* - USB_Init no longer takes a Mode parameter if compiled for a USB device with no host mode option, or
* if forced to a particular mode via the USB_HOST_ONLY or USB_DEVICE_ONLY compile time options
* - USB_Init no longer takes an Options parameter if options statically configured by USE_STATIC_OPTIONS
* - Endpoint_Ignore_* and Pipe_Ignore_* made smaller by making the dummy variable non-volatile so that the
* compiler can throw away the result more efficiently
* - Added in an optional GroupID value to each scheduler entry, so that groups of tasks can once again be
* controlled by the new Scheduler_SetGroupTaskMode() routine
* - Added support for AT90USB162 and AT90USB82 AVR models
* - Added support for the STK525 and STK526 boards
* - Added support for custom board drivers to be supplied by selecting the board type as BOARD_USER, and
* placing board drivers in {Application Directory}/Board/
* - PLL is now stopped and USB clock is frozen when detatched from host in device mode, to save power
* - Joystick defines are now in synch with the schematics - orientation will be rotated for the USBKEY
* - Fixed USB_DEV_IsUSBSuspended() - now checks the correct register
* - Fixed data transfers to devices when in host mode
* - Renamed USB_DEV_OPT_HIGHSPEED to USB_DEV_OPT_FULLSPEED and USB_HOST_IsDeviceHighSpeed() to
* USB_HOST_IsDeviceFullSpeed() to be in line with the official USB speed names (to avoid confusion with
* the real high speed mode, which is unavailable on the USB AVRs)
*
*
* \section Sec_ChangeLog120 Version 1.2.0 - Released February 4th, 2008
*
* - Added USB_DeviceEnumerationComplete event for host mode
* - Added new Scheduler_Init routine to preprepare the scheduler, so that tasks can be started and
* stopped before the scheduler has been started (via Scheduler_Start)
* - Connection events in both Device and Host mode are now interrupt-driven, allowing the USB management
* task to be stopped when the USB is not connected to a host or device
* - All demos updated to stop the USB task when not in use via the appropriate USB events
* - Mass Storage Host demo application updated to function correctly with all USB flash disks
* - Mass Storage Host demo application now prints out the capacity and number of LUNs in the attached
* device, and prints the first block as hexadecimal numbers rather than ASCII characters
* - Endpoint and Pipe clearing routines now clear the Endpoint/Pipe interrupt and status flags
* - Shifted error handling code in the host enum state machine to a single block, to reduce code complexity
* - Added in DESCRIPTOR_TYPE, DESCRIPTOR_SIZE and DESCRIPTOR_CAST macros to make config descriptor processing
* clearer in USB hosts and DESCRIPTOR_ADDRESS for convenience in USB devices
* - Added in alloca macro to common.h, in case the user is using an old version of avr-lib-c missing the macro
*
*
* \section Sec_ChangeLog130 Version 1.1.0 - Released January 25th 2008
*
* - Fixed DCONNI interrupt being enabled accidentally after a USB reset
* - Fixed DDISCI interrupt not being disabled when a device is not connected
* - Added workaround for powerless pullup devices causing false disconnect interrupts
* - Added USB_DeviceEnumerationFailed event for Host mode
* - AVR_HOST_GetDeviceConfigDescriptor routine no longer modifies ConfigSizePtr if a valid buffer
* pointer is passed
* - Added ALLOCABLE_BYTES to DynAlloc, and added code to make the size of key storage variables
* dependant on size of memory parameters passed in via the user project's makefile
* - Fixed incorrect device reset routine being called in USBTask
* - Devices which do not connect within the standard 300mS are now supported
* - Removed incorrect ATTR_PURE from Scheduler_SetTaskMode(), which was preventing tasks from being
* started/stopped, as well as USB_InitTaskPointer(), which was breaking dual device/host USB projects
* - Changed scheduler to use the task name rather than IDs for setting the task mode, eliminating the
* need to have a task ID list
* - ID transistion interrupt now raises the appropriate device/host disconnect event if device attached
* - Fixed double VBUS change (and VBUS -) event when detatching in device mode
* - Added ability to disable ANSI terminal codes by the defining of DISABLE_TERMINAL_CODES in makefile
* - Removed return from ConfigurePipe and ConfigureEndpoint functions - use Pipe_IsConfigured() and
* Endpoint_IsConfigured() after calling the config functions to determine success
*/

72
LUFA/Common/BoardTypes.h Normal file
View file

@ -0,0 +1,72 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* This file contains constants which can be passed to the compiler (via setting the macro BOARD) in the
* user project makefile using the -D option to configure the library board-specific drivers.
*
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
* functionality.
*/
#ifndef __BOARDTYPES_H__
#define __BOARDTYPES_H__
/* Preprocessor Checks: */
#if !defined(__COMMON_H__)
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Selects the USBKEY specific board drivers, including Dataflash, Joystick and LED drivers. */
#define BOARD_USBKEY 0
/** Selects the STK525 specific board drivers, including Dataflash, Joystick and LED drivers. */
#define BOARD_STK525 1
/** Selects the STK526 specific board drivers, including Dataflash, Joystick and LED drivers. */
#define BOARD_STK526 2
/** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */
#define BOARD_RZUSBSTICK 3
/** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */
#define BOARD_ATAVRUSBRF01 4
/** Selects the user-defined board drivers, which should be placed in the user project's folder
* under a directory named /Board/. Each board driver should be named identically to the LUFA
* master board driver (i.e., driver in the LUFA/Drivers/Board director) so that the library
* can correctly identify it.
*/
#define BOARD_USER 5
#endif

77
LUFA/Common/ButtLoadTag.h Normal file
View file

@ -0,0 +1,77 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* This file contains macros for the embedding of compile-time strings into the resultant project binary for
* identification purposes. It is designed to prefix "tags" with the magic string of "@(#)" so that the tags
* can easily be identified in the binary data.
*
* These tags are compatible with the ButtLoad project at http://www.fourwalledcubicle.com/ButtLoad.php .
*/
#ifndef __BUTTLOADTAG_H__
#define __BUTTLOADTAG_H__
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Creates a new tag in the resultant binary, containing the specified data array. The macro id
* parameter is only for identification purposes (so that the tag data can be referenced in code)
* and is not visible in the compiled binary.
*/
#define BUTTLOADTAG(id, data) const struct ButtLoadTagData BUTTTAG_##id \
PROGMEM __attribute__((used, externally_visible)) = \
{MagicString: BT_TAGHEADER, TagData: data}
/** Macro for retrieving a reference to the specified tag's contents. The tag data is located in
* the program memory (FLASH) space, and so must be read out with the macros in avr-libc which
* deal with embedded data.
*/
#define BUTTLOADTAG_DATA(id) BUTTTAG_##id.TagData
/* Structures: */
/** Structure for ButtLoad compatible binary tags. */
struct ButtLoadTagData
{
char MagicString[4]; /**< Magic tag header, containing the string "@(#)". */
char TagData[]; /**< Tag contents as a char array. */
};
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define BT_TAGHEADER {'@','(','#',')'}
#endif
#endif

171
LUFA/Common/Common.h Normal file
View file

@ -0,0 +1,171 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* This file contains macros which are common to all library elements, and which may be useful in user code. It
* also includes other common headees, such as Atomic.h, FunctionAttributes.h and BoardTypes.h.
*/
#ifndef __COMMON_H__
#define __COMMON_H__
/* Includes: */
#include <avr/io.h>
#include <stdio.h>
#include <avr/version.h>
#include "FunctionAttributes.h"
#include "BoardTypes.h"
#include <alloca.h>
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Macro for encasing other multi-statment macros. This should be used along with an opening brace
* before the start of any multi-statement macro, so that the macros contents as a whole are treated
* as a discreete block and not as a list of seperate statements which may cause problems when used as
* a block (such as inline IF statments).
*/
#define MACROS do
/** Macro for encasing other multi-statment macros. This should be used along with a preceeding closing
* brace at the end of any multi-statement macro, so that the macros contents as a whole are treated
* as a discreete block and not as a list of seperate statements which may cause problems when used as
* a block (such as inline IF statments).
*/
#define MACROE while (0)
/** Defines a volatile NOP statment which cannot be optimized out by the compiler, and thus can always
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer
* removes/reorders code to the point where break points cannot reliably be set.
*/
#define JTAG_DEBUG_POINT() asm volatile ("NOP" ::)
/** Defines an explicit JTAG break point in the resulting binary via the ASM BREAK statment. When
* a JTAG is used, this causes the program execution to halt when reached until manually resumed. */
#define JTAG_DEBUG_BREAK() asm volatile ("BREAK" ::)
/** Macro for testing condition "x" and breaking via JTAG_DEBUG_BREAK() if the condition is false. */
#define JTAG_DEBUG_ASSERT(x) MACROS{ if (!(x)) { JTAG_DEBUG_BREAK(); } }MACROE
/** Macro for testing condition "x" and writing debug data to the serial stream if false. As a
* prerequisite for this macro, the serial stream should be configured via the Serial_Stream driver.
*
* The serial output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion
* {x} failed."
*/
#define SERIAL_STREAM_ASSERT(x) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #x); \
} }MACROE
/* Inline Functions: */
/** Function for reliably setting the AVR's system clock prescaler, using inline assembly. This function
* is guaranteed to operate reliably regardless of optimization setting or other compile time options.
*
* \param PrescalerMask The mask of the new prescaler setting for CLKPR
*/
static inline void SetSystemClockPrescaler(uint8_t PrescalerMask)
{
uint8_t tmp = (1 << CLKPCE);
__asm__ __volatile__ (
"in __tmp_reg__,__SREG__" "\n\t"
"cli" "\n\t"
"sts %1, %0" "\n\t"
"sts %1, %2" "\n\t"
"out __SREG__, __tmp_reg__"
: /* no outputs */
: "d" (tmp),
"M" (_SFR_MEM_ADDR(CLKPR)),
"d" (PrescalerMask)
: "r0");
}
/** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1,
* etc.
*
* \param Byte Byte of data whose bits are to be reversed
*/
static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint8_t BitReverse(uint8_t Byte)
{
Byte = (((Byte & 0xF0) >> 4) | ((Byte & 0x0F) << 4));
Byte = (((Byte & 0xCC) >> 2) | ((Byte & 0x33) << 2));
Byte = (((Byte & 0xAA) >> 1) | ((Byte & 0x55) << 1));
return Byte;
}
/** Function to reverse the byte ordering of the individual bytes in a 16 bit number.
*
* \param Word Word of data whose bytes are to be swapped
*/
static inline uint16_t SwapEndian_16(uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint16_t SwapEndian_16(uint16_t Word)
{
return ((Word >> 8) | (Word << 8));
}
/** Function to reverse the byte ordering of the individual bytes in a 32 bit number.
*
* \param DWord Double word of data whose bytes are to be swapped
*/
static inline uint32_t SwapEndian_32(uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint32_t SwapEndian_32(uint32_t DWord)
{
return (((DWord & 0xFF000000) >> 24) |
((DWord & 0x00FF0000) >> 8) |
((DWord & 0x0000FF00) << 8) |
((DWord & 0x000000FF) << 24));
}
/** Function to reverse the byte ordering of the individual bytes in a n byte number.
*
* \param Data Pointer to a number containing an even number of bytes to be reversed
* \param Bytes Length of the data in bytes
*/
static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes);
static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes)
{
uint8_t Temp;
while (Bytes)
{
Temp = *Data;
*Data = *(Data + Bytes - 1);
*(Data + Bytes) = Temp;
Data++;
Bytes -= 2;
}
}
#endif

View file

@ -0,0 +1,110 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* This file contains macros for applying GCC specific attributes to functions to control various optimizer
* and code generation features of the compiler. Attributes may be placed in the function prototype in any
* order, and multiple attributes can be specified for a single function via a space seperated list.
*
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
* functionality.
*/
#ifndef __FUNCATTR_H__
#define __FUNCATTR_H__
/* Preprocessor Checks: */
#if !defined(__COMMON_H__)
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates to the compiler that the function can not ever return, so that any stack restoring or
* return code may be ommited by the compiler in the resulting binary.
*/
#define ATTR_NO_RETURN __attribute__ ((noreturn))
/** Places the function in one of the initilization sections, which execute before the main function
* of the application. The init function number can be specified as "x", as an integer. Refer to the
* avr-libc manual for more information on the initialization sections.
*/
#define ATTR_INIT_SECTION(x) __attribute__ ((naked, section (".init" #x )))
/** Indicates that the function returns a value which should not be ignored by the user code. When
* applied, any ignored return value from calling the function will produce a compiler warning.
*/
#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
/** Indicates that the specified parameters of the function are pointers which should never be NULL.
* When applied as a 1-based comma seperated list the compiler will emmit a warning if the specified
* parameters are known at compiler time to be NULL at the point of calling the function.
*/
#define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))
/** Removes any preample or postample from the function. When used, the function will not have any
* register or stack saving code. This should be used with caution, and when used the programmer
* is responsible for maintaining stack and register integrity.
*/
#define ATTR_NAKED __attribute__ ((naked))
/** Prevents the compiler from considering a specified function for inlining. When applied, the given
* function will not be inlined under any circumstances.
*/
#define ATTR_NOINLINE __attribute__ ((noinline))
/** Forces the compiler to inline the specified function. When applied, the given function will be
* inlined under all circumstances.
*/
#define ATTR_ALWAYSINLINE __attribute__ ((always_inline))
/** Indicates that the specified function is pure, in that it has no side-effects other than global
* or parameter variable access.
*/
#define ATTR_PURE __attribute__ ((pure))
/** Indicates that the specified function is constant, in that it has no side effects other than
* parameter access.
*/
#define ATTR_CONST __attribute__ ((const))
/** Marks a given function as deprecated, which produces a warning if the function is called. */
#define ATTR_DEPRECATED __attribute__ ((deprecated))
/** Marks a function as a weak reference, which can be overridden by other functions with an
* identical name (in which case the weak reference is discarded at link time).
*/
#define ATTR_WEAK __attribute__ ((weak))
/** Marks a function as an alias for another function of name "x". */
#define ATTR_ALIAS(x) __attribute__ ((alias( #x )))
#endif

167
LUFA/CompileTimeTokens.txt Normal file
View file

@ -0,0 +1,167 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \page TokenSummary Summary of Compile Tokens
*
* The following lists all the possible tokens which can be defined in a project makefile, and passed to the
* compiler via the -D switch, to alter the LUFA library code. These tokens may alter the library behaviour,
* or remove features unused by a given application in order to save flash space.
*
* \section Sec_SummaryNonUSBTokens Non USB Related Tokens
* This section describes compile tokens which affect non-USB sections of the LUFA library.
*
* <b>DISABLE_TERMINAL_CODES</b> - TerminalCodes.h \n
* If an application contains ANSI terminal control codes listed in TerminalCodes.h, it might be desired to remove them
* at compile time for use with a terminal which is non-ANSI control code aware, without modifying the source code. If
* this token is defined, all ANSI control codes in the application code from the TerminalCodes.h header are removed from
* the source code at compile time.
*
* <b>NUM_BLOCKS</b> - DynAlloc.h \n
* Sets the number of allocable blocks in the psudo-heap of the dynamic memory allocation driver. This should be
* defined as a constant larger than zero.
*
* <b>BLOCK_SIZE</b> - DynAlloc.h \n
* Sets the size of each allocable block in the psudo-heap of the dynamic memory allocation driver. This should be
* defined as a constant larger than zero.
*
* <b>NUM_HANDLES</b> - DynAlloc.h \n
* Sets the maximum number of managed memory handles which can be handed out by the dynamic memory allocation driver
* simultaneously, before a handle (and its associated allocated memory) must be freed.
*
* \section Sec_SummaryUSBClassTokens USB Class Driver Related Tokens
* This section describes compile tokens which affect USB class-specific drivers in the LUFA library.
*
* <b>HID_ENABLE_FEATURE_PROCESSING</b> - HIDParser.h \n
* Define this token to enable the processing of FEATURE HID report items, if any, into the processed HID structure.
* By default FEATURE items (which are device features settable by the host but not directly visible by the user) are
* skipped when processing a device HID report.
*
* <b>HID_INCLUDE_CONSTANT_DATA_ITEMS</b> - HIDParser.h \n
* By default, constant data items (usually used as spacers to align seperate report items to a byte or word boundary)
* in the HID report are skipped during report processing. It is highly unusual for an application to make any use of
* constant data items (as they do not carry any useful data and only occupy limited RAM) however if required defining
* this switch will put constant data items into the processed HID report structure.
*
* <b>HID_STATETABLE_STACK_DEPTH</b> - HIDParser.h \n
* HID reports may contain PUSH and POP elements, to store and retrieve the current HID state table onto a stack. This
* allows for reports to save the state table before modifying it slightly for a data item, and then restore the previous
* state table in a compact manner. This token may be defined to a non-zero value to give the maximum depth of the state
* table stack. If not defined, this defaults to the value indicated in the HID.h file documentation.
*
* <b>HID_USAGE_STACK_DEPTH</b> - HIDParser.h \n
* HID reports generally contain many USAGE elements, which are assigned to INPUT, OUTPUT and FEATURE items in succession
* when multiple items are defined at once (via REPORT COUNT elements). This allows for several items to be defined with
* different usages in a compact manner. This token may be defined to a non-zero value to set the maximum depth of the
* usage stack, indicating the maximum number of USAGE items which can be stored tempoarily until the next INPUT, OUTPUT
* and FEATURE item. If not defined, this defaults to the value indicated in the HID.h file documentation.
*
* <b>HID_MAX_COLLECTIONS</b> - HIDParser.h \n
* HID reports generally contain several COLLECTION elements, used to group related data items together. Collection information
* is stored seperately in the processed usage structure (and referred to by the data elements in the structure) to save space.
* This token may be defined to a non-zero value to set the maximum number of COLLECTION items which can be processed by the
* parser into the resultant processed report structure. If not defined, this defaults to the value indicated in the HID.h file
* documentation.
*
* <b>HID_MAX_REPORTITEMS</b> - HIDParser.h \n
* All HID reports contain one or more INPUT, OUTPUT and/or FEATURE items describing the data which can be sent to and from the HID
* device. Each item has associated usages, bit offsets in the item reports and other associated data indicating the manner in which
* the report data should be interpreted by the host. This token may be defined to a non-zero value to set the maximum number of
* data elements which can be stored in the processed HID report strucuture, including INPUT, OUTPUT and (if enabled) FEATURE items.
* If a item has a multiple count (i.e. a REPORT COUNT of more than 1), each item in the report count is placed seperately in the
* processed HID report table. If not defined, this defaults to the value indicated in the HID.h file documentation.
*
* \section Sec_SummaryUSBTokens USB Driver Related Tokens
* This section describes compile tokens which affect USB driver stack as a whole in the LUFA library.
*
* <b>USE_RAM_DESCRIPTORS</b> - StdDescriptors.h \n
* Define this token to indicate to the USB driver that device descriptors are stored in RAM, rather than the default of
* the AVR's flash. RAM descriptors may be desirable in applications where speed or minimizing flash usage is more important
* than RAM usage, or applications where the descriptors need to be modified at runtime.
*
* <b>USE_EEPROM_DESCRIPTORS</b> - StdDescriptors.h \n
* Similar to USE_RAM_DESCRIPTORS, but descriptors are stored in the AVR's EEPROM memory rather than RAM.
*
* <b>USE_NONSTANDARD_DESCRIPTOR_NAMES</b> - StdDescriptors.h \n
* The USB 2.0 standard gives some rather obscure names for the elements in the standard descriptor types (device, configuration,
* string, endpoint, etc.). By default the LUFA library uses these names in its predefined descriptor structure types for
* compatibility. If this token is defined, the structure element names are switched to the LUFA-specific but more descriptive
* names documented in the StdDescriptors.h source file.
*
* <b>FIXED_CONTROL_ENDPOINT_SIZE</b> - Endpoint.h \n
* By default, the library determines the size of the control endpoint (when in device mode) by reading the device descriptor.
* Normally this reduces the amount of configuration required for the library, allows the value to change dynamically (if
* descriptors are stored in EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this token can be
* defined to a non-zero value instead to give the size in bytes of the control endpoint, to reduce the size of the compiled
* binary at the expense of flexibility.
*
* <b>STATIC_ENDPOINT_CONFIGURATION</b> - Endpoint.h \n
* By default, the endpoint configuration routine is designed to accept dynamic inputs, so that the endpoints can be configured
* using variable values known only at runtime. This allows for a great deal of flexibility, however uses a small amount of binary
* space which may be wasted if all endpoint configurations are static and known at compile time. Define this token via the -D switch
* to optimize the endpoint configuration routine for constant inputs, to reduce the size of the compiled binary at the expense of
* flexibility. Note that with this option dynamic values may still be used, but will result in many times more code to be generated than
* if the option was disabled. This is designed to be used only if the FIXED_CONTROL_ENDPOINT_SIZE option is also used.
*
* <b>USE_SINGLE_DEVICE_CONFIGURATION</b> - DevChapter9.h \n
* By default, the library determines the number of configurations a USB device supports by reading the device descriptor. This reduces
* the amount of configuration required to set up the library, and allows the value to change dynamically (if descriptors are stored in
* EEPROM or RAM rather than flash memory) and reduces code maintenance. However, many USB device projects use only a single configuration.
* Defining this token enables single-configuration mode, reducing the compiled size of the binary at the expense of flexibility.
*
* <b>NO_CLEARSET_FEATURE_REQUEST</b> - DevChapter9.h \n
* In some limited USB device applications, the Get Feature and Set Feature requests are not used - this is when the device does not have
* device level features (such as remote wakeup) nor any data endpoints beyond the mandatory control endpoint. In such limited situations,
* this token may be defined to remove the handling of the Get Feature and Set Feature Chapter 9 requests to save space. Generally, this
* is usually only useful in (some) bootloaders.
*
* <b>NO_STREAM_CALLBACKS</b> - Endpoint.h, Pipe.h \n
* Both the endpoint and the pipe driver code contains stream functions, allowing for arrays of data to be sent to or from the
* host easily via a single function call (rather than complex routines worrying about sending full packets, waiting for the endpoint/
* pipe to become ready, etc.). By default, these stream functions require a callback function which is executed after each byte processed,
* allowing for early-aborts of stream transfers by the application. If callbacks are not required in an application, they can be removed
* by defining this token, reducing the compiled binary size. When removed, the stream functions no longer accept a callback function as
* a parameter.
*
* <b>USB_HOST_TIMEOUT_MS</b> - Host.h \n
* When a control transfer is initiated in host mode to an attached device, a timeout is used to abort the transfer if the attached
* device fails to respond within the timeout period. This token may be defined to a non-zero value to set the timeout period for
* control transfers, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.
*
* <b>HOST_DEVICE_SETTLE_DELAY_MS</b> - Host.h \n
* Some devices require a delay of up to 5 seconds after they are connected to VBUS before the enumeration process can be started, or
* they will fail to enumerate correctly. By placing a delay before the enumeration process, it can be ensured that the bus has settled
* back to a known idle state before communications occur with the device. This token may be defined to a non-zero value to set the
* device settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.
*
* <b>USE_STATIC_OPTIONS</b> - LowLevel.h \n
* By default, the USB_Init() function accepts dynamic options at runtime to alter the library behaviour, including whether the USB pad
* voltage regulator is enabled, and the device speed when in device mode. By defining this token to a mask comprised of the USB options
* mask defines usually passed as the Options parameter to USB_Init(), the resulting compiled binary can be decreased in size by removing
* the dynamic options code, and replacing it with the statically set options. When defined, the USB_Init() function no longer accepts an
* Options parameter.
*
* <b>USB_DEVICE_ONLY</b> - LowLevel.h \n
* For the USB AVR models supporting both device and host USB modes, the USB_Init() function contains a Mode parameter which specifies the
* mode the library should be initialized to. If only device mode is required, the code for USB host mode can be removed from the binary to
* save space. When defined, the USB_Init() function no longer accepts a Mode parameter. This define is irrelevent on smaller USB AVRs which
* do not support host mode.
*
* <b>USB_HOST_ONLY</b> - LowLevel.h \n
* Same as USB_DEVICE_ONLY, except the library is fixed to USB host mode rather than USB device mode. Not available on some USB AVR models.
*
* <b>USB_STREAM_TIMEOUT_MS</b> - LowLevel.h \n
* When endpoint and/or pipe stream functions are used, by default there is a timeout between each transfer which the connected device or host
* must satisfy, or the stream function aborts the remaining data transfer. This token may be defined to a non-zero value to set the timeout
* period for stream transfers, specified in milliseconds. If not defined, the default value specified in LowLevel.h is used instead.
*
* <b>NO_LIMITED_CONTROLLER_CONNECT</b> - Events.h \n
* On the smaller USB AVRs, the USB controller lacks VBUS events to determine the physical connection state of the USB bus to a host. In lieu of
* VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be
* slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is
* required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_IsConnected global
* can be accurately set and the USB_Connect and USB_Disconnect events manually raised by the RAISE_EVENT macro. When defined, this token disables
* the library's auto-detection of the connection state by the aformentioned suspension and wake up events.
*/

119
LUFA/DirectorySummaries.txt Normal file
View file

@ -0,0 +1,119 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \dir Common
* \brief Common library header files.
*
* This folder contains header files which are common to all parts of the LUFA library. They may be used freely in
* user applications.
*
* \dir MemoryAllocator
* \brief Auto-defragmenting dynamic memory allocation library.
*
* This folder contains a simple handle-based dynamic memory allocation library, capable of handing out memory in
* block chunks. As new memory is allocated, the library will defragment the already allocated memory to ensure
* optimal memory usage. It is not used within the LUFA library, and is provided as a convenience for user applications.
*
* \dir Scheduler
* \brief Simple round-robbin scheduler.
*
* This folder contains the simple LUFA round-robbin scheduler, provided as a convenience for user applications. It
* is very simple in design, and is intended to make code easier to read, rather than providing a complete RTOS kernel.
*
* \dir Drivers
* \brief Library hardware and software drivers.
*
* This folder contains all the library hardware and software drivers for each supported board and USB AVR
* microcontroller model.
*
* \dir Drivers/Misc
* \brief Miscellaneous driver files.
*
* This folder contains drivers for aspects other than the USB interface, board hardware or AVR peripherals.
*
* \dir Drivers/AT90USBXXX
* \brief USB AVR peripheral driver files.
*
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible with
* all USB AVR models.
*
* \dir Drivers/AT90USBXXX/AT90USBXXX67
* \brief AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 AVR model peripheral driver files. Its original name is due to legacy
* reasons.
*
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible only with
* the AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 USB AVR models, such as the AT90USB1287. Its contents should <b>not</b> be
* included by the user application - the dispatch header file located in the parent AT90USBXXX directory should be used
* instead.
*
* \dir Drivers/USB
* \brief USB controller peripheral driver files.
*
* This folder contains the main header files required to implement the USB interface in the USB supporting AVR models.
* The header files contained directly in this folder should be included in the user application in order to gain USB
* functionality, and the appropriate C source files in the LowLevel and HighLevel driver folders added to the compile
* and link stages.
*
* \dir Drivers/USB/LowLevel
* \brief Low level USB driver files.
*
* This folder contains low level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir Drivers/USB/HighLevel
* \brief High level USB driver files.
*
* This folder contains high level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir Drivers/USB/Class
* \brief USB Class helper driver files.
*
* This folder contains drivers for implementing functionality of standardized USB classes. These are not used directly by the library,
* but provide a standard and library-maintained way of implementing functionality from some of the defined USB classes without extensive
* development effort. Is is recommended that these drivers be used where possible to reduce maintenance of user applications.
*
* \dir Drivers/Board
* \brief Board hardware driver files.
*
* This folder contains drivers for interfacing with the physical hardware on supported commercial boards, primarily from
* the Atmel corporation. Header files in this folder should be included in user applications requring the functionality of
* hardware placed on supported boards.
*
* \dir Drivers/Board/USBKEY
* \brief USBKEY board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel USBKEY demonstration board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/STK526
* \brief STK526 board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel STK526 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/STK525
* \brief STK525 board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel STK525 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/RZUSBSTICK
* \brief RZUSBSTICK board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel RZUSBSTICK board, as used in the Atmel "Raven" wireless kits. The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir DriverStubs
* \brief Driver stub header files for custom boards, to allow the LUFA board drivers to operate.
*
* This contains stub files for the LUFA board drivers. If the LUFA board drivers are used with board hardare other than those
* directly supported by the library, the BOARD parameter of the application's makefile can be set to "USER", and these stub files
* copied to the "/Board/" directory of the application's folder. When fleshed out with working driver code for the custom board,
* the corresponding LUFA board APIs will work correctly with the non-standard board hardware.
*/

1485
LUFA/Doxygen.conf Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,81 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/*
This is a stub driver header file, for implementing custom board
layout hardware with compatible LUFA board specific drivers. If
the library is configured to use the BOARD_USER board mode, this
driver file should be completed and copied into the "/Board/" folder
inside the application's folder.
This stub is for the board-specific component of the LUFA Dataflash
driver.
*/
#ifndef __DATAFLASH_USER_H__
#define __DATAFLASH_USER_H__
/* Includes: */
// TODO: Add any required includes here
/* Preprocessor Checks: */
#if !defined(INCLUDE_FROM_DATAFLASH_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all dataflashes
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
#define DATAFLASH_TOTALCHIPS // TODO: Replace with the number of dataflashes on the board, max 2
/** Mask for no dataflash chip selected. */
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 // TODO: Replace with mask to select the first Dataflash chip
/** Mask for the second dataflash chip selected. */
#define DATAFLASH_CHIP2 // TODO: Replace with mask to select the second Dataflash chip, if available
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
/** Total number of pages inside each of the board's dataflash ICs. */
#define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs
#endif

84
LUFA/DriverStubs/HWB.h Normal file
View file

@ -0,0 +1,84 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/*
This is a stub driver header file, for implementing custom board
layout hardware with compatible LUFA board specific drivers. If
the library is configured to use the BOARD_USER board mode, this
driver file should be completed and copied into the "/Board/" folder
inside the application's folder.
This stub is for the board-specific component of the LUFA HWB (Hardware
Button, a physical button on most Atmel USB boards) driver. This could
alternately be driven from any button connected to the USB AVR.
*/
#ifndef __HWB_USER_H__
#define __HWB_USER_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#include "../../../Common/Common.h"
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(INCLUDE_FROM_HWB_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/HWB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void HWB_Init(void)
{
// TODO: Initialize the appropriate port pin as an input here, with pullup
}
static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline bool HWB_GetStatus(void)
{
// TODO: Return current button status here, debounced if required
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,99 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/*
This is a stub driver header file, for implementing custom board
layout hardware with compatible LUFA board specific drivers. If
the library is configured to use the BOARD_USER board mode, this
driver file should be completed and copied into the "/Board/" folder
inside the application's folder.
This stub is for the board-specific component of the LUFA Joystick
driver, a small surface mount four-way (plus button) digital joystick
on most USB AVR boards.
*/
#ifndef __JOYSTICK_USER_H__
#define __JOYSTICK_USER_H__
/* Includes: */
#include <avr/io.h>
#include "../../../Common/Common.h"
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(INCLUDE_FROM_JOYSTICK_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
#define JOY_LEFT // TODO: Add mask to indicate joystick left position here
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT // TODO: Add mask to indicate joystick right position here
/** Mask for the joystick being pushed in the upward direction. */
#define JOY_UP // TODO: Add mask to indicate joystick up position here
/** Mask for the joystick being pushed in the downward direction. */
#define JOY_DOWN // TODO: Add mask to indicate joystick down position here
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
{
// TODO: Initialize joystick port pins as inputs with pullups
};
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
// TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

121
LUFA/DriverStubs/LEDs.h Normal file
View file

@ -0,0 +1,121 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/*
This is a stub driver header file, for implementing custom board
layout hardware with compatible LUFA board specific drivers. If
the library is configured to use the BOARD_USER board mode, this
driver file should be completed and copied into the "/Board/" folder
inside the application's folder.
This stub is for the board-specific component of the LUFA LEDs driver,
for the LEDs (up to four) mounted on most USB AVR boards.
*/
#ifndef __LEDS_USER_H__
#define __LEDS_USER_H__
/* Includes: */
#include <avr/io.h>
#include "../../../Common/Common.h"
// TODO: Add any required includes here
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */
#define LEDS_LED1 // TODO: Add mask for first board LED here
/** LED mask for the second LED on the board. */
#define LEDS_LED2 // TODO: Add mask for second board LED here
/** LED mask for the third LED on the board. */
#define LEDS_LED3 // TODO: Add mask for third board LED here
/** LED mask for the fourth LED on the board. */
#define LEDS_LED4 // TODO: Add mask for fourth board LED here
/** LED mask for all the LEDs on the board. */
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
/** LED mask for the none of the board LEDs */
#define LEDS_NO_LEDS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
// TODO: Add code to initialize LED port pins as outputs here
}
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
{
// TODO: Add code to turn on LEDs given in the LedMask mask here, leave others as-is
}
static inline void LEDs_TurnOffLEDs(const uint8_t LedMask)
{
// TODO: Add code to turn off LEDs given in the LedMask mask here, leave others as-is
}
static inline void LEDs_SetAllLEDs(const uint8_t LedMask)
{
// TODO: Add code to turn on only LEDs given in the LedMask mask here, all others off
}
static inline void LEDs_ChangeLEDs(const uint8_t LedMask, const uint8_t ActiveMask)
{
// TODO: Add code to set the Leds in the given LedMask to the status given in ActiveMask here
}
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
// TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros
}
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,58 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* This file is the master dispatch header file for the device-specific ADC driver, for AVRs containing an ADC.
*
* User code should include this file, which will in turn include the correct ADC driver header file for the
* currently selected AVR model.
*/
#ifndef __ADC_H__
#define __ADC_H__
/* Macros: */
#if !defined(__DOXYGEN__)
#define INCLUDE_FROM_ADC_H
#define INCLUDE_FROM_CHIP_DRIVER
#endif
/* Includes: */
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
defined(__AVR_ATmega32U6__))
#include "AT90USBXXX67/ADC.h"
#else
#error "ADC is not available for the currently selected AVR model."
#endif
#endif

View file

@ -0,0 +1,177 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* ADC driver for the AT90USB1287, AT90USB1286, AT90USB647, AT90USB646, ATMEGA16U4 and ATMEGA32U4 AVRs.
*
* \note This file should not be included directly. It is automatically included as needed by the ADC driver
* dispatch header located in LUFA/Drivers/AT90USBXXX/ADC.h.
*/
#ifndef __ADC_AT90USBXXX67_H__
#define __ADC_AT90USBXXX67_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#include "../../../Common/Common.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(INCLUDE_FROM_ADC_H)
#error Do not include this file directly. Include LUFA/Drivers/AT90USBXXX/ADC.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Initializes the ADC, ready for conversions. This must be called before any other ADC operations.
* The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and
* prescaler masks.
*/
#define ADC_Init(mode) MACROS{ ADCSRA = ((1 << ADEN) | mode); }MACROE
/** Turns off the ADC. If this is called, any further ADC operations will require a call to the
* ADC_Init() macro before the ADC can be used again.
*/
#define ADC_Off() MACROS{ ADCSRA = 0; }MACROE
/** Indicates if the ADC is enabled. This macro will return boolean true if the ADC subsystem is
* currently enabled, or false otherwise.
*/
#define ADC_GetStatus() ((ADCSRA & (1 << ADEN)) ? true : false)
/** Indicates if the current ADC conversion is completed, or still in progress. This returns boolean
* false if the reading is still taking place, or true if the conversion is complete and ready to be
* read out with ADC_GetResult().
*/
#define ADC_IsReadingComplete() (!(ADCSRA & (1 << ADSC)))
/** Returns the result of the last conversion, as a 16-bit wide integer. */
#define ADC_GetResult() ADC
/** Reference mask, for using the voltage present at the AVR's AREF pin for the ADC reference. */
#define ADC_REFERENCE_AREF 0
/** Reference mask, for using the voltage present at the AVR's AVCC pin for the ADC reference. */
#define ADC_REFERENCE_AVCC (1 << REFS0)
/** Reference mask, for using the internally generated 2.56V reference voltage as the ADC reference. */
#define ADC_REFERENCE_INT2560MV ((1 << REFS1)| (1 << REFS0))
/** Left-adjusts the 10-bit ADC result, so that the upper 8 bits of the value returned by the
* ADC_GetResult() macro contain the 8 most significant bits of the result. */
#define ADC_LEFT_ADJUSTED (1 << ADLAR)
/** Right-adjusts the 10-bit ADC result, so that the lower 8 bits of the value returned by the
* ADC_GetResult() macro contain the 8 least significant bits of the result. */
#define ADC_RIGHT_ADJUSTED (0 << ADLAR)
/** Sets the ADC mode to free running, so that conversions take place continuously as fast as the ADC
* is capable of at the given input clock speed. */
#define ADC_FREE_RUNNING (1 << ADATE)
/** Sets the ADC mode to single conversion, so that only a single conversion will take place before
* the ADC returns to idle. */
#define ADC_SINGLE_CONVERSION (0 << ADATE)
/** Sets the ADC input clock to prescale by a factor of 2 the AVR's system clock. */
#define ADC_PRESCALE_2 (1 << ADPS0)
/** Sets the ADC input clock to prescale by a factor of 4 the AVR's system clock. */
#define ADC_PRESCALE_4 (1 << ADPS1)
/** Sets the ADC input clock to prescale by a factor of 8 the AVR's system clock. */
#define ADC_PRESCALE_8 ((1 << ADPS0) | (1 << ADPS1))
/** Sets the ADC input clock to prescale by a factor of 16 the AVR's system clock. */
#define ADC_PRESCALE_16 (1 << ADPS2)
/** Sets the ADC input clock to prescale by a factor of 32 the AVR's system clock. */
#define ADC_PRESCALE_32 ((1 << ADPS2) | (1 << ADPS0))
/** Sets the ADC input clock to prescale by a factor of 64 the AVR's system clock. */
#define ADC_PRESCALE_64 ((1 << ADPS2) | (1 << ADPS1))
/** Sets the ADC input clock to prescale by a factor of 128 the AVR's system clock. */
#define ADC_PRESCALE_128 ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0))
/* Inline Functions: */
/** Configures the given ADC channel, ready for ADC conversions. This function sets the
* associated port pin as an input and disables the digital portion of the I/O to reduce
* power consumption.
*
* \param Channel ADC channel number to set up for conversions
*/
static inline void ADC_SetupChannel(const uint8_t Channel)
{
DDRD &= ~(1 << Channel);
DIDR0 |= (1 << Channel);
}
/** Starts the reading of the given channel, but does not wait until the conversion has completed.
* Once executed, the conversion status can be determined via the ADC_IsReadingComplete() macro and
* the result read via the ADC_GetResult() macro.
*
* \param MUXMask Mask comprising of an ADC channel number, reference mask and adjustment mask
*/
static inline void ADC_StartReading(const uint8_t MUXMask)
{
ADMUX = MUXMask;
ADCSRA |= (1 << ADSC);
}
/** Performs a complete single reading from channel, including a polling spinloop to wait for the
* conversion to complete, and the returning of the converted value.
*
* \param MUXMask Mask comprising of an ADC channel number, reference mask and adjustment mask
*/
static inline uint16_t ADC_GetChannelReading(const uint8_t MUXMask) ATTR_WARN_UNUSED_RESULT;
static inline uint16_t ADC_GetChannelReading(const uint8_t MUXMask)
{
ADC_StartReading(MUXMask);
while (!(ADC_IsReadingComplete()));
return ADC_GetResult();
}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,139 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Hardware SPI subsystem driver for the supported USB AVRs models.
*/
#ifndef __SPI_H__
#define __SPI_H__
/* Includes: */
#include <stdbool.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define SPI_USE_DOUBLESPEED (1 << 7)
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 2. */
#define SPI_SPEED_FCPU_DIV_2 SPI_USE_DOUBLESPEED
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 4. */
#define SPI_SPEED_FCPU_DIV_4 0
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 8. */
#define SPI_SPEED_FCPU_DIV_8 (SPI_USE_DOUBLESPEED | (1 << SPR0))
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 16. */
#define SPI_SPEED_FCPU_DIV_16 (1 << SPR0)
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 32. */
#define SPI_SPEED_FCPU_DIV_32 (SPI_USE_DOUBLESPEED | (1 << SPR1))
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 64. */
#define SPI_SPEED_FCPU_DIV_64 (SPI_USE_DOUBLESPEED | (1 << SPR1) | (1 < SPR0))
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 128. */
#define SPI_SPEED_FCPU_DIV_128 ((1 << SPR1) | (1 < SPR0))
/* Inline Functions: */
/** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other
* SPI routines.
*
* \param PrescalerMask Prescaler mask to set the SPI clock speed
* \param Master If true, sets the SPI system to use master mode, slave if false
*/
static inline void SPI_Init(const uint8_t PrescalerMask, const bool Master)
{
DDRB |= ((1 << 1) | (1 << 2));
PORTB |= ((1 << 0) | (1 << 3));
SPCR = ((1 << SPE) | (Master << MSTR) | (1 << CPOL) | (1 << CPHA) |
(PrescalerMask & ~SPI_USE_DOUBLESPEED));
if (PrescalerMask & SPI_USE_DOUBLESPEED)
SPSR = (1 << SPI2X);
}
/** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.
*
* \param Byte Byte to send through the SPI interface
*
* \return Response byte from the attached SPI device
*/
static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYSINLINE;
static inline uint8_t SPI_TransferByte(const uint8_t Byte)
{
SPDR = Byte;
while (!(SPSR & (1 << SPIF)));
return SPDR;
}
/** Sends a byte through the SPI interface, blocking until the transfer is complete. The response
* byte sent to from the attached SPI device is ignored.
*
* \param Byte Byte to send through the SPI interface
*/
static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYSINLINE;
static inline void SPI_SendByte(const uint8_t Byte)
{
SPDR = Byte;
while (!(SPSR & (1 << SPIF)));
}
/** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response
* byte from the attached SPI device is returned.
*
* \return The response byte from the attached SPI device
*/
static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYSINLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t SPI_ReceiveByte(void)
{
SPDR = 0x00;
while (!(SPSR & (1 << SPIF)));
return SPDR;
}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,65 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "Serial.h"
void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{
UCSR1A = ((DoubleSpeed) ? (1 << U2X1) : 0);
UCSR1B = ((1 << RXEN1) | (1 << TXEN1));
UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10));
DDRD |= (1 << 3);
PORTD |= (1 << 2);
UBRR1 = SERIAL_UBBRVAL(BaudRate);
}
void Serial_TxString_P(const char *FlashStringPtr)
{
uint8_t CurrByte;
while ((CurrByte = pgm_read_byte(FlashStringPtr)) != 0x00)
{
Serial_TxByte(CurrByte);
FlashStringPtr++;
}
}
void Serial_TxString(const char *StringPtr)
{
uint8_t CurrByte;
while ((CurrByte = *StringPtr) != 0x00)
{
Serial_TxByte(CurrByte);
StringPtr++;
}
}

View file

@ -0,0 +1,115 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Driver for the USART subsystem on supported USB AVRs.
*/
#ifndef __SERIAL_H__
#define __SERIAL_H__
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdbool.h>
#include "../../Common/Common.h"
#include "../Misc/TerminalCodes.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates whether a character has been received through the USART - boolean false if no character
* has been received, or non-zero if a character is waiting to be read from the reception buffer.
*/
#define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false)
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
* not set.
*/
#define SERIAL_UBBRVAL(baud) (((F_CPU / 16) / baud) - 1)
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
* set.
*/
#define SERIAL_2X_UBBRVAL(baud) (((F_CPU / 8) / baud) - 1)
/* Function Prototypes: */
/** Initializes the USART, ready for serial data transmission and reception.
*
* \param BaudRate Baud rate to configure the USART to
* \param DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate
*/
void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed);
/** Transmits a given string located in program space (FLASH) through the USART.
*
* \param FlashStringPtr Pointer to a string located in program space
*/
void Serial_TxString_P(const char *FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1);
/** Transmits a given string located in SRAM memory through the USART.
*
* \param StringPtr Pointer to a string located in SRAM space
*/
void Serial_TxString(const char *StringPtr) ATTR_NON_NULL_PTR_ARG(1);
/* Inline Functions: */
/** Transmits a given byte through the USART.
*
* \param DataByte Byte to transmit through the USART
*/
static inline void Serial_TxByte(const char DataByte)
{
while (!(UCSR1A & (1 << UDRE1)));
UDR1 = DataByte;
}
/** Receives a byte from the USART.
*
* \return Byte received from the USART
*/
static inline char Serial_RxByte(void)
{
while (!(UCSR1A & (1 << RXC1)));
return UDR1;
}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

View file

@ -0,0 +1,45 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "Serial_Stream.h"
FILE USARTStream = FDEV_SETUP_STREAM(SerialStream_TxByte, SerialStream_RxByte, _FDEV_SETUP_RW);
int SerialStream_TxByte(char DataByte, FILE *Stream)
{
Serial_TxByte(DataByte);
return 0;
}
int SerialStream_RxByte(FILE *Stream)
{
return Serial_RxByte();
}

View file

@ -0,0 +1,82 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 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
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Serial stream driver for the USART subsystem on supported USB AVRs. This makes use of the functions in the
* regular USART driver, but allows the avr-libc standard stream functions (printf, puts, etc.) to work with the
* USART.
**/
#ifndef __SERIAL_STREAM_H__
#define __SERIAL_STREAM_H__
/* Includes: */
#include <avr/io.h>
#include <stdio.h>
#include "Serial.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* External Variables: */
extern FILE USARTStream;
/* Function Prototypes: */
int SerialStream_TxByte(char DataByte, FILE *Stream) ATTR_NON_NULL_PTR_ARG(2);
int SerialStream_RxByte(FILE *Stream) ATTR_NON_NULL_PTR_ARG(1);
#endif
/* Public Interface - May be used in end-application: */
/* Inline Functions: */
/** Initializes the serial stream (and regular USART driver) so that both the stream and regular
* USART driver functions can be used. Must be called before any stream or regular USART functions.
*
* \param BaudRate Baud rate to configure the USART to
* \param DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate
*/
static inline void SerialStream_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{
Serial_Init(BaudRate, DoubleSpeed);
stdout = &USARTStream;
}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more