1 #ifndef ION_DEVICE_USB_CALCULATOR_H 2 #define ION_DEVICE_USB_CALCULATOR_H 44 m_dfuFunctionalDescriptor(
61 m_interfaceDescriptor(
63 k_dfuInterfaceAlternateSetting,
69 &m_dfuFunctionalDescriptor),
70 m_configurationDescriptor(
73 k_bConfigurationValue,
81 &m_interfaceDescriptor),
82 m_webUSBPlatformDescriptor(
84 k_webUSBLandingPageIndex),
88 &m_webUSBPlatformDescriptor),
89 m_languageStringDescriptor(),
90 m_manufacturerStringDescriptor(
"NumWorks"),
91 m_productStringDescriptor(
"NumWorks Calculator"),
92 m_serialNumberStringDescriptor(serialNumber),
93 m_interfaceStringDescriptor(
"@Flash/0x08000000/04*016Kg,01*064Kg,07*128Kg"),
97 m_microsoftOSStringDescriptor(k_microsoftOSVendorCode),
98 m_workshopURLDescriptor(
URLDescriptor::Scheme::HTTPS,
"workshop.numworks.com"),
99 m_extendedCompatIdDescriptor(
"WINUSB"),
102 &m_configurationDescriptor,
103 &m_languageStringDescriptor,
104 &m_manufacturerStringDescriptor,
105 &m_productStringDescriptor,
106 &m_serialNumberStringDescriptor,
107 &m_interfaceStringDescriptor,
110 m_dfuInterface(
this, &
m_ep0, k_dfuInterfaceAlternateSetting)
116 assert(configurationIndex == k_bConfigurationValue);
119 return k_bConfigurationValue;
124 static constexpr
uint8_t k_bConfigurationValue = 1;
125 static constexpr
uint8_t k_dfuInterfaceAlternateSetting = 0;
126 static constexpr
uint8_t k_webUSBVendorCode = 1;
127 static constexpr
uint8_t k_webUSBLandingPageIndex = 1;
128 static constexpr
uint8_t k_microsoftOSVendorCode = 2;
131 bool getURLCommand(
uint8_t * transferBuffer,
uint16_t * transferBufferLength,
uint16_t transferBufferMaxLength);
132 bool getExtendedCompatIDCommand(
uint8_t * transferBuffer,
uint16_t * transferBufferLength,
uint16_t transferBufferMaxLength);
Calculator(const char *serialNumber)
virtual uint8_t getActiveConfiguration() override
virtual Descriptor * descriptor(uint8_t type, uint8_t index) override
bool processSetupInRequest(SetupPacket *request, uint8_t *transferBuffer, uint16_t *transferBufferLength, uint16_t transferBufferMaxLength) override
virtual void setActiveConfiguration(uint8_t configurationIndex) override
static void PollAndReset(bool exitWithKeyboard)