Some minor whitespace corrections.

pull/1469/head
Dean Camera 16 years ago
parent 462fb500d7
commit b2330934b9

@ -110,7 +110,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ACSpecification = VERSION_BCD(01.00), .ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_AudioInterface_AC_t) + .TotalLength = (sizeof(USB_AudioInterface_AC_t) +
sizeof(USB_AudioInputTerminal_t) + sizeof(USB_AudioInputTerminal_t) +
sizeof(USB_AudioOutputTerminal_t)), sizeof(USB_AudioOutputTerminal_t)),
.InCollection = 1, .InCollection = 1,
.InterfaceNumbers = {1}, .InterfaceNumbers = {1},

@ -160,7 +160,7 @@ void EVENT_USB_Connect(void)
#if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO)) #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))
/* PWM speaker timer initialization */ /* PWM speaker timer initialization */
TCCRxA = ((1 << WGMx0) | (1 << COMxA1) | (1 << COMxA0) TCCRxA = ((1 << WGMx0) | (1 << COMxA1) | (1 << COMxA0)
| (1 << COMxB1) | (1 << COMxB0)); // Set on match, clear on TOP | (1 << COMxB1) | (1 << COMxB0)); // Set on match, clear on TOP
TCCRxB = ((1 << WGMx2) | (1 << CSx0)); // Fast 8-Bit PWM, Fcpu speed TCCRxB = ((1 << WGMx2) | (1 << CSx0)); // Fast 8-Bit PWM, Fcpu speed
#endif #endif
} }

@ -109,8 +109,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ACSpecification = VERSION_BCD(01.00), .ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_AudioInterface_AC_t) + .TotalLength = (sizeof(USB_AudioInterface_AC_t) +
sizeof(USB_AudioInputTerminal_t) + sizeof(USB_AudioInputTerminal_t) +
sizeof(USB_AudioOutputTerminal_t)), sizeof(USB_AudioOutputTerminal_t)),
.InCollection = 1, .InCollection = 1,
.InterfaceNumbers = {1}, .InterfaceNumbers = {1},

@ -81,6 +81,6 @@
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif #endif

@ -79,6 +79,6 @@
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif #endif

@ -99,6 +99,6 @@
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif #endif

@ -64,6 +64,6 @@
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif #endif

@ -43,14 +43,14 @@
*/ */
USB_ClassInfo_HID_t Keyboard_HID_Interface = USB_ClassInfo_HID_t Keyboard_HID_Interface =
{ {
.InterfaceNumber = 0, .InterfaceNumber = 0,
.ReportINEndpointNumber = KEYBOARD_EPNUM, .ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE, .ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t), .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
.IdleCount = 500, .IdleCount = 500,
}; };
/** Main program entry point. This routine contains the overall program flow, including initial /** Main program entry point. This routine contains the overall program flow, including initial
@ -58,32 +58,32 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
*/ */
int main(void) int main(void)
{ {
SetupHardware(); SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
for (;;) for (;;)
{ {
USB_HID_USBTask(&Keyboard_HID_Interface); USB_HID_USBTask(&Keyboard_HID_Interface);
USB_USBTask(); USB_USBTask();
} }
} }
/** Configures the board hardware and chip peripherals for the demo's functionality. */ /** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware() void SetupHardware()
{ {
/* Disable watchdog if enabled by bootloader/fuses */ /* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF); MCUSR &= ~(1 << WDRF);
wdt_disable(); wdt_disable();
/* Disable clock division */ /* Disable clock division */
clock_prescale_set(clock_div_1); clock_prescale_set(clock_div_1);
/* Hardware Initialization */ /* Hardware Initialization */
Joystick_Init(); Joystick_Init();
LEDs_Init(); LEDs_Init();
Buttons_Init(); Buttons_Init();
USB_Init(); USB_Init();
/* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
OCR0A = ((F_CPU / 64) / 1000); OCR0A = ((F_CPU / 64) / 1000);
@ -95,28 +95,28 @@ void SetupHardware()
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
if (!(USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface))) if (!(USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_UnhandledControlPacket(void)
{ {
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface); USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
@ -135,28 +135,28 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*/ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData) uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{ {
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus();
if (JoyStatus_LCL & JOY_UP) if (JoyStatus_LCL & JOY_UP)
KeyboardReport->KeyCode[0] = 0x04; // A KeyboardReport->KeyCode[0] = 0x04; // A
else if (JoyStatus_LCL & JOY_DOWN) else if (JoyStatus_LCL & JOY_DOWN)
KeyboardReport->KeyCode[0] = 0x05; // B KeyboardReport->KeyCode[0] = 0x05; // B
if (JoyStatus_LCL & JOY_LEFT) if (JoyStatus_LCL & JOY_LEFT)
KeyboardReport->KeyCode[0] = 0x06; // C KeyboardReport->KeyCode[0] = 0x06; // C
else if (JoyStatus_LCL & JOY_RIGHT) else if (JoyStatus_LCL & JOY_RIGHT)
KeyboardReport->KeyCode[0] = 0x07; // D KeyboardReport->KeyCode[0] = 0x07; // D
if (JoyStatus_LCL & JOY_PRESS) if (JoyStatus_LCL & JOY_PRESS)
KeyboardReport->KeyCode[0] = 0x08; // E KeyboardReport->KeyCode[0] = 0x08; // E
if (ButtonStatus_LCL & BUTTONS_BUTTON1) if (ButtonStatus_LCL & BUTTONS_BUTTON1)
KeyboardReport->KeyCode[0] = 0x09; // F KeyboardReport->KeyCode[0] = 0x09; // F
return sizeof(USB_KeyboardReport_Data_t); return sizeof(USB_KeyboardReport_Data_t);
} }
/** HID class driver callback function for the processing of HID reports from the host. /** HID class driver callback function for the processing of HID reports from the host.
@ -168,17 +168,17 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID, void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize) void* ReportData, uint16_t ReportSize)
{ {
uint8_t LEDMask = LEDS_NO_LEDS; uint8_t LEDMask = LEDS_NO_LEDS;
uint8_t* LEDReport = (uint8_t*)ReportData; uint8_t* LEDReport = (uint8_t*)ReportData;
if (*LEDReport & 0x01) // NUM Lock if (*LEDReport & 0x01) // NUM Lock
LEDMask |= LEDS_LED1; LEDMask |= LEDS_LED1;
if (*LEDReport & 0x02) // CAPS Lock if (*LEDReport & 0x02) // CAPS Lock
LEDMask |= LEDS_LED3; LEDMask |= LEDS_LED3;
if (*LEDReport & 0x04) // SCROLL Lock if (*LEDReport & 0x04) // SCROLL Lock
LEDMask |= LEDS_LED4; LEDMask |= LEDS_LED4;
LEDs_SetAllLEDs(LEDMask); LEDs_SetAllLEDs(LEDMask);
} }

@ -71,6 +71,6 @@
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif #endif

@ -92,13 +92,13 @@ void SetupHardware(void)
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */

@ -106,13 +106,13 @@ void SetupHardware(void)
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */

@ -175,9 +175,9 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM), .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = EP_TYPE_BULK, .Attributes = EP_TYPE_BULK,
.EndpointSize = CDC_TXRX_EPSIZE, .EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS= 0x00 .PollingIntervalMS = 0x00
} }
}; };

@ -110,7 +110,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ACSpecification = VERSION_BCD(01.00), .ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_AudioInterface_AC_t) + .TotalLength = (sizeof(USB_AudioInterface_AC_t) +
sizeof(USB_AudioInputTerminal_t) + sizeof(USB_AudioInputTerminal_t) +
sizeof(USB_AudioOutputTerminal_t)), sizeof(USB_AudioOutputTerminal_t)),
.InCollection = 1, .InCollection = 1,
.InterfaceNumbers = {1}, .InterfaceNumbers = {1},

@ -97,7 +97,7 @@ void EVENT_USB_Connect(void)
#if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO)) #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))
/* PWM speaker timer initialization */ /* PWM speaker timer initialization */
TCCRxA = ((1 << WGMx0) | (1 << COMxA1) | (1 << COMxA0) TCCRxA = ((1 << WGMx0) | (1 << COMxA1) | (1 << COMxA0)
| (1 << COMxB1) | (1 << COMxB0)); // Set on match, clear on TOP | (1 << COMxB1) | (1 << COMxB0)); // Set on match, clear on TOP
TCCRxB = ((1 << WGMx2) | (1 << CSx0)); // Fast 8-Bit PWM, Fcpu speed TCCRxB = ((1 << WGMx2) | (1 << CSx0)); // Fast 8-Bit PWM, Fcpu speed
#endif #endif
} }

@ -109,8 +109,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ACSpecification = VERSION_BCD(01.00), .ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_AudioInterface_AC_t) + .TotalLength = (sizeof(USB_AudioInterface_AC_t) +
sizeof(USB_AudioInputTerminal_t) + sizeof(USB_AudioInputTerminal_t) +
sizeof(USB_AudioOutputTerminal_t)), sizeof(USB_AudioOutputTerminal_t)),
.InCollection = 1, .InCollection = 1,
.InterfaceNumbers = {1}, .InterfaceNumbers = {1},

@ -175,9 +175,9 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM), .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = EP_TYPE_BULK, .Attributes = EP_TYPE_BULK,
.EndpointSize = CDC_TXRX_EPSIZE, .EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS= 0x00 .PollingIntervalMS = 0x00
} }
}; };

Loading…
Cancel
Save