Numworks Epsilon  1.4.1
Graphing Calculator Operating System
interface.h
Go to the documentation of this file.
1 #ifndef ION_DEVICE_USB_INTERFACE_H
2 #define ION_DEVICE_USB_INTERFACE_H
3 
4 #include "endpoint0.h"
5 #include "request_recipient.h"
6 #include "setup_packet.h"
7 
8 namespace Ion {
9 namespace USB {
10 namespace Device {
11 
12 class Interface : public RequestRecipient {
13 public:
15  RequestRecipient(ep0)
16  {
17  }
18 protected:
19  virtual void setActiveInterfaceAlternative(uint8_t interfaceAlternativeIndex) = 0;
21  bool processSetupInRequest(SetupPacket * request, uint8_t * transferBuffer, uint16_t * transferBufferLength, uint16_t transferBufferMaxLength) override;
22 private:
23  // USB Standard Interface Request Codes
24  enum class Request {
25  GetStatus = 0,
26  ClearFeature = 1,
27  SetFeature = 3,
28  GetInterface = 10,
29  SetInterface = 11,
30  };
31  bool getStatus(uint8_t * transferBuffer, uint16_t * transferBufferLength, uint16_t transferBufferMaxLength);
32  bool getInterface(uint8_t * transferBuffer, uint16_t * transferBufferLength, uint16_t transferBufferMaxLength);
33  bool setInterface(SetupPacket * request, uint16_t * transferBufferLength);
34  bool clearFeature(uint16_t * transferBufferLength);
35  bool setFeature(uint16_t * transferBufferLength);
36 };
37 
38 }
39 }
40 }
41 
42 #endif
unsigned short uint16_t
Definition: stdint.h:5
unsigned char uint8_t
Definition: stdint.h:4
Definition: app.cpp:5
virtual uint8_t getActiveInterfaceAlternative()=0
Interface(Endpoint0 *ep0)
Definition: interface.h:14
bool processSetupInRequest(SetupPacket *request, uint8_t *transferBuffer, uint16_t *transferBufferLength, uint16_t transferBufferMaxLength) override
Definition: interface.cpp:9
Definition: backlight.h:6
virtual void setActiveInterfaceAlternative(uint8_t interfaceAlternativeIndex)=0