Updated MicropendousKeyboardTest, VirtualSerial, and VirtualSerial_FreeRTOS firmware demos.

This commit is contained in:
opendous
2013-03-17 03:49:55 +00:00
parent b9fa952804
commit 7f2ac5a890
53 changed files with 11438 additions and 9068 deletions

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -1,231 +1,231 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** HID class report descriptor. This is a special descriptor constructed with values from the
* USBIF HID class specification to describe the reports and capabilities of the HID device. This
* descriptor is parsed by the host and its contents used to determine what data (and in what encoding)
* the device will send, and what it may be sent back from the host. Refer to the HID specification for
* more details on HID report descriptors.
*/
const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
{
/* Use the HID class driver's standard Keyboard report.
* Max simultaneous keys: 6
*/
HID_DESCRIPTOR_KEYBOARD(6)
};
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = USB_CSCP_NoDeviceClass,
.SubClass = USB_CSCP_NoDeviceSubclass,
.Protocol = USB_CSCP_NoDeviceProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
.TotalEndpoints = 1,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_BootSubclass,
.Protocol = HID_CSCP_KeyboardBootProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.HID_KeyboardHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
.HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = KEYBOARD_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x05
},
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
.UnicodeString = L"Dean Camera"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
.UnicodeString = L"LUFA Keyboard Demo"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case HID_DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
}
*DescriptorAddress = Address;
return Size;
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** HID class report descriptor. This is a special descriptor constructed with values from the
* USBIF HID class specification to describe the reports and capabilities of the HID device. This
* descriptor is parsed by the host and its contents used to determine what data (and in what encoding)
* the device will send, and what it may be sent back from the host. Refer to the HID specification for
* more details on HID report descriptors.
*/
const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
{
/* Use the HID class driver's standard Keyboard report.
* Max simultaneous keys: 6
*/
HID_DESCRIPTOR_KEYBOARD(6)
};
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = USB_CSCP_NoDeviceClass,
.SubClass = USB_CSCP_NoDeviceSubclass,
.Protocol = USB_CSCP_NoDeviceProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
.TotalEndpoints = 1,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_BootSubclass,
.Protocol = HID_CSCP_KeyboardBootProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.HID_KeyboardHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
.HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = KEYBOARD_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
.PollingIntervalMS = 0x05
},
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
.UnicodeString = L"www.micropendous.org"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(24), .Type = DTYPE_String},
.UnicodeString = L"MicropendousKeyboardTest"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case HID_DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
}
*DescriptorAddress = Address;
return Size;
}

View File

@@ -1,73 +1,73 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// Keyboard HID Interface
USB_Descriptor_Interface_t HID_Interface;
USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPSIZE 8
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// Keyboard HID Interface
USB_Descriptor_Interface_t HID_Interface;
USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
/* Macros: */
/** Endpoint address of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
/** Size in bytes of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPSIZE 8
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,207 +1,578 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the Keyboard demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "Keyboard.h"
/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */
static uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];
/** LUFA HID Class driver interface configuration and state information. This structure is
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpoint =
{
.Address = KEYBOARD_EPADDR,
.Size = KEYBOARD_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},
};
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware()
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
Buttons_Init();
USB_Init();
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
USB_Device_EnableSOFEvents();
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
}
/** Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
}
/** HID class driver callback function for the creation of HID reports to the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
* \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
* \param[in] ReportType Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
* \param[out] ReportData Pointer to a buffer where the created report should be stored
* \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent)
*
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
*/
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
uint8_t UsedKeyCodes = 0;
if (JoyStatus_LCL & JOY_UP)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
else if (JoyStatus_LCL & JOY_DOWN)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
if (JoyStatus_LCL & JOY_LEFT)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
else if (JoyStatus_LCL & JOY_RIGHT)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
if (JoyStatus_LCL & JOY_PRESS)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
if (UsedKeyCodes)
KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT;
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
/** HID class driver callback function for the processing of HID reports from the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
* \param[in] ReportID Report ID of the received report from the host
* \param[in] ReportType The type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature
* \param[in] ReportData Pointer to a buffer where the received report has been stored
* \param[in] ReportSize Size in bytes of the received HID report
*/
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize)
{
uint8_t LEDMask = LEDS_NO_LEDS;
uint8_t* LEDReport = (uint8_t*)ReportData;
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
LEDs_SetAllLEDs(LEDMask);
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Modified for MicropendousKeyboardTest by Opendous Inc. 2013-03-16 (www.micropendous.org)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the Keyboard demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "MicropendousKeyboardTest.h"
/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */
static uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];
/** LUFA HID Class driver interface configuration and state information. This structure is
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{
.Config =
{
.InterfaceNumber = 0,
.ReportINEndpoint =
{
.Address = KEYBOARD_EPADDR,
.Size = KEYBOARD_EPSIZE,
.Banks = 1,
},
.PrevReportINBuffer = PrevKeyboardHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},
};
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware()
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Disable JTAG to allow testing port F */
#if ( defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
defined(__AVR_ATmega32U6__) )
JTAG_DISABLE();
#endif
/* enable Ports based on which IC is being used */
/* For more information look over the corresponding AVR's datasheet in the
'I/O Ports' Chapter under subheading 'Ports as General Digital I/O' */
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__))
DDRD = 0;
PORTD = 0xFF;
DDRB = 0;
PORTB = 0xFF;
DDRC = 0;
PORTC |= (1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7); //only PC2,4,5,6,7 are pins
// be careful using PortC as PC0 is used for the Crystal and PC1 is nRESET
#endif
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
DDRD = 0;
PORTD = 0xFF;
DDRB = 0;
PORTB = 0xFF;
DDRC = 0;
PORTC = (1 << PC6) | (1 << PC7); //only PC6,7 are pins
DDRE = 0;
PORTE = (1 << PE2) | (1 << PE6); //only PE2,6 are pins
DDRF = 0;
PORTF = (1 << PF0) | (1 << PF1) | (1 << PF4) | (1 << PF5) | (1 << PF6) | (1 << PF7); // only PF0,1,4,5,6,7 are pins
#endif
#if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_ATmega32U6__))
DDRA = 0;
PORTA = 0xFF;
DDRB = 0;
PORTB = 0xFF;
DDRC = 0;
PORTC = 0xFF;
DDRD = 0;
PORTD = 0xFF;
DDRE = 0;
PORTE = 0xFF;
DDRF = 0;
PORTF = 0xFF;
#endif
/* Hardware Initialization */
LEDs_Init();
LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
Buttons_Init();
DISABLE_VOLTAGE_TXRX(); // used on Micropendous REV1/2 boards
DISABLE_EXT_SRAM(); // used on Micropendous REV1/2 boards
SELECT_USB_B(); // needed for Micropendous REV1/2 boards
USB_Init();
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
USB_Device_EnableSOFEvents();
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
}
/** Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
}
/** HID class driver callback function for the creation of HID reports to the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
* \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
* \param[in] ReportType Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
* \param[out] ReportData Pointer to a buffer where the created report should be stored
* \param[out] ReportSize Number of bytes written in the report (or zero if no report is to be sent)
*
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
*/
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
//uint8_t JoyStatus_LCL = Joystick_GetStatus();
//uint8_t ButtonStatus_LCL = Buttons_GetStatus();
uint8_t UsedKeyCodes = 0;
// 32-pin USB AVRs
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__))
if (~PINB & (1 << PINB0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINB & (1 << PINB1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINB & (1 << PINB2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINB & (1 << PINB3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINB & (1 << PINB4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINB & (1 << PINB5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINB & (1 << PINB6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINB & (1 << PINB7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINC & (1 << PINC2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINC & (1 << PINC4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINC & (1 << PINC5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINC & (1 << PINC6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINC & (1 << PINC7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PIND & (1 << PIND0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PIND & (1 << PIND1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PIND & (1 << PIND2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PIND & (1 << PIND3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PIND & (1 << PIND4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PIND & (1 << PIND5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PIND & (1 << PIND6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PIND & (1 << PIND7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
}
#endif // end 32-pin USB AVRs
// 44-pin USB AVRs
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
if (~PINB & (1 << PINB0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINB & (1 << PINB1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINB & (1 << PINB2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINB & (1 << PINB3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINB & (1 << PINB4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINB & (1 << PINB5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINB & (1 << PINB6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINB & (1 << PINB7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINC & (1 << PINC6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINC & (1 << PINC7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PIND & (1 << PIND0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PIND & (1 << PIND1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PIND & (1 << PIND2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PIND & (1 << PIND3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PIND & (1 << PIND4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PIND & (1 << PIND5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PIND & (1 << PIND6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PIND & (1 << PIND7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINE & (1 << PINE2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINE & (1 << PINE6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINF & (1 << PINF0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINF & (1 << PINF1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINF & (1 << PINF4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINF & (1 << PINF5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINF & (1 << PINF6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINF & (1 << PINF7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
}
#endif // end 44-pin USB AVRs
// 64-pin USB AVRs
#if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_ATmega32U6__))
if (~PINB & (1 << PINB0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
// On Micropendous boards pin B1 is the LED so it cannot be read
#if ((BOARD != BOARD_MICROPENDOUS_REV1) && (BOARD != BOARD_MICROPENDOUS_REV2))
} else if (~PINB & (1 << PINB1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
#endif // BOARD != MICROPENDOUS_REV1/2
} else if (~PINB & (1 << PINB2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINB & (1 << PINB3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINB & (1 << PINB4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINB & (1 << PINB5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINB & (1 << PINB6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINB & (1 << PINB7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PIND & (1 << PIND0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PIND & (1 << PIND1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PIND & (1 << PIND2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PIND & (1 << PIND3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PIND & (1 << PIND4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PIND & (1 << PIND5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PIND & (1 << PIND6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PIND & (1 << PIND7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINF & (1 << PINF0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINF & (1 << PINF1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINF & (1 << PINF2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINF & (1 << PINF3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINF & (1 << PINF4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINF & (1 << PINF5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINF & (1 << PINF6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINF & (1 << PINF7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINE & (1 << PINE2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
// On Micropendous boards Ports A, C, and most of E control various board functions and are not exposed
#if ((BOARD != BOARD_MICROPENDOUS_REV1) && (BOARD != BOARD_MICROPENDOUS_REV2))
} else if (~PINA & (1 << PINA0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINA & (1 << PINA1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINA & (1 << PINA2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINA & (1 << PINA3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINA & (1 << PINA4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINA & (1 << PINA5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINA & (1 << PINA6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINA & (1 << PINA7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINC & (1 << PINC0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINC & (1 << PINC1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINC & (1 << PINC2)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_2_AND_AT;
} else if (~PINC & (1 << PINC3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINC & (1 << PINC4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINC & (1 << PINC5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINC & (1 << PINC6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINC & (1 << PINC7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
} else if (~PINE & (1 << PINE0)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS;
} else if (~PINE & (1 << PINE1)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_1_AND_EXCLAMATION;
} else if (~PINE & (1 << PINE3)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_3_AND_HASHMARK;
} else if (~PINE & (1 << PINE4)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_4_AND_DOLLAR;
} else if (~PINE & (1 << PINE5)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_5_AND_PERCENTAGE;
} else if (~PINE & (1 << PINE6)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_6_AND_CARET;
} else if (~PINE & (1 << PINE7)) {
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;
KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_7_AND_AND_AMPERSAND;
#endif // BOARD != MICROPENDOUS_REV1/2
}
#endif // end 64-pin USB AVRs
//if (UsedKeyCodes)
// KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT;
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
/** HID class driver callback function for the processing of HID reports from the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
* \param[in] ReportID Report ID of the received report from the host
* \param[in] ReportType The type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature
* \param[in] ReportData Pointer to a buffer where the received report has been stored
* \param[in] ReportSize Size in bytes of the received HID report
*/
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize)
{
uint8_t LEDMask = LEDS_NO_LEDS;
uint8_t* LEDReport = (uint8_t*)ReportData;
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
LEDs_SetAllLEDs(LEDMask);
}

View File

@@ -1,88 +1,87 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Keyboard.c.
*/
#ifndef _KEYBOARD_H_
#define _KEYBOARD_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Keyboard.c.
*/
#ifndef _MICROPENDOUSKEYBOARDTEST_H_
#define _MICROPENDOUSKEYBOARDTEST_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif // _MICROPENDOUSKEYBOARDTEST_H_

View File

@@ -1,73 +1,73 @@
/** \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.
*/
/** \mainpage Keyboard Device Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Keyboard Subclass</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF HID Specification \n
* USBIF HID Usage Tables</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Low Speed Mode \n
* Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Keyboard demonstration application. This gives a simple reference application
* for implementing a USB Keyboard using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). It is boot protocol compatible, and thus
* works under compatible BIOS as if it was a native keyboard (e.g. PS/2).
*
* On start-up the system will automatically enumerate and function as a keyboard
* when the USB connection to a host is present. To use the keyboard example,
* manipulate the joystick to send the letters a, b, c, d and e. See the USB HID
* documentation for more information on sending keyboard event and key presses. Unlike
* other LUFA Keyboard demos, this example shows explicitly how to send multiple key presses
* inside the same report to the host.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/
/** \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.
*/
/** \mainpage Keyboard Device Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Keyboard Subclass</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF HID Specification \n
* USBIF HID Usage Tables</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Low Speed Mode \n
* Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Keyboard demonstration application. This gives a simple reference application
* for implementing a USB Keyboard using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). It is boot protocol compatible, and thus
* works under compatible BIOS as if it was a native keyboard (e.g. PS/2).
*
* On start-up the system will automatically enumerate and function as a keyboard
* when the USB connection to a host is present. To use the keyboard example,
* manipulate the joystick to send the letters a, b, c, d and e. See the USB HID
* documentation for more information on sending keyboard event and key presses. Unlike
* other LUFA Keyboard demos, this example shows explicitly how to send multiple key presses
* inside the same report to the host.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/

View File

@@ -0,0 +1,290 @@
:10000000B7C00000D4C00000D2C00000D0C00000C3
:10001000CEC00000CCC00000CAC00000C8C00000B4
:10002000C6C00000C4C0000061C40000C0C0000021
:10003000BEC00000BCC00000BAC00000B8C00000D4
:10004000B6C00000B4C00000B2C00000B0C00000E4
:10005000AEC00000ACC00000AAC00000A8C00000F4
:10006000A6C00000A4C00000A2C00000A0C0000004
:100070009EC000009CC000009AC0000098C0000014
:1000800096C0000094C0000092C0000090C0000024
:100090008EC000008CC0000032034D006900630078
:1000A00072006F00700065006E0064006F007500E4
:1000B00073004B006500790062006F006100720000
:1000C0006400540065007300740000002A03770088
:1000D000770077002E006D006900630072006F00EA
:1000E000700065006E0064006F00750073002E00E4
:1000F0006F00720067000000040309040902220077
:10010000010100C0320904000001030101000921BE
:1001100011010001223F00070581030800051201BB
:10012000100100000008EB03422001000102000161
:1001300005010906A101050719E029E715002501B8
:10014000750195088102950175088101050819015D
:100150002905950575019102950175039101150019
:1001600025FF0507190029FF950675088100C000C5
:1001700011241FBECFEFD0E2DEBFCDBF11E0A0E063
:10018000B1E0E4EEF1E100E00BBF02C007900D9298
:10019000A032B107D9F71BBE11E0A0E2B1E001C067
:1001A0001D92A533B107E1F73ED00C94F00828CF9B
:1001B00095B19D7F982B95B9089584B7877F84BFAB
:1001C00088E10FB6F89480936000109260000FBE33
:1001D00080E090E020E80FB6F894209361008093CF
:1001E00061000FBE85B7806890E00FB6F89485BFB8
:1001F0000FBE85BF11B88FEF82B914B885B917B893
:1002000088B91AB88BB91DB88EB910BA81BB219ABA
:100210002998299A6A98729A73986B9A6C9A749A28
:1002200077986F9A48C3C9DF82E0C2DF789480E094
:1002300091E0F3D68AD5FBCF80E0BACF82E0B8CF89
:1002400080E091E0D1D69091E20094609093E2003A
:10025000882311F080E001C082E0AACF80E091E025
:1002600090C580910E0190910F01009729F00197A0
:1002700090930F0180930E0108950F931F93F9013E
:10028000D801189902C085E03BC01A9902C085E0E8
:1002900065C01B9902C085E043C01C9902C085E07F
:1002A00045C01D9902C085E047C01E9902C085E087
:1002B00049C01F9902C085E04BC0489902C087E041
:1002C0001FC0499902C087E021C04A9902C087E057
:1002D00045C04B9902C087E023C04C9902C087E01B
:1002E00025C04D9902C087E027C04E9902C087E023
:1002F00029C04F9902C087E02BC0789904C089E0DB
:10030000828387E22DC0799904C089E082838EE1DF
:1003100027C07A9902C089E021C07B9904C089E096
:10032000828380E21DC07C9904C089E0828381E2DF
:1003300017C07D9904C089E0828382E211C07E9952
:1003400004C089E0828383E20BC07F9904C089E006
:10035000828384E205C0629904C088E082838FE1D1
:10036000838388E090E011969C938E9380E01F91A8
:100370000F910895F901808180FD02C080E001C0E5
:1003800082E016CF933089F0943028F4913049F10F
:10039000923061F505C09132D1F0923239F51CC02E
:1003A00082E290E0ECEFF0E025C0813041F0813056
:1003B00018F08230D9F406C0E8EFF0E005C0ECECAC
:1003C000F0E002C0E8E9F0E0849190E013C089E039
:1003D00090E0EEE0F1E00EC08FE390E0E0E3F1E0CA
:1003E00009C082E190E0EEE1F1E004C080E090E03D
:1003F000E0E0F0E0DA011196FC93EE930895AF92FD
:10040000BF92CF92DF92EF92FF921F93CF93DF9331
:10041000EC017B016A01D7D1182F8823A9F5C114FB
:10042000D10439F0F60120813181E21AF30AC20FBA
:10043000D31FAA24BB2423C08091E80085FD16C0E9
:100440008091E8008E778093E8007FD4C114D104B6
:1004500049F0F601808191818A0D9B1D91838083F3
:1004600015E012C0B0D1882351F00DC0899180935E
:10047000F1000894E108F1080894A11CB11CE114F2
:10048000F104D1F601C0182F812FDF91CF911F9178
:10049000FF90EF90DF90CF90BF90AF9008952091A4
:1004A0003301309134012617370720F4B901FC01DC
:1004B00020E037C061157105D1F72091E8002E7753
:1004C0002093E800F4CF80912C01882309F43FC0E9
:1004D0008530C9F18091E80083FD37C08091E80044
:1004E00082FD2BC08091E80080FF1BC08091F2004C
:1004F0009091F30006C021912093F100615070406B
:1005000001966115710519F088309105A0F321E07D
:100510008830910509F020E08091E8008E77809383
:10052000E8006115710579F6222369F606C080910D
:100530002C01882361F0853061F08091E80082FF12
:10054000F6CF80E0089583E0089581E0089582E089
:10055000089583E008956115710529F42091E8005C
:100560002B772093E800382F292F26C080912C016B
:100570008823B1F1853081F18091E80083FD2EC0A0
:100580008091E80082FFF2CFE32FF22F08C0809124
:10059000F10081933E2F2F2F6150704041F03E2F8C
:1005A0002F2F8091F2009091F300009781F78091B6
:1005B000E8008B778093E80061157105B9F606C0F5
:1005C00080912C01882361F0853061F08091E800F2
:1005D00080FFF6CF80E0089583E0089581E00895DC
:1005E00082E0089583E00895209133013091340131
:1005F0002617370720F4B901FC0120E038C0611547
:100600007105D1F72091E8002E772093E800F4CF10
:1006100080912C01882309F440C08530D1F180916C
:10062000E80083FD38C08091E80082FD2CC08091F5
:10063000E80080FF1CC08091F2009091F30007C099
:1006400024912093F100319661507040019661151C
:10065000710519F08830910598F321E088309105F3
:1006600009F020E08091E8008E778093E800611522
:10067000710571F6222361F606C080912C01882352
:1006800061F0853061F08091E80082FFF6CF80E074
:10069000089583E0089581E0089582E0089583E05D
:1006A0000895982F2AC09093E900981739F0709117
:1006B000EC002091ED005091F00003C0242F762F24
:1006C00050E021FF19C03091EB003E7F3093EB00EA
:1006D0003091ED003D7F3093ED003091EB003160C3
:1006E0003093EB007093EC002093ED005093F000FA
:1006F0002091EE0027FF08C09F5F9730A0F28F7017
:100700008093E90081E0089580E008950F931F939E
:10071000CF93DF93162FEC0100E02AC09881992334
:1007200029F16B81E981FA812C81892F8F708730C3
:1007300018F56295660F660F607C991F9927991FBF
:10074000692B223010F096E001C092E028E030E002
:1007500040E003C04F5F220F331F2E173F07D0F337
:100760004295407F492B9DDF882331F00F5F25960E
:100770000117A1F681E001C080E0DF91CF911F91C8
:100780000F91089580912D0187FF13C004C08091BF
:100790002C018823B9F08091E80082FFF8CF809186
:1007A000E8008B778093E800089580912C018823DE
:1007B00049F08091E80080FFF8CF8091E8008E77C3
:1007C0008093E80008958091E4009091E50045E66B
:1007D00001C0C9012091EC0020FF23C02091E80056
:1007E00020FD15C020912C01222399F0253099F08D
:1007F0002091EB0025FD11C02091E4003091E5002F
:100800002817390739F3415021F784E0089580E033
:10081000089582E0089583E0089581E0089580E0DE
:1008200008952091E80022FFDDCFF9CF0F931F93A9
:10083000CF93DF934ED055D0C8EDD0E088818F772D
:10084000888388818068888388818F7D8883E7EDAD
:10085000F0E080818068808319BC10922C01109296
:10086000280110922A011092290100EE10E0F801EF
:1008700080818B7F808388818160888380E060E0D5
:1008800042E00FDFE1EEF0E080818E7F8083E2EED8
:10089000F0E0808181608083808188608083F801BE
:1008A00080818E7F8083888180618883DF91CF9172
:1008B0001F910F910895E8EDF0E080818F7E808395
:1008C000E7EDF0E080818160808381E080932B01FF
:1008D000ADCFE8EDF0E080818C7F80831092E20064
:1008E00008951092DA001092E10008951F920F927D
:1008F0000FB60F920BB60F9211242F933F934F9385
:100900005F936F937F938F939F93AF93BF93EF9377
:10091000FF938091E10082FF0AC08091E20082FF94
:1009200006C08091E1008B7F8093E1009ADC80918A
:10093000DA0080FF1DC08091D80080FF19C080912F
:10094000DA008E7F8093DA008091D90080FF0CC09E
:1009500084E189BD86E189BD09B400FEFDCF81E057
:1009600080932C0169DC04C019BC10922C0166DC58
:100970008091E10080FF18C08091E20080FF14C0E8
:100980008091E2008E7F8093E2008091E20080619E
:100990008093E2008091D80080628093D80019BCD7
:1009A00085E080932C01D0D18091E10084FF2DC09F
:1009B0008091E20084FF29C084E189BD86E189BD80
:1009C00009B400FEFDCF8091D8008F7D8093D800C0
:1009D0008091E1008F7E8093E1008091E2008F7E24
:1009E0008093E2008091E20081608093E200809138
:1009F0002801882321F48091E30087FF02C084E06E
:100A000001C081E080932C019FD18091E10083FFA0
:100A100022C08091E20083FF1EC08091E100877FA9
:100A20008093E10082E080932C0110922801809154
:100A3000E1008E7F8093E1008091E2008E7F8093C1
:100A4000E2008091E20080618093E20080E060E05B
:100A500042E027DE79D1FF91EF91BF91AF919F9155
:100A60008F917F916F915F914F913F912F910F9057
:100A70000BBE0F900FBE0F901F9018951F93CF9332
:100A8000DF93CDB7DEB7AC970FB6F894DEBF0FBEDD
:100A9000CDBF80E0EDE2F1E09091F10091938F5FA6
:100AA0008830D1F7DBDB8091E80083FF35C180918E
:100AB0002D0120912E01253009F484C0263040F408
:100AC0002130A1F1213070F0233009F025C12EC072
:100AD000283009F4F3C0293009F402C1263009F0A6
:100AE0001BC193C0803821F0823809F015C108C0BD
:100AF0008091290190912A01992371F082600CC0A4
:100B0000809131018F708093E9009091EB0081E03A
:100B100095FF80E01092E9009091E800977F909314
:100B2000E8008093F1001092F100D3C0882319F0FF
:100B3000823009F0F1C090E08F719070009729F039
:100B40008230910509F0E8C00BC080912F018130FF
:100B500009F0E2C0233009F080E080932A012CC024
:100B600080912F01882341F5209131012F7009F4E4
:100B7000D3C02093E9008091EB0080FF1DC08091DD
:100B80002E01833021F48091EB00806213C08091AC
:100B9000EB0080618093EB0081E090E002C0880F61
:100BA000991F2A95E2F78093EA001092EA0080915B
:100BB000EB0088608093EB001092E9008091E800E0
:100BC000877F8AC0882309F0A7C010912F011F7763
:100BD0008091E3008078812B8093E3008091E8008E
:100BE000877F8093E800CEDD8091E80080FFFCCF16
:100BF0008091E30080688093E300112311F083E08B
:100C000001C082E080932C0187C08058823008F0B8
:100C100083C080912F019091300123E08C3D920799
:100C2000A9F583E08C838AE28B835FB7F894DE01B9
:100C3000139680E090E04EE061E2E42FF0E06093F4
:100C40005700E49180FF03C0E295EF704F5FEF70B3
:100C50002E2F30E0EA3018F0295C3F4F02C0205DB3
:100C60003F4F13963C932E93129701961296843120
:100C7000910519F75FBF8091E800877F8093E800B6
:100C8000CE0103966AE270E00ADC12C06091310185
:100C9000AE014F5F5F4F76DBBC01009709F43CC0AB
:100CA0008091E800877F8093E80089819A819CDCAD
:100CB0008091E8008B778093E8002EC0803861F542
:100CC0008091E800877F8093E800809128018093DD
:100CD000F1008091E8008E778093E80053DD1CC01E
:100CE0008823D1F490912F019230B0F48091E800E4
:100CF000877F8093E8009093280144DD809128014C
:100D0000882321F48091E30087FF02C084E001C0C2
:100D100081E080932C0194DA8091E80083FF0AC07F
:100D20008091E800877F8093E8008091EB008062EB
:100D30008093EB00AC960FB6F894DEBF0FBECDBF2C
:100D4000DF91CF911F9108950895CF9380912C0149
:100D50008823A9F08091E9008F709091EC0090FFBA
:100D600002C0C0E801C0C0E0C82B1092E900809129
:100D7000E80083FF01C082DECF70C093E900CF910D
:100D800008956F927F928F929F92AF92BF92CF926F
:100D9000DF92EF92FF920F931F93CF93DF9300D0D8
:100DA0000F92CDB7DEB77C016DB67EB68091E800BC
:100DB00083FF03C1F701808190E0209131013091E0
:100DC00032012817390709F0F8C080912E018330CD
:100DD00009F49AC0843030F4813071F0823009F027
:100DE000ECC0CFC08A3009F4B4C08B3009F49DC088
:100DF000893009F0E2C04BC080912D01813A09F0A1
:100E0000DCC09DB68EB61B821A8280912F010091A4
:100E100030018983F70140858DB79EB7841B910906
:100E20000FB6F8949EBF0FBE8DBFCDB6DEB6089448
:100E3000C11CD11CBC2CAD2CC60160E070E050E0A0
:100E4000C8D1402F4150C701BE016F5F7F4F96014F
:100E50008E010E5F1F4F11DAF7018681978100978F
:100E600021F04085B60150E0ABD11092E9008091AD
:100E7000E800877F8093E8006A817B818B2D9A2D23
:100E80000EDB8091E8008B778093E8003AC0809178
:100E90002D01813209F091C09DB68EB600913301CB
:100EA00010913401C0902F01D09030018DB79EB7C2
:100EB000801B910B0FB6F8949EBF0FBE8DBFADB6D1
:100EC000BEB60894A11CB11C8091E800877F809376
:100ED000E800C501B8013FDB8091E8008E77809380
:100EE000E80081E090E0CC2011F480E090E04D2D0E
:100EF00041509501280F391F081B190BC7016C2D94
:100F000039DA9DBE8EBE59C080912D01813A09F01B
:100F100054C08091E800877F8093E8008091E800CA
:100F200080FFFCCFF701818540C080912D01813287
:100F300009F043C08091E800877F8093E80022DCBD
:100F400090912F0181E0992309F480E0F7018187D6
:100F500034C080912D01813281F58091E800877F36
:100F60008093E8000FDC80912F0190913001807018
:100F700036E0969587953A95E1F7F701958784874E
:100F80001CC080912D01813AC1F48091E800877FD7
:100F90008093E8008091E80080FFFCCFF701848512
:100FA000958596958795969587958093F100809184
:100FB000E8008E778093E800E5DB0FB6F8947EBEFC
:100FC0000FBE6DBE0F900F900F90DF91CF911F91CC
:100FD0000F91FF90EF90DF90CF90BF90AF909F90D8
:100FE0008F907F906F900895CF93DF93FC010996C7
:100FF000DC0187E0ED0119928A95E9F781E08187AC
:1010000084EF91E09587848783E08483CF01019604
:1010100061E07CDBDF91CF9108954F925F926F92F8
:101020007F928F929F92AF92BF92CF92DF92EF9278
:10103000FF920F931F93CF93DF9300D00F92CDB702
:10104000DEB77C014DB65EB680912C01843009F08C
:1010500091C08091E4009091E500F70122853385ED
:101060002817390709F486C081818F708093E900C1
:101070008091E80085FF7EC07DB66EB640858DB755
:101080009EB7841B91090FB6F8949EBF0FBE8DBF0B
:101090000DB71EB70F5F1F4F19821B821A82B02E29
:1010A000A12EC80160E070E050E093D0C701BE01FE
:1010B0006F5F7F4F40E098018E010E5F1F4FDDD8BC
:1010C000182FF70184859585009759F081E090E00D
:1010D000268537852115310511F080E090E04C011F
:1010E00002C088249924F701C680D780C114D10496
:1010F00091F04A815B818B2D9A2DB60154D001E08D
:10110000009709F400E0F7014085C6016B2D7A2DA8
:1011100050E056D001C000E08A819B81009709F120
:10112000112329F4002319F481149104D1F0F7015B
:10113000848595859787868781818F708093E90064
:101140008981882311F08093F1006A817B818B2D46
:101150009A2D40E050E053D98091E8008E7780933B
:10116000E8008091E4009091E500F7019387828781
:101170007DBE6EBE0FB6F8945EBE0FBE4DBE0F9024
:101180000F900F90DF91CF911F910F91FF90EF90F3
:10119000DF90CF90BF90AF909F908F907F906F9097
:1011A0005F904F900895FB01DC0104C08D91019088
:1011B000801921F441505040C8F7881B990B0895BD
:1011C000FB01DC0102C001900D9241505040D8F764
:1011D0000895DC0101C06D9341505040E0F708953F
:0411E000F894FFCFB1
:1011E4000081080000012001080000000000000048
:1011F400A120000000000200A10100000000000086
:00000001FF

View File

@@ -5,10 +5,10 @@
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
<config name="lufa.drivers.board.name" value="usbkey"/>
<config name="lufa.drivers.board.name" value="micropendous_rev2"/>
<build type="define" name="F_CPU" value="8000000UL"/>
<build type="define" name="F_USB" value="8000000UL"/>
<build type="define" name="F_CPU" value="16000000UL"/>
<build type="define" name="F_USB" value="16000000UL"/>
</project>
<module type="application" id="lufa.demos.device.class.keyboard" caption="Keyboard HID Device Demo (Class Driver APIs)">
@@ -26,11 +26,11 @@
<device-support-alias value="lufa_xmega"/>
<device-support-alias value="lufa_uc3"/>
<build type="distribute" subtype="user-file" value="Keyboard.txt"/>
<build type="distribute" subtype="user-file" value="MicropendousKeyboardTest.txt"/>
<build type="c-source" value="Keyboard.c"/>
<build type="c-source" value="MicropendousKeyboardTest.c"/>
<build type="c-source" value="Descriptors.c"/>
<build type="header-file" value="Keyboard.h"/>
<build type="header-file" value="MicropendousKeyboardTest.h"/>
<build type="header-file" value="Descriptors.h"/>
<build type="module-config" subtype="path" value="Config"/>

View File

@@ -1,38 +1,40 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = USBKEY
F_CPU = 8000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = Keyboard
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../../../LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = MICROPENDOUS_REV2
F_CPU = 16000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = MicropendousKeyboardTest
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../libs/LUFA/LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =
CDC_BOOTLOADER_PORT = /dev/ttyACM0
#CDC_BOOTLOADER_PORT = COM5
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk

View File

@@ -1,260 +1,260 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_NoSpecificSubclass,
.Protocol = CDC_CSCP_NoSpecificProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
.TotalEndpoints = 1,
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_ACMSubclass,
.Protocol = CDC_CSCP_ATCommandProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
.CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
.CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
.TotalEndpoints = 2,
.Class = CDC_CSCP_CDCDataClass,
.SubClass = CDC_CSCP_NoDataSubclass,
.Protocol = CDC_CSCP_NoDataProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
}
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
.UnicodeString = L"Dean Camera"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
.UnicodeString = L"LUFA CDC Demo"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
}
*DescriptorAddress = Address;
return Size;
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_NoSpecificSubclass,
.Protocol = CDC_CSCP_NoSpecificProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
.TotalEndpoints = 1,
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_ACMSubclass,
.Protocol = CDC_CSCP_ATCommandProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
.CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
.CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
.TotalEndpoints = 2,
.Class = CDC_CSCP_CDCDataClass,
.SubClass = CDC_CSCP_NoDataSubclass,
.Protocol = CDC_CSCP_NoDataProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
}
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
.UnicodeString = L"Dean Camera"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
.UnicodeString = L"LUFA CDC Demo"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
}
*DescriptorAddress = Address;
return Size;
}

View File

@@ -1,89 +1,89 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
# Purpose: Test the throughput of a Micropendous board loaded with Virtual Serial Port loopback firmware
# Visit www.Micropendous.org/Serial for more info.
# Created: 2008-09-30 by Opendous Inc.
# Last Edit: 2009-10-03 by Opendous Inc.
# Released under the MIT License
import serial # for accessing the serial port on multiple platforms
import time, sys
# test Serial Port throughput by sending and receiving transfersToComplete number
# of transferSize sized strings
# comport is a string - the Serial Port name to use
# transferSize is an integer - the string lenght
# transfersToComplete is an integer - the number of transfers to test with
def SerialThroughputTest(comport, transferSize, transfersToComplete):
ser = serial.Serial(comport) # open serial port for communication
print ser # dump all info regarding serial port being used
ScriptStartTime = time.time()
# create a transferSize length string
i = 0
s = ''
while (i < (transferSize - 1)):
s = s + 'A'
i = i + 1
# want last letter to be X
s = s + 'X'
# complete a series of transfers
i = 0
while (i < transfersToComplete):
# send one string to device then get back the string
ser.write(s)
receivedData = ser.read(transferSize)
#print receivedData
i = i + 1
ScriptEndTime = time.time()
print "\nIt took", (ScriptEndTime - ScriptStartTime), "seconds to transfer", \
(transfersToComplete * transferSize), "bytes for a throughput of", \
(((transfersToComplete * transferSize) / (ScriptEndTime - ScriptStartTime)) / 1000), "kbytes/second"
# be careful using readline as it will block until a newline character is received
ser.close() # release/close the serial port
# if this file is the program actually being run, print usage info or run SerialThroughputTest
if __name__ == '__main__':
if (len(sys.argv) != 4):
print "Serial Communication Throughput Testing"
print " Usage:"
print " python", sys.argv[0], "<port> <transferSize> <testSize>"
print " Where <port> = serial port; COM? on Windows, '/dev/ttyACM0 on Linux'"
print " Enumerated serial port can be found on Linux using dmesg"
print " look for something like cdc_acm 2-1:1.0: ttyACM0: USB ACM device"
print " Where <transferSize> = the size of each transfer, this value should match"
print " CDC_TXRX_EPSIZE in Descriptors.h for maximum throughput"
print " Where <testSize> = how many transfers to complete, 100 is usually enough"
print " "
print " python", sys.argv[0], "COM5 64 100"
exit()
SerialThroughputTest(sys.argv[1], int(sys.argv[2]), int(sys.argv[3]))

View File

@@ -1,175 +1,182 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the VirtualSerial demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "VirtualSerial.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
* used like any regular character stream in the C APIs
*/
static FILE USBSerialStream;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
CheckJoystickMovement();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
USB_Init();
}
/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
void CheckJoystickMovement(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
ReportString = "Joystick Down\r\n";
else if (JoyStatus_LCL & JOY_LEFT)
ReportString = "Joystick Left\r\n";
else if (JoyStatus_LCL & JOY_RIGHT)
ReportString = "Joystick Right\r\n";
else if (JoyStatus_LCL & JOY_PRESS)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
/* Write the string to the virtual COM port via the created character stream */
fputs(ReportString, &USBSerialStream);
/* Alternatively, without the stream: */
// CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString);
}
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Updated for Loopback by Opendous Inc. 2013-03-16
www.Micropendous.org/VirtualSerial
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the VirtualSerial demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "VirtualSerial.h"
// Global buffer for use with STDIO functions
volatile char buffer[CDC_TXRX_EPSIZE];
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
* used like any regular character stream in the C APIs
*/
static FILE USBSerialStream;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
GlobalInterruptEnable();
for (;;)
{
MainTask();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
//CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Disable JTAG; allows upper nibble of Port F to be used as GPIO */
#if ( defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
defined(__AVR_ATmega32U6__) )
JTAG_DISABLE();
#endif
/* Hardware Initialization */
LEDs_Init();
LEDs_TurnOnLEDs(LEDS_LED1);
DISABLE_VOLTAGE_TXRX(); // used on Micropendous REV1/2 boards
DISABLE_EXT_SRAM(); // used on Micropendous REV1/2 boards
SELECT_USB_B(); // needed for Micropendous REV1/2 boards
USB_Init();
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
void MainTask(void)
{
int count = 0;
// If the host has sent data then echo it back
// Throughput is maximized if the full EP buffer is read and sent each time
// Throughput approaches CDC_TXRX_EPSIZE kbytes/second and depends on transfer size from host
if ((count = fread(&buffer, 1, CDC_TXRX_EPSIZE, &USBSerialStream)) > 0) {
fwrite(&buffer, 1, count, &USBSerialStream);
}
// If HWB Button is pressed then send formatted strings
if (Buttons_GetStatus()) {
fprintf_P(&USBSerialStream, PSTR("\r\nHWB has been pressed!\r\n")); // send a constant string stored in FLASH
fprintf(&USBSerialStream, "PORTD = %3x\r\n", PIND); // send a string that is dynamic and stored in SRAM
}
}

View File

@@ -1,76 +1,76 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for VirtualSerial.c.
*/
#ifndef _VIRTUALSERIAL_H_
#define _VIRTUALSERIAL_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdio.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for VirtualSerial.c.
*/
#ifndef _VIRTUALSERIAL_H_
#define _VIRTUALSERIAL_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdio.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void MainTask(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
#endif

View File

@@ -1,73 +1,73 @@
/** \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.
*/
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF CDC Class Standard</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
*
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
* Operating Systems should automatically use their own inbuilt
* CDC-ACM drivers.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/
/** \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.
*/
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF CDC Class Standard</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
*
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
* Operating Systems should automatically use their own inbuilt
* CDC-ACM drivers.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/

View File

@@ -0,0 +1,359 @@
:100000009EC00000BBC00000B9C00000B7C0000027
:10001000B5C00000B3C00000B1C00000AFC0000018
:10002000ADC00000ABC0000043C300000EC4000020
:10003000A5C00000A3C00000A1C000009FC0000038
:100040009DC000009BC0000099C0000097C0000048
:1000500095C0000093C0000091C000008FC0000058
:100060008DC000008BC0000089C0000087C0000068
:1000700085C0000083C0000081C000007FC0000078
:100080007DC000007BC0000079C0000077C0000088
:1000900075C0000073C000000D0A48574220686117
:1000A00073206265656E2070726573736564210DDF
:1000B0000A001C034C00550046004100200043008C
:1000C000440043002000440065006D006F00000004
:1000D00018034400650061006E00200043006100C9
:1000E0006D0065007200610000000403090409024C
:1000F0003E00020100C032090400000102020100BA
:100100000524001001042402060524060001070549
:1001100082030800FF09040100020A00000007052D
:1001200004021000050705830210000512011001EA
:1001300002000008EB03442001000102DC0111244D
:100140001FBECFEFD0E2DEBFCDBF11E0A0E0B1E037
:10015000E8E1F6E100E00BBF02C007900D92AA3380
:10016000B107D9F71BBE11E0AAE3B1E001C01D92AF
:10017000A536B107E1F785D00C940A0B41CF84B7BF
:10018000877F84BF88E10FB6F89480936000109257
:1001900060000FBE80E090E020E80FB6F894209356
:1001A0006100809361000FBE85B7806890E00FB654
:1001B000F89485BF0FBE85BF219A2998299A739814
:1001C0006B9A6C9A749A77986F9A57C22998089587
:1001D000299A08958EE091E0A7D5882311F090E048
:1001E00001C092E085B18D7F892B85B908958EE09D
:1001F00091E0EDC4CF93DF9388E491E061E070E09B
:1002000040E150E02AE331E0ADD6AC011816190602
:100210003CF488E491E061E070E02AE331E0DFD66D
:100220008CB182FD2BC000D000D0CAE3D1E0ADB7C5
:10023000BEB71296DC93CE93119788E990E014969E
:100240009C938E93139772D629B100D0EDB7FEB769
:100250003196ADB7BEB71296DC93CE93119780E07E
:1002600091E0938382832483158251D6EDB7FEB744
:1002700036960FB6F894FEBF0FBEEDBFDF91CF915B
:1002800008957DDF8EE091E06AE371E02CD67894EA
:10029000B1DF8EE091E0D1D57ED4FACF923029F053
:1002A000933041F09130E9F417C08EE390E0EEEE28
:1002B000F0E01BC0813041F0813018F0823089F4C9
:1002C00006C0EAEEF0E005C0E0EDF0E002C0E2EBCF
:1002D000F0E0849190E009C082E190E0ECE2F1E08E
:1002E00004C080E090E0E0E0F0E0DA011196FC93D9
:1002F000EE9308952091630130916401261737072A
:1003000020F4B901FC0120E037C061157105D1F777
:100310002091E8002E772093E800F4CF80915C01D3
:10032000882309F43FC08530C9F18091E80083FD3E
:1003300037C08091E80082FD2BC08091E80080FFEB
:100340001BC08091F2009091F30006C02191209390
:10035000F1006150704001966115710519F0883007
:100360009105A0F321E08830910509F020E080910B
:10037000E8008E778093E8006115710579F62223F5
:1003800069F606C080915C01882361F0853061F0D8
:100390008091E80082FFF6CF80E0089583E0089521
:1003A00081E0089582E0089583E00895209163013B
:1003B000309164012617370720F4B901FC0120E0D1
:1003C00038C061157105D1F72091E8002E77209390
:1003D000E800F4CF80915C01882309F440C08530A7
:1003E000D1F18091E80083FD38C08091E80082FD62
:1003F0002CC08091E80080FF1CC08091F200909199
:10040000F30007C024912093F100319661507040B1
:1004100001966115710519F08830910598F321E076
:100420008830910509F020E08091E8008E77809374
:10043000E8006115710571F6222361F606C080910E
:100440005C01882361F0853061F08091E80082FFD3
:10045000F6CF80E0089583E0089581E0089582E07A
:10046000089583E00895982F2AC09093E900981783
:1004700039F07091EC002091ED005091F00003C034
:10048000242F762F50E021FF19C03091EB003E7FE2
:100490003093EB003091ED003D7F3093ED003091D3
:1004A000EB0031603093EB007093EC002093ED0093
:1004B0005093F0002091EE0027FF08C09F5F973017
:1004C000A0F28F708093E90081E0089580E00895A4
:1004D0000F931F93CF93DF93162FEC0100E02AC0F8
:1004E0009881992329F16B81E981FA812C81892FE7
:1004F0008F70873018F56295660F660F607C991FC4
:100500009927991F692B223010F096E001C092E0E4
:1005100028E030E040E003C04F5F220F331F2E176A
:100520003F07D0F34295407F492B9DDF882331F070
:100530000F5F25960117A1F681E001C080E0DF91F1
:10054000CF911F910F91089580915D0187FF13C096
:1005500004C080915C018823B9F08091E80082FF9B
:10056000F8CF8091E8008B778093E8000895809120
:100570005C01882349F08091E80080FFF8CF8091EA
:10058000E8008E778093E80008958091E4009091D0
:10059000E50045E601C0C9012091EC0020FF23C021
:1005A0002091E80020FD15C020915C01222399F0E4
:1005B000253099F02091EB0025FD11C02091E40039
:1005C0003091E5002817390739F3415021F784E0CD
:1005D000089580E0089582E0089583E0089581E021
:1005E000089580E008952091E80022FFDDCFF9CF43
:1005F0000F931F93CF93DF934ED055D0C8EDD0E02B
:1006000088818F77888388818068888388818F7DBF
:100610008883E7EDF0E080818068808319BC1092C8
:100620005C011092580110925A011092590100EE8B
:1006300010E0F80180818B7F8083888181608883CE
:1006400080E060E042E00FDFE1EEF0E080818E7F4D
:100650008083E2EEF0E08081816080838081886029
:100660008083F80180818E7F808388818061888388
:10067000DF91CF911F910F910895E8EDF0E0808117
:100680008F7E8083E7EDF0E080818160808381E070
:1006900080935B01ADCFE8EDF0E080818C7F8083BB
:1006A0001092E20008951092DA001092E10008958D
:1006B0001F920F920FB60F920BB60F9211242F9329
:1006C0003F934F935F936F937F938F939F93AF93DA
:1006D000BF93EF93FF938091E10082FF0AC0809166
:1006E000E20082FF06C08091E1008B7F8093E100F1
:1006F00051D28091DA0080FF1DC08091D80080FF28
:1007000019C08091DA008E7F8093DA008091D90041
:1007100080FF0CC084E189BD86E189BD09B400FE7B
:10072000FDCF81E080935C0151DD04C019BC1092C3
:100730005C014EDD8091E10080FF18C08091E200F5
:1007400080FF14C08091E2008E7F8093E200809150
:10075000E20080618093E2008091D8008062809303
:10076000D80019BC85E080935C0114D28091E1002F
:1007700084FF2DC08091E20084FF29C084E189BDFF
:1007800086E189BD09B400FEFDCF8091D8008F7D40
:100790008093D8008091E1008F7E8093E10080916A
:1007A000E2008F7E8093E2008091E200816080937E
:1007B000E20080915801882321F48091E30087FFB3
:1007C00002C084E001C081E080935C01E3D18091AC
:1007D000E10083FF27C08091E20083FF23C0809166
:1007E000E100877F8093E10082E080935C011092BA
:1007F00058018091E1008E7F8093E1008091E200BA
:100800008E7F8093E2008091E20080618093E2001D
:1008100080E060E042E027DE8091F0008860809315
:10082000F000B8D1FF91EF91BF91AF919F918F915F
:100830007F916F915F914F913F912F910F900BBEE0
:100840000F900FBE0F901F9018951F920F920FB62A
:100850000F920BB60F9211242F933F934F935F93F8
:100860006F937F938F939F93AF93BF93CF93EF93A8
:10087000FF93C091E900CF708091EC001092E900E5
:100880008091F000877F8093F00078941DD01092C3
:10089000E9008091F00088608093F000C093E90047
:1008A000FF91EF91CF91BF91AF919F918F917F91E8
:1008B0006F915F914F913F912F910F900BBE0F90D1
:1008C0000FBE0F901F9018951F93CF93DF93CDB756
:1008D000DEB7AC970FB6F894DEBF0FBECDBF80E099
:1008E000EDE5F1E09091F10091938F5F8830D1F7C1
:1008F0007EDC8091E80083FF35C180915D0120910D
:100900005E01253009F484C0263040F42130A1F185
:10091000213070F0233009F025C12EC0283009F4B1
:10092000F3C0293009F402C1263009F01BC193C07D
:10093000803821F0823809F015C108C08091590132
:1009400090915A01992371F082600CC080916101ED
:100950008F708093E9009091EB0081E095FF80E03B
:100960001092E9009091E800977F9093E8008093BF
:10097000F1001092F100D3C0882319F0823009F001
:10098000F1C090E08F719070009729F0823091054E
:1009900009F0E8C00BC080915F01813009F0E2C02E
:1009A000233009F080E080935A012CC080915F01D0
:1009B000882341F5209161012F7009F4D3C0209361
:1009C000E9008091EB0080FF1DC080915E018330C3
:1009D00021F48091EB00806213C08091EB00806174
:1009E0008093EB0081E090E002C0880F991F2A9568
:1009F000E2F78093EA001092EA008091EB008860B1
:100A00008093EB001092E9008091E800877F8AC014
:100A1000882309F0A7C010915F011F778091E30040
:100A20008078812B8093E3008091E800877F80931A
:100A3000E8008ADD8091E80080FFFCCF8091E30030
:100A400080688093E300112311F083E001C082E00D
:100A500080935C0187C08058823008F083C0809109
:100A60005F019091600123E08C3D9207A9F583E03E
:100A70008C838AE28B835FB7F894DE01139680E063
:100A800090E04EE061E2E42FF0E060935700E491E3
:100A900080FF03C0E295EF704F5FEF702E2F30E0C4
:100AA000EA3018F0295C3F4F02C0205D3F4F13969B
:100AB0003C932E931297019612968431910519F763
:100AC0005FBF8091E800877F8093E800CE010396A6
:100AD0006AE270E00FDC12C060916101AE014F5F0D
:100AE0005F4FDCDBBC01009709F43CC08091E8005B
:100AF000877F8093E80089819A8158DC8091E800A3
:100B00008B778093E8002EC0803861F58091E800F3
:100B1000877F8093E800809158018093F100809155
:100B2000E8008E778093E8000FDD1CC08823D1F4A5
:100B300090915F019230B0F48091E800877F8093BC
:100B4000E8009093580100DD80915801882321F43A
:100B50008091E30087FF02C084E001C081E08093C0
:100B60005C0138DB8091E80083FF0AC08091E800D7
:100B7000877F8093E8008091EB0080628093EB0098
:100B8000AC960FB6F894DEBF0FBECDBFDF91CF910C
:100B90001F9108950895CF9380915C018823A9F057
:100BA0008091E9008F709091EC0090FF02C0C0E846
:100BB00001C0C0E0C82B1092E9008091E80083FFDB
:100BC00001C082DECF70C093E900CF910895CF932A
:100BD000DF93EC018091E80083FFA3C0888190E05F
:100BE00020916101309162012817390709F099C0FD
:100BF00080915E01813269F0823220F4803209F006
:100C000090C03CC0823209F46BC0833209F089C0C5
:100C10007AC080915D01813A09F083C08091E8003B
:100C2000877F8093E8008091E80080FFFCCF8C896B
:100C30009D89AE89BF898093F100492F5A2F6B2F70
:100C400077274093F100AD01662777274093F100A5
:100C50008B2F9927AA27BB278093F100888D80933B
:100C6000F100898D8093F1008A8D8093F10080914D
:100C7000E8008E778093E80067DC53C080915D01C7
:100C8000813209F04EC08091E800877F8093E800B0
:100C900005C080915C01882309F443C08091E8007D
:100CA00082FFF7CF3091F1002091F1009091F10097
:100CB0008091F1003C8B2D8B9E8B8F8B8091F1006E
:100CC000888F8091F100898F8091F1008A8F8091C7
:100CD000E8008B778093E80037DCCE0117D121C084
:100CE00080915D018132E9F48091E800877F8093F3
:100CF000E8002ADC80915F0190916001998B888BDC
:100D0000CE0104D10EC080915D01813251F48091F9
:100D1000E800877F8093E80017DCCE0160915F01D7
:100D2000F5D0DF91CF910895CF93DF93EC014096FA
:100D3000FC018BE0DF011D928A95E9F782E08C834C
:100D4000898783E08E87CE01019661E0C1DB88232D
:100D500059F0CE01069661E0BBDB882329F0CE0175
:100D60000B9661E0B5DB01C080E0DF91CF91089583
:100D7000CF93FC01C62F80915C018430E9F4448953
:100D80005589668977894115510561057105A1F07D
:100D900081818F708093E9008091E80085FD08C013
:100DA0008091E8008E778093E800EFDB882329F4B8
:100DB000C093F10080E001C082E0CF910895282F18
:100DC000FB0184859585622FD3DF882319F08FEF8F
:100DD0009FEF089580E090E00895FC0180915C0110
:100DE000843029F5448955896689778941155105EB
:100DF00061057105E1F081818F708093E900809138
:100E0000F2009091F3000097A1F09091E80080919A
:100E1000E8008E778093E80095FD0DC0B6DB88234F
:100E200059F49091E8009E779093E800089582E04D
:100E3000089580E0089580E0089520915C012430B9
:100E400099F4FC01448955896689778941155105D2
:100E50006105710549F021812F702093E9002091EF
:100E6000E80020FF01C0B9CF0895FC0180915C012A
:100E7000843051F544895589668977894115510532
:100E80006105710509F186818F708093E900809179
:100E9000E80082FF1CC08091F2009091F30000975F
:100EA00021F08091F10090E002C08FEF9FEF209140
:100EB000F2003091F3002115310559F42091E8003A
:100EC0002B772093E80008958FEF9FEF08958FEF21
:100ED0009FEF0895FC0184859585C7DF97FF02C0C9
:100EE0008EEF9FEF0895FB012EE0DB011D922A9506
:100EF000E9F723E023832FED36E0318720872AE6C8
:100F000037E0338722879587848708950895CF93A4
:100F1000DF93CDB7DEB7AE01475F5F4F8D819E8116
:100F20006F8178859DD0DF91CF9108950F931F93A6
:100F3000CF93DF93CDB7DEB70F811885AE01455F44
:100F40005F4FF801838188608383C80169857A8552
:100F500087D0F8012381277F2383DF91CF911F91D1
:100F60000F9108958F929F92AF92BF92CF92DF928E
:100F7000EF92FF920F931F93CF93DF934B015A0190
:100F80007901F901238120FF1AC06C01C0E0D0E093
:100F900012C0C70175D2FFEF8F3F9F0791F0F60196
:100FA00081936F010F5F1F4F02C000E010E0081532
:100FB000190579F72196CA15DB05B9F702C0C0E01B
:100FC000D0E0CE01DF91CF911F910F91FF90EF9074
:100FD000DF90CF90BF90AF909F908F9008958F92A9
:100FE0009F92AF92BF92CF92DF92EF92FF920F93B8
:100FF0001F93CF93DF934B015A016901F9012381BC
:1010000021FF1EC0DC01C0E0D0E013C00F5F1F4F06
:10101000F601208531858C91B601F901099500977B
:1010200089F40894E11CF11CD801E814F90471F763
:101030002196CA15DB0531F08D01EE24FF24F4CF93
:10104000C0E0D0E0CE01DF91CF911F910F91FF90D2
:10105000EF90DF90CF90BF90AF909F908F900895CA
:101060002F923F924F925F926F927F928F929F92B8
:10107000AF92BF92CF92DF92EF92FF920F931F93A6
:10108000CF93DF93CDB7DEB72D970FB6F894DEBFC1
:101090000FBECDBF3C017D876C875A01FC011782D2
:1010A0001682838181FFBBC12E010894411C511C13
:1010B000F3019381EC85FD8593FD859193FF8191EB
:1010C000FD87EC87882309F4A6C1853241F493FD9E
:1010D000859193FF8191FD87EC87853221F490E023
:1010E000B3010ED2E5CFFF24EE2410E01032B0F4AD
:1010F0008B3269F08C3228F4803251F0833271F4F3
:101100000BC08D3239F0803349F411602CC012606D
:10111000146029C0186027C0106125C017FD2EC0BB
:10112000282F20532A3098F416FF08C08F2D880FDF
:10113000F82EFF0CFF0CF80EF20E15C08E2D880F46
:10114000E82EEE0CEE0CE80EE20E10620CC08E32B1
:1011500021F416FD60C1106406C08C3611F41068CD
:1011600002C0883659F4EC85FD8593FD859193FF87
:101170008191FD87EC87882309F0B8CF982F95548B
:10118000933018F09052933038F424E030E0A20EFF
:10119000B31E3FE339830FC0833631F0833781F0CC
:1011A000833509F056C021C0F5018081898322E092
:1011B00030E0A20EB31E21E0C22ED12C420113C09A
:1011C00092E0292E312C2A0C3B1CF5018080918065
:1011D00016FF03C06F2D70E002C06FEF7FEFC401F8
:1011E00044D16C0151011F7714C082E0282E312CAC
:1011F0002A0C3B1CF5018080918016FF03C06F2DE7
:1012000070E002C06FEF7FEFC40124D16C01106861
:10121000510113FD1AC005C080E290E0B30170D106
:10122000EA948E2D90E0C816D906B0F30EC0F401F2
:1012300017FD859117FF81914F0190E0B30160D1B7
:10124000E110EA940894C108D108C114D10479F7D7
:10125000DFC0843611F0893649F5F50117FF07C064
:1012600080819181A281B38124E030E008C0808137
:101270009181AA2797FDA095BA2F22E030E0A20E17
:10128000B31E012F0F76B7FF08C0B095A0959095BB
:1012900081959F4FAF4FBF4F0068BC01CD01A201A8
:1012A0002AE030E059D1D82ED4183EC0853721F439
:1012B0001F7E2AE030E020C0197F8F36A9F08037EA
:1012C00020F4883509F0A7C00BC0803721F088379B
:1012D00009F0A1C001C0106114FF09C0146007C06B
:1012E00014FF08C0166006C028E030E005C020E109
:1012F00030E002C020E132E0F50117FF07C0608155
:1013000071818281938144E050E006C060817181E7
:1013100080E090E042E050E0A40EB51EA2011CD196
:10132000D82ED418012F0F7706FF09C00E7FDF14C7
:1013300030F404FF06C002FD04C00F7E02C01D2D64
:1013400001C01F2D802F90E004FF0CC0FE01ED0DA9
:10135000F11D2081203311F4097E09C002FF06C06F
:101360001E5F05C086789070009709F01F5F802E81
:10137000992403FD11C000FF0CC0FD2C1E1548F47C
:10138000FE0CF11A1E2D05C080E290E0B301B8D02A
:101390001F5F1E15C8F304C01E1510F4E11A01C02A
:1013A000EE2484FE0EC080E390E0B301A9D082FE5B
:1013B0001DC081FE03C088E590E010C088E790E082
:1013C0000DC0C40186789070009781F081FC02C046
:1013D00080E201C08BE207FD8DE290E0B30190D086
:1013E00005C080E390E0B3018BD0FA94DF14C8F31A
:1013F000DA94F201ED0DF11D808190E0B30180D00F
:10140000DD20B1F705C080E290E0B30179D0EA9425
:10141000EE20C9F74DCEF3018681978102C08FEF90
:101420009FEF2D960FB6F894DEBF0FBECDBFDF91B4
:10143000CF911F910F91FF90EF90DF90CF90BF90D1
:10144000AF909F908F907F906F905F904F903F9064
:101450002F900895FC010590615070400110D8F75D
:10146000809590958E0F9F1F0895FC0161507040EC
:1014700001900110D8F7809590958E0F9F1F0895C9
:10148000CF93DF93EC012B8120FF35C026FF09C0ED
:101490002F7B2B838E819F8101969F838E838A81F0
:1014A00028C022FF0FC0E881F9818081992787FD3C
:1014B0009095009719F420622B831DC03196F98313
:1014C000E88311C0EA85FB85CE01099597FF0BC023
:1014D0002B813FEF8F3F930711F480E101C080E241
:1014E000822B8B8308C02E813F812F5F3F4F3F832C
:1014F0002E8390E002C08FEF9FEFDF91CF91089590
:101500000F931F93CF93DF938C01EB018B8181FFAE
:101510001BC082FF0DC02E813F818C819D812817C9
:10152000390764F4E881F9810193F983E88306C0FF
:10153000E885F985802F0995009731F48E819F8188
:1015400001969F838E8302C00FEF1FEFC801DF91CA
:10155000CF911F910F910895FA01AA27283051F1D8
:10156000203181F1E8946F936E7F6E5F7F4F8F4FD4
:101570009F4FAF4FB1E03ED0B4E03CD0670F781F33
:10158000891F9A1FA11D680F791F8A1F911DA11D18
:101590006A0F711D811D911DA11D20D009F4689451
:1015A0003F912AE0269F11243019305D3193DEF6F9
:1015B000CF010895462F4770405D4193B3E00FD0AF
:1015C000C9F7F6CF462F4F70405D4A3318F0495D9A
:1015D00031FD4052419302D0A9F7EACFB4E0A6957D
:1015E0009795879577956795BA95C9F7009761059F
:1015F000710508959B01AC010A2E069457954795F5
:1016000037952795BA95C9F7620F731F841F951FE9
:08161000A01D0895F894FFCF1E
:10161800504F525444203D202533780D0A00008352
:101628001000000104100000018208000001000001
:10163800000000000000000000A1200000000002DF
:0A16480000A10100000000000000F6
:00000001FF

View File

@@ -5,10 +5,10 @@
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
<config name="lufa.drivers.board.name" value="usbkey"/>
<config name="lufa.drivers.board.name" value="micropendous"/>
<build type="define" name="F_CPU" value="8000000UL"/>
<build type="define" name="F_USB" value="8000000UL"/>
<build type="define" name="F_CPU" value="16000000UL"/>
<build type="define" name="F_USB" value="16000000UL"/>
</project>
<module type="application" id="lufa.demos.device.class.cdc" caption="Virtual Serial CDC Device Demo (Class Driver APIs)">

View File

@@ -1,38 +1,40 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = USBKEY
F_CPU = 8000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = VirtualSerial
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../../../LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = MICROPENDOUS_REV2
F_CPU = 16000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = VirtualSerial
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../libs/LUFA/LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =
CDC_BOOTLOADER_PORT = /dev/ttyACM0
#CDC_BOOTLOADER_PORT = COM5
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk

View File

@@ -0,0 +1,43 @@
# Purpose: Write then read characters from a serial port loopback device
# Visit www.Micropendous.org/Serial for more info.
# Created: 2009-09-31 by Opendous Inc.
# Last Edit: 2009-10-02 by Opendous Inc.
# Released to the Public Domain
import serial # PySerial for accessing the serial port on multiple platforms
import sys # command-line argument handling
# function which sends then reads data from the given serial port
# comport should be a string
def SerialSendReceive(comport):
# open the given serial port for communication
ser = serial.Serial(comport)
ser.setTimeout(1000)
ser.setWriteTimeout(1000)
print ser # dump all info regarding serial port being used
ser.write('www.Micropendous.org') # send these characters to the serial port
print ser.read(20) # read the above characters back, assuming loopback
ser.write('www.Micropendous.org\n') # send this line to the serial port
print ser.readline() # read the returned line
# be careful using readline() as it will block until a newline character is received
ser.close() # release/close the serial port
# if this file is the program actually being run, print usage info or run SerialSendReceive
if __name__ == '__main__':
if (len(sys.argv) != 2):
print "Serial Communication Example"
print " Usage:"
print " python", sys.argv[0], "<port>"
print " Where <port> = serial port; COM? on Windows, '/dev/ttyACM0 on Linux'"
print " Enumerated serial port can be found on Linux using dmesg"
print " look for something like cdc_acm 2-1:1.0: ttyACM0: USB ACM device"
print " python", sys.argv[0], "COM5"
exit()
SerialSendReceive(sys.argv[1])

View File

@@ -1,260 +1,260 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_NoSpecificSubclass,
.Protocol = CDC_CSCP_NoSpecificProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
.TotalEndpoints = 1,
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_ACMSubclass,
.Protocol = CDC_CSCP_ATCommandProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
.CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
.CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
.TotalEndpoints = 2,
.Class = CDC_CSCP_CDCDataClass,
.SubClass = CDC_CSCP_NoDataSubclass,
.Protocol = CDC_CSCP_NoDataProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
}
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
.UnicodeString = L"Dean Camera"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
.UnicodeString = L"LUFA CDC Demo"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
}
*DescriptorAddress = Address;
return Size;
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
* the device's capabilities and functions.
*/
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
*/
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
.USBSpecification = VERSION_BCD(01.10),
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_NoSpecificSubclass,
.Protocol = CDC_CSCP_NoSpecificProtocol,
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
.TotalEndpoints = 1,
.Class = CDC_CSCP_CDCClass,
.SubClass = CDC_CSCP_ACMSubclass,
.Protocol = CDC_CSCP_ATCommandProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
.CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_NOTIFICATION_EPADDR,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
.CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
.TotalEndpoints = 2,
.Class = CDC_CSCP_CDCDataClass,
.SubClass = CDC_CSCP_NoDataSubclass,
.Protocol = CDC_CSCP_NoDataProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_RX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
},
.CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = CDC_TX_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x05
}
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
const USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
.UnicodeString = {LANGUAGE_ID_ENG}
};
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
.UnicodeString = L"www.micropendous.org"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(44), .Type = DTYPE_String},
.UnicodeString = L"Micropendous VirtualSerial FreeRTOS Loopback"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
break;
}
*DescriptorAddress = Address;
return Size;
}

View File

@@ -1,89 +1,89 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Control Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
/*
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
***************************************************************************
* *
* FreeRTOS tutorial books are available in pdf and paperback. *
* Complete, revised, and edited pdf reference manuals are also *
* available. *
* *
* Purchasing FreeRTOS documentation will not only help you, by *
* ensuring you get running as quickly as possible and with an *
* in-depth knowledge of how to use FreeRTOS, it will also help *
* the FreeRTOS project to continue with its mission of providing *
* professional grade, cross platform, de facto standard solutions *
* for microcontrollers - completely free of charge! *
* *
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
* *
* Thank you for using FreeRTOS, and thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
distribute a combined work that includes FreeRTOS without being obliged to
provide the source code for proprietary components outside of the FreeRTOS
kernel.
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
viewed here: http://www.freertos.org/a00114.html and also obtained by
writing to Real Time Engineers Ltd., contact details for whom are available
on the FreeRTOS WEB site.
1 tab == 4 spaces!
***************************************************************************
* *
* Having a problem? Start by reading the FAQ "My application does *
* not run, what could be wrong?" *
* *
* http://www.FreeRTOS.org/FAQHelp.html *
* *
***************************************************************************
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
license and Real Time Engineers Ltd. contact details.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, and our new
fully thread aware and reentrant UDP/IP stack.
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
Integrity Systems, who sell the code with commercial support,
indemnification and middleware, under the OpenRTOS brand.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#include <avr/io.h>
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) F_CPU )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( (size_t ) ( 1500 ) )
#define configMAX_TASK_NAME_LEN ( 8 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 1
#define configIDLE_SHOULD_YIELD 1
#define configQUEUE_REGISTRY_SIZE 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#endif /* FREERTOS_CONFIG_H */

View File

@@ -0,0 +1,64 @@
# Purpose: Test the throughput of a Micropendous board loaded with Virtual Serial Port loopback firmware
# Visit www.Micropendous.org/Serial for more info.
# Created: 2008-09-30 by Opendous Inc.
# Last Edit: 2009-10-03 by Opendous Inc.
# Released under the MIT License
import serial # for accessing the serial port on multiple platforms
import time, sys
# test Serial Port throughput by sending and receiving transfersToComplete number
# of transferSize sized strings
# comport is a string - the Serial Port name to use
# transferSize is an integer - the string lenght
# transfersToComplete is an integer - the number of transfers to test with
def SerialThroughputTest(comport, transferSize, transfersToComplete):
ser = serial.Serial(comport) # open serial port for communication
print ser # dump all info regarding serial port being used
ScriptStartTime = time.time()
# create a transferSize length string
i = 0
s = ''
while (i < (transferSize - 1)):
s = s + 'A'
i = i + 1
# want last letter to be X
s = s + 'X'
# complete a series of transfers
i = 0
while (i < transfersToComplete):
# send one string to device then get back the string
ser.write(s)
receivedData = ser.read(transferSize)
#print receivedData
i = i + 1
ScriptEndTime = time.time()
print "\nIt took", (ScriptEndTime - ScriptStartTime), "seconds to transfer", \
(transfersToComplete * transferSize), "bytes for a throughput of", \
(((transfersToComplete * transferSize) / (ScriptEndTime - ScriptStartTime)) / 1000), "kbytes/second"
# be careful using readline as it will block until a newline character is received
ser.close() # release/close the serial port
# if this file is the program actually being run, print usage info or run SerialThroughputTest
if __name__ == '__main__':
if (len(sys.argv) != 4):
print "Serial Communication Throughput Testing"
print " Usage:"
print " python", sys.argv[0], "<port> <transferSize> <testSize>"
print " Where <port> = serial port; COM? on Windows, '/dev/ttyACM0 on Linux'"
print " Enumerated serial port can be found on Linux using dmesg"
print " look for something like cdc_acm 2-1:1.0: ttyACM0: USB ACM device"
print " Where <transferSize> = the size of each transfer, this value should match"
print " CDC_TXRX_EPSIZE in Descriptors.h for maximum throughput"
print " Where <testSize> = how many transfers to complete, 100 is usually enough"
print " "
print " python", sys.argv[0], "COM5 64 100"
exit()
SerialThroughputTest(sys.argv[1], int(sys.argv[2]), int(sys.argv[3]))

View File

@@ -1,175 +1,236 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the VirtualSerial demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "VirtualSerial.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
* used like any regular character stream in the C APIs
*/
static FILE USBSerialStream;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
CheckJoystickMovement();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
USB_Init();
}
/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
void CheckJoystickMovement(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
ReportString = "Joystick Down\r\n";
else if (JoyStatus_LCL & JOY_LEFT)
ReportString = "Joystick Left\r\n";
else if (JoyStatus_LCL & JOY_RIGHT)
ReportString = "Joystick Right\r\n";
else if (JoyStatus_LCL & JOY_PRESS)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
/* Write the string to the virtual COM port via the created character stream */
fputs(ReportString, &USBSerialStream);
/* Alternatively, without the stream: */
// CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString);
}
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Updated for Loopback by Opendous Inc. 2013-03-16
www.Micropendous.org/VirtualSerial
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Main source file for the VirtualSerial demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "VirtualSerial.h"
// Global buffer for use with STDIO functions
volatile char buffer[CDC_TXRX_EPSIZE];
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpoint =
{
.Address = CDC_TX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.DataOUTEndpoint =
{
.Address = CDC_RX_EPADDR,
.Size = CDC_TXRX_EPSIZE,
.Banks = 1,
},
.NotificationEndpoint =
{
.Address = CDC_NOTIFICATION_EPADDR,
.Size = CDC_NOTIFICATION_EPSIZE,
.Banks = 1,
},
},
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
* used like any regular character stream in the C APIs
*/
static FILE USBSerialStream;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
GlobalInterruptEnable();
// Create Tasks for FreeRTOS
// The VirtualSerial/USB-CDC task is highest priority to ensure USB functions run in time
xTaskCreate(MainTask, (signed portCHAR *) "MainTask", configMINIMAL_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL );
xTaskCreate(VirtualSerialTask, (signed portCHAR *) "ViSeTask", configMINIMAL_STACK_SIZE, NULL, (ViSe_TASK_PRIORITY | portPRIVILEGE_BIT), NULL );
// Start the scheduler
vTaskStartScheduler();
// Should never get here!
return 0;
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Disable JTAG; allows upper nibble of Port F to be used as GPIO */
#if ( defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
defined(__AVR_ATmega32U6__) )
JTAG_DISABLE();
#endif
/* Hardware Initialization */
LEDs_Init();
LEDs_TurnOnLEDs(LEDS_LED1);
DISABLE_VOLTAGE_TXRX(); // used on Micropendous REV1/2 boards
DISABLE_EXT_SRAM(); // used on Micropendous REV1/2 boards
SELECT_USB_B(); // needed for Micropendous REV1/2 boards
USB_Init();
}
// CoRoutines are not enabled, but FreeRTOS complains during compile
void vApplicationIdleHook(void)
{
//vCoRoutineSchedule();
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
static void VirtualSerialTask(void *pvParameters)
{
for (;;)
{
// Must throw away unused bytes from the host, or it will lock up while waiting for the device
// TODO: this causes loopback to fail
//CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
// want CDC and USB functions to run without interruption but
// with interrupts enabled so ENTER/EXIT_CRITICAL won't work
vTaskSuspendAll();
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
xTaskResumeAll();
vTaskDelay((portTickType) taskDelayPeriod );
}
}
static void MainTask(void *pvParameters)
{
for(;;) {
MainTaskLoop();
portYIELD();
}
}
void MainTaskLoop(void)
{
int count = 0;
// If the host has sent data then echo it back
// Throughput is maximized if the full EP buffer is read and sent each time
// Throughput approaches CDC_TXRX_EPSIZE kbytes/second and depends on transfer size from host
// NOTE: AVRlibc stdio functions are not thread-safe and must therefore be in a Suspend-Resume section
vTaskSuspendAll();
count = fread(&buffer, 1, CDC_TXRX_EPSIZE, &USBSerialStream);
xTaskResumeAll();
//TODO: you can process the received buffer data here
vTaskSuspendAll();
if (count > 0) {
fwrite(&buffer, 1, count, &USBSerialStream);
}
xTaskResumeAll();
// If HWB Button is pressed then send formatted strings
if (Buttons_GetStatus()) {
// NOTE: AVRlibc stdio functions are not thread-safe and must therefore be in a Suspend-Resume section
vTaskSuspendAll();
fprintf_P(&USBSerialStream, PSTR("\r\nHWB has been pressed!\r\n")); // send a constant string stored in FLASH
fprintf(&USBSerialStream, "PORTD = %3x\r\n", PIND); // send a string that is dynamic and stored in SRAM
xTaskResumeAll();
}
}

View File

@@ -1,76 +1,92 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for VirtualSerial.c.
*/
#ifndef _VIRTUALSERIAL_H_
#define _VIRTUALSERIAL_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdio.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
#endif
/*
LUFA Library
Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims 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
*
* Header file for VirtualSerial.c.
*/
#ifndef _VIRTUALSERIAL_FREERTOS_H_
#define _VIRTUALSERIAL_FREERTOS_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdio.h>
#include "Descriptors.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
// FreeRTOS include files
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "FreeRTOSConfig.h"
// FreeRTOS Task Settings
// USB-CDC/VirtualSerial Task must run at higher priority than the MainTask loop
#define MAIN_TASK_PRIORITY ( configMAX_PRIORITIES - 3 )
#define ViSe_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) // highest priority
#define taskDelayPeriod 3
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void MainTaskLoop(void);
void vApplicationIdleHook(void);
static void VirtualSerialTask(void *pvParameters);
static void MainTask(void *pvParameters);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
#endif

View File

@@ -1,73 +1,73 @@
/** \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.
*/
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF CDC Class Standard</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
*
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
* Operating Systems should automatically use their own inbuilt
* CDC-ACM drivers.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/
/** \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.
*/
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
* \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF CDC Class Standard</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
*
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
* Windows. This will enable Windows to use its inbuilt CDC drivers,
* negating the need for custom drivers for the device. Other
* Operating Systems should automatically use their own inbuilt
* CDC-ACM drivers.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/

View File

@@ -0,0 +1,548 @@
:10000000C6C00000E3C00000E1C00000DFC0000087
:10001000DDC00000DBC00000D9C00000D7C0000078
:10002000D5C00000D3C00000B0C300007BC40000F6
:10003000CDC00000CBC00000C9C00000C7C0000098
:10004000C5C000000C94450DC1C00000BFC0000039
:10005000BDC00000BBC00000B9C00000B7C00000B8
:10006000B5C00000B3C00000B1C00000AFC00000C8
:10007000ADC00000ABC00000A9C00000A7C00000D8
:10008000A5C00000A3C00000A1C000009FC00000E8
:100090009DC000009BC000000D0A485742206861C7
:1000A00073206265656E2070726573736564210DDF
:1000B0000A005A034D006900630072006F0070006F
:1000C00065006E0064006F0075007300200056002C
:1000D000690072007400750061006C0053006500D7
:1000E0007200690061006C0020004600720065002B
:1000F0006500520054004F00530020004C006F0078
:100100006F0070006200610063006B0000002A0352
:100110007700770077002E006D00690063007200A1
:100120006F00700065006E0064006F007500730062
:100130002E006F007200670000000403090409022A
:100140003E00020100C03209040000010202010069
:1001500005240010010424020605240600010705F9
:1001600082030800FF09040100020A0000000705DD
:10017000040210000507058302100005120110019A
:1001800002000008EB03442001000102DC011124FD
:100190001FBECFEFD0E2DEBFCDBF11E0A0E0B1E0E7
:1001A000E4ECF1E200E00BBF02C007900D92A23533
:1001B000B107D9F71BBE17E0A2E5B1E001C01D925F
:1001C000A93CB107E1F737D00C94E01019CF0E9499
:1001D0004E0980E291E09ED64BD50E94F30983E060
:1001E00090E00E949B0AF3CF84B7877F84BF88E1A9
:1001F0000FB6F89480936000109260000FBE80E00C
:1002000090E020E80FB6F89420936100809361009D
:100210000FBE85B7806890E00FB6F89485BF0FBE1B
:1002200085BF219A2998299A73986B9A6C9A749A27
:1002300077986F9A8FC2AF92BF92CF92DF92EF9270
:10024000FF920F93D1DF80E291E062E571E0B8D6D2
:10025000789487EB91E060E071E040E850E020E0C6
:1002600030E002E0EE24FF24CC24DD24AA24BB24C9
:10027000F0D687EE90E069E071E040E850E020E0E1
:1002800030E004E0E6D6E1D780E090E00F91FF9007
:10029000EF90DF90CF90BF90AF9008952998089588
:1002A000299A089580E291E0ACD5882311F090E07E
:1002B00001C092E085B18D7F892B85B9089580E2D8
:1002C00091E0F2C4CF93DF93E9D78CEA97E061E045
:1002D00070E040E150E022E531E00E94880DEC0141
:1002E0000E94F309DBD71C161D064CF48CEA97E03C
:1002F00061E070E0AE0122E531E00E94C50D0E9490
:10030000F3098CB182FD30C0C9D700D000D0C2E55E
:10031000D1E0ADB7BEB71296DC93CE93119788E9C2
:1003200090E014969C938E9313970E946C0D29B1C4
:1003300000D0EDB7FEB73196ADB7BEB71296DC93DD
:10034000CE93119782E191E0938382832483158277
:100350000E945D0DEDB7FEB736960FB6F894FEBF5E
:100360000FBEEDBF0E94F309DF91CF910895AADF80
:100370000E94940CFCCF923029F0933041F09130E0
:10038000E9F417C08EE390E0EEE3F1E01BC08130AA
:1003900041F0813018F0823089F406C0EAE3F1E0E0
:1003A00005C0EEE0F1E002C0E2EBF0E0849190E005
:1003B00009C082E190E0ECE7F1E004C080E090E069
:1003C000E0E0F0E0DA011196FC93EE9308952091BD
:1003D000C7073091C8072617370720F4B901FC0179
:1003E00020E037C061157105D1F72091E8002E7724
:1003F0002093E800F4CF8091C007882309F43FC020
:100400008530C9F18091E80083FD37C08091E80014
:1004100082FD2BC08091E80080FF1BC08091F2001C
:100420009091F30006C021912093F100615070403B
:1004300001966115710519F088309105A0F321E04E
:100440008830910509F020E08091E8008E77809354
:10045000E8006115710579F6222369F606C08091DE
:10046000C007882361F0853061F08091E80082FF49
:10047000F6CF80E0089583E0089581E0089582E05A
:10048000089583E008952091C7073091C807261783
:10049000370720F4B901FC0120E038C0611571056F
:1004A000D1F72091E8002E772093E800F4CF8091D7
:1004B000C007882309F440C08530D1F18091E8005D
:1004C00083FD38C08091E80082FD2CC08091E80057
:1004D00080FF1CC08091F2009091F30007C024912E
:1004E0002093F100319661507040019661157105BD
:1004F00019F08830910598F321E08830910509F0D2
:1005000020E08091E8008E778093E8006115710506
:1005100071F6222361F606C08091C007882361F03E
:10052000853061F08091E80082FFF6CF80E0089589
:1005300083E0089581E0089582E0089583E00895BE
:10054000982F2AC09093E900981739F07091EC0029
:100550002091ED005091F00003C0242F762F50E041
:1005600021FF19C03091EB003E7F3093EB003091BA
:10057000ED003D7F3093ED003091EB003160309322
:10058000EB007093EC002093ED005093F00020916D
:10059000EE0027FF08C09F5F9730A0F28F70809316
:1005A000E90081E0089580E008950F931F93CF93B1
:1005B000DF93162FEC0100E02AC09881992329F1DE
:1005C0006B81E981FA812C81892F8F70873018F532
:1005D0006295660F660F607C991F9927991F692B9A
:1005E000223010F096E001C092E028E030E040E0D8
:1005F00003C04F5F220F331F2E173F07D0F34295E2
:10060000407F492B9DDF882331F00F5F259601172E
:10061000A1F681E001C080E0DF91CF911F910F91A1
:1006200008958091C10787FF13C004C08091C0075F
:100630008823B9F08091E80082FFF8CF8091E8002C
:100640008B778093E80008958091C007882349F054
:100650008091E80080FFF8CF8091E8008E7780934A
:10066000E80008958091E4009091E50045E601C01E
:10067000C9012091EC0020FF23C02091E80020FD5B
:1006800015C02091C007222399F0253099F02091C0
:10069000EB0025FD11C02091E4003091E500281702
:1006A000390739F3415021F784E0089580E0089537
:1006B00082E0089583E0089581E0089580E0089540
:1006C0002091E80022FFDDCFF9CF0F931F93CF9346
:1006D000DF934ED055D0C8EDD0E088818F778883E6
:1006E00088818068888388818F7D8883E7EDF0E04A
:1006F00080818068808319BC1092C0071092BC076B
:100700001092BE071092BD0700EE10E0F801808144
:100710008B7F808388818160888380E060E042E015
:100720000FDFE1EEF0E080818E7F8083E2EEF0E08B
:10073000808181608083808188608083F8018081EE
:100740008E7F8083888180618883DF91CF911F9124
:100750000F910895E8EDF0E080818F7E8083E7EDD2
:10076000F0E080818160808381E08093BF07ADCF1E
:10077000E8EDF0E080818C7F80831092E2000895A4
:100780001092DA001092E10008951F920F920FB6B6
:100790000F920BB60F9211242F933F934F935F93B9
:1007A0006F937F938F939F93AF93BF93EF93FF9339
:1007B0008091E10082FF0AC08091E20082FF06C0C2
:1007C0008091E1008B7F8093E10051D28091DA002B
:1007D00080FF1DC08091D80080FF19C08091DA0091
:1007E0008E7F8093DA008091D90080FF0CC084E175
:1007F00089BD86E189BD09B400FEFDCF81E080930B
:10080000C0074CDD04C019BC1092C00749DD8091BF
:10081000E10080FF18C08091E20080FF14C0809149
:10082000E2008E7F8093E2008091E20080618093FD
:10083000E2008091D80080628093D80019BC85E0E6
:100840008093C00714D28091E10084FF2DC0809175
:10085000E20084FF29C084E189BD86E189BD09B435
:1008600000FEFDCF8091D8008F7D8093D8008091CD
:10087000E1008F7E8093E1008091E2008F7E809383
:10088000E2008091E20081608093E2008091BC07E9
:10089000882321F48091E30087FF02C084E001C037
:1008A00081E08093C007E3D18091E10083FF27C0FE
:1008B0008091E20083FF23C08091E100877F8093D5
:1008C000E10082E08093C0071092BC078091E100B4
:1008D0008E7F8093E1008091E2008E7F8093E20022
:1008E0008091E20080618093E20080E060E042E07D
:1008F00027DE8091F00088608093F000B8D1FF91EE
:10090000EF91BF91AF919F918F917F916F915F9187
:100910004F913F912F910F900BBE0F900FBE0F90F4
:100920001F9018951F920F920FB60F920BB60F9251
:1009300011242F933F934F935F936F937F938F93E4
:100940009F93AF93BF93CF93EF93FF93C091E90031
:10095000CF708091EC001092E9008091F000877FC9
:100960008093F00078941DD01092E9008091F000FF
:1009700088608093F000C093E900FF91EF91CF91E0
:10098000BF91AF919F918F917F916F915F914F91A7
:100990003F912F910F900BBE0F900FBE0F901F90A5
:1009A00018951F93CF93DF93CDB7DEB7AC970FB6F3
:1009B000F894DEBF0FBECDBF80E0E1ECF7E0909190
:1009C000F10091938F5F8830D1F779DC8091E80056
:1009D00083FF35C18091C1072091C207253009F4FA
:1009E00084C0263040F42130A1F1213070F0233052
:1009F00009F025C12EC0283009F4F3C0293009F4CC
:100A000002C1263009F01BC193C0803821F0823822
:100A100009F015C108C08091BD079091BE079923C8
:100A200071F082600CC08091C5078F708093E900DF
:100A30009091EB0081E095FF80E01092E9009091A9
:100A4000E800977F9093E8008093F1001092F10006
:100A5000D3C0882319F0823009F0F1C090E08F7183
:100A60009070009729F08230910509F0E8C00BC022
:100A70008091C307813009F0E2C0233009F080E0A3
:100A80008093BE072CC08091C307882341F5209135
:100A9000C5072F7009F4D3C02093E9008091EB00C3
:100AA00080FF1DC08091C207833021F48091EB004C
:100AB000806213C08091EB0080618093EB0081E045
:100AC00090E002C0880F991F2A95E2F78093EA0010
:100AD0001092EA008091EB0088608093EB00109206
:100AE000E9008091E800877F8AC0882309F0A7C0C9
:100AF0001091C3071F778091E3008078812B80934A
:100B0000E3008091E800877F8093E8008ADD809190
:100B1000E80080FFFCCF8091E30080688093E300D1
:100B2000112311F083E001C082E08093C00787C0E9
:100B30008058823008F083C08091C3079091C40729
:100B400023E08C3D9207A9F583E08C838AE28B83B6
:100B50005FB7F894DE01139680E090E04EE061E22A
:100B6000E42FF0E060935700E49180FF03C0E2952A
:100B7000EF704F5FEF702E2F30E0EA3018F0295CF5
:100B80003F4F02C0205D3F4F13963C932E93129728
:100B9000019612968431910519F75FBF8091E800A4
:100BA000877F8093E800CE0103966AE270E00FDC55
:100BB00012C06091C507AE014F5F5F4FDCDBBC0127
:100BC000009709F43CC08091E800877F8093E8009B
:100BD00089819A8158DC8091E8008B778093E800C6
:100BE0002EC0803861F58091E800877F8093E8000F
:100BF0008091BC078093F1008091E8008E7780930C
:100C0000E8000FDD1CC08823D1F49091C307923017
:100C1000B0F48091E800877F8093E8009093BC0750
:100C200000DD8091BC07882321F48091E30087FFD9
:100C300002C084E001C081E08093C00733DB809173
:100C4000E80083FF0AC08091E800877F8093E80076
:100C50008091EB0080628093EB00AC960FB6F89425
:100C6000DEBF0FBECDBFDF91CF911F9108950895D4
:100C7000CF938091C0078823A9F08091E9008F70FD
:100C80009091EC0090FF02C0C0E801C0C0E0C82B0A
:100C90001092E9008091E80083FF01C082DECF70EE
:100CA000C093E900CF910895CF93DF93EC01809139
:100CB000E80083FFA3C0888190E02091C5073091B0
:100CC000C6072817390709F099C08091C2078132F9
:100CD00069F0823220F4803209F090C03CC0823248
:100CE00009F46BC0833209F089C07AC08091C107D2
:100CF000813A09F083C08091E800877F8093E80003
:100D00008091E80080FFFCCF8C899D89AE89BF89E6
:100D10008093F100492F5A2F6B2F77274093F100D2
:100D2000AD01662777274093F1008B2F9927AA27DB
:100D3000BB278093F100888D8093F100898D80938B
:100D4000F1008A8D8093F1008091E8008E77809386
:100D5000E80067DC53C08091C107813209F04EC0C2
:100D60008091E800877F8093E80005C08091C007EC
:100D7000882309F443C08091E80082FFF7CF3091C7
:100D8000F1002091F1009091F1008091F1003C8BF5
:100D90002D8B9E8B8F8B8091F100888F8091F1003D
:100DA000898F8091F1008A8F8091E8008B77809302
:100DB000E80037DCCE0117D121C08091C107813214
:100DC000E9F48091E800877F8093E8002ADC809135
:100DD000C3079091C407998B888BCE0104D10EC0B4
:100DE0008091C107813251F48091E800877F809320
:100DF000E80017DCCE016091C307F5D0DF91CF91F9
:100E00000895CF93DF93EC014096FC018BE0DF0166
:100E10001D928A95E9F782E08C83898783E08E872B
:100E2000CE01019661E0C1DB882359F0CE01069620
:100E300061E0BBDB882329F0CE010B9661E0B5DBD6
:100E400001C080E0DF91CF910895CF93FC01C62FC0
:100E50008091C0078430E9F444895589668977898F
:100E60004115510561057105A1F081818F70809355
:100E7000E9008091E80085FD08C08091E8008E7748
:100E80008093E800EFDB882329F4C093F10080E031
:100E900001C082E0CF910895282FFB0184859585BC
:100EA000622FD3DF882319F08FEF9FEF089580E042
:100EB00090E00895FC018091C007843029F54489B1
:100EC0005589668977894115510561057105E1F0FC
:100ED00081818F708093E9008091F2009091F300FE
:100EE0000097A1F09091E8008091E8008E778093C0
:100EF000E80095FD0DC0B6DB882359F49091E80019
:100F00009E779093E800089582E0089580E0089528
:100F100080E008952091C007243099F4FC014489B1
:100F2000558966897789411551056105710549F033
:100F300021812F702093E9002091E80020FF01C05B
:100F4000B9CF0895FC018091C007843051F54489E0
:100F5000558966897789411551056105710509F142
:100F600086818F708093E9008091E80082FF1CC029
:100F70008091F2009091F300009721F08091F100B0
:100F800090E002C08FEF9FEF2091F2003091F300CC
:100F90002115310559F42091E8002B772093E800C2
:100FA00008958FEF9FEF08958FEF9FEF0895FC0155
:100FB00084859585C7DF97FF02C08EEF9FEF089568
:100FC000FB012EE0DB011D922A95E9F723E0238344
:100FD0002CE437E03187208727ED37E033872287FD
:100FE0009587848708950895CF93DF93EC01E0916E
:100FF0006001F091610193838283809168019091F7
:101000006901C817D90760F480916C0190916D0156
:1010100060916001709161016E5F7F4F2DD316C0AA
:1010200080916E0190916F016091600170916101FA
:101030006E5F7F4F21D38091500190915101C8176D
:10104000D90720F4D0935101C0935001DF91CF9183
:1010500008954F925F926F927F928F929F92BF926C
:10106000CF92DF92EF92FF920F931F93CF93DF9374
:101070002C014B01EA013901B02E81E290E058D3F6
:101080008C01009709F4CEC0C114D10419F4CE012B
:101090004FD36C01F801D08EC78AC114D10419F462
:1010A000C80176D3BFC0C60165EA70E0AE01EFD4D7
:1010B000CE010197F801C788D08CC80ED91EC8018F
:1010C0004996B40148E050E0E9D4F80110A2CB2DD4
:1010D000F4E0FB1508F4C4E0F801C68B72E0872E3B
:1010E000912C800E911EC4019AD2C8010C9697D201
:1010F000F8011187008785E090E08C1B91099587A6
:101100008487138B028BC601B201A30142D3F8017D
:1011100091838083E114F10419F0F70111830083B6
:101120000FB6F8940F9280916A018F5F80936A01E5
:1011300080916001909161010097B1F51093610178
:101140000093600180916A01813009F03CC0C0E0E9
:10115000D0E0CE0163E0880F991F6A95E1F78C0F0C
:101160009D1F8E589E4F4DD22196C530D10589F7CF
:10117000CFE9D1E0CE0145D258EAC52E51E0D52EB7
:10118000C6013FD281EB91E03CD28AEB91E039D2AB
:1011900083EC91E036D2D0936F01C0936E01D09270
:1011A0006D01C0926C010FC080916601882359F4D3
:1011B000E0916001F09161018689B81620F01093EA
:1011C000610100936001F801268980917001821706
:1011D00010F420937001809171018F5F80937101F1
:1011E00080916701821710F42093670130E0C901F4
:1011F00043E0880F991F4A95E1F7820F931F8E589D
:101200009E4FB40110D20F900FBE809166018823CB
:1012100059F0E0916001F091610186898B1520F40D
:1012200083D302C08FEF01C081E0DF91CF911F9186
:101230000F91FF90EF90DF90CF90BF909F908F9095
:101240007F906F905F904F900895AF92BF92CF9232
:10125000DF92EF92FF920F938DE69AE06BE471E0DC
:1012600040E850E020E030E000E0EE24FF24CC2411
:10127000DD24AA24BB24EDDE813041F4F894809370
:101280006601109269011092680113D30F91FF90CB
:10129000EF90DF90CF90BF90AF900895809165015F
:1012A0008F5F8093650108950F931F93CF93DF9312
:1012B00080916501882309F08CC08091680190912C
:1012C000690101969093690180936801809168019A
:1012D00090916901009779F580916E0190916F016D
:1012E00020916C0130916D0130936F0120936E015C
:1012F00090936D0180936C01809162018F5F809368
:101300006201E0916E01F0916F018081882319F4F0
:101310008FEF9FEF0CC0E0916E01F0916F0105809F
:10132000F681E02D0680F781E02D828193819093F4
:1013300051018093500120916801309169018091A1
:101340005001909151012817390708F447C0E091E6
:101350006E01F0916F018081882319F48FEF9FEF68
:1013600012C0E0916E01F0916F010580F681E02DD1
:10137000C681D7818A819B81209168013091690162
:101380002817390728F4909351018093500126C003
:101390008E010E5F1F4FC801A4D18C899D890097D3
:1013A00019F0CE010C969DD12E898091670182178C
:1013B00010F42093670130E0C90143E0880F991FC2
:1013C0004A95E1F7820F931F8E589E4FB8012BD19B
:1013D000BECF809164018F5F80936401DF91CF91D4
:1013E0001F910F910895EF92FF920F931F93CF9348
:1013F000DF930F92CDB7DEB70FB6F8940F928091BE
:10140000650181508093650180916501882309F011
:1014100059C080916A018823A1F555C0E091B601B9
:10142000F091B701E680F780C7010C965AD1870189
:101430000E5F1F4FC80155D1D70156962C91569774
:1014400080916701821710F42093670130E0C90191
:1014500053E0880F991F5A95E1F7820F931F8E581A
:101460009E4FB801E0D0E0916001F0916101D70199
:1014700056969C9156978689981720F0B1E0B983CB
:1014800001C019828091B101882341F680916401E5
:10149000882339F40BC008DF809164018150809368
:1014A0006401809164018823B1F707C0E981E130CC
:1014B00021F080916301813029F41092630134D2CC
:1014C00081E001C080E00F900FBE0F90DF91CF91BF
:1014D0001F910F91FF90EF90089523C0DFDEC09120
:1014E000BA0181DFCC23E9F00FB6F8940F92E091B6
:1014F000BF01F091C001C681D781CE010296F1D023
:1015000080916A01815080936A0180916B018150C2
:1015100080936B010F900FBE8F89988D39D1CE01CA
:1015200037D180916B018823C9F680917201823096
:10153000C0F3FAD1F6CF0F931F93CF93DF938C01B3
:10154000009791F0ABDEC0916801D0916901C00FA6
:10155000D11F80916001909161010296C2D0CE01AD
:1015600043DD41DF882309F4DFD1DF91CF911F9163
:101570000F91089580916501882349F081E080935F
:101580006301089580916701815080936701809184
:10159000670190E0FC0173E0EE0FFF1F7A95E1F721
:1015A000E80FF91FEE58FE4F8081882359F3809190
:1015B000670190E0FC0163E0EE0FFF1F6A95E1F721
:1015C000E80FF91FEE58FE4FA181B28112960D90DF
:1015D000BC91A02DB283A183CF010396A817B907B0
:1015E00031F412968D919C9113979283818301809F
:1015F000F281E02D86819781909361018093600153
:101600000895FC010396928381832FEF3FEF34838B
:101610002383968385839087878310820895FC01B6
:10162000118610860895CF93DF93EC01FB01898129
:101630009A81DC0112962D913C911397338322837A
:1016400029813A813583248312962D913C911397F9
:10165000D90115967C936E931497DC0113967C93B5
:101660006E9312977A836983D187C08788818F5F51
:101670008883DF91CF910895CF93DF939C01EB0195
:10168000488159818FEF4F3F580721F4F901A78115
:10169000B08510C0D901139604C012960D90BC916C
:1016A000A02D1296ED91FC9113978081918148179E
:1016B000590798F71296ED91FC911397FB83EA83F3
:1016C000D583C483BD83AC831396DC93CE931297EA
:1016D00039872887F90180818F5F8083DF91CF91DF
:1016E0000895FC01A281B3818481958115969C9314
:1016F0008E931497A481B5818281938113969C93D4
:101700008E931297A085B18511968D919C91129719
:101710008E179F0731F48481958112969C938E9346
:101720001197118610868C9181508C938C9108951D
:10173000CF93DF93EC01B2DD8091CC019091CD018C
:10174000009731F48FEC91E09093CD018093CC0120
:101750008091AA079091AB079E01280F391F45E0A1
:101760002B3D340770F48217930758F4C091CC01D5
:10177000D091CD01C80FD91F3093AB072093AA0792
:1017800002C0C0E0D0E02FDECE01DF91CF910895FE
:10179000089521E1FC012083319732E23083FC017E
:1017A0003297A3E3A083FC0133976083FC01349755
:1017B0007083FC0135971082FC01369760E86083E6
:1017C000FC0137971082FC01389762E06083FC01CE
:1017D000399763E06083FC013A9764E06083FC0121
:1017E0003B9765E06083FC013C9766E06083FC0109
:1017F0003D9767E06083FC013E9768E06083FC01F1
:101800003F9769E06083FC01709760E16083FC01B1
:1018100071972083FC01729722E12083FC0173976A
:1018200023E12083FC01749724E12083FC01759758
:1018300025E12083FC01769726E12083FC01779740
:1018400027E12083FC01789728E12083FC01799728
:1018500029E12083FC017A9720E22083FC017B9719
:1018600021E22083FC017C973083FC017D9723E2F9
:101870002083FC017E974083FC017F975083FC010D
:10188000B09726E22083FC01B19727E22083FC0178
:10189000B29728E22083FC01B39729E22083FC0160
:1018A000B49720E32083FC01B59721E3208386973A
:1018B000089589EF90E090938900809388001092BA
:1018C00080008BE08093810082E080936F00A09184
:1018D0006001B0916101CD91CDBFDD91DEBFFF917F
:1018E000EF91DF91CF91BF91AF919F918F917F91B8
:1018F0006F915F914F913F912F911F910F91FF90A9
:10190000EF90DF90CF90BF90AF909F908F907F909F
:101910006F905F904F903F902F901F900F900FBE51
:101920000F90089581E008950F920FB6F8940F92EA
:101930001F9211242F923F924F925F926F927F924B
:101940008F929F92AF92BF92CF92DF92EF92FF92CF
:101950000F931F932F933F934F935F936F937F93B7
:101960008F939F93AF93BF93CF93DF93EF93FF93A7
:10197000A0916001B09161010DB60D920EB60D926D
:10198000F9DDA0916001B0916101CD91CDBFDD91F4
:10199000DEBFFF91EF91DF91CF91BF91AF919F910A
:1019A0008F917F916F915F914F913F912F911F91F7
:1019B0000F91FF90EF90DF90CF90BF90AF909F90EE
:1019C0008F907F906F905F904F903F902F901F90DF
:1019D0000F900FBE0F9008950F920FB6F8940F92CC
:1019E0001F9211242F923F924F925F926F927F929B
:1019F0008F929F92AF92BF92CF92DF92EF92FF921F
:101A00000F931F932F933F934F935F936F937F9306
:101A10008F939F93AF93BF93CF93DF93EF93FF93F6
:101A2000A0916001B09161010DB60D920EB60D92BC
:101A30003BDCA0DDA0916001B0916101CD91CDBFF3
:101A4000DD91DEBFFF91EF91DF91CF91BF91AF911B
:101A50009F918F917F916F915F914F913F912F91C6
:101A60001F910F91FF90EF90DF90CF90BF90AF90BC
:101A70009F908F907F906F905F904F903F902F90AE
:101A80001F900F900FBE0F900895A6DF1895DC01F0
:101A900001C06D9341505040E0F70895FB01DC0117
:101AA0004150504048F001900D920020C9F701C00C
:101AB0001D9241505040E0F70895CF93DF93CDB78A
:101AC000DEB7AE01475F5F4F8D819E816F81788564
:101AD0009DD0DF91CF9108950F931F93CF93DF9304
:101AE000CDB7DEB70F811885AE01455F5F4FF801B6
:101AF000838188608383C80169857A8587D0F801EE
:101B00002381277F2383DF91CF911F910F91089528
:101B10008F929F92AF92BF92CF92DF92EF92FF92FD
:101B20000F931F93CF93DF934B015A017901F90172
:101B3000238120FF1AC06C01C0E0D0E012C0C701B1
:101B400075D2FFEF8F3F9F0791F0F60181936F01F0
:101B50000F5F1F4F02C000E010E00815190579F76C
:101B60002196CA15DB05B9F702C0C0E0D0E0CE016E
:101B7000DF91CF911F910F91FF90EF90DF90CF9069
:101B8000BF90AF909F908F9008958F929F92AF9249
:101B9000BF92CF92DF92EF92FF920F931F93CF935A
:101BA000DF934B015A016901F901238121FF1EC016
:101BB000DC01C0E0D0E013C00F5F1F4FF6012085AD
:101BC00031858C91B601F9010995009789F4089443
:101BD000E11CF11CD801E814F90471F72196CA152B
:101BE000DB0531F08D01EE24FF24F4CFC0E0D0E01E
:101BF000CE01DF91CF911F910F91FF90EF90DF9079
:101C0000CF90BF90AF909F908F9008952F923F926A
:101C10004F925F926F927F928F929F92AF92BF92FC
:101C2000CF92DF92EF92FF920F931F93CF93DF93A8
:101C3000CDB7DEB72D970FB6F894DEBF0FBECDBF80
:101C40003C017D876C875A01FC01178216828381D3
:101C500081FFBBC12E010894411C511CF3019381EB
:101C6000EC85FD8593FD859193FF8191FD87EC8740
:101C7000882309F4A6C1853241F493FD859193FF31
:101C80008191FD87EC87853221F490E0B3010ED27B
:101C9000E5CFFF24EE2410E01032B0F48B3269F06F
:101CA0008C3228F4803251F0833271F40BC08D32C3
:101CB00039F0803349F411602CC01260146029C0DF
:101CC000186027C0106125C017FD2EC0282F205393
:101CD0002A3098F416FF08C08F2D880FF82EFF0CBD
:101CE000FF0CF80EF20E15C08E2D880FE82EEE0CAC
:101CF000EE0CE80EE20E10620CC08E3221F416FDDE
:101D000060C1106406C08C3611F4106802C08836B9
:101D100059F4EC85FD8593FD859193FF8191FD87B5
:101D2000EC87882309F0B8CF982F9554933018F09A
:101D30009052933038F424E030E0A20EB31E3FE31B
:101D400039830FC0833631F0833781F0833509F052
:101D500056C021C0F5018081898322E030E0A20EC7
:101D6000B31E21E0C22ED12C420113C092E0292ED5
:101D7000312C2A0C3B1CF5018080918016FF03C09A
:101D80006F2D70E002C06FEF7FEFC40144D16C0192
:101D900051011F7714C082E0282E312C2A0C3B1CE5
:101DA000F5018080918016FF03C06F2D70E002C0A6
:101DB0006FEF7FEFC40124D16C011068510113FD56
:101DC0001AC005C080E290E0B30170D1EA948E2D74
:101DD00090E0C816D906B0F30EC0F40117FD859146
:101DE00017FF81914F0190E0B30160D1E110EA94B7
:101DF0000894C108D108C114D10479F7DFC0843632
:101E000011F0893649F5F50117FF07C080819181EE
:101E1000A281B38124E030E008C080819181AA27AB
:101E200097FDA095BA2F22E030E0A20EB31E012F3D
:101E30000F76B7FF08C0B095A095909581959F4FFC
:101E4000AF4FBF4F0068BC01CD01A2012AE030E0D6
:101E500059D1D82ED4183EC0853721F41F7E2AE0F0
:101E600030E020C0197F8F36A9F0803720F4883504
:101E700009F0A7C00BC0803721F0883709F0A1C056
:101E800001C0106114FF09C0146007C014FF08C02E
:101E9000166006C028E030E005C020E130E002C056
:101EA00020E132E0F50117FF07C060817181828176
:101EB000938144E050E006C06081718180E090E051
:101EC00042E050E0A40EB51EA2011CD1D82ED418B9
:101ED000012F0F7706FF09C00E7FDF1430F404FFD7
:101EE00006C002FD04C00F7E02C01D2D01C01F2DC3
:101EF000802F90E004FF0CC0FE01ED0DF11D20814C
:101F0000203311F4097E09C002FF06C01E5F05C020
:101F100086789070009709F01F5F802E992403FD4A
:101F200011C000FF0CC0FD2C1E1548F4FE0CF11A68
:101F30001E2D05C080E290E0B301B8D01F5F1E15D2
:101F4000C8F304C01E1510F4E11A01C0EE2484FE8B
:101F50000EC080E390E0B301A9D082FE1DC081FED7
:101F600003C088E590E010C088E790E00DC0C40190
:101F700086789070009781F081FC02C080E201C0F9
:101F80008BE207FD8DE290E0B30190D005C080E3C5
:101F900090E0B3018BD0FA94DF14C8F3DA94F20125
:101FA000ED0DF11D808190E0B30180D0DD20B1F70F
:101FB00005C080E290E0B30179D0EA94EE20C9F741
:101FC0004DCEF3018681978102C08FEF9FEF2D9652
:101FD0000FB6F894DEBF0FBECDBFDF91CF911F913A
:101FE0000F91FF90EF90DF90CF90BF90AF909F90B8
:101FF0008F907F906F905F904F903F902F900895BB
:10200000FC010590615070400110D8F780959095C3
:102010008E0F9F1F0895FC016150704001900110C8
:10202000D8F7809590958E0F9F1F0895CF93DF93DB
:10203000EC012B8120FF35C026FF09C02F7B2B83AD
:102040008E819F8101969F838E838A8128C022FF83
:102050000FC0E881F9818081992787FD90950097CD
:1020600019F420622B831DC03196F983E88311C0D7
:10207000EA85FB85CE01099597FF0BC02B813FEFC9
:102080008F3F930711F480E101C080E2822B8B83A4
:1020900008C02E813F812F5F3F4F3F832E8390E00A
:1020A00002C08FEF9FEFDF91CF9108950F931F93A1
:1020B000CF93DF938C01EB018B8181FF1BC082FFEB
:1020C0000DC02E813F818C819D812817390764F4D2
:1020D000E881F9810193F983E88306C0E885F985F1
:1020E000802F0995009731F48E819F8101969F83FF
:1020F0008E8302C00FEF1FEFC801DF91CF911F91B8
:102100000F910895FA01AA27283051F1203181F169
:10211000E8946F936E7F6E5F7F4F8F4F9F4FAF4FEF
:10212000B1E03ED0B4E03CD0670F781F891F9A1F02
:10213000A11D680F791F8A1F911DA11D6A0F711DB6
:10214000811D911DA11D20D009F468943F912AE0C2
:10215000269F11243019305D3193DEF6CF010895AA
:10216000462F4770405D4193B3E00FD0C9F7F6CFDB
:10217000462F4F70405D4A3318F0495D31FD4052A3
:10218000419302D0A9F7EACFB4E0A6959795879539
:1021900077956795BA95C9F7009761057105089518
:1021A0009B01AC010A2E06945795479537952795C4
:1021B000BA95C9F7620F731F841F951FA01D08955C
:0421C000F894FFCFC1
:1021C4004D61696E5461736B005669536554617354
:1021D4006B00504F525444203D202533780D0A00A3
:1021E40000831000000104100000018208000001B7
:1021F4000000000000000000000000A1200000001A
:10220400000200A10100000000000049444C450008
:02221400FFFFCA
:00000001FF

View File

@@ -5,10 +5,10 @@
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
<config name="lufa.drivers.board.name" value="usbkey"/>
<config name="lufa.drivers.board.name" value="micropendous"/>
<build type="define" name="F_CPU" value="8000000UL"/>
<build type="define" name="F_USB" value="8000000UL"/>
<build type="define" name="F_CPU" value="16000000UL"/>
<build type="define" name="F_USB" value="16000000UL"/>
</project>
<module type="application" id="lufa.demos.device.class.cdc" caption="Virtual Serial CDC Device Demo (Class Driver APIs)">
@@ -26,12 +26,12 @@
<device-support-alias value="lufa_xmega"/>
<device-support-alias value="lufa_uc3"/>
<build type="distribute" subtype="user-file" value="VirtualSerial.txt"/>
<build type="distribute" subtype="user-file" value="LUFA VirtualSerial.inf"/>
<build type="distribute" subtype="user-file" value="VirtualSerial_FreeRTOS.txt"/>
<build type="distribute" subtype="user-file" value="LUFA_VirtualSerial_FreeRTOS.inf"/>
<build type="c-source" value="VirtualSerial.c"/>
<build type="c-source" value="VirtualSerial_FreeRTOS.c"/>
<build type="c-source" value="Descriptors.c"/>
<build type="header-file" value="VirtualSerial.h"/>
<build type="header-file" value="VirtualSerial_FreeRTOS.h"/>
<build type="header-file" value="Descriptors.h"/>
<build type="module-config" subtype="path" value="Config"/>

View File

@@ -1,38 +1,49 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = USBKEY
F_CPU = 8000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = VirtualSerial
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../../../LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
MCU = at90usb1287
ARCH = AVR8
BOARD = MICROPENDOUS_REV2
F_CPU = 16000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = VirtualSerial
LUFA_PATH = ../../libs/LUFA/LUFA
FREERTOS_PATH = ../../libs/FreeRTOS
FREERTOS_DEMO_DIR = $(FREERTOS_PATH)/Demo/Common/Minimal
FREERTOS_SOURCE_DIR = $(FREERTOS_PATH)/Source
FREERTOS_PORT_DIR = $(FREERTOS_PATH)/Source/portable/GCC/AT90USB_ATmegaXXUY
FREERTOS_SOURCE = $(FREERTOS_SOURCE_DIR)/tasks.c \
$(FREERTOS_SOURCE_DIR)/queue.c \
$(FREERTOS_SOURCE_DIR)/list.c \
$(FREERTOS_SOURCE_DIR)/portable/MemMang/heap_1.c \
$(FREERTOS_PORT_DIR)/port.c
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(FREERTOS_SOURCE)
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -I$(FREERTOS_SOURCE_DIR)/include -I$(FREERTOS_SOURCE_DIR) -I$(FREERTOS_PORT_DIR) -I$(FREERTOS_DEMO_DIR)
LD_FLAGS =
CDC_BOOTLOADER_PORT = /dev/ttyACM0
#CDC_BOOTLOADER_PORT = COM5
# Default target
all:
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk

View File

@@ -0,0 +1,43 @@
# Purpose: Write then read characters from a serial port loopback device
# Visit www.Micropendous.org/Serial for more info.
# Created: 2009-09-31 by Opendous Inc.
# Last Edit: 2009-10-02 by Opendous Inc.
# Released to the Public Domain
import serial # PySerial for accessing the serial port on multiple platforms
import sys # command-line argument handling
# function which sends then reads data from the given serial port
# comport should be a string
def SerialSendReceive(comport):
# open the given serial port for communication
ser = serial.Serial(comport)
ser.setTimeout(1000)
ser.setWriteTimeout(1000)
print ser # dump all info regarding serial port being used
ser.write('www.Micropendous.org') # send these characters to the serial port
print ser.read(20) # read the above characters back, assuming loopback
ser.write('www.Micropendous.org\n') # send this line to the serial port
print ser.readline() # read the returned line
# be careful using readline() as it will block until a newline character is received
ser.close() # release/close the serial port
# if this file is the program actually being run, print usage info or run SerialSendReceive
if __name__ == '__main__':
if (len(sys.argv) != 2):
print "Serial Communication Example"
print " Usage:"
print " python", sys.argv[0], "<port>"
print " Where <port> = serial port; COM? on Windows, '/dev/ttyACM0 on Linux'"
print " Enumerated serial port can be found on Linux using dmesg"
print " look for something like cdc_acm 2-1:1.0: ttyACM0: USB ACM device"
print " python", sys.argv[0], "COM5"
exit()
SerialSendReceive(sys.argv[1])

View File

@@ -0,0 +1,2 @@
This directory contains a copy of FreeRTOS v7.4.0
stripped of all files not related to the USB AVRs.

View File

@@ -79,6 +79,11 @@ Changes from V2.6.0
+ AVR port - Replaced the inb() and outb() functions with direct memory
access. This allows the port to be built with the 20050414 build of
WinAVR.
Changes from FreeRTOS V7.4.0
+ AVR port - Adapted ATmega323 port to the AT90USB USB AVRs
*/
#include <stdlib.h>
@@ -92,13 +97,14 @@ Changes from V2.6.0
*----------------------------------------------------------*/
/* Start tasks with interrupts enables. */
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 )
#define portFLAGS_INT_ENABLED ( ( portSTACK_TYPE ) 0x80 )
/* Hardware constants for timer 1. */
#define portCLEAR_COUNTER_ON_MATCH ( ( unsigned char ) 0x08 )
#define portPRESCALE_64 ( ( unsigned char ) 0x03 )
#define portCLOCK_PRESCALER ( ( unsigned long ) 64 )
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( unsigned char ) 0x10 )
#define portCLEAR_COUNTER_ON_MATCH ( (unsigned portCHAR)(1 << WGM12) )
// CS10 and CS11 will set a prescale value of 64
#define portPRESCALE_64 ( (unsigned portCHAR)((1 << CS10) | (1 << CS11)) )
#define portCLOCK_PRESCALER ( (unsigned portLONG) 64 )
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( (unsigned portCHAR)(1 << OCIE1A) )
/*-----------------------------------------------------------*/
@@ -406,8 +412,7 @@ void vPortYieldFromTick( void )
*/
static void prvSetupTimerInterrupt( void )
{
unsigned long ulCompareMatch;
unsigned char ucHighByte, ucLowByte;
unsigned long ulCompareMatch;
/* Using 16bit timer 1 to generate the tick. Correct fuses must be
selected for the configCPU_CLOCK_HZ clock. */
@@ -422,21 +427,16 @@ unsigned char ucHighByte, ucLowByte;
/* Setup compare match value for compare match A. Interrupts are disabled
before this is called so we need not worry here. */
ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
ulCompareMatch >>= 8;
ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
OCR1AH = ucHighByte;
OCR1AL = ucLowByte;
OCR1A = ulCompareMatch;
/* Start Timer1 */
TCCR1A = 0;
/* Setup clock source and compare match behaviour. */
ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
TCCR1B = ucLowByte;
TCCR1B = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
/* Enable the interrupt - this is okay as interrupt are currently globally
disabled. */
ucLowByte = TIMSK;
ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
TIMSK = ucLowByte;
/* Enable the interrupt - interrupt are currently globally disabled so it will work */
TIMSK1 = portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
}
/*-----------------------------------------------------------*/
@@ -447,8 +447,8 @@ unsigned char ucHighByte, ucLowByte;
* the context is saved at the start of vPortYieldFromTick(). The tick
* count is incremented after the context is saved.
*/
void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal, naked ) );
void SIG_OUTPUT_COMPARE1A( void )
void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal, naked ) );
void TIMER1_COMPA_vect( void )
{
vPortYieldFromTick();
asm volatile ( "reti" );
@@ -460,12 +460,10 @@ unsigned char ucHighByte, ucLowByte;
* tick count. We don't need to switch context, this can only be done by
* manual calls to taskYIELD();
*/
void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) );
void SIG_OUTPUT_COMPARE1A( void )
void TIMER1_COMPA_vect( void ) __attribute__ ( ( signal ) );
void TIMER1_COMPA_vect( void )
{
vTaskIncrementTick();
}
#endif

View File

@@ -0,0 +1,22 @@
svn checkout http://lufa-lib.googlecode.com/svn/trunk/ lufa-lib-read-only
This directory contains LUFA SVN Revision 2637 with the following modifications:
Files Added:
LUFA/Common/MicropendousDefines.h
LUFA/Common/MissingDefines.h
Files Modified:
* to include MicropendousDefines.h and MissingDefines.h:
LUFA/Common/Common.h
* to ease development with Micropendous boards:
LUFA/Common/BoardTypes.h
LUFA/Drivers/Board/Buttons.h
LUFA/Drivers/Board/LEDs.h
LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h
LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h

View File

@@ -1,103 +1,103 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += ATPROGRAM
LUFA_BUILD_TARGETS += atprogram atprogram-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA ATPROGRAM Programmer Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device using the Atmel atprogram
# utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
# -----------------------------------------------------------------------------
# TARGETS:
#
# atprogram - Program target FLASH with application using
# atprogram
# atprogram-ee - Program target EEPROM with application data
# using atprogram
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# ATPROGRAM_PROGRAMMER - Name of programming hardware to use
# ATPROGRAM_INTERFACE - Name of programming interface to use
# ATPROGRAM_PORT - Name of communication port to use
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
ATPROGRAM_PROGRAMMER ?= jtagice3
ATPROGRAM_INTERFACE ?= jtag
ATPROGRAM_PORT ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
# Output Messages
MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
# Construct base atprogram command flags
BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
ifneq ($(ATPROGRAM_PORT),)
BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
endif
# Construct the flags to use for the various memory spaces
ifeq ($(ARCH), AVR8)
ATPROGRAM_FLASH_FLAGS := --chiperase --flash
ATPROGRAM_EEPROM_FLAGS := --eeprom
else ifeq ($(ARCH), XMEGA)
ATPROGRAM_FLASH_FLAGS := --erase --flash
ATPROGRAM_EEPROM_FLAGS := --eeprom
else ifeq ($(ARCH), UC3)
ATPROGRAM_FLASH_FLAGS := --erase
ATPROGRAM_EEPROM_FLAGS := --eeprom
else
$(error Unsupported architecture "$(ARCH)")
endif
# Programs in the target FLASH memory using ATPROGRAM
atprogram: $(TARGET).elf $(MAKEFILE_LIST)
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
# Programs in the target EEPROM memory using ATPROGRAM
atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
# Phony build targets for this module
.PHONY: atprogram atprogram-ee
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += ATPROGRAM
LUFA_BUILD_TARGETS += atprogram atprogram-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA ATPROGRAM Programmer Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device using the Atmel atprogram
# utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
# -----------------------------------------------------------------------------
# TARGETS:
#
# atprogram - Program target FLASH with application using
# atprogram
# atprogram-ee - Program target EEPROM with application data
# using atprogram
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# ATPROGRAM_PROGRAMMER - Name of programming hardware to use
# ATPROGRAM_INTERFACE - Name of programming interface to use
# ATPROGRAM_PORT - Name of communication port to use
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
ATPROGRAM_PROGRAMMER ?= jtagice3
ATPROGRAM_INTERFACE ?= jtag
ATPROGRAM_PORT ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
# Output Messages
MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
# Construct base atprogram command flags
BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
ifneq ($(ATPROGRAM_PORT),)
BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
endif
# Construct the flags to use for the various memory spaces
ifeq ($(ARCH), AVR8)
ATPROGRAM_FLASH_FLAGS := --chiperase --flash
ATPROGRAM_EEPROM_FLAGS := --eeprom
else ifeq ($(ARCH), XMEGA)
ATPROGRAM_FLASH_FLAGS := --erase --flash
ATPROGRAM_EEPROM_FLAGS := --eeprom
else ifeq ($(ARCH), UC3)
ATPROGRAM_FLASH_FLAGS := --erase
ATPROGRAM_EEPROM_FLAGS := --eeprom
else
$(error Unsupported architecture "$(ARCH)")
endif
# Programs in the target FLASH memory using ATPROGRAM
atprogram: $(TARGET).elf $(MAKEFILE_LIST)
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
# Programs in the target EEPROM memory using ATPROGRAM
atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
# Phony build targets for this module
.PHONY: atprogram atprogram-ee

View File

@@ -1,86 +1,96 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += AVRDUDE
LUFA_BUILD_TARGETS += avrdude avrdude-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA AVRDUDE Programmer Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device using the open source
# avr-dude utility.
# -----------------------------------------------------------------------------
# TARGETS:
#
# avrdude - Program target FLASH with application using
# avrdude
# avrdude-ee - Program target EEPROM with application data
# using avrdude
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# AVRDUDE_PROGRAMMER - Name of programming hardware to use
# AVRDUDE_PORT - Name of communication port to use
# AVRDUDE_FLAGS - Flags to pass to avr-dude
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
AVRDUDE_PROGRAMMER ?= jtagicemkii
AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER)
$(call ERROR_IF_EMPTY, AVRDUDE_PORT)
# Output Messages
MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
# Construct base avrdude command flags
BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
# Programs in the target FLASH memory using AVRDUDE
avrdude: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
avrdude $(BASE_AVRDUDE_FLAGS) -U flash:w:$< $(AVRDUDE_FLAGS)
# Programs in the target EEPROM memory using AVRDUDE
avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS)
# Phony build targets for this module
.PHONY: avrdude avrdude-ee
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += AVRDUDE
LUFA_BUILD_TARGETS += avrdude avrdude-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA AVRDUDE Programmer Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device using the open source
# avr-dude utility.
# -----------------------------------------------------------------------------
# TARGETS:
#
# avrdude - Program target FLASH with application using
# avrdude
# avrdude-ee - Program target EEPROM with application data
# using avrdude
# cdc - Program target (with CDC Bootloader) FLASH
# with application using avrdude
# cdc-ee - Program target (with CDC Bootloader) EEPROM
# with application using avrdude
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# AVRDUDE_PROGRAMMER - Name of programming hardware to use
# AVRDUDE_PORT - Name of communication port to use
# AVRDUDE_FLAGS - Flags to pass to avr-dude
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
AVRDUDE_PROGRAMMER ?= jtagicemkii
AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER)
$(call ERROR_IF_EMPTY, AVRDUDE_PORT)
# Output Messages
MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
# Construct base avrdude command flags
BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
# Programs in the target FLASH memory using AVRDUDE
avrdude: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
avrdude $(BASE_AVRDUDE_FLAGS) -U flash:w:$< $(AVRDUDE_FLAGS)
# Programs in the target EEPROM memory using AVRDUDE
avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS)
cdc: $(TARGET).hex
avrdude -v -v -c avr109 -P $(CDC_BOOTLOADER_PORT) -p $(MCU) -U flash:w:$(TARGET).hex
cdc-ee: $(TARGET).hex
avrdude -v -v -c avr109 -P $(CDC_BOOTLOADER_PORT) -p $(MCU) -U eeprom:w:$(TARGET).eep
# Phony build targets for this module
.PHONY: avrdude avrdude-ee cdc cdc-ee

View File

@@ -1,339 +1,339 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += BUILD
LUFA_BUILD_TARGETS += size symbol-sizes all lib elf hex lss clean mostlyclean
LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH
LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL LINKER_RELAXATIONS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA GCC Compiler Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to build a C, C++ and/or Assembly application
# via the AVR-GCC compiler.
# -----------------------------------------------------------------------------
# TARGETS:
#
# size - List built application size
# symbol-sizes - Print application symbols from the binary ELF
# file as a list sorted by size in bytes
# all - Build application and list size
# lib - Build and archive source files into a library
# elf - Build application ELF debug object file
# hex - Build application HEX object files
# lss - Build application LSS assembly listing file
# clean - Remove all project intermediatary and binary
# output files
# mostlyclean - Remove intermediatary output files, but
# preserve binaries
# <filename>.s - Compile C/C++ source file into an assembly file
# for manual code inspection
#
# MANDATORY PARAMETERS:
#
# TARGET - Application name
# ARCH - Device architecture name
# MCU - Microcontroller device model name
# SRC - List of input source files (*.c, *.cpp, *.S)
# F_USB - Speed of the input clock of the USB controller
# in Hz
# LUFA_PATH - Path to the LUFA library core
#
# OPTIONAL PARAMETERS:
#
# BOARD - LUFA board hardware
# OPTIMIZATION - Optimization level
# C_STANDARD - C Language Standard to use
# CPP_STANDARD - C++ Language Standard to use
# F_CPU - Speed of the CPU, in Hz
# C_FLAGS - Flags to pass to the C compiler only
# CPP_FLAGS - Flags to pass to the C++ compiler only
# ASM_FLAGS - Flags to pass to the assembler only
# CC_FLAGS - Common flags to pass to the C/C++ compiler and
# assembler
# LD_FLAGS - Flags to pass to the linker
# LINKER_RELAXATIONS - Enable or disable linker relaxations to
# decrease binary size (note: can cause link
# failures on systems with an unpatched binutils)
# OBJDIR - Directory for the output object and dependency
# files; if equal to ".", the output files will
# be generated in the same folder as the sources
# OBJECT_FILES - Extra object files to link in to the binaries
# DEBUG_FORMAT - Format of the debugging information to
# generate in the compiled object files
# DEBUG_LEVEL - Level the debugging information to generate in
# the compiled object files
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
BOARD ?= NONE
OPTIMIZATION ?= s
F_CPU ?=
C_STANDARD ?= gnu99
CPP_STANDARD ?= gnu++98
C_FLAGS ?=
CPP_FLAGS ?=
ASM_FLAGS ?=
CC_FLAGS ?=
OBJDIR ?= .
OBJECT_FILES ?=
DEBUG_FORMAT ?= dwarf-2
DEBUG_LEVEL ?= 2
LINKER_RELAXATIONS ?= Y
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, ARCH)
$(call ERROR_IF_EMPTY, F_USB)
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, BOARD)
$(call ERROR_IF_EMPTY, OPTIMIZATION)
$(call ERROR_IF_EMPTY, C_STANDARD)
$(call ERROR_IF_EMPTY, CPP_STANDARD)
$(call ERROR_IF_EMPTY, OBJDIR)
$(call ERROR_IF_EMPTY, DEBUG_FORMAT)
$(call ERROR_IF_EMPTY, DEBUG_LEVEL)
$(call ERROR_IF_NONBOOL, LINKER_RELAXATIONS)
# Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8)
CROSS := avr
else ifeq ($(ARCH), XMEGA)
CROSS := avr
$(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
else ifeq ($(ARCH), UC3)
CROSS := avr32
$(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
else
$(error Unsupported architecture "$(ARCH)")
endif
# Output Messages
MSG_INFO_MESSAGE := ' [INFO] :'
MSG_COMPILE_CMD := ' [GCC] :'
MSG_ASSEMBLE_CMD := ' [GAS] :'
MSG_NM_CMD := ' [NM] :'
MSG_REMOVE_CMD := ' [RM] :'
MSG_LINK_CMD := ' [LNK] :'
MSG_ARCHIVE_CMD := ' [AR] :'
MSG_SIZE_CMD := ' [SIZE] :'
MSG_OBJCPY_CMD := ' [OBJCPY] :'
MSG_OBJDMP_CMD := ' [OBJDMP] :'
# Convert input source file list to differentiate them by type
C_SOURCE := $(filter %.c, $(SRC))
CPP_SOURCE := $(filter %.cpp, $(SRC))
ASM_SOURCE := $(filter %.S, $(SRC))
# Create a list of unknown source file types, if any are found throw an error
UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC))
ifneq ($(UNKNOWN_SOURCE),)
$(error Unknown input source file formats: $(UNKNOWN_SOURCE))
endif
# Convert input source filenames into a list of required output object files
OBJECT_FILES += $(addsuffix .o, $(basename $(SRC)))
# Check if an output object file directory was specified instead of the input file location
ifneq ($(OBJDIR),.)
# Prefix all the object filenames with the output object file directory path
OBJECT_FILES := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES)))
# Check if any object file (without path) appears more than once in the object file list
ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES)))
$(error Cannot build with OBJDIR parameter set - one or more object file name is not unique)
endif
# Create the output object file directory if it does not exist and add it to the virtual path list
$(shell mkdir $(OBJDIR) 2> /dev/null)
VPATH += $(dir $(SRC))
endif
# Create a list of dependency files from the list of object files
DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d)
# Create a list of common flags to pass to the compiler/linker/assembler
BASE_CC_FLAGS := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL)
ifeq ($(ARCH), AVR8)
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), XMEGA)
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), UC3)
BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos
endif
BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
BASE_CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
ifneq ($(F_CPU),)
BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL
endif
# Additional language specific compiler flags
BASE_C_FLAGS := -x c -O$(OPTIMIZATION) -std=$(C_STANDARD) -Wstrict-prototypes
BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD)
BASE_ASM_FLAGS := -x assembler-with-cpp
# Create a list of flags to pass to the linker
BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections
ifeq ($(LINKER_RELAXATIONS), Y)
BASE_LD_FLAGS += -Wl,--relax
endif
ifeq ($(ARCH), AVR8)
BASE_LD_FLAGS += -mmcu=$(MCU)
else ifeq ($(ARCH), XMEGA)
BASE_LD_FLAGS += -mmcu=$(MCU)
else ifeq ($(ARCH), UC3)
BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data
endif
# Determine flags to pass to the size utility based on its reported features (only invoke if size target required)
# and on an architecture where this non-standard patch is available
ifneq ($(ARCH), UC3)
size: SIZE_MCU_FLAG := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
endif
# Pre-build informational target, to give compiler and project name information when building
build_begin:
@echo $(MSG_INFO_MESSAGE) Begin compilation of project \"$(TARGET)\"...
@echo ""
@$(CROSS)-gcc --version
# Post-build informational target, to project name information when building has completed
build_end:
@echo $(MSG_INFO_MESSAGE) Finished building project \"$(TARGET)\".
# Prints size information of a compiled application (FLASH, RAM and EEPROM usages)
size: $(TARGET).elf
@echo $(MSG_SIZE_CMD) Determining size of \"$<\"
@echo ""
$(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $<
# Prints size information on the symbols within a compiled application in decimal bytes
symbol-sizes: $(TARGET).elf
@echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes
$(CROSS)-nm --size-sort --demangle --radix=d $<
# Cleans intermediary build files, leaving only the compiled application files
mostlyclean:
@echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
rm -f $(OBJECT_FILES)
@echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\"
rm -f $(DEPENDENCY_FILES)
# Cleans all build files, leaving only the original source code
clean: mostlyclean
@echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\"
rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym $(TARGET).a
# Performs a complete build of the user application and prints size information afterwards
all: build_begin elf hex bin lss sym size build_end
# Helper targets, to build a specific type of output file without having to know the project target name
lib: lib$(TARGET).a
elf: $(TARGET).elf
hex: $(TARGET).hex $(TARGET).eep
bin: $(TARGET).bin $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Default target to *create* the user application's specified source files; if this rule is executed by
# make, the input source file doesn't exist and an error needs to be presented to the user
$(SRC):
$(error Source file does not exist: $@)
# Compiles an input C source file and generates an assembly listing for it
%.s: %.c $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Generating assembly from C file \"$(notdir $<)\"
$(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) $< -o $@
# Compiles an input C++ source file and generates an assembly listing for it
%.s: %.cpp $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Generating assembly from C++ file \"$(notdir $<)\"
$(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) $< -o $@
# Compiles an input C source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Compiles an input C++ source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Assembles an input ASM source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST)
@echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Generates a library archive file from the user application, which can be linked into other applications
.PRECIOUS : $(OBJECT_FILES)
.SECONDARY : %.a
%.a: $(OBJECT_FILES)
@echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\"
$(CROSS)-ar rcs $@ $(OBJECT_FILES)
# Generates an ELF debug file from the user application, which can be further processed for FLASH and EEPROM data
# files, or used for programming and debugging directly
.PRECIOUS : $(OBJECT_FILES)
.SECONDARY : %.elf
%.elf: $(OBJECT_FILES)
@echo $(MSG_LINK_CMD) Linking object files into \"$@\"
$(CROSS)-gcc $^ -o $@ $(BASE_LD_FLAGS) $(LD_FLAGS)
# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Intel HEX format file of it
%.hex: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"
$(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Binary format file of it
%.bin: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting BIN file data from \"$<\"
$(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $< $@
# Extracts out the loadable EEPROM memory data from the project ELF file, and creates an Intel HEX format file of it
%.eep: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\"
$(CROSS)-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0
# Creates an assembly listing file from an input project ELF file, containing interleaved assembly and source data
%.lss: %.elf
@echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\"
$(CROSS)-objdump -h -d -S -z $< > $@
# Creates a symbol file listing the loadable and discarded symbols from an input project ELF file
%.sym: %.elf
@echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\"
$(CROSS)-nm -n $< > $@
# Include build dependency files
-include $(DEPENDENCY_FILES)
# Phony build targets for this module
.PHONY: build_begin build_end size symbol-sizes lib elf hex lss clean mostlyclean
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += BUILD
LUFA_BUILD_TARGETS += size symbol-sizes all lib elf hex lss clean mostlyclean
LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH
LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL LINKER_RELAXATIONS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA GCC Compiler Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to build a C, C++ and/or Assembly application
# via the AVR-GCC compiler.
# -----------------------------------------------------------------------------
# TARGETS:
#
# size - List built application size
# symbol-sizes - Print application symbols from the binary ELF
# file as a list sorted by size in bytes
# all - Build application and list size
# lib - Build and archive source files into a library
# elf - Build application ELF debug object file
# hex - Build application HEX object files
# lss - Build application LSS assembly listing file
# clean - Remove all project intermediatary and binary
# output files
# mostlyclean - Remove intermediatary output files, but
# preserve binaries
# <filename>.s - Compile C/C++ source file into an assembly file
# for manual code inspection
#
# MANDATORY PARAMETERS:
#
# TARGET - Application name
# ARCH - Device architecture name
# MCU - Microcontroller device model name
# SRC - List of input source files (*.c, *.cpp, *.S)
# F_USB - Speed of the input clock of the USB controller
# in Hz
# LUFA_PATH - Path to the LUFA library core
#
# OPTIONAL PARAMETERS:
#
# BOARD - LUFA board hardware
# OPTIMIZATION - Optimization level
# C_STANDARD - C Language Standard to use
# CPP_STANDARD - C++ Language Standard to use
# F_CPU - Speed of the CPU, in Hz
# C_FLAGS - Flags to pass to the C compiler only
# CPP_FLAGS - Flags to pass to the C++ compiler only
# ASM_FLAGS - Flags to pass to the assembler only
# CC_FLAGS - Common flags to pass to the C/C++ compiler and
# assembler
# LD_FLAGS - Flags to pass to the linker
# LINKER_RELAXATIONS - Enable or disable linker relaxations to
# decrease binary size (note: can cause link
# failures on systems with an unpatched binutils)
# OBJDIR - Directory for the output object and dependency
# files; if equal to ".", the output files will
# be generated in the same folder as the sources
# OBJECT_FILES - Extra object files to link in to the binaries
# DEBUG_FORMAT - Format of the debugging information to
# generate in the compiled object files
# DEBUG_LEVEL - Level the debugging information to generate in
# the compiled object files
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
BOARD ?= NONE
OPTIMIZATION ?= s
F_CPU ?=
C_STANDARD ?= gnu99
CPP_STANDARD ?= gnu++98
C_FLAGS ?=
CPP_FLAGS ?=
ASM_FLAGS ?=
CC_FLAGS ?=
OBJDIR ?= .
OBJECT_FILES ?=
DEBUG_FORMAT ?= dwarf-2
DEBUG_LEVEL ?= 2
LINKER_RELAXATIONS ?= Y
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
$(call ERROR_IF_EMPTY, ARCH)
$(call ERROR_IF_EMPTY, F_USB)
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, BOARD)
$(call ERROR_IF_EMPTY, OPTIMIZATION)
$(call ERROR_IF_EMPTY, C_STANDARD)
$(call ERROR_IF_EMPTY, CPP_STANDARD)
$(call ERROR_IF_EMPTY, OBJDIR)
$(call ERROR_IF_EMPTY, DEBUG_FORMAT)
$(call ERROR_IF_EMPTY, DEBUG_LEVEL)
$(call ERROR_IF_NONBOOL, LINKER_RELAXATIONS)
# Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8)
CROSS := avr
else ifeq ($(ARCH), XMEGA)
CROSS := avr
$(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
else ifeq ($(ARCH), UC3)
CROSS := avr32
$(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
else
$(error Unsupported architecture "$(ARCH)")
endif
# Output Messages
MSG_INFO_MESSAGE := ' [INFO] :'
MSG_COMPILE_CMD := ' [GCC] :'
MSG_ASSEMBLE_CMD := ' [GAS] :'
MSG_NM_CMD := ' [NM] :'
MSG_REMOVE_CMD := ' [RM] :'
MSG_LINK_CMD := ' [LNK] :'
MSG_ARCHIVE_CMD := ' [AR] :'
MSG_SIZE_CMD := ' [SIZE] :'
MSG_OBJCPY_CMD := ' [OBJCPY] :'
MSG_OBJDMP_CMD := ' [OBJDMP] :'
# Convert input source file list to differentiate them by type
C_SOURCE := $(filter %.c, $(SRC))
CPP_SOURCE := $(filter %.cpp, $(SRC))
ASM_SOURCE := $(filter %.S, $(SRC))
# Create a list of unknown source file types, if any are found throw an error
UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC))
ifneq ($(UNKNOWN_SOURCE),)
$(error Unknown input source file formats: $(UNKNOWN_SOURCE))
endif
# Convert input source filenames into a list of required output object files
OBJECT_FILES += $(addsuffix .o, $(basename $(SRC)))
# Check if an output object file directory was specified instead of the input file location
ifneq ($(OBJDIR),.)
# Prefix all the object filenames with the output object file directory path
OBJECT_FILES := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES)))
# Check if any object file (without path) appears more than once in the object file list
ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES)))
$(error Cannot build with OBJDIR parameter set - one or more object file name is not unique)
endif
# Create the output object file directory if it does not exist and add it to the virtual path list
$(shell mkdir $(OBJDIR) 2> /dev/null)
VPATH += $(dir $(SRC))
endif
# Create a list of dependency files from the list of object files
DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d)
# Create a list of common flags to pass to the compiler/linker/assembler
BASE_CC_FLAGS := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL)
ifeq ($(ARCH), AVR8)
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), XMEGA)
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), UC3)
BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos
endif
BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
BASE_CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
ifneq ($(F_CPU),)
BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL
endif
# Additional language specific compiler flags
BASE_C_FLAGS := -x c -O$(OPTIMIZATION) -std=$(C_STANDARD) -Wstrict-prototypes
BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD)
BASE_ASM_FLAGS := -x assembler-with-cpp
# Create a list of flags to pass to the linker
BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections
ifeq ($(LINKER_RELAXATIONS), Y)
BASE_LD_FLAGS += -Wl,--relax
endif
ifeq ($(ARCH), AVR8)
BASE_LD_FLAGS += -mmcu=$(MCU)
else ifeq ($(ARCH), XMEGA)
BASE_LD_FLAGS += -mmcu=$(MCU)
else ifeq ($(ARCH), UC3)
BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data
endif
# Determine flags to pass to the size utility based on its reported features (only invoke if size target required)
# and on an architecture where this non-standard patch is available
ifneq ($(ARCH), UC3)
size: SIZE_MCU_FLAG := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
endif
# Pre-build informational target, to give compiler and project name information when building
build_begin:
@echo $(MSG_INFO_MESSAGE) Begin compilation of project \"$(TARGET)\"...
@echo ""
@$(CROSS)-gcc --version
# Post-build informational target, to project name information when building has completed
build_end:
@echo $(MSG_INFO_MESSAGE) Finished building project \"$(TARGET)\".
# Prints size information of a compiled application (FLASH, RAM and EEPROM usages)
size: $(TARGET).elf
@echo $(MSG_SIZE_CMD) Determining size of \"$<\"
@echo ""
$(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $<
# Prints size information on the symbols within a compiled application in decimal bytes
symbol-sizes: $(TARGET).elf
@echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes
$(CROSS)-nm --size-sort --demangle --radix=d $<
# Cleans intermediary build files, leaving only the compiled application files
mostlyclean:
@echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
rm -f $(OBJECT_FILES)
@echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\"
rm -f $(DEPENDENCY_FILES)
# Cleans all build files, leaving only the original source code
clean: mostlyclean
@echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\"
rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym $(TARGET).a
# Performs a complete build of the user application and prints size information afterwards
all: build_begin elf hex bin lss sym size build_end
# Helper targets, to build a specific type of output file without having to know the project target name
lib: lib$(TARGET).a
elf: $(TARGET).elf
hex: $(TARGET).hex $(TARGET).eep
bin: $(TARGET).bin $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Default target to *create* the user application's specified source files; if this rule is executed by
# make, the input source file doesn't exist and an error needs to be presented to the user
$(SRC):
$(error Source file does not exist: $@)
# Compiles an input C source file and generates an assembly listing for it
%.s: %.c $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Generating assembly from C file \"$(notdir $<)\"
$(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) $< -o $@
# Compiles an input C++ source file and generates an assembly listing for it
%.s: %.cpp $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Generating assembly from C++ file \"$(notdir $<)\"
$(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) $< -o $@
# Compiles an input C source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Compiles an input C++ source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST)
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Assembles an input ASM source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST)
@echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\"
$(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
# Generates a library archive file from the user application, which can be linked into other applications
.PRECIOUS : $(OBJECT_FILES)
.SECONDARY : %.a
%.a: $(OBJECT_FILES)
@echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\"
$(CROSS)-ar rcs $@ $(OBJECT_FILES)
# Generates an ELF debug file from the user application, which can be further processed for FLASH and EEPROM data
# files, or used for programming and debugging directly
.PRECIOUS : $(OBJECT_FILES)
.SECONDARY : %.elf
%.elf: $(OBJECT_FILES)
@echo $(MSG_LINK_CMD) Linking object files into \"$@\"
$(CROSS)-gcc $^ -o $@ $(BASE_LD_FLAGS) $(LD_FLAGS)
# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Intel HEX format file of it
%.hex: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"
$(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Binary format file of it
%.bin: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting BIN file data from \"$<\"
$(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $< $@
# Extracts out the loadable EEPROM memory data from the project ELF file, and creates an Intel HEX format file of it
%.eep: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\"
$(CROSS)-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0
# Creates an assembly listing file from an input project ELF file, containing interleaved assembly and source data
%.lss: %.elf
@echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\"
$(CROSS)-objdump -h -d -S -z $< > $@
# Creates a symbol file listing the loadable and discarded symbols from an input project ELF file
%.sym: %.elf
@echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\"
$(CROSS)-nm -n $< > $@
# Include build dependency files
-include $(DEPENDENCY_FILES)
# Phony build targets for this module
.PHONY: build_begin build_end size symbol-sizes lib elf hex lss clean mostlyclean

View File

@@ -1,172 +1,172 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += CORE
LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional list_provided list_macros
LUFA_BUILD_MANDATORY_VARS +=
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Core Build System Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of core build targets for the LUFA build system
# -----------------------------------------------------------------------------
# TARGETS:
#
# help - Build system help
# list_targets - List all build targets
# list_modules - List all build modules
# list_mandatory - List all mandatory make variables required by
# the included build modules of the application
# list_optional - List all optional make variables required by
# the included build modules of the application
# list_provided - List all provided make variables from the
# included build modules of the application
# list_macros - List all provided make macros from the
# included build modules of the application
#
# MANDATORY PARAMETERS:
#
# (None)
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
# Converts a given input to a printable output using "(None)" if no items are in the list
CONVERT_TO_PRINTABLE = $(if $(strip $(1)), $(1), (None))
# Build sorted and filtered lists of the included build module data
SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES))
SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS))
SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS))
SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
SORTED_LUFA_PROVIDED_VARS = $(sort $(LUFA_BUILD_PROVIDED_VARS))
SORTED_LUFA_PROVIDED_MACROS = $(sort $(LUFA_BUILD_PROVIDED_MACROS))
# Create printable versions of the sorted build module data (use "(None)" when no data is available)
PRINTABLE_LUFA_BUILD_MODULES = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_MODULES))
PRINTABLE_LUFA_BUILD_TARGETS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_TARGETS))
PRINTABLE_LUFA_MANDATORY_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_MANDATORY_VARS))
PRINTABLE_LUFA_OPTIONAL_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_OPTIONAL_VARS))
PRINTABLE_LUFA_PROVIDED_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_VARS))
PRINTABLE_LUFA_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_MACROS))
help:
@echo "==================================================================="
@echo " LUFA Build System 2.0 "
@echo " (C) Dean Camera, 2013 { dean @ fourwalledcubicle . com } "
@echo "==================================================================="
@echo "DESCRIPTION: "
@echo " This build system is a set of makefile modules for (GNU) Make, to "
@echo " provide a simple system for building LUFA powered applications. "
@echo " Each makefile module can be included from within a user makefile, "
@echo " to expose the build rules documented in the comments at the top of"
@echo " each build module. "
@echo " "
@echo "USAGE: "
@echo " To execute a rule, define all variables indicated in the desired "
@echo " module as a required parameter before including the build module "
@echo " in your project makefile. Parameters marked as optional will "
@echo " assume a default value in the modules if not user-assigned. "
@echo " "
@echo " By default the target output shows both a friendly summary, as "
@echo " well as the actual invoked command. To suppress the output of the "
@echo " invoked commands and show only the friendly command output, run "
@echo " make with the \"-s\" switch added before the target(s). "
@echo " "
@echo "SEE ALSO: "
@echo " For more information, see the 'Build System' chapter of the LUFA "
@echo " project documentation. "
@echo "==================================================================="
@echo " "
@echo " Currently used build system modules in this application: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
@echo " "
@echo " "
@echo " Currently available build targets in this application: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
@echo " "
@echo " "
@echo " Mandatory variables required by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Optional variables required by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Variables provided by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Macros provided by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
@echo " "
@echo "==================================================================="
@echo " The LUFA BuildSystem 2.0 - Powered By Duct Tape (tm) "
@echo "==================================================================="
# Lists build modules included by the project makefile, in alphabetical order
list_modules:
@echo Currently Used Build System Modules:
@printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
# Lists build targets included by the project makefile, in alphabetical order
list_targets:
@echo Currently Available Build Targets:
@printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
# Lists mandatory variables that must be set by the project makefile, in alphabetical order
list_mandatory:
@echo Mandatory Variables for Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
# Lists optional variables that must be set by the project makefile, in alphabetical order
list_optional:
@echo Optional Variables for Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
# Lists variables provided by the included build modules, in alphabetical order
list_provided:
@echo Variables Provided by the Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
# Lists macros provided by the included build modules, in alphabetical order
list_macros:
@echo Macros Provided by the Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
# Disable default in-built make rules (those that are needed are explicitly
# defined, and doing so has performance benefits when recursively building)
.SUFFIXES:
# Phony build targets for this module
.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += CORE
LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional list_provided list_macros
LUFA_BUILD_MANDATORY_VARS +=
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Core Build System Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of core build targets for the LUFA build system
# -----------------------------------------------------------------------------
# TARGETS:
#
# help - Build system help
# list_targets - List all build targets
# list_modules - List all build modules
# list_mandatory - List all mandatory make variables required by
# the included build modules of the application
# list_optional - List all optional make variables required by
# the included build modules of the application
# list_provided - List all provided make variables from the
# included build modules of the application
# list_macros - List all provided make macros from the
# included build modules of the application
#
# MANDATORY PARAMETERS:
#
# (None)
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
# Converts a given input to a printable output using "(None)" if no items are in the list
CONVERT_TO_PRINTABLE = $(if $(strip $(1)), $(1), (None))
# Build sorted and filtered lists of the included build module data
SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES))
SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS))
SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS))
SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
SORTED_LUFA_PROVIDED_VARS = $(sort $(LUFA_BUILD_PROVIDED_VARS))
SORTED_LUFA_PROVIDED_MACROS = $(sort $(LUFA_BUILD_PROVIDED_MACROS))
# Create printable versions of the sorted build module data (use "(None)" when no data is available)
PRINTABLE_LUFA_BUILD_MODULES = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_MODULES))
PRINTABLE_LUFA_BUILD_TARGETS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_TARGETS))
PRINTABLE_LUFA_MANDATORY_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_MANDATORY_VARS))
PRINTABLE_LUFA_OPTIONAL_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_OPTIONAL_VARS))
PRINTABLE_LUFA_PROVIDED_VARS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_VARS))
PRINTABLE_LUFA_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_MACROS))
help:
@echo "==================================================================="
@echo " LUFA Build System 2.0 "
@echo " (C) Dean Camera, 2013 { dean @ fourwalledcubicle . com } "
@echo "==================================================================="
@echo "DESCRIPTION: "
@echo " This build system is a set of makefile modules for (GNU) Make, to "
@echo " provide a simple system for building LUFA powered applications. "
@echo " Each makefile module can be included from within a user makefile, "
@echo " to expose the build rules documented in the comments at the top of"
@echo " each build module. "
@echo " "
@echo "USAGE: "
@echo " To execute a rule, define all variables indicated in the desired "
@echo " module as a required parameter before including the build module "
@echo " in your project makefile. Parameters marked as optional will "
@echo " assume a default value in the modules if not user-assigned. "
@echo " "
@echo " By default the target output shows both a friendly summary, as "
@echo " well as the actual invoked command. To suppress the output of the "
@echo " invoked commands and show only the friendly command output, run "
@echo " make with the \"-s\" switch added before the target(s). "
@echo " "
@echo "SEE ALSO: "
@echo " For more information, see the 'Build System' chapter of the LUFA "
@echo " project documentation. "
@echo "==================================================================="
@echo " "
@echo " Currently used build system modules in this application: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
@echo " "
@echo " "
@echo " Currently available build targets in this application: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
@echo " "
@echo " "
@echo " Mandatory variables required by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Optional variables required by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Variables provided by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
@echo " "
@echo " "
@echo " Macros provided by the selected build Modules: "
@echo " "
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
@echo " "
@echo "==================================================================="
@echo " The LUFA BuildSystem 2.0 - Powered By Duct Tape (tm) "
@echo "==================================================================="
# Lists build modules included by the project makefile, in alphabetical order
list_modules:
@echo Currently Used Build System Modules:
@printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)"
# Lists build targets included by the project makefile, in alphabetical order
list_targets:
@echo Currently Available Build Targets:
@printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)"
# Lists mandatory variables that must be set by the project makefile, in alphabetical order
list_mandatory:
@echo Mandatory Variables for Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)"
# Lists optional variables that must be set by the project makefile, in alphabetical order
list_optional:
@echo Optional Variables for Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)"
# Lists variables provided by the included build modules, in alphabetical order
list_provided:
@echo Variables Provided by the Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)"
# Lists macros provided by the included build modules, in alphabetical order
list_macros:
@echo Macros Provided by the Included Modules:
@printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)"
# Disable default in-built make rules (those that are needed are explicitly
# defined, and doing so has performance benefits when recursively building)
.SUFFIXES:
# Phony build targets for this module
.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros

View File

@@ -1,106 +1,106 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += CPPCHECK
LUFA_BUILD_TARGETS += cppcheck cppcheck-config
LUFA_BUILD_MANDATORY_VARS += SRC
LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \
CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA CPPCheck Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to scan a project with the free "cppcheck" static
# analysis tool, to check for code errors at runtime (see http://cppcheck.sourceforge.net).
# -----------------------------------------------------------------------------
# TARGETS:
#
# cppcheck - Scan the project with CPPCheck
# cppcheck-config - Use CPPCheck to look for missing include files
#
# MANDATORY PARAMETERS:
#
# SRC - List of source files to statically analyze
#
# OPTIONAL PARAMETERS:
#
# CPPCHECK_INCLUDES - Extra include paths to search for missing
# header files
# CPPCHECK_EXCLUDES - Source file paths to exclude checking (can be
# a path fragment if desired)
# CPPCHECK_MSG_TEMPLATE - Template for cppcheck error and warning output
# CPPCHECK_ENABLE - General cppcheck category checks to enable
# CPPCHECK_SUPPRESS - Specific cppcheck warnings to disable by ID
# CPPCHECK_FAIL_ON_WARNING - Set to Y to fail the build on cppcheck
# warnings, N to continue even if warnings occur
# CPPCHECK_QUIET - Enable cppcheck verbose or quiet output mode
# CPPCHECK_FLAGS - Additional flags to pass to cppcheck
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
CPPCHECK_INCLUDES ?=
CPPCHECK_EXCLUDES ?=
CPPCHECK_MSG_TEMPLATE ?= {file}:{line}: {severity} ({id}): {message}
CPPCHECK_ENABLE ?= all
CPPCHECK_SUPPRESS ?= variableScope missingInclude
CPPCHECK_FAIL_ON_WARNING ?= Y
CPPCHECK_QUIET ?= Y
CPPCHECK_FLAGS ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, SRC)
$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE)
$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE)
$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING)
$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET)
# Build a default argument list for cppcheck
BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99
# Sanity check parameters and construct additional command line arguments to cppcheck
ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y)
BASE_CPPCHECK_FLAGS += --error-exitcode=1
endif
ifeq ($(CPPCHECK_QUIET), Y)
BASE_CPPCHECK_FLAGS += --quiet
endif
# Output Messages
MSG_CPPCHECK_CMD := ' [CPPCHECK]:'
# Checks the CPPCheck configuration as used in the user project, to determine if any paths are missing or invalid
cppcheck-config: $(MAKEFILE_LIST)
@echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files
cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC)
# Runs a static analysis using CPPCheck to determine if there are any issues
cppcheck: $(MAKEFILE_LIST)
@echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files
cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC)
# Phony build targets for this module
.PHONY: cppcheck-config cppcheck
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += CPPCHECK
LUFA_BUILD_TARGETS += cppcheck cppcheck-config
LUFA_BUILD_MANDATORY_VARS += SRC
LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \
CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA CPPCheck Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to scan a project with the free "cppcheck" static
# analysis tool, to check for code errors at runtime (see http://cppcheck.sourceforge.net).
# -----------------------------------------------------------------------------
# TARGETS:
#
# cppcheck - Scan the project with CPPCheck
# cppcheck-config - Use CPPCheck to look for missing include files
#
# MANDATORY PARAMETERS:
#
# SRC - List of source files to statically analyze
#
# OPTIONAL PARAMETERS:
#
# CPPCHECK_INCLUDES - Extra include paths to search for missing
# header files
# CPPCHECK_EXCLUDES - Source file paths to exclude checking (can be
# a path fragment if desired)
# CPPCHECK_MSG_TEMPLATE - Template for cppcheck error and warning output
# CPPCHECK_ENABLE - General cppcheck category checks to enable
# CPPCHECK_SUPPRESS - Specific cppcheck warnings to disable by ID
# CPPCHECK_FAIL_ON_WARNING - Set to Y to fail the build on cppcheck
# warnings, N to continue even if warnings occur
# CPPCHECK_QUIET - Enable cppcheck verbose or quiet output mode
# CPPCHECK_FLAGS - Additional flags to pass to cppcheck
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
CPPCHECK_INCLUDES ?=
CPPCHECK_EXCLUDES ?=
CPPCHECK_MSG_TEMPLATE ?= {file}:{line}: {severity} ({id}): {message}
CPPCHECK_ENABLE ?= all
CPPCHECK_SUPPRESS ?= variableScope missingInclude
CPPCHECK_FAIL_ON_WARNING ?= Y
CPPCHECK_QUIET ?= Y
CPPCHECK_FLAGS ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, SRC)
$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE)
$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE)
$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING)
$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET)
# Build a default argument list for cppcheck
BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99
# Sanity check parameters and construct additional command line arguments to cppcheck
ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y)
BASE_CPPCHECK_FLAGS += --error-exitcode=1
endif
ifeq ($(CPPCHECK_QUIET), Y)
BASE_CPPCHECK_FLAGS += --quiet
endif
# Output Messages
MSG_CPPCHECK_CMD := ' [CPPCHECK]:'
# Checks the CPPCheck configuration as used in the user project, to determine if any paths are missing or invalid
cppcheck-config: $(MAKEFILE_LIST)
@echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files
cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC)
# Runs a static analysis using CPPCheck to determine if there are any issues
cppcheck: $(MAKEFILE_LIST)
@echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files
cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC)
# Phony build targets for this module
.PHONY: cppcheck-config cppcheck

View File

@@ -1,95 +1,95 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += DFU
LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA DFU Bootloader Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device currently running a DFU
# class bootloader with a project's FLASH and EEPROM files.
# -----------------------------------------------------------------------------
# TARGETS:
#
# flip - Program FLASH into target via Atmel FLIP
# flip-ee - Program EEPROM into target via Atmel FLIP
# dfu - Program FLASH into target via dfu-programmer
# dfu-ee - Program EEPROM into target via dfu-programmer
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity-check values of mandatory user-supplied variables
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
# Output Messages
MSG_COPY_CMD := ' [CP] :'
MSG_REMOVE_CMD := ' [RM] :'
MSG_DFU_CMD := ' [DFU] :'
# Programs in the target FLASH memory using BATCHISP, the command line tool used by FLIP
flip: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\"
batchisp -hardware usb -device $(MCU) -operation erase f loadbuffer $< program
batchisp -hardware usb -device $(MCU) -operation start reset 0
# Programs in the target EEPROM memory using BATCHISP, the command line tool used by FLIP
flip-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_COPY_CMD) Copying EEP file to temporary file \"$<.hex\"
cp $< $<.hex
@echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\"
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
@echo $(MSG_REMOVE_CMD) Removing temporary file \"$<.hex\"
rm $<.hex
# Programs in the target FLASH memory using DFU-PROGRAMMER
dfu: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\"
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $<
dfu-programmer $(MCU) reset
# Programs in the target EEPROM memory using DFU-PROGRAMMER
dfu-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\"
dfu-programmer $(MCU) eeprom-flash $<
dfu-programmer $(MCU) reset
# Phony build targets for this module
.PHONY: flip flip-ee dfu dfu-ee
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += DFU
LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA DFU Bootloader Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device currently running a DFU
# class bootloader with a project's FLASH and EEPROM files.
# -----------------------------------------------------------------------------
# TARGETS:
#
# flip - Program FLASH into target via Atmel FLIP
# flip-ee - Program EEPROM into target via Atmel FLIP
# dfu - Program FLASH into target via dfu-programmer
# dfu-ee - Program EEPROM into target via dfu-programmer
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity-check values of mandatory user-supplied variables
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
# Output Messages
MSG_COPY_CMD := ' [CP] :'
MSG_REMOVE_CMD := ' [RM] :'
MSG_DFU_CMD := ' [DFU] :'
# Programs in the target FLASH memory using BATCHISP, the command line tool used by FLIP
flip: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\"
batchisp -hardware usb -device $(MCU) -operation erase f loadbuffer $< program
batchisp -hardware usb -device $(MCU) -operation start reset 0
# Programs in the target EEPROM memory using BATCHISP, the command line tool used by FLIP
flip-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_COPY_CMD) Copying EEP file to temporary file \"$<.hex\"
cp $< $<.hex
@echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\"
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
@echo $(MSG_REMOVE_CMD) Removing temporary file \"$<.hex\"
rm $<.hex
# Programs in the target FLASH memory using DFU-PROGRAMMER
dfu: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\"
dfu-programmer $(MCU) erase
dfu-programmer $(MCU) flash $<
dfu-programmer $(MCU) reset
# Programs in the target EEPROM memory using DFU-PROGRAMMER
dfu-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\"
dfu-programmer $(MCU) eeprom-flash $<
dfu-programmer $(MCU) reset
# Phony build targets for this module
.PHONY: flip flip-ee dfu dfu-ee

View File

@@ -1,100 +1,100 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += DOXYGEN
LUFA_BUILD_TARGETS += doxygen doxygen_upgrade doxygen_create
LUFA_BUILD_MANDATORY_VARS += LUFA_PATH
LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Doxygen Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to automatically build Doxygen documentation for
# a project (see www.doxygen.org).
# -----------------------------------------------------------------------------
# TARGETS:
#
# doxygen - Build Doxygen Documentation
# doxygen_create - Create a new Doxygen configuration file using
# the latest template
# doxygen_upgrade - Upgrade an existing Doxygen configuration file
# to the latest template
#
# MANDATORY PARAMETERS:
#
# LUFA_PATH - Path to the LUFA library core
#
# OPTIONAL PARAMETERS:
#
# DOXYGEN_CONF - Doxygen configuration filename
# DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings,
# N to continue even if warnings occur
# DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen
# configuration file
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
DOXYGEN_CONF ?= Doxygen.conf
DOXYGEN_FAIL_ON_WARNING ?= Y
DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_EXTRA_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, DOXYGEN_CONF)
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
# Output Messages
MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
# Determine Doxygen invocation command
BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
else
DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
endif
# Error if the specified Doxygen configuration file does not exist
$(DOXYGEN_CONF):
$(error Doxygen configuration file $@ does not exist)
# Builds the project documentation using the specified configuration file and the DOXYGEN tool
doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
$(DOXYGEN_CMD)
# Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
doxygen_upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
doxygen -u $(DOXYGEN_CONF) > /dev/null
# Creates a new Doxygen configuration file with the set file name
doxygen_create: $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
doxygen -g $(DOXYGEN_CONF) > /dev/null
# Phony build targets for this module
.PHONY: doxygen doxygen_upgrade doxygen_create
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += DOXYGEN
LUFA_BUILD_TARGETS += doxygen doxygen_upgrade doxygen_create
LUFA_BUILD_MANDATORY_VARS += LUFA_PATH
LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Doxygen Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to automatically build Doxygen documentation for
# a project (see www.doxygen.org).
# -----------------------------------------------------------------------------
# TARGETS:
#
# doxygen - Build Doxygen Documentation
# doxygen_create - Create a new Doxygen configuration file using
# the latest template
# doxygen_upgrade - Upgrade an existing Doxygen configuration file
# to the latest template
#
# MANDATORY PARAMETERS:
#
# LUFA_PATH - Path to the LUFA library core
#
# OPTIONAL PARAMETERS:
#
# DOXYGEN_CONF - Doxygen configuration filename
# DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings,
# N to continue even if warnings occur
# DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen
# configuration file
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
DOXYGEN_CONF ?= Doxygen.conf
DOXYGEN_FAIL_ON_WARNING ?= Y
DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_EXTRA_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, DOXYGEN_CONF)
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
# Output Messages
MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
# Determine Doxygen invocation command
BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
else
DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
endif
# Error if the specified Doxygen configuration file does not exist
$(DOXYGEN_CONF):
$(error Doxygen configuration file $@ does not exist)
# Builds the project documentation using the specified configuration file and the DOXYGEN tool
doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
$(DOXYGEN_CMD)
# Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
doxygen_upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
doxygen -u $(DOXYGEN_CONF) > /dev/null
# Creates a new Doxygen configuration file with the set file name
doxygen_create: $(MAKEFILE_LIST)
@echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
doxygen -g $(DOXYGEN_CONF) > /dev/null
# Phony build targets for this module
.PHONY: doxygen doxygen_upgrade doxygen_create

View File

@@ -1,94 +1,94 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += HID
LUFA_BUILD_TARGETS += hid hid-ee teensy teensy-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA HID Bootloader Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device currently running a HID
# class bootloader with a project's FLASH files.
# -----------------------------------------------------------------------------
# TARGETS:
#
# hid - Program FLASH into target via
# hid_bootloader_cli
# hid-ee - Program EEPROM into target via a temporary
# AVR application and hid_bootloader_cli
# teensy - Program FLASH into target via
# teensy_loader_cli
# teensy-ee - Program EEPROM into target via a temporary
# AVR application and teensy_loader_cli
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity-check values of mandatory user-supplied variables
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
# Output Messages
MSG_HID_BOOTLOADER_CMD := ' [HID] :'
MSG_OBJCPY_CMD := ' [OBJCPY] :'
MSG_MAKE_CMD := ' [MAKE] :'
# Programs in the target FLASH memory using the HID_BOOTLOADER_CLI tool
hid: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with hid_bootloader_cli using \"$<\"
hid_bootloader_cli -mmcu=$(MCU) -v $<
# Programs in the target EEPROM memory using the HID_BOOTLOADER_CLI tool (note: clears target FLASH memory)
hid-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\"
avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin
@echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
make -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid
# Programs in the target FLASH memory using the TEENSY_BOOTLOADER_CLI tool
teensy: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\"
teensy_loader_cli -mmcu=$(MCU) -v $<
# Programs in the target EEPROM memory using the TEENSY_BOOTLOADER_CLI tool (note: clears target FLASH memory)
teensy-ee: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\"
avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin
@echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
make -s -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid-teensy
# Phony build targets for this module
.PHONY: hid hid-ee teensy teensy-ee
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += HID
LUFA_BUILD_TARGETS += hid hid-ee teensy teensy-ee
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA HID Bootloader Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of targets to re-program a device currently running a HID
# class bootloader with a project's FLASH files.
# -----------------------------------------------------------------------------
# TARGETS:
#
# hid - Program FLASH into target via
# hid_bootloader_cli
# hid-ee - Program EEPROM into target via a temporary
# AVR application and hid_bootloader_cli
# teensy - Program FLASH into target via
# teensy_loader_cli
# teensy-ee - Program EEPROM into target via a temporary
# AVR application and teensy_loader_cli
#
# MANDATORY PARAMETERS:
#
# MCU - Microcontroller device model name
# TARGET - Application name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# (None)
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity-check values of mandatory user-supplied variables
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, MCU)
$(call ERROR_IF_EMPTY, TARGET)
# Output Messages
MSG_HID_BOOTLOADER_CMD := ' [HID] :'
MSG_OBJCPY_CMD := ' [OBJCPY] :'
MSG_MAKE_CMD := ' [MAKE] :'
# Programs in the target FLASH memory using the HID_BOOTLOADER_CLI tool
hid: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with hid_bootloader_cli using \"$<\"
hid_bootloader_cli -mmcu=$(MCU) -v $<
# Programs in the target EEPROM memory using the HID_BOOTLOADER_CLI tool (note: clears target FLASH memory)
hid-ee: $(TARGET).eep $(MAKEFILE_LIST)
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\"
avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin
@echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
make -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid
# Programs in the target FLASH memory using the TEENSY_BOOTLOADER_CLI tool
teensy: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\"
teensy_loader_cli -mmcu=$(MCU) -v $<
# Programs in the target EEPROM memory using the TEENSY_BOOTLOADER_CLI tool (note: clears target FLASH memory)
teensy-ee: $(TARGET).hex $(MAKEFILE_LIST)
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\"
avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin
@echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
make -s -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid-teensy
# Phony build targets for this module
.PHONY: hid hid-ee teensy teensy-ee

View File

@@ -1,143 +1,143 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += SOURCES
LUFA_BUILD_TARGETS +=
LUFA_BUILD_MANDATORY_VARS += LUFA_PATH ARCH
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS += LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST \
LUFA_SRC_USB LUFA_SRC_USBCLASS_DEVICE \
LUFA_SRC_USBCLASS_HOST LUFA_SRC_USBCLASS \
LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL \
LUFA_SRC_TWI LUFA_SRC_PLATFORM
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Sources Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of makefile variables for the various LUFA module sources.
# Once included, the sources required to use a given LUFA module will become
# available using the makefile variable names listed in the LUFA project
# documentation.
# -----------------------------------------------------------------------------
# TARGETS:
#
# (None)
#
# MANDATORY PARAMETERS:
#
# LUFA_PATH - Path to the LUFA library core
# ARCH - Device architecture name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# LUFA_SRC_USB_DEVICE - List of LUFA USB driver source files required
# for USB Device mode only
# LUFA_SRC_USB_HOST - List of LUFA USB driver source files required
# for USB Host mode only
# LUFA_SRC_USB - List of LUFA USB driver source files for all
# USB modes
# LUFA_SRC_USBCLASS_DEVICE - List of LUFA USB Class driver source files for
# USB Device mode only
# LUFA_SRC_USBCLASS_HOST - List of LUFA USB Class driver source files for
# USB Host mode only
# LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files for
# all USB modes
# LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source
# files
# LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files
# LUFA_SRC_TWI - List of LUFA TWI driver source files
# LUFA_SRC_PLATFORM - List of LUFA architecture specific platform
# management source files
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, ARCH)
# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH))
# Construct LUFA module source variables
LUFA_SRC_USB_COMMON := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c \
LUFA_SRC_USB_HOST := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \
$(LUFA_SRC_USB_COMMON)
LUFA_SRC_USB_DEVICE := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \
$(LUFA_SRC_USB_COMMON)
LUFA_SRC_USBCLASS_DEVICE := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \
LUFA_SRC_USBCLASS_HOST := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c
LUFA_SRC_USB := $(sort $(LUFA_SRC_USB_COMMON) $(LUFA_SRC_USB_HOST) $(LUFA_SRC_USB_DEVICE))
LUFA_SRC_USBCLASS := $(LUFA_SRC_USBCLASS_DEVICE) $(LUFA_SRC_USBCLASS_HOST)
LUFA_SRC_TEMPERATURE := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c
LUFA_SRC_SERIAL := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c
LUFA_SRC_TWI := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c
ifeq ($(ARCH), UC3)
LUFA_SRC_PLATFORM := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S \
$(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c
else
LUFA_SRC_PLATFORM :=
endif
# Build a list of all available module sources
LUFA_SRC_ALL_FILES := $(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS) \
$(LUFA_SRC_TEMPERATURE) \
$(LUFA_SRC_SERIAL) \
$(LUFA_SRC_TWI) \
$(LUFA_SRC_PLATFORM)
#
# LUFA Library
# Copyright (C) Dean Camera, 2013.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
LUFA_BUILD_MODULES += SOURCES
LUFA_BUILD_TARGETS +=
LUFA_BUILD_MANDATORY_VARS += LUFA_PATH ARCH
LUFA_BUILD_OPTIONAL_VARS +=
LUFA_BUILD_PROVIDED_VARS += LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST \
LUFA_SRC_USB LUFA_SRC_USBCLASS_DEVICE \
LUFA_SRC_USBCLASS_HOST LUFA_SRC_USBCLASS \
LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL \
LUFA_SRC_TWI LUFA_SRC_PLATFORM
LUFA_BUILD_PROVIDED_MACROS +=
# -----------------------------------------------------------------------------
# LUFA Sources Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
# Provides a set of makefile variables for the various LUFA module sources.
# Once included, the sources required to use a given LUFA module will become
# available using the makefile variable names listed in the LUFA project
# documentation.
# -----------------------------------------------------------------------------
# TARGETS:
#
# (None)
#
# MANDATORY PARAMETERS:
#
# LUFA_PATH - Path to the LUFA library core
# ARCH - Device architecture name
#
# OPTIONAL PARAMETERS:
#
# (None)
#
# PROVIDED VARIABLES:
#
# LUFA_SRC_USB_DEVICE - List of LUFA USB driver source files required
# for USB Device mode only
# LUFA_SRC_USB_HOST - List of LUFA USB driver source files required
# for USB Host mode only
# LUFA_SRC_USB - List of LUFA USB driver source files for all
# USB modes
# LUFA_SRC_USBCLASS_DEVICE - List of LUFA USB Class driver source files for
# USB Device mode only
# LUFA_SRC_USBCLASS_HOST - List of LUFA USB Class driver source files for
# USB Host mode only
# LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files for
# all USB modes
# LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source
# files
# LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files
# LUFA_SRC_TWI - List of LUFA TWI driver source files
# LUFA_SRC_PLATFORM - List of LUFA architecture specific platform
# management source files
#
# PROVIDED MACROS:
#
# (None)
#
# -----------------------------------------------------------------------------
SHELL = /bin/sh
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, ARCH)
# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH))
# Construct LUFA module source variables
LUFA_SRC_USB_COMMON := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c \
LUFA_SRC_USB_HOST := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \
$(LUFA_SRC_USB_COMMON)
LUFA_SRC_USB_DEVICE := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \
$(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \
$(LUFA_SRC_USB_COMMON)
LUFA_SRC_USBCLASS_DEVICE := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \
LUFA_SRC_USBCLASS_HOST := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c
LUFA_SRC_USB := $(sort $(LUFA_SRC_USB_COMMON) $(LUFA_SRC_USB_HOST) $(LUFA_SRC_USB_DEVICE))
LUFA_SRC_USBCLASS := $(LUFA_SRC_USBCLASS_DEVICE) $(LUFA_SRC_USBCLASS_HOST)
LUFA_SRC_TEMPERATURE := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c
LUFA_SRC_SERIAL := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c
LUFA_SRC_TWI := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c
ifeq ($(ARCH), UC3)
LUFA_SRC_PLATFORM := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S \
$(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c
else
LUFA_SRC_PLATFORM :=
endif
# Build a list of all available module sources
LUFA_SRC_ALL_FILES := $(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS) \
$(LUFA_SRC_TEMPERATURE) \
$(LUFA_SRC_SERIAL) \
$(LUFA_SRC_TWI) \
$(LUFA_SRC_PLATFORM)

View File

@@ -74,6 +74,10 @@
#include "CompilerSpecific.h"
#include "Attributes.h"
/* MicropendousDefines must be included after BoardTypes.h */
#include "MissingDefines.h"
#include "MicropendousDefines.h"
#if defined(USE_LUFA_CONFIG_HEADER)
#include "LUFAConfig.h"
#endif

View File

@@ -0,0 +1,140 @@
/*
Written 2012-07-21 By Opendous Inc.
For use with Micropendous USB AVR boards http://www.Micropendous.org
This source file is hereby deeded by Opendous Inc. under the
Creative Commons CC0 Dedication into the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
You can copy, modify, distribute and utilize the work, even for commercial
purposes, all without asking permission, persuent to the following:
- In no way are the patent or trademark rights of any person affected by
CC0, nor are the rights that other persons may have in the work or in how
the work is used, such as publicity or privacy rights.
- Unless expressly stated otherwise, the person who associated a work with
this deed makes no warranties about the work, and disclaims liability for
all uses of the work, to the fullest extent permitted by applicable law.
- When using or citing the work, you should not imply endorsement by the
author or the affirmer.
*/
#ifndef __MICROPENDOUS_DEFINES_H__
#define __MICROPENDOUS_DEFINES_H__
/* Includes: */
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
// Defines related to the TXB0108 8-bit Bidirectional Voltage Translator connected to PortB
#if ((BOARD == BOARD_MICROPENDOUS_REV2))
// On Micropendous Rev2 boards, the translator is on PE3 and is Active-Low enabled
#define DISABLE_VOLTAGE_TXRX() PORTE &= ~(1 << PE3); DDRE |= (1 << PE3);
#define ENABLE_VOLTAGE_TXRX() PORTE |= (1 << PE3); DDRE |= (1 << PE3);
#elif ((BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_DIP))
// On Micropendous Rev1 boards, the translator is on PE6 and is Active-Low enabled
#define DISABLE_VOLTAGE_TXRX() PORTE &= ~(1 << PE6); DDRE |= (1 << PE6);
#define ENABLE_VOLTAGE_TXRX() PORTE |= (1 << PE6); DDRE |= (1 << PE6);
#else
// other Micropendous boards do not have a voltage translator but NOPs maintain code operation count
#define ENABLE_VOLTAGE_TXRX() __asm__ volatile ("NOP" ::)
#define DISABLE_VOLTAGE_TXRX() __asm__ volatile ("NOP" ::)
#endif
// Defines related to the USB Selector
#if ((BOARD == BOARD_MICROPENDOUS_REV2))
// On Micropendous Rev2 boards, USB-A port selection is Active-High with overcurrent flag on PE6
#define SELECT_USB_A() PORTE |= (1 << PE7); DDRE |= (1 << PE7);
#define SELECT_USB_B() PORTE &= ~(1 << PE7); DDRE |= (1 << PE7);
#define USB_A_OVERCURRENT_FLAG_ENABLE() PORTE &= ~(1 << PE6); DDRE &= ~(1 << PE6);
#define USB_A_OVERCURRENT_FLAG() ((PINE >> 6) & (0x01))
#elif ((BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_DIP))
// On Micropendous Rev1 and DIP boards, USB-A port selection is Active-Low with overcurrent flag on a test-point
#define SELECT_USB_A() PORTE &= ~(1 << PE7); DDRE |= (1 << PE7);
#define SELECT_USB_B() PORTE |= (1 << PE7); DDRE |= (1 << PE7);
#define USB_A_OVERCURRENT_FLAG_ENABLE() __asm__ volatile ("NOP" ::)
#define USB_A_OVERCURRENT_FLAG() __asm__ volatile ("NOP" ::)
#warning Remember to uncomment NO_AUTO_VBUS_MANAGEMENT and INVERTED_VBUS_ENABLE_LINE in Config/LUFAConfig.h
#else
// other Micropendous boards do not have an USB selector but NOPs maintain code operation count
#define SELECT_USB_A() __asm__ volatile ("NOP" ::)
#define SELECT_USB_B() __asm__ volatile ("NOP" ::)
#define USB_A_OVERCURRENT_FLAG_ENABLE() __asm__ volatile ("NOP" ::)
#define USB_A_OVERCURRENT_FLAG() __asm__ volatile ("NOP" ::)
#endif
// Defines related to external SRAM
#if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__))
#define EXT_SRAM_START 0x2100
#elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB646__))
#define EXT_SRAM_START 0x1100
#endif
#ifndef EXT_SRAM_END
#define EXT_SRAM_END 0xFFFF
#endif
#ifndef EXT_SRAM_SIZE
#define EXT_SRAM_SIZE (EXT_SRAM_END - EXT_SRAM_START)
#endif
#if ((BOARD == BOARD_MICROPENDOUS_REV2) || (BOARD == BOARD_MICROPENDOUS_REV1))
// On Micropendous boards nCE is PE4 and Address Bit 17 is PE5. PE0,1,2 are also control signals.
#define PORTE_EXT_SRAM_SETUP() DDRE = ((1 << PE0) | (1 << PE1) | (1 << PE2) | (1 << PE4) | (1 << PE5)); PORTE = ((1 << PE0) | (1 << PE1) | (1 << PE2) | (1 << PE4));
#define ENABLE_EXT_SRAM() DDRE |= (1 << PE4); PORTE &= ~(1 << PE4);
#define DISABLE_EXT_SRAM() DDRE |= (1 << PE4); PORTE |= (1 << PE4);
#define SELECT_EXT_SRAM_BANK0() DDRE |= (1 << PE5); PORTE &= ~(1 << PE5);
#define SELECT_EXT_SRAM_BANK1() DDRE |= (1 << PE5); PORTE |= (1 << PE5);
#define CURRENT_SRAM_BANK() ((PINE >> 5) & (0x01))
#elif ((BOARD == BOARD_MICROPENDOUS_A) || (BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4))
// On Micropendous3/4/A boards nCE is PE6 and Address Bit 17 is PE7. PE0,1,2 are also control signals.
#define PORTE_EXT_SRAM_SETUP() DDRE = ((1 << PE0) | (1 << PE1) | (1 << PE2) | (1 << PE6) | (1 << PE7)); PORTE = ((1 << PE0) | (1 << PE1) | (1 << PE2) | (1 << PE6));
#define ENABLE_EXT_SRAM() DDRE |= (1 << PE6); PORTE &= ~(1 << PE6);
#define DISABLE_EXT_SRAM() DDRE |= (1 << PE6); PORTE |= (1 << PE6);
#define SELECT_EXT_SRAM_BANK0() DDRE |= (1 << PE7); PORTE &= ~(1 << PE7);
#define SELECT_EXT_SRAM_BANK1() DDRE |= (1 << PE7); PORTE |= (1 << PE7);
#define CURRENT_SRAM_BANK() ((PINE >> 7) & (0x01))
#else
// other Micropendous boards do not have external SRAM but NOPs maintain code operation count
#define PORTE_EXT_SRAM_SETUP() __asm__ volatile ("NOP" ::)
#define ENABLE_EXT_SRAM() __asm__ volatile ("NOP" ::)
#define DISABLE_EXT_SRAM() __asm__ volatile ("NOP" ::)
#define SELECT_EXT_SRAM_BANK0() __asm__ volatile ("NOP" ::)
#define SELECT_EXT_SRAM_BANK1() __asm__ volatile ("NOP" ::)
#define CURRENT_SRAM_BANK() __asm__ volatile ("NOP" ::)
#endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif // __MICROPENDOUS_DEFINES_H__

View File

@@ -0,0 +1,182 @@
/* Copyright (c) 2009 By Eric B. Weddington
All rights reserved.
Defines missing from currently used versions of avr-libc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MISSING_DEFINES__
#define __MISSING_DEFINES__
#include <avr/version.h>
#ifndef PINHIGH
#define PINHIGH(PORT, PIN) PORT |= (1 << PIN);
#endif
#ifndef PINLOW
#define PINLOW(PORT, PIN) PORT &= ~(1 << PIN);
#endif
/* Missing WinAVR include defines */
/* WinAVR does not define these for the ATmega??u4*/
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#ifndef PB7
#define PB7 7
#endif
#ifndef PB6
#define PB6 6
#endif
#ifndef PB5
#define PB5 5
#endif
#ifndef PB4
#define PB4 4
#endif
#ifndef PB3
#define PB3 3
#endif
#ifndef PB2
#define PB2 2
#endif
#ifndef PB1
#define PB1 1
#endif
#ifndef PB0
#define PB0 0
#endif
#ifndef PC7
#define PC7 7
#endif
#ifndef PC6
#define PC6 6
#endif
#ifndef PD7
#define PD7 7
#endif
#ifndef PD6
#define PD6 6
#endif
#ifndef PD5
#define PD5 5
#endif
#ifndef PD4
#define PD4 4
#endif
#ifndef PD3
#define PD3 3
#endif
#ifndef PD2
#define PD2 2
#endif
#ifndef PD1
#define PD1 1
#endif
#ifndef PD0
#define PD0 0
#endif
#ifndef PE2
#define PE2 2
#endif
#ifndef PE6
#define PE6 6
#endif
#ifndef PF7
#define PF7 7
#endif
#ifndef PF6
#define PF6 6
#endif
#ifndef PF5
#define PF5 5
#endif
#ifndef PF4
#define PF4 4
#endif
#ifndef PF1
#define PF1 1
#endif
#ifndef PF0
#define PF0 0
#endif
#endif
// missing avr-libc Linux defines
//#ifndef clock_prescale_set
//#if (__AVR_LIBC_VERSION__ < 10606UL)
#ifndef clock_div_1
#define clock_div_1 0
#endif
#ifndef clock_div_2
#define clock_div_2 1
#endif
#ifndef clock_div_4
#define clock_div_4 2
#endif
#ifndef clock_div_8
#define clock_div_8 3
#endif
#ifndef clock_div_16
#define clock_div_16 4
#endif
#ifndef clock_div_32
#define clock_div_32 5
#endif
#ifndef clock_div_64
#define clock_div_64 6
#endif
#ifndef clock_div_128
#define clock_div_128 7
#endif
#ifndef clock_div_256
#define clock_div_256 8
#endif
#ifndef clock_prescale_set
#define clock_prescale_set(x) \
{ \
uint8_t tmp = _BV(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" (x) \
: "r0"); \
}
#endif
//#endif // (__AVR_LIBC_VERSION__ < 10606UL)
#endif // MissingDefines.h

View File

@@ -134,7 +134,7 @@
(BOARD == BOARD_MICROPENDOUS_32U2) || defined(__DOXYGEN__))
#include "../../LEDs.h"
/** Indicates the board has a hardware LEDs mounted. */
/** Indicates the board has hardware LEDs mounted. */
#define BOARD_HAS_LEDS
#endif

View File

@@ -92,12 +92,20 @@
#if (BOARD == BOARD_MICROPENDOUS_32U2)
#define _BOARD_LED1_MASK (1 << 6)
#define _BOARD_LED_PORTLETTER D
#elif (BOARD == BOARD_MICROPENDOUS_32U4)
#define _BOARD_LED1_MASK (1 << 6)
#define _BOARD_LED_PORTLETTER D
#elif (BOARD == BOARD_MICROPENDOUS_REV1)
#define _BOARD_LED1_MASK (1 << 1)
#define _BOARD_LED_PORTLETTER B
#elif (BOARD == BOARD_MICROPENDOUS_REV2)
#define _BOARD_LED1_MASK (1 << 1)
#define _BOARD_LED_PORTLETTER B
#else
#define _BOARD_LED1_MASK (1 << 1)
#define _BOARD_LED_PORTLETTER B
#warning The currently selected Micropendous board does not have an LED.
#warning Use PB1, cathode to GND with resistor: PB1---/\R/\---|LED>---GND
#endif
#define _BOARD_LED_CONCAT2(Reg, Letter) Reg ## Letter

View File

@@ -135,11 +135,11 @@
#include "XMEGA/A3BU_XPLAINED/Buttons.h"
#elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3))
#include "AVR8/USB2AX/Buttons.h"
#elif ((BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \
(BOARD == BOARD_MICROPENDOUS_1) || (BOARD == BOARD_MICROPENDOUS_2) || \
(BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4) || \
(BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \
(BOARD == BOARD_MICROPENDOUS_DIP))
#elif ( (BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \
(BOARD == BOARD_MICROPENDOUS_1) || (BOARD == BOARD_MICROPENDOUS_2) || \
(BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4) || \
(BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \
(BOARD == BOARD_MICROPENDOUS_DIP) || (BOARD == BOARD_MICROPENDOUS_32U4) )
#include "AVR8/MICROPENDOUS/Buttons.h"
#elif (BOARD == BOARD_B1_XPLAINED)
#include "XMEGA/B1_XPLAINED/Buttons.h"

View File

@@ -176,8 +176,11 @@
#include "XMEGA/A3BU_XPLAINED/LEDs.h"
#elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3) || (BOARD == BOARD_USB2AX_V31))
#include "AVR8/USB2AX/LEDs.h"
#elif ((BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \
(BOARD == BOARD_MICROPENDOUS_32U2))
#elif ( (BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \
(BOARD == BOARD_MICROPENDOUS_1) || (BOARD == BOARD_MICROPENDOUS_2) || \
(BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4) || \
(BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \
(BOARD == BOARD_MICROPENDOUS_DIP) || (BOARD == BOARD_MICROPENDOUS_32U4) )
#include "AVR8/MICROPENDOUS/LEDs.h"
#elif (BOARD == BOARD_B1_XPLAINED)
#include "XMEGA/B1_XPLAINED/LEDs.h"