Commit 032a83e9 authored by Dean Camera's avatar Dean Camera
Browse files

Moved all source to the trunk directory.

parent 6a10d6b4
Instructions for converting the LUFA USBtoSerial Demo to an AVR ISP Programmer.
By Opendous Inc., Copyright under the Creative Commons Attribution License:
http://creativecommons.org/licenses/by/3.0/
1) Start with the LUFA/Demos/USBtoSerial firmware.
- rename USBtoSerial.c, USBtoSerial.h, and USBtoSerial.aps to
AVRISP_Programmer.*
- edit AVRISP_Programmer.aps and rename all instances of "USBtoSerial" to
"AVRISP_Programmer"
- copy AVRISP_Programmer.txt from an older version of AVRISP_Programmer
2) Edit makefile by changing TARGET from "USBtoSerial" to "AVRISP_Programmer"
3) Edit AVRISP_Programmer.h:
- change ifdef _USB_TO_SERIAL_H to _AVRISP_PROGRAMMER_H_
- rename ReconfigureUSART(void) to ReconfigureSPI(void)
- add void processHostSPIRequest(void); & void delay_ms(uint8_t dly);
- replace the define for Serial.h with one for SPI.h:
#include <libs/LUFA/Drivers/AT90USBXXX/SPI.h>
4) Make alterations to Descriptors.c
- change manufacturer string to "www.AVRopendous.org", length=19
- change product string to "LUFA-Based AVR ISP Programmer", length=29
5) Edit Ringbuff.h to enable the Peek Command: #define BUFF_USEPEEK
6) Edit AVRISP_Programmer.c:
- change #include "USBtoSerial.h" to #include "AVRISP_Programmer.h"
- change BUTTLOADTAG(ProjName to "LUFA AVR910 ISP Programmer"
- in main(), rename ReconfigureUSART() to Reconfigure();
- in EVENT_HANDLER(USB_UnhandledControlPacket), rename ReconfigureUSART
- delete the ISRs: ISR(USART1_RX_vect) & ISR(USART1_TX_vect)
- delete ReconfigureUSART(void)
- add void ReconfigureSPI(void), void processHostSPIRequest(void),
and void delay_ms(uint8_t dly) from a previous version
- add Timer1 and SPI initialization code to main():
/* Hardware Initialization */
//LEDs_Init();
DDRB = 0;
PORTB = 0;
DDRC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2
// PC2 is also used for RESET, so set it HIGH initially - note 'P' command sets it to LOW (Active)
PORTC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2
DDRD = 0;
PORTD = (1 << PB7); // only PB7(HWB) should be High as this is the bootloader pin
// Prepare PortB for SPI - set PB0(^SS), PB1(SCK), PB2(MOSI) as output as well as all other pins except PB3(MISO)
DDRB = (1 << PB0) | (1 << PB1) | (1 << PB2) | (0 << PB3) | (1 << PB4) | (1 << PB5) | (1 << PB6) | (1 << PB7);
PORTB |= (1 << PB0);
// initialize Timer1 for use in delay function
TCCR1A = 0;
//TCCR1B = (1 << CS10); // no prescaling, use CLK
TCCR1B = ((1 << CS12) | (1 << CS10)); // prescale by CLK/1024
// 8MHz/1024 = 7813 ticks per second --> ~8 ticks per millisecond (ms)
timerval = TCNT1; // start timer1
- In TASK(CDC_Task) in the
if (USB_IsConnected) {
if (Endpoint_ReadWriteAllowed()) {
while (Endpoint_BytesInEndpoint()) {
...
structure, after Buffer_StoreElement(&Rx_Buffer, Endpoint_Read_Byte()):
/* Each time there is an element, check which comand should be
run and if enough data is available to run that command.
There are 1-byte, 2-byte, 3-byte, 4-byte commands, and 5-byte commands
Remember that the "which command" byte counts as 1 */
if (Rx_Buffer.Elements == 0) {
// do nothing, wait for data
} else {
tempByte = Buffer_PeekElement(&Rx_Buffer); // peek at first element
/* make sure the issued command and associated data are all ready */
if (Rx_Buffer.Elements == 1) { // zero data byte command
if ((tempByte == 'P') | (tempByte == 'a') | (tempByte == 'm') |
(tempByte == 'R') | (tempByte == 'd') | (tempByte == 'e') |
(tempByte == 'L') | (tempByte == 's') | (tempByte == 't') |
(tempByte == 'S') | (tempByte == 'V') | (tempByte == 'v') |
(tempByte == 'p') | (tempByte == 'F')) {
processHostSPIRequest(); // command has enough data, process it
}
} else if (Rx_Buffer.Elements == 2) { // one data byte command
if ((tempByte == 'T') | (tempByte == 'c') | (tempByte == 'C') |
(tempByte == 'D') | (tempByte == 'l') | (tempByte == 'f') |
(tempByte == 'x') | (tempByte == 'y')) {
processHostSPIRequest(); // command has enough data, process it
}
} else if (Rx_Buffer.Elements == 3) { // two data byte command
if ((tempByte == 'A') | (tempByte == 'Z')) {
processHostSPIRequest(); // command has enough data, process it
}
} else if (Rx_Buffer.Elements == 4) { // three data byte command
if ((tempByte == ':')) {
processHostSPIRequest(); // command has enough data, process it
}
} else if (Rx_Buffer.Elements == 5) { // four data byte command
if ((tempByte == '.')) {
processHostSPIRequest(); // command has enough data, process it
}
} else {
// do nothing
}
}
- need to add code to flush the buffer. Change:
/* Check if Rx buffer contains data */
if (Rx_Buffer.Elements)
{
/* Initiate the transmission of the buffer contents if USART idle*/
if (!(Transmitting))
{
Transmitting = true;
Serial_TxByte(Buffer_GetElement(&Rx_Buffer));
}
}
To:
/* Check if Rx buffer contains data */
if (Rx_Buffer.Elements)
{
/* Initiate the transmission of the buffer contents if USART idle*/
if (!(Transmitting))
{
Transmitting = true;
/* The following flushes the receive buffer to prepare for new
data and commands. Need to flush the buffer as the command
byte which is peeked above needs to be dealt with, otherwise
the command bytes will overflow the buffer eventually */
//Buffer_GetElement(&Rx_Buffer); // also works
Buffer_Initialize(&Rx_Buffer);
}
}
- need to add the following defines and globals:
#define RESETPORT PORTB
#define RESETPIN PB0
#define RESETPORT2 PORTC
#define RESETPIN2 PC2
#define CR_HEX '\r'
#define DELAY_VERYSHORT 0x01
#define DELAY_SHORT 0x02
#define DELAY_MEDIUM 0x03
#define DELAY_LONG 0x05
#define DELAY_MULTIPLE 0x04
/* AVR Device Codes - Can have a maximum of 14 but can be any you want.
Note that these are completely irrelevent. If AVRdude supports a
device, then that device is programmable. Use -F switch to ignore
device codes. */
#define AVRDEVCODE01 0x55 /* ATtiny12 */
#define AVRDEVCODE02 0x56 /* ATtiny15 */
#define AVRDEVCODE03 0x5E /* ATtiny261 */
#define AVRDEVCODE04 0x76 /* ATmega8 */
#define AVRDEVCODE05 0x74 /* ATmega16 */
#define AVRDEVCODE06 0x72 /* ATmega32 */
#define AVRDEVCODE07 0x45 /* ATmega64 */
#define AVRDEVCODE08 0x74 /* ATmega644 */
#define AVRDEVCODE09 0x43 /* ATmega128 */
#define AVRDEVCODE10 0x63 /* ATmega162 */
#define AVRDEVCODE11 0x78 /* ATmega169 */
#define AVRDEVCODE12 0x6C /* AT90S4434 */
#define AVRDEVCODE13 0x38 /* AT90S8515A */
#define AVRDEVCODE14 0x65 /* AT90S8555 */
/* some global variables used throughout */
uint8_t tempIOreg = 0;
uint8_t tempIOreg2 = 0;
uint8_t tempIOreg3 = 0;
uint8_t tempIOreg4 = 0;
uint8_t dataWidth = 0;
uint8_t firstRun = 1;
uint8_t deviceCode = 0;
uint8_t tempByte = 0;
uint16_t currAddress = 0;
uint16_t timerval = 0;
<AVRStudio><MANAGEMENT><ProjectName>AVRISP_Programmer</ProjectName><Created>30-Sep-2008 14:18:39</Created><LastEdit>30-Sep-2008 14:18:52</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>30-Sep-2008 14:18:39</Created><Version>4</Version><Build>4, 14, 0, 589</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile></ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Users\Dean\Documents\Electronics\Projects\WORK\MyUSBWORK\Demos\AVRISP_Programmer\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET></CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>Descriptors.c</SOURCEFILE><SOURCEFILE>RingBuff.c</SOURCEFILE><SOURCEFILE>AVRISP_Programmer.c</SOURCEFILE><HEADERFILE>Descriptors.h</HEADERFILE><HEADERFILE>RingBuff.h</HEADERFILE><HEADERFILE>AVRISP_Programmer.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>AVRISP_Programmer.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20080512\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20080512\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
This diff is collapsed.
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for USBtoSerial.c.
*/
#ifndef _AVRISP_PROGRAMMER_H_
#define _AVRISP_PROGRAMMER_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include "Descriptors.h"
#include "RingBuff.h"
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/AT90USBXXX/SPI.h> // SPI driver
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
#define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
#define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that the DTR line state should be high.
*/
#define CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that theRTS line state should be high.
*/
#define CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
#define CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
#define CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
#define CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
#define CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has ocurred on the virtual serial port.
*/
#define CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has ocurred on the virtual serial port.
*/
#define CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has ocurred on the virtual serial port.
*/
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Type Defines: */
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
* as set by the host via a class specific request.
*/
typedef struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum
*/
uint8_t DataBits; /**< Bits of data per charater of the virtual serial port */
} CDC_Line_Coding_t;
/** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a
* change in the device state asynchronously.
*/
typedef struct
{
uint8_t NotificationType; /**< Notification type, a mask of REQDIR_*, REQTYPE_* and REQREC_* constants
* from the library StdRequestType.h header
*/
uint8_t Notification; /**< Notification value, a NOTIF_* constant */
uint16_t wValue; /**< Notification wValue, notification-specific */
uint16_t wIndex; /**< Notification wIndex, notification-specific */
uint16_t wLength; /**< Notification wLength, notification-specific */
} USB_Notification_Header_t;
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
OneStopBit = 0, /**< Each frame contains one stop bit */
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
TwoStopBits = 2, /**< Each frame contains two stop bits */
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
Parity_None = 0, /**< No parity bit mode on each frame */
Parity_Odd = 1, /**< Odd parity bit mode on each frame */
Parity_Even = 2, /**< Even parity bit mode on each frame */
Parity_Mark = 3, /**< Mark parity bit mode on each frame */
Parity_Space = 4, /**< Space parity bit mode on each frame */
};
/** Enum for the possible status codes for passing to the UpdateStatus() function. */
enum USBtoSerial_StatusCodes_t
{
Status_USBNotReady = 0, /**< USB is not ready (disconnected from a USB host) */
Status_USBEnumerating = 1, /**< USB interface is enumerating */
Status_USBReady = 2, /**< USB interface is connected and ready */
};
/* Tasks: */
TASK(CDC_Task);
/* Function Prototypes: */
void ReconfigureSPI(void);
void UpdateStatus(uint8_t CurrentStatus);
void processHostSPIRequest(void);
void delay_ms(uint8_t dly);
#endif
/** \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 AVRISP_Programmer
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a USB to Serial converter using the CDC class. Data communicated
* over the USB Virtual Serial Port according to Atmel's AVR910
* protocol is used to program AVR MCUs that are
* "In-System Programmable via SPI Port".
*
* After running this firmware 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.
*
* Usage:
* avrdude -vv -F -P COM7 -c avr910 -p t261
* Note -F flag which overrides signature check and enables programming
* of any "In-System Programmable via SPI Port" AVR MCU. Part number,
* t261, should be set to your target device.
* avrdude -vv -F -P COM7 -c avr910 -p t261 -U flash:w:PROG.hex
* PROG.hex is the hex file to program your t261 AVR with
* avrdude -vv -F -P COM7 -b 115200 -c avr910 -p t261 -U flash:w:test.hex
* The -b 115200 sets the SPI clock to 62.5kHz from the default 125kHz and may
* work when the default programming speed fails.
* AVROSP.exe -dATtiny261 -cCOM7 -rf
* AVRosp is the Open Source AVR ISP Programming Software available from Atmel.com
*
* Note: on Linux systems, COM7 should be replaced with someting like /dev/ttyACM0
* You can determine this value by running dmesg after plugging in the device
* Note: you must RESET the programmer after each use (AVRdude session).
*
* Note: If you experience errors with older devices, try changing DELAY_LONG
* to a larger value, such as 0xFF in AVRISP_Programmer.c
*
* MISO, MOSI, and SCK are connected directly from the AVRopendous board
* to the pin of the same functionality on the target. RESET pin on the target
* can be connected either to SS (PB0), or PC2. Do not have any other pins
* connected - especially HWB pin, to avoid unintentional behaviour.
*
* AVR910 functionality was overlayed on USBtoSerial functionality.
* Keep this in mind when looking over the code.
* Default target speed is 125kHz and corresponds to 19200 baud, which
* is the default setting for AVRdude.
*
* Changing "Baud-Rate" will change the SPI speed. Defualt SPI clock speed
* is 8Mhz / 4 = 2MHz. 8Mhz is the device clock speed. This is the setting at
* 9600 baud. The following is a table of baud-rate vs. SPI Speed that will result
* 9600 = 2Mhz
* 14400 = 1MHz
* 19200 = 125kHz (AVRdude Default)
* 38400 = 250kHz
* 57600 = 500kHz
* 115200 = 62.5kHz
*
*
*
*
* <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>Usable Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*/
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* 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.
*/
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
Header: {Size: sizeof(USB_Descriptor_Device_t), Type: DTYPE_Device},
USBSpecification: VERSION_BCD(01.10),
Class: 0x02,
SubClass: 0x00,
Protocol: 0x00,
Endpoint0Size: 8,
VendorID: 0x03EB,
ProductID: 0x204F,
ReleaseNumber: 0x0000,
ManufacturerStrIndex: 0x01,
ProductStrIndex: 0x02,
SerialNumStrIndex: NO_DESCRIPTOR,
NumberOfConfigurations: 1
};
/** 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.
*/
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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
MaxPowerConsumption: USB_CONFIG_POWER_MA(100)
},
CCI_Interface:
{
Header: {Size: sizeof(USB_Descriptor_Interface_t), Type: DTYPE_Interface},
InterfaceNumber: 0,
AlternateSetting: 0,
TotalEndpoints: 1,
Class: 0x02,
SubClass: 0x02,
Protocol: 0x01,
InterfaceStrIndex: NO_DESCRIPTOR
},
CDC_Functional_IntHeader:
{
Header: {Size: sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), Type: 0x24},
SubType: 0x00,
Data: {0x01, 0x10}
},
CDC_Functional_CallManagement:
{
Header: {Size: sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), Type: 0x24},
SubType: 0x01,
Data: {0x03, 0x01}
},
CDC_Functional_AbstractControlManagement:
{
Header: {Size: sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), Type: 0x24},
SubType: 0x02,
Data: {0x06}
},
CDC_Functional_Union:
{
Header: {Size: sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), Type: 0x24},
SubType: 0x06,
Data: {0x00, 0x01}
},
ManagementEndpoint:
{
Header: {Size: sizeof(USB_Descriptor_Endpoint_t), Type: DTYPE_Endpoint},
EndpointAddress: (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
Attributes: EP_TYPE_INTERRUPT,
EndpointSize: CDC_NOTIFICATION_EPSIZE,
PollingIntervalMS: 0xFF
},
DCI_Interface:
{
Header: {Size: sizeof(USB_Descriptor_Interface_t), Type: DTYPE_Interface},
InterfaceNumber: 1,