Run wspurify script on /trunk/ and /branches/ C source files, to remove any trailing whitespace at the end of each line.
This commit is contained in:
parent
77f354609f
commit
f201f6697b
278 changed files with 1000 additions and 910 deletions
|
@ -67,7 +67,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Atmel AVRISP-MKII Interface
|
||||
USB_Descriptor_Interface_t AVRISP_Interface;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
|
||||
|
|
|
@ -150,7 +150,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
|
|||
Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
|
||||
sizeof(Write_Memory_Params.ProgData)), NULL);
|
||||
Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
|
||||
|
||||
|
||||
if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
@ -236,7 +236,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
|
|||
/* Must reset the polling address afterwards, so it is not erroneously used for the next byte */
|
||||
PollAddress = 0;
|
||||
}
|
||||
|
||||
|
||||
/* EEPROM just increments the address each byte, flash needs to increment on each word and
|
||||
* also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
|
||||
* address boundary has been crossed during FLASH memory programming */
|
||||
|
@ -248,7 +248,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
|
|||
MustLoadExtendedAddress = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If the current page must be committed, send the PROGRAM PAGE command to the target */
|
||||
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
|
|||
/* Check to see if the FLASH address has crossed the extended address boundary */
|
||||
if ((V2Command == CMD_PROGRAM_FLASH_ISP) && !(CurrentAddress & 0xFFFF))
|
||||
MustLoadExtendedAddress = true;
|
||||
}
|
||||
}
|
||||
|
||||
Endpoint_Write_8(V2Command);
|
||||
Endpoint_Write_8(ProgrammingStatus);
|
||||
|
@ -293,7 +293,7 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
|
|||
|
||||
Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NULL);
|
||||
Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
|
||||
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
|
||||
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
|
||||
|
@ -526,3 +526,4 @@ void ISPProtocol_DelayMS(uint8_t DelayMS)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void ISPTarget_DisableTargetISP(void)
|
|||
{
|
||||
DDRB &= ~((1 << 1) | (1 << 2));
|
||||
PORTB &= ~((1 << 0) | (1 << 3));
|
||||
|
||||
|
||||
/* Must re-enable rescue clock once software ISP has exited, as the timer for the rescue clock is
|
||||
* re-purposed for software SPI */
|
||||
ISPTarget_ConfigureRescueClock();
|
||||
|
@ -195,7 +195,7 @@ void ISPTarget_ConfigureRescueClock(void)
|
|||
#if defined(XCK_RESCUE_CLOCK_ENABLE)
|
||||
/* Configure XCK as an output for the specified AVR model */
|
||||
DDRD |= (1 << 5);
|
||||
|
||||
|
||||
/* Start USART to generate a 4MHz clock on the XCK pin */
|
||||
UBRR1 = ((F_CPU / 2 / ISP_RESCUE_CLOCK_SPEED) - 1);
|
||||
UCSR1B = (1 << TXEN1);
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
if (HardwareSPIMode)
|
||||
return ~SPI_ReceiveByte();
|
||||
else
|
||||
return ~ISPTarget_TransferSoftSPIByte(0x00);
|
||||
return ~ISPTarget_TransferSoftSPIByte(0x00);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@
|
|||
if (HardwareSPIMode)
|
||||
return ~SPI_TransferByte(Byte);
|
||||
else
|
||||
return ~ISPTarget_TransferSoftSPIByte(Byte);
|
||||
return ~ISPTarget_TransferSoftSPIByte(Byte);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void V2Protocol_Init(void)
|
|||
#endif
|
||||
|
||||
V2Params_LoadNonVolatileParamValues();
|
||||
|
||||
|
||||
#if defined(ENABLE_ISP_PROTOCOL)
|
||||
ISPTarget_ConfigureRescueClock();
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/wdt.h>
|
||||
|
||||
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
||||
#include "../Descriptors.h"
|
||||
|
@ -61,11 +61,11 @@
|
|||
#if defined(USB_SERIES_4_AVR) && ((VTARGET_ADC_CHANNEL == 2) || (VTARGET_ADC_CHANNEL == 3)) && !defined(NO_VTARGET_DETECT)
|
||||
#error The U4 AVR chips do not contain ADC channels 2 or 3. Please change VTARGET_ADC_CHANNEL or define NO_VTARGET_DETECT in the makefile.
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(VTARGET_USE_INTERNAL_REF)
|
||||
#undef VTARGET_REF_VOLTS
|
||||
#define VTARGET_REF_VOLTS 2.56
|
||||
|
||||
|
||||
#define VTARGET_REF_MASK ADC_REFERENCE_INT2560MV
|
||||
#else
|
||||
#define VTARGET_REF_MASK ADC_REFERENCE_AVCC
|
||||
|
|
|
@ -151,7 +151,7 @@ void TINYNVM_DisableTPI(void)
|
|||
/* Clear the NVMEN bit in the TPI STATUS register to disable TPI mode */
|
||||
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_STATUS_REG);
|
||||
XPROGTarget_SendByte(0x00);
|
||||
|
||||
|
||||
/* Read back the STATUS register, check to see if it took effect */
|
||||
XPROGTarget_SendByte(TPI_CMD_SLDCS | PDI_RESET_REG);
|
||||
} while (XPROGTarget_ReceiveByte() != 0x00);
|
||||
|
|
|
@ -149,7 +149,7 @@ void XMEGANVM_DisablePDI(void)
|
|||
{
|
||||
XMEGANVM_WaitWhileNVMBusBusy();
|
||||
|
||||
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run - must perform this until the
|
||||
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run - must perform this until the
|
||||
* change takes effect, as in some cases it takes multiple writes (silicon bug?).
|
||||
*/
|
||||
do
|
||||
|
@ -157,7 +157,7 @@ void XMEGANVM_DisablePDI(void)
|
|||
/* Clear reset register */
|
||||
XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
|
||||
XPROGTarget_SendByte(0x00);
|
||||
|
||||
|
||||
/* Read back the reset register, check to see if it took effect */
|
||||
XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_RESET_REG);
|
||||
} while (XPROGTarget_ReceiveByte() != 0x00);
|
||||
|
|
|
@ -143,7 +143,7 @@ static void XPROGProtocol_LeaveXPROGMode(void)
|
|||
TINYNVM_DisableTPI();
|
||||
|
||||
#if defined(XCK_RESCUE_CLOCK_ENABLE) && defined(ENABLE_ISP_PROTOCOL)
|
||||
/* If the XCK rescue clock option is enabled, we need to restart it once the
|
||||
/* If the XCK rescue clock option is enabled, we need to restart it once the
|
||||
* XPROG mode has been exited, since the XPROG protocol stops it after use. */
|
||||
ISPTarget_ConfigureRescueClock();
|
||||
#endif
|
||||
|
@ -258,7 +258,7 @@ static void XPROGProtocol_WriteMemory(void)
|
|||
Endpoint_ClearOUT();
|
||||
Endpoint_WaitUntilReady();
|
||||
}
|
||||
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
|
||||
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
|
||||
|
|
|
@ -120,7 +120,7 @@ void XPROGTarget_DisableTargetTPI(void)
|
|||
/* Set all USART lines as inputs, tristate */
|
||||
DDRD &= ~((1 << 5) | (1 << 3));
|
||||
PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
|
||||
|
||||
|
||||
/* Tristate target /RESET line */
|
||||
AUX_LINE_DDR &= ~AUX_LINE_MASK;
|
||||
AUX_LINE_PORT &= ~AUX_LINE_MASK;
|
||||
|
@ -164,7 +164,7 @@ void XPROGTarget_SendIdle(void)
|
|||
/* Switch to Tx mode if currently in Rx mode */
|
||||
if (!(IsSending))
|
||||
XPROGTarget_SetTxMode();
|
||||
|
||||
|
||||
/* Need to do nothing for a full frame to send an IDLE */
|
||||
for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ int main(void)
|
|||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */
|
||||
RingBuffer_Remove(&USARTtoUSB_Buffer);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* Main source file for the HIDReportViewer project. This file contains the main tasks of
|
||||
* the project and is responsible for the initial application hardware configuration.
|
||||
*/
|
||||
|
||||
|
||||
#include "HIDReportViewer.h"
|
||||
|
||||
/** Processed HID report descriptor items structure, containing information on each HID report element */
|
||||
|
@ -75,7 +75,7 @@ int main(void)
|
|||
for (;;)
|
||||
{
|
||||
RetrieveDeviceData();
|
||||
|
||||
|
||||
HID_Host_USBTask(&Device_HID_Interface);
|
||||
USB_USBTask();
|
||||
}
|
||||
|
@ -88,12 +88,12 @@ void RetrieveDeviceData(void)
|
|||
{
|
||||
if (USB_CurrentMode != USB_MODE_Host)
|
||||
return;
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
|
||||
OutputReportSizes();
|
||||
OutputParsedReportItems();
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||
USB_Host_SetDeviceConfiguration(0);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void OutputParsedReportItems(void)
|
|||
RItem->Attributes.Logical.Maximum,
|
||||
RItem->Attributes.Physical.Minimum,
|
||||
RItem->Attributes.Physical.Maximum);
|
||||
|
||||
|
||||
OutputCollectionPath(RItem->CollectionPath);
|
||||
}
|
||||
}
|
||||
|
@ -188,10 +188,10 @@ void OutputCollectionPath(const HID_CollectionPath_t* const CollectionPath)
|
|||
" - Type: 0x%02" PRIX8 "\r\n"
|
||||
" - Usage: 0x%02" PRIX8 "\r\n"),
|
||||
CurrentNode->Type, CurrentNode->Usage);
|
||||
|
||||
|
||||
CurrentNode = CurrentNode->Parent;
|
||||
}
|
||||
|
||||
|
||||
printf_P(PSTR(" |\r\n"
|
||||
" END\r\n"));
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Mass Storage Interface
|
||||
USB_Descriptor_Interface_t MS_Interface;
|
||||
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
/** Indicates if the disk is write protected or not. */
|
||||
#define DISK_READ_ONLY false
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
|
||||
|
|
|
@ -190,3 +190,4 @@ FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item from the open di
|
|||
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
SCSI_ASENSE_WRITE_PROTECTED,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
|
@ -307,7 +307,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
|
||||
if (IsDataRead == DATA_READ)
|
||||
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
|
||||
|
@ -341,4 +341,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -65,14 +65,14 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// CDC Command 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -90,7 +90,7 @@ int main(void)
|
|||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
sei();
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
MIDI_EventPacket_t ReceivedMIDIEvent;
|
||||
|
@ -99,7 +99,7 @@ int main(void)
|
|||
if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
|
||||
{
|
||||
DDSNoteData* LRUNoteStruct = &NoteData[0];
|
||||
|
||||
|
||||
/* Find a free entry in the note table to use for the note being turned on */
|
||||
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
|
||||
{
|
||||
|
@ -112,13 +112,13 @@ int main(void)
|
|||
}
|
||||
else if (NoteData[i].LRUAge >= LRUNoteStruct->LRUAge)
|
||||
{
|
||||
/* If an older entry that the current entry has been found, prefer overwriting that one */
|
||||
/* If an older entry that the current entry has been found, prefer overwriting that one */
|
||||
LRUNoteStruct = &NoteData[i];
|
||||
}
|
||||
|
||||
|
||||
NoteData[i].LRUAge++;
|
||||
}
|
||||
|
||||
|
||||
/* Update the oldest note entry with the new note data and reset its age */
|
||||
LRUNoteStruct->Pitch = ReceivedMIDIEvent.Data2;
|
||||
LRUNoteStruct->TableIncrement = (uint32_t)(BASE_INCREMENT * SCALE_FACTOR) +
|
||||
|
@ -133,7 +133,7 @@ int main(void)
|
|||
else if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_OFF >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
|
||||
{
|
||||
bool FoundActiveNote = false;
|
||||
|
||||
|
||||
/* Find the note in the note table to turn off */
|
||||
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
|
||||
{
|
||||
|
@ -142,13 +142,13 @@ int main(void)
|
|||
else if (NoteData[i].Pitch)
|
||||
FoundActiveNote = true;
|
||||
}
|
||||
|
||||
|
||||
/* If all notes off, turn off the indicator LED */
|
||||
if (!(FoundActiveNote))
|
||||
LEDs_SetAllLEDs(LEDS_NO_LEDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
|
||||
USB_USBTask();
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ int main(void)
|
|||
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
|
||||
{
|
||||
uint16_t MixedSample = 0;
|
||||
|
||||
|
||||
/* Sum together all the active notes to form a single sample */
|
||||
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
|
||||
{
|
||||
|
@ -167,13 +167,13 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
|
|||
{
|
||||
/* Use the top 8 bits of the table position as the sample table index */
|
||||
uint8_t TableIndex = (NoteData[i].TablePosition >> 24);
|
||||
|
||||
|
||||
/* Add the new tone sample to the accumulator and increment the table position */
|
||||
MixedSample += SineTable[TableIndex];
|
||||
NoteData[i].TablePosition += NoteData[i].TableIncrement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Output clamped mixed sample value to the PWM */
|
||||
OCR3A = (MixedSample <= 0xFF) ? MixedSample : 0xFF;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void SetupHardware(void)
|
|||
|
||||
/* Disable clock division */
|
||||
clock_prescale_set(clock_div_1);
|
||||
|
||||
|
||||
/* Hardware Initialization */
|
||||
LEDs_Init();
|
||||
USB_Init();
|
||||
|
@ -234,7 +234,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
|||
bool ConfigSuccess = true;
|
||||
|
||||
ConfigSuccess &= MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface);
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
||||
|
@ -243,3 +243,4 @@ void EVENT_USB_Device_ControlRequest(void)
|
|||
{
|
||||
MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* Header file for AudioOutput.c.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _AUDIO_OUTPUT_H_
|
||||
#define _AUDIO_OUTPUT_H_
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "Descriptors.h"
|
||||
|
||||
|
||||
#include <LUFA/Version.h>
|
||||
#include <LUFA/Drivers/Board/LEDs.h>
|
||||
#include <LUFA/Drivers/Peripheral/ADC.h>
|
||||
|
@ -63,27 +63,27 @@
|
|||
|
||||
/** 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)
|
||||
|
||||
|
||||
/** Scale factor used to convert the floating point frequencies and ratios into a fixed point number */
|
||||
#define SCALE_FACTOR 65536
|
||||
|
||||
|
||||
/** Base (lowest) allowable MIDI note frequency */
|
||||
#define BASE_FREQUENCY 27.5
|
||||
|
||||
|
||||
/** Ratio between each note in an octave */
|
||||
#define NOTE_OCTIVE_RATIO 1.05946
|
||||
|
||||
|
||||
/** Lowest valid MIDI pitch index */
|
||||
#define BASE_PITCH_INDEX 21
|
||||
|
||||
|
||||
/** Maximum number of MIDI notes that can be played simultaneously */
|
||||
#define MAX_SIMULTANEOUS_NOTES 3
|
||||
|
||||
|
||||
/** Number of samples in the virtual sample table (can be expanded to lower maximum frequency, but allow for
|
||||
* more simultaneous notes due to the reduced amount of processing time needed when the samples are spaced out)
|
||||
*/
|
||||
#define VIRTUAL_SAMPLE_TABLE_SIZE 512
|
||||
|
||||
|
||||
/** Sample table increments per period for the base MIDI note frequency */
|
||||
#define BASE_INCREMENT (((F_CPU / VIRTUAL_SAMPLE_TABLE_SIZE / 2) / BASE_FREQUENCY))
|
||||
|
||||
|
@ -98,10 +98,11 @@
|
|||
|
||||
/* 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_UnhandledControlRequest(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config; /**< Configuration descriptor header structure */
|
||||
|
||||
|
||||
// Keyboard HID Interface
|
||||
USB_Descriptor_Interface_t HID_Interface; /**< Keyboard interface descriptor */
|
||||
USB_HID_Descriptor_HID_t HID_KeyboardHID; /**< Keyboard HID descriptor */
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Media Controller HID Interface
|
||||
USB_Descriptor_Interface_t HID_Interface;
|
||||
USB_HID_Descriptor_HID_t HID_MediaControlHID;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/*
|
||||
Copyright 2011 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
|
||||
|
|
|
@ -104,7 +104,7 @@ int main(void)
|
|||
{
|
||||
Read_Joystick_Status();
|
||||
DiscardNextReport();
|
||||
|
||||
|
||||
USB_USBTask();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Relay Board Interface
|
||||
USB_Descriptor_Interface_t RelayBoardInterface;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
|
|
@ -43,12 +43,12 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Mass Storage Interface
|
||||
USB_Descriptor_Interface_t MS_Interface;
|
||||
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
|
||||
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
|
||||
|
||||
|
||||
// Settings Management Generic HID Interface
|
||||
USB_Descriptor_Interface_t HID_Interface;
|
||||
USB_HID_Descriptor_HID_t HID_GenericHID;
|
||||
|
|
|
@ -34,7 +34,7 @@ bool DS1307_SetTimeDate(const TimeDate_t* NewTimeDate)
|
|||
NewRegValues.Byte6.Fields.Month = (NewTimeDate->Month % 10);
|
||||
NewRegValues.Byte7.Fields.TenYear = (NewTimeDate->Year / 10);
|
||||
NewRegValues.Byte7.Fields.Year = (NewTimeDate->Year % 10);
|
||||
|
||||
|
||||
// Write the new Time and Date into the DS1307
|
||||
if (TWI_WritePacket(DS1307_ADDRESS, 10, &WriteAddress, sizeof(WriteAddress),
|
||||
(uint8_t*)&NewRegValues, sizeof(DS1307_DateTimeRegs_t)) != TWI_ERROR_NoError)
|
||||
|
@ -51,24 +51,24 @@ bool DS1307_GetTimeDate(TimeDate_t* const TimeDate)
|
|||
TimeDate->Hour = 1;
|
||||
TimeDate->Minute = 1;
|
||||
TimeDate->Second = 1;
|
||||
|
||||
|
||||
TimeDate->Day = 1;
|
||||
TimeDate->Month = 1;
|
||||
TimeDate->Year = 1;
|
||||
|
||||
|
||||
return true;
|
||||
#endif
|
||||
|
||||
DS1307_DateTimeRegs_t CurrentRegValues;
|
||||
const uint8_t ReadAddress = 0;
|
||||
|
||||
|
||||
// Read in the stored Time and Date from the DS1307
|
||||
if (TWI_ReadPacket(DS1307_ADDRESS, 10, &ReadAddress, sizeof(ReadAddress),
|
||||
(uint8_t*)&CurrentRegValues, sizeof(DS1307_DateTimeRegs_t)) != TWI_ERROR_NoError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Convert stored time value into decimal
|
||||
TimeDate->Second = (CurrentRegValues.Byte1.Fields.TenSec * 10) + CurrentRegValues.Byte1.Fields.Sec;
|
||||
TimeDate->Minute = (CurrentRegValues.Byte2.Fields.TenMin * 10) + CurrentRegValues.Byte2.Fields.Min;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
uint8_t Month;
|
||||
uint8_t Year;
|
||||
} TimeDate_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
uint8_t IntVal;
|
||||
} Byte4;
|
||||
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
|
|
@ -946,7 +946,7 @@ FRESULT remove_chain (
|
|||
#if _USE_ERASE
|
||||
if (ecl + 1 == nxt) { /* Next cluster is contiguous */
|
||||
ecl = nxt;
|
||||
} else { /* End of contiguous clusters */
|
||||
} else { /* End of contiguous clusters */
|
||||
resion[0] = clust2sect(fs, scl); /* Start sector */
|
||||
resion[1] = clust2sect(fs, ecl) + fs->csize - 1; /* End sector */
|
||||
disk_ioctl(fs->drv, CTRL_ERASE_SECTOR, resion); /* Erase the block */
|
||||
|
@ -2650,7 +2650,7 @@ FRESULT f_close (
|
|||
#if _FS_REENTRANT
|
||||
res = validate(fp->fs, fp->id);
|
||||
if (res == FR_OK) {
|
||||
res = dec_lock(fp->lockid);
|
||||
res = dec_lock(fp->lockid);
|
||||
unlock_fs(fp->fs, FR_OK);
|
||||
}
|
||||
#else
|
||||
|
@ -2749,7 +2749,7 @@ FRESULT f_getcwd (
|
|||
res = dir_read(&dj);
|
||||
if (res != FR_OK) break;
|
||||
if (ccl == LD_CLUST(dj.dir)) break; /* Found the entry */
|
||||
res = dir_next(&dj, 0);
|
||||
res = dir_next(&dj, 0);
|
||||
} while (res == FR_OK);
|
||||
if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
|
||||
if (res != FR_OK) break;
|
||||
|
@ -3978,3 +3978,4 @@ int f_printf (
|
|||
|
||||
#endif /* !_FS_READONLY */
|
||||
#endif /* _USE_STRFUNC */
|
||||
|
||||
|
|
|
@ -333,3 +333,4 @@ int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
|||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
SCSI_ASENSE_WRITE_PROTECTED,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
|
@ -306,7 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
|
||||
if (IsDataRead == DATA_READ)
|
||||
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
|
||||
|
@ -340,3 +340,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
|
|||
const uint16_t ReportSize)
|
||||
{
|
||||
Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
|
||||
|
||||
|
||||
DS1307_SetTimeDate(&ReportParams->TimeDate);
|
||||
|
||||
/* If the logging interval has changed from its current value, write it to EEPROM */
|
||||
|
|
|
@ -65,14 +65,14 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// CDC Command 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;
|
||||
|
|
|
@ -97,7 +97,7 @@ int main(void)
|
|||
if (!(ReceivedByte < 0))
|
||||
RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
|
||||
}
|
||||
|
||||
|
||||
/* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */
|
||||
uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);
|
||||
if ((TIFR0 & (1 << TOV0)) || (BufferCount > (uint8_t)(sizeof(USARTtoUSB_Buffer_Data) * .75)))
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// RNDIS CDC Command Interface
|
||||
USB_Descriptor_Interface_Association_t CDC_IAD;
|
||||
USB_Descriptor_Interface_t CDC_CCI_Interface;
|
||||
|
@ -82,12 +82,12 @@
|
|||
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
|
||||
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
|
||||
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
|
||||
|
||||
|
||||
// RNDIS CDC Data Interface
|
||||
USB_Descriptor_Interface_t CDC_DCI_Interface;
|
||||
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
|
||||
USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint;
|
||||
|
||||
|
||||
// Mass Storage Interface
|
||||
USB_Descriptor_Interface_t MS_Interface;
|
||||
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
|
||||
|
|
|
@ -100,3 +100,4 @@ bool DHCPCommon_GetOption(const uint8_t* DHCPOptionList,
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <uip.h>
|
||||
|
||||
/* Macros: */
|
||||
|
|
|
@ -42,20 +42,20 @@
|
|||
struct uip_conn* BroadcastConnection;
|
||||
|
||||
uint8_t LeasedIPs[255 / 8];
|
||||
|
||||
|
||||
/** Initialization function for the DHCP server. */
|
||||
void DHCPServerApp_Init(void)
|
||||
{
|
||||
/* Listen on port 67 for DHCP server connections from hosts */
|
||||
uip_listen(HTONS(DHCP_SERVER_PORT));
|
||||
|
||||
|
||||
/* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
|
||||
struct uip_udp_conn* BroadcastConnection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCP_CLIENT_PORT));
|
||||
|
||||
/* If the connection was successfully created, bind it to the local DHCP client port */
|
||||
if (BroadcastConnection != NULL)
|
||||
uip_udp_bind(BroadcastConnection, HTONS(DHCP_SERVER_PORT));
|
||||
|
||||
|
||||
/* Set all IP addresses as unleased */
|
||||
memset(LeasedIPs, 0x00, sizeof(LeasedIPs));
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ void DHCPServerApp_Callback(void)
|
|||
|
||||
/* Try to extract out the client's preferred IP address if it is indicated in the packet */
|
||||
if (!(DHCPCommon_GetOption(AppData->Options, DHCP_OPTION_REQ_IPADDR, &PreferredClientIP)))
|
||||
memcpy(&PreferredClientIP, &uip_all_zeroes_addr, sizeof(uip_ipaddr_t));
|
||||
|
||||
memcpy(&PreferredClientIP, &uip_all_zeroes_addr, sizeof(uip_ipaddr_t));
|
||||
|
||||
switch (DHCPMessageType)
|
||||
{
|
||||
case DHCP_DISCOVER:
|
||||
|
@ -116,7 +116,7 @@ void DHCPServerApp_Callback(void)
|
|||
/* Check to see if the requested IP address has already been leased to a client */
|
||||
if (!(DHCPServerApp_CheckIfIPLeased(&PreferredClientIP)))
|
||||
{
|
||||
/* Create a new DHCP ACK packet to accept the IP address lease */
|
||||
/* Create a new DHCP ACK packet to accept the IP address lease */
|
||||
AppDataSize += DHCPServerApp_FillDHCPHeader(AppData, DHCP_ACK, &RemoteMACAddress, &PreferredClientIP, TransactionID);
|
||||
|
||||
/* Add network mask and router information to the list of DHCP ACK packet options */
|
||||
|
@ -133,12 +133,12 @@ void DHCPServerApp_Callback(void)
|
|||
/* Create a new DHCP NAK packet to reject the requested allocation */
|
||||
AppDataSize += DHCPServerApp_FillDHCPHeader(AppData, DHCP_NAK, &RemoteMACAddress, &uip_all_zeroes_addr, TransactionID);
|
||||
}
|
||||
|
||||
|
||||
/* Send the DHCP ACK or NAK packet */
|
||||
uip_poll_conn(BroadcastConnection);
|
||||
memcpy(&uip_udp_conn->ripaddr, &uip_broadcast_addr, sizeof(uip_ipaddr_t));
|
||||
uip_udp_send(AppDataSize);
|
||||
|
||||
|
||||
break;
|
||||
case DHCP_RELEASE:
|
||||
/* Mark the IP address as released in the allocation table */
|
||||
|
@ -179,7 +179,7 @@ static uint16_t DHCPServerApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
|
|||
memcpy(&DHCPHeader->YourIP, PreferredClientIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->ClientHardwareAddress, ClientHardwareAddress, sizeof(struct uip_eth_addr));
|
||||
DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
|
||||
|
||||
|
||||
/* Add a DHCP message type and terminator options to the start of the DHCP options field */
|
||||
DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
|
||||
DHCPHeader->Options[1] = 1;
|
||||
|
@ -202,7 +202,7 @@ static bool DHCPServerApp_CheckIfIPLeased(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Make sure that the requested IP address isn't already leased to the virtual server or another client */
|
||||
if (IPAddress->u8[3] && !(IPAddress->u8[3] == uip_hostaddr.u8[3]) && !(LeasedIPs[Byte] & Mask))
|
||||
return false;
|
||||
|
@ -217,13 +217,13 @@ static bool DHCPServerApp_CheckIfIPLeased(const uip_ipaddr_t* const IPAddress)
|
|||
static void DHCPServerApp_GetUnleasedIP(uip_ipaddr_t* const NewIPAddress)
|
||||
{
|
||||
uip_ipaddr_copy(NewIPAddress, &uip_hostaddr);
|
||||
|
||||
|
||||
/** Look through the current subnet, skipping the broadcast and zero IP addresses */
|
||||
for (uint8_t IP = 1; IP < 254; IP++)
|
||||
{
|
||||
/* Update new IP address to lease with the current IP address to test */
|
||||
NewIPAddress->u8[3] = IP;
|
||||
|
||||
|
||||
/* If we've found an unleased IP, abort with the updated IP stored for the called */
|
||||
if (!(DHCPServerApp_CheckIfIPLeased(NewIPAddress)))
|
||||
return;
|
||||
|
@ -241,7 +241,7 @@ static void DHCPServerApp_LeaseIP(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Mark the IP address as leased in the allocation table */
|
||||
LeasedIPs[Byte] |= Mask;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ static void DHCPServerApp_UnleaseIP(const uip_ipaddr_t* const IPAddress)
|
|||
{
|
||||
uint8_t Byte = (IPAddress->u8[3] / 8);
|
||||
uint8_t Mask = (1 << (IPAddress->u8[3] % 8));
|
||||
|
||||
|
||||
/* Mark the IP address as unleased in the allocation table */
|
||||
LeasedIPs[Byte] &= ~Mask;
|
||||
}
|
||||
|
|
|
@ -946,7 +946,7 @@ FRESULT remove_chain (
|
|||
#if _USE_ERASE
|
||||
if (ecl + 1 == nxt) { /* Next cluster is contiguous */
|
||||
ecl = nxt;
|
||||
} else { /* End of contiguous clusters */
|
||||
} else { /* End of contiguous clusters */
|
||||
resion[0] = clust2sect(fs, scl); /* Start sector */
|
||||
resion[1] = clust2sect(fs, ecl) + fs->csize - 1; /* End sector */
|
||||
disk_ioctl(fs->drv, CTRL_ERASE_SECTOR, resion); /* Erase the block */
|
||||
|
@ -2650,7 +2650,7 @@ FRESULT f_close (
|
|||
#if _FS_REENTRANT
|
||||
res = validate(fp->fs, fp->id);
|
||||
if (res == FR_OK) {
|
||||
res = dec_lock(fp->lockid);
|
||||
res = dec_lock(fp->lockid);
|
||||
unlock_fs(fp->fs, FR_OK);
|
||||
}
|
||||
#else
|
||||
|
@ -2749,7 +2749,7 @@ FRESULT f_getcwd (
|
|||
res = dir_read(&dj);
|
||||
if (res != FR_OK) break;
|
||||
if (ccl == LD_CLUST(dj.dir)) break; /* Found the entry */
|
||||
res = dir_next(&dj, 0);
|
||||
res = dir_next(&dj, 0);
|
||||
} while (res == FR_OK);
|
||||
if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
|
||||
if (res != FR_OK) break;
|
||||
|
@ -3978,3 +3978,4 @@ int f_printf (
|
|||
|
||||
#endif /* !_FS_READONLY */
|
||||
#endif /* _USE_STRFUNC */
|
||||
|
||||
|
|
|
@ -333,3 +333,4 @@ int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
|||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
SCSI_ASENSE_WRITE_PROTECTED,
|
||||
SCSI_ASENSEQ_NO_QUALIFIER);
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
|
||||
|
@ -306,7 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
|
||||
if (IsDataRead == DATA_READ)
|
||||
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
|
||||
|
@ -340,3 +340,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <avr/pgmspace.h>
|
||||
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
||||
|
||||
#include "../Descriptors.h"
|
||||
#include "DataflashManager.h"
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void uIPManagement_Init(void)
|
|||
MACAddress.addr[5] = SERVER_MAC_ADDRESS[5];
|
||||
|
||||
#if defined(ENABLE_DHCP_SERVER)
|
||||
DHCPServerApp_Init();
|
||||
DHCPServerApp_Init();
|
||||
#endif
|
||||
|
||||
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
|
||||
|
@ -84,7 +84,7 @@ void uIPManagement_Init(void)
|
|||
else
|
||||
{
|
||||
#if defined(ENABLE_DHCP_CLIENT)
|
||||
DHCPClientApp_Init();
|
||||
DHCPClientApp_Init();
|
||||
#else
|
||||
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
|
||||
uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
|
||||
|
@ -170,7 +170,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
|
|||
/* If no packet received, exit processing routine */
|
||||
if (!(RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface_Device)))
|
||||
return;
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
/* Read the Incoming packet straight into the UIP packet buffer */
|
||||
|
@ -181,13 +181,13 @@ static void uIPManagement_ProcessIncomingPacket(void)
|
|||
/* If no packet received, exit processing routine */
|
||||
if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface_Host)))
|
||||
return;
|
||||
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
/* Read the Incoming packet straight into the UIP packet buffer */
|
||||
RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface_Host, uip_buf, &uip_len);
|
||||
}
|
||||
|
||||
|
||||
/* If the packet contains an Ethernet frame, process it */
|
||||
if (uip_len > 0)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
* (when DHCP is disabled).
|
||||
*/
|
||||
#define DEVICE_GATEWAY (uint8_t[]){10, 0, 0, 1}
|
||||
|
||||
|
||||
/** Ethernet MAC address of the virtual webserver. When in device RNDIS mode, the virtual webserver requires
|
||||
* a unique MAC address that it can use when sending packets to the RNDIS adapter, which contains a seperate
|
||||
* MAC address as set in the RNDIS class driver configuration structure.
|
||||
|
|
|
@ -62,7 +62,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device =
|
|||
.AdapterMACAddress = {{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
|
||||
* passed to all Mass Storage Class driver functions, so that multiple instances of the same class
|
||||
* within a device can be differentiated from one another.
|
||||
|
|
|
@ -67,7 +67,7 @@ void USBHostMode_USBTask(void)
|
|||
return;
|
||||
|
||||
uIPManagement_ManageNetwork();
|
||||
|
||||
|
||||
RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface_Host);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
|
||||
// Atmel AVRISP-MKII Interface
|
||||
USB_Descriptor_Interface_t AVRISP_Interface;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
|
||||
|
|
|
@ -67,3 +67,4 @@
|
|||
void SoftUART_Init(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -65,14 +65,14 @@
|
|||
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;
|
||||
|
|
|
@ -134,7 +134,7 @@ void UARTBridge_Task(void)
|
|||
if (!(ReceivedByte < 0))
|
||||
RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte);
|
||||
}
|
||||
|
||||
|
||||
/* Check if the UART receive buffer flush timer has expired or buffer is nearly full */
|
||||
uint16_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer);
|
||||
if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue