mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-30 21:02:32 +01:00 
			
		
		
		
	Better checking of whether a packet is received in the RNDISEthernetHost Class driver demo - show busy LED status while packets are being printed out.
This commit is contained in:
		
							parent
							
								
									e5057fec8e
								
							
						
					
					
						commit
						958d28d05d
					
				| @ -159,18 +159,21 @@ int main(void) | |||||||
| /** Prints incomming packets from the attached RNDIS device to the serial port. */ | /** Prints incomming packets from the attached RNDIS device to the serial port. */ | ||||||
| void PrintIncommingPackets(void) | void PrintIncommingPackets(void) | ||||||
| { | { | ||||||
| 	uint16_t PacketLength; | 	if (RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)) | ||||||
|  | 	{ | ||||||
|  | 		LEDs_SetAllLEDs(LEDMASK_USB_BUSY); | ||||||
| 
 | 
 | ||||||
|  | 		uint16_t PacketLength; | ||||||
| 		RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength); | 		RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength); | ||||||
| 	 | 	 | ||||||
| 	if (PacketLength) |  | ||||||
| 	{ |  | ||||||
| 		printf("***PACKET (Size %d)***\r\n", PacketLength); | 		printf("***PACKET (Size %d)***\r\n", PacketLength); | ||||||
| 	 | 	 | ||||||
| 		for (uint16_t i = 0; i < PacketLength; i++) | 		for (uint16_t i = 0; i < PacketLength; i++) | ||||||
| 		  printf("%02x ", PacketBuffer[i]); | 		  printf("%02x ", PacketBuffer[i]); | ||||||
| 
 | 
 | ||||||
| 		printf("\r\n\r\n"); | 		printf("\r\n\r\n"); | ||||||
|  | 		 | ||||||
|  | 		LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -63,6 +63,9 @@ | |||||||
| 		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ | 		/** 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_ERROR        (LEDS_LED1 | LEDS_LED3) | ||||||
| 		 | 		 | ||||||
|  | 		/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ | ||||||
|  | 		#define LEDMASK_USB_BUSY         (LEDS_LED2) | ||||||
|  | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void SetupHardware(void); | 		void SetupHardware(void); | ||||||
| 		void PrintIncommingPackets(void); | 		void PrintIncommingPackets(void); | ||||||
|  | |||||||
| @ -83,8 +83,8 @@ | |||||||
|  *  <table> |  *  <table> | ||||||
|  *  <tr> |  *  <tr> | ||||||
|  *   <th width="100px">USB Class</th>  |  *   <th width="100px">USB Class</th>  | ||||||
|  *   <th width="80px">Device</th>  |  *   <th width="90px">Device Mode</th>  | ||||||
|  *   <th width="80px">Host</th>  |  *   <th width="90px">Host Mode</th>  | ||||||
|  *  </tr> |  *  </tr> | ||||||
|  *  <tr> |  *  <tr> | ||||||
|  *   <td>Audio</td> |  *   <td>Audio</td> | ||||||
| @ -113,13 +113,13 @@ | |||||||
|  *  </tr> |  *  </tr> | ||||||
|  *  <tr> |  *  <tr> | ||||||
|  *   <td>Printer</td> |  *   <td>Printer</td> | ||||||
|  *   <td bgcolor="#00EE00">No</td> |  *   <td bgcolor="#EE0000">No</td> | ||||||
| *    <td bgcolor="#00EE00">Yes</td> | *    <td bgcolor="#00EE00">Yes</td> | ||||||
|  *  </tr> |  *  </tr> | ||||||
|  *  <tr> |  *  <tr> | ||||||
|  *   <td>RNDIS</td> |  *   <td>RNDIS</td> | ||||||
|  *   <td bgcolor="#00EE00">Yes</td> |  *   <td bgcolor="#00EE00">Yes</td> | ||||||
|  *   <td bgcolor="#EE0000">Yes</td> |  *   <td bgcolor="#00EE00">Yes</td> | ||||||
|  *  </tr> |  *  </tr> | ||||||
|  *  <tr> |  *  <tr> | ||||||
|  *   <td>Still Image</td> |  *   <td>Still Image</td> | ||||||
|  | |||||||
| @ -11,14 +11,11 @@ | |||||||
|   *  If you have an item to add to this list, please contact the library author via email, the LUFA mailing list, |   *  If you have an item to add to this list, please contact the library author via email, the LUFA mailing list, | ||||||
|   *  or post your suggestion as an enhancement request to the project bug tracker. |   *  or post your suggestion as an enhancement request to the project bug tracker. | ||||||
|   * |   * | ||||||
|   *  <b>Targeted for the Next Release (SVN Development Only):</b> |  | ||||||
|   * |  | ||||||
|   *  <b>Targeted for Future Releases:</b> |   *  <b>Targeted for Future Releases:</b> | ||||||
|   *  - Code Features |   *  - Code Features | ||||||
|   *      -# Add hub support when in Host mode for multiple devices |   *      -# Add hub support when in Host mode for multiple devices | ||||||
|   *      -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error |   *      -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error | ||||||
|   *      -# Add standardized descriptor names to class driver structures |   *      -# Add standardized descriptor names to class driver structures | ||||||
|   *      -# Finish RNDIS Host Class driver |  | ||||||
|   *      -# Correct mishandling of error cases in Mass Storage demos |   *      -# Correct mishandling of error cases in Mass Storage demos | ||||||
|   *  - Documentation/Support |   *  - Documentation/Support | ||||||
|   *      -# Remake AVRStudio project files |   *      -# Remake AVRStudio project files | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dean Camera
						Dean Camera