From a67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 4 Jun 2009 02:55:30 +0000 Subject: Minor documentation page updates. Redocumented all device demos, now that they have changed over to the new USB class drivers. Added C linkage to class drivers for C++ support. Added prefixes to most of the class driver constants to prevent name clashes. --- Demos/Device/RNDISEthernet/RNDISEthernet.c | 31 +++++++++++++++++++++++------- Demos/Device/RNDISEthernet/RNDISEthernet.h | 11 ++++++++++- 2 files changed, 34 insertions(+), 8 deletions(-) (limited to 'Demos/Device/RNDISEthernet') diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.c b/Demos/Device/RNDISEthernet/RNDISEthernet.c index 3246cd8bc..7c857197f 100644 --- a/Demos/Device/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/RNDISEthernet/RNDISEthernet.c @@ -28,8 +28,18 @@ this software. */ +/** \file + * + * Main source file for the RNDISEthernet demo. This file contains the main tasks of + * the demo and is responsible for the initial application hardware configuration. + */ + #include "RNDISEthernet.h" +/** LUFA RNDIS Class driver interface configuration and state information. This structure is + * passed to all RNDIS Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. + */ USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface = { .ControlInterfaceNumber = 0, @@ -46,13 +56,19 @@ USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface = .AdapterVendorDescription = "LUFA RNDIS Demo Adapter", .AdapterMACAddress = {ADAPTER_MAC_ADDRESS}, }; - + +/** 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); + TCP_Init(); + Webserver_Init(); + printf_P(PSTR("\r\n\r\n****** RNDIS Demo running. ******\r\n")); for (;;) @@ -71,6 +87,7 @@ int main(void) } } +/** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) { /* Disable watchdog if enabled by bootloader/fuses */ @@ -84,22 +101,21 @@ void SetupHardware(void) LEDs_Init(); SerialStream_Init(9600, false); USB_Init(); - - /* Initialize TCP and Webserver modules */ - TCP_Init(); - Webserver_Init(); } +/** Event handler for the library USB Connection event. */ void EVENT_USB_Connect(void) { - LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } +/** Event handler for the library USB Disconnection event. */ void EVENT_USB_Disconnect(void) { - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } +/** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -108,6 +124,7 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } +/** Event handler for the library USB Unhandled Control Packet event. */ void EVENT_USB_UnhandledControlPacket(void) { USB_RNDIS_ProcessControlPacket(&Ethernet_RNDIS_Interface); diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.h b/Demos/Device/RNDISEthernet/RNDISEthernet.h index f0247ce81..f0ba75a3d 100644 --- a/Demos/Device/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/RNDISEthernet/RNDISEthernet.h @@ -58,11 +58,20 @@ #include /* 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) - #define LEDMASK_USB_BUSY LEDS_LED2 + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_USB_BUSY (LEDS_LED2) /* Function Prototypes: */ void SetupHardware(void); -- cgit v1.2.3