mirror of
https://github.com/mfulz/qmk_firmware.git
synced 2025-06-22 06:35:17 +02:00
Add TMC device capabilities to the incomplete TMC demo.
This commit is contained in:
parent
eb8a708b53
commit
3a79548dc2
@ -30,6 +30,29 @@
|
|||||||
|
|
||||||
#include "TestAndMeasurement.h"
|
#include "TestAndMeasurement.h"
|
||||||
|
|
||||||
|
/** Contains the (usually static) capabilities of the TMC device. This table is requested by the
|
||||||
|
* host upon enumeration to give it information on what features of the Test and Measurement USB
|
||||||
|
* Class the device supports.
|
||||||
|
*/
|
||||||
|
TMC_Capabilities_t Capabilities =
|
||||||
|
{
|
||||||
|
.Status = TMC_REQUEST_STATUS_SUCCESS,
|
||||||
|
.TMCVersion = VERSION_BCD(1.00),
|
||||||
|
|
||||||
|
.Interface =
|
||||||
|
{
|
||||||
|
.ListenOnly = false,
|
||||||
|
.TalkOnly = false,
|
||||||
|
.PulseIndicateSupported = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
.Device =
|
||||||
|
{
|
||||||
|
.SupportsAbortINOnMatch = false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** 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
|
||||||
* setup of all components and the main program loop.
|
* setup of all components and the main program loop.
|
||||||
*/
|
*/
|
||||||
@ -141,7 +164,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
|
|||||||
case Req_GetCapabilities:
|
case Req_GetCapabilities:
|
||||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||||
{
|
{
|
||||||
|
/* Acknowledge the SETUP packet, ready for data transfer */
|
||||||
|
Endpoint_ClearSETUP();
|
||||||
|
|
||||||
|
/* Write the device capabilities to the control endpoint */
|
||||||
|
Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t));
|
||||||
|
|
||||||
|
/* Finalize the stream transfer to send the last packet or clear the host abort */
|
||||||
|
Endpoint_ClearOUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -153,4 +183,13 @@ void TMC_Task(void)
|
|||||||
/* Device must be connected and configured for the task to run */
|
/* Device must be connected and configured for the task to run */
|
||||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Endpoint_SelectEndpoint(TMC_OUT_EPNUM);
|
||||||
|
|
||||||
|
if (Endpoint_IsOUTReceived())
|
||||||
|
{
|
||||||
|
// TEMP - Indicate data received
|
||||||
|
LEDs_SetAllLEDs(LEDS_ALL_LEDS);
|
||||||
|
Endpoint_ClearOUT();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,32 @@
|
|||||||
#define TMC_REQUEST_STATUS_NOCHECKINITIATED 0x82
|
#define TMC_REQUEST_STATUS_NOCHECKINITIATED 0x82
|
||||||
#define TMC_REQUEST_STATUS_CHECKINPROGRESS 0x83
|
#define TMC_REQUEST_STATUS_CHECKINPROGRESS 0x83
|
||||||
|
|
||||||
|
/* Type Defines */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t Status;
|
||||||
|
uint8_t _RESERVED1;
|
||||||
|
|
||||||
|
uint16_t TMCVersion;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned char ListenOnly : 1;
|
||||||
|
unsigned char TalkOnly : 1;
|
||||||
|
unsigned char PulseIndicateSupported : 1;
|
||||||
|
unsigned char _RESERVED : 5;
|
||||||
|
} Interface;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned char SupportsAbortINOnMatch : 1;
|
||||||
|
unsigned char _RESERVED : 7;
|
||||||
|
} Device;
|
||||||
|
|
||||||
|
uint8_t _RESERVED2[6];
|
||||||
|
uint8_t _RESERVED3[12];
|
||||||
|
} TMC_Capabilities_t;
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
void SetupHardware(void);
|
void SetupHardware(void);
|
||||||
void TMC_Task(void);
|
void TMC_Task(void);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* to the next version released. It does not indicate all new additions to the library in each version change, only
|
* to the next version released. It does not indicate all new additions to the library in each version change, only
|
||||||
* areas relevant to making older projects compatible with the API changes of each new release.
|
* areas relevant to making older projects compatible with the API changes of each new release.
|
||||||
*
|
*
|
||||||
* \section Sec_Migration100513 Migrating from 100513 to XXXXXX
|
* \section Sec_MigrationXXXXXX Migrating from 100513 to XXXXXX
|
||||||
*
|
*
|
||||||
* <b>Non-USB Library Components</b>
|
* <b>Non-USB Library Components</b>
|
||||||
* - The Dataflash board driver stub file has changed, as dataflash functions previously located in the internal
|
* - The Dataflash board driver stub file has changed, as dataflash functions previously located in the internal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user