Add notification endpoint to the incomplete TMC demo.
This commit is contained in:
		
							parent
							
								
									9274610a48
								
							
						
					
					
						commit
						be520aed52
					
				
					 6 changed files with 37 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -106,7 +106,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		|||
			.InterfaceNumber        = 0x00,
 | 
			
		||||
			.AlternateSetting       = 0x00,
 | 
			
		||||
			
 | 
			
		||||
			.TotalEndpoints         = 2,
 | 
			
		||||
			.TotalEndpoints         = 3,
 | 
			
		||||
				
 | 
			
		||||
			.Class                  = 0xFE,
 | 
			
		||||
			.SubClass               = 0x03,
 | 
			
		||||
| 
						 | 
				
			
			@ -133,6 +133,16 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		|||
			.Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
 | 
			
		||||
			.EndpointSize           = TMC_IO_EPSIZE,
 | 
			
		||||
			.PollingIntervalMS      = 0x00
 | 
			
		||||
		},
 | 
			
		||||
		
 | 
			
		||||
	.NotificationEndpoint = 
 | 
			
		||||
		{
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
 | 
			
		||||
			
 | 
			
		||||
			.EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | TMC_NOTIFICATION_EPNUM),
 | 
			
		||||
			.Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
 | 
			
		||||
			.EndpointSize           = TMC_NOTIFICATION_EPSIZE,
 | 
			
		||||
			.PollingIntervalMS      = 0xFF
 | 
			
		||||
		}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,13 +44,19 @@
 | 
			
		|||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		/** Endpoint number of the TMC device-to-host data IN endpoint. */
 | 
			
		||||
		#define TMC_IN_EPNUM          3	
 | 
			
		||||
		#define TMC_IN_EPNUM            3	
 | 
			
		||||
 | 
			
		||||
		/** Endpoint number of the TMC host-to-device data OUT endpoint. */
 | 
			
		||||
		#define TMC_OUT_EPNUM         4	
 | 
			
		||||
		#define TMC_OUT_EPNUM           4	
 | 
			
		||||
 | 
			
		||||
		/** Endpoint number of the TMC notification IN endpoint. */
 | 
			
		||||
		#define TMC_NOTIFICATION_EPNUM  2	
 | 
			
		||||
 | 
			
		||||
		/** Size in bytes of the TMC data endpoints. */
 | 
			
		||||
		#define TMC_IO_EPSIZE         64
 | 
			
		||||
		#define TMC_IO_EPSIZE           64
 | 
			
		||||
 | 
			
		||||
		/** Size in bytes of the TMC notification endpoint. */
 | 
			
		||||
		#define TMC_NOTIFICATION_EPSIZE 8
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for the device configuration descriptor structure. This must be defined in the
 | 
			
		||||
| 
						 | 
				
			
			@ -63,6 +69,7 @@
 | 
			
		|||
			USB_Descriptor_Interface_t            Interface;
 | 
			
		||||
			USB_Descriptor_Endpoint_t             DataOutEndpoint;
 | 
			
		||||
			USB_Descriptor_Endpoint_t             DataInEndpoint;
 | 
			
		||||
			USB_Descriptor_Endpoint_t             NotificationEndpoint;
 | 
			
		||||
		} USB_Descriptor_Configuration_t;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
 | 
			
		|||
{
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_READY);
 | 
			
		||||
 | 
			
		||||
	/* Setup TMC In and Out Endpoints */
 | 
			
		||||
	/* Setup TMC In, Out and Notification Endpoints */
 | 
			
		||||
	if (!(Endpoint_ConfigureEndpoint(TMC_IN_EPNUM, EP_TYPE_BULK,
 | 
			
		||||
		                             ENDPOINT_DIR_IN, TMC_IO_EPSIZE,
 | 
			
		||||
	                                 ENDPOINT_BANK_SINGLE)))
 | 
			
		||||
| 
						 | 
				
			
			@ -134,6 +134,13 @@ void EVENT_USB_Device_ConfigurationChanged(void)
 | 
			
		|||
	{
 | 
			
		||||
		LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
 | 
			
		||||
		                             ENDPOINT_DIR_IN, TMC_NOTIFICATION_EPSIZE,
 | 
			
		||||
	                                 ENDPOINT_BANK_SINGLE)))
 | 
			
		||||
	{
 | 
			
		||||
		LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue