Add new attributes to the HID Report Parser and HID Host Mode Class driver to keep track of the largest report the device can send for buffer allocation purposes. Change MouseHostWithParser and KeyboardHostWithParser demos to only allocate the needed number of bytes.
This commit is contained in:
		
							parent
							
								
									3ffa7543a0
								
							
						
					
					
						commit
						242303c160
					
				
					 9 changed files with 41 additions and 25 deletions
				
			
		| 
						 | 
				
			
			@ -120,7 +120,7 @@ int main(void)
 | 
			
		|||
			case HOST_STATE_Configured:
 | 
			
		||||
				if (HID_Host_IsReportReceived(&Keyboard_HID_Interface))
 | 
			
		||||
				{
 | 
			
		||||
					uint8_t KeyboardReport[50];
 | 
			
		||||
					uint8_t KeyboardReport[Keyboard_HID_Interface.State.LargestReportSize];
 | 
			
		||||
					HID_Host_ReceiveReport(&Keyboard_HID_Interface, &KeyboardReport);
 | 
			
		||||
					
 | 
			
		||||
					for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ int main(void)
 | 
			
		|||
			case HOST_STATE_Configured:
 | 
			
		||||
				if (HID_Host_IsReportReceived(&Mouse_HID_Interface))
 | 
			
		||||
				{
 | 
			
		||||
					uint8_t MouseReport[50];
 | 
			
		||||
					uint8_t MouseReport[Keyboard_HID_Interface.State.LargestReportSize];
 | 
			
		||||
					HID_Host_ReceiveReport(&Mouse_HID_Interface, &MouseReport);
 | 
			
		||||
 | 
			
		||||
					uint8_t LEDMask = LEDS_NO_LEDS;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue