25 #define ADK_VID 0x18D1
26 #define ADK_PID 0x2D00
27 #define ADB_PID 0x2D01
31 #define ADK_GETPROTO 51 //check USB accessory protocol version
32 #define ADK_SENDSTR 52 //send identifying string
33 #define ADK_ACCSTART 53 //start device in accessory mode
35 #define bmREQ_ADK_GET USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
36 #define bmREQ_ADK_SEND USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
38 #define ACCESSORY_STRING_MANUFACTURER 0
39 #define ACCESSORY_STRING_MODEL 1
40 #define ACCESSORY_STRING_DESCRIPTION 2
41 #define ACCESSORY_STRING_VERSION 3
42 #define ACCESSORY_STRING_URI 4
43 #define ACCESSORY_STRING_SERIAL 5
45 #define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT
52 const char* manufacturer;
54 const char* description;
60 uint8_t getProto(uint8_t* adkproto);
61 uint8_t sendStr(uint8_t index,
const char* str);
62 uint8_t switchAcc(
void);
84 const char* description,
90 uint8_t
RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
91 uint8_t
SndData(uint16_t nbytes, uint8_t *dataptr);
95 virtual uint8_t
ConfigureDevice(uint8_t parent, uint8_t port,
bool lowspeed);
96 virtual uint8_t
Init(uint8_t parent, uint8_t port,
bool lowspeed);
111 virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) {
122 inline uint8_t ADK::getProto(uint8_t* adkproto) {
123 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_GET,
ADK_GETPROTO, 0, 0, 0, 2, 2, adkproto, NULL));
127 inline uint8_t ADK::sendStr(uint8_t index,
const char* str) {
128 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_SEND,
ADK_SENDSTR, 0, 0, index, strlen(str) + 1, strlen(str) + 1, (uint8_t*) str, NULL));
132 inline uint8_t ADK::switchAcc(
void) {
133 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_SEND,
ADK_ACCSTART, 0, 0, 0, 0, 0, NULL, NULL));
static const uint8_t epDataInIndex
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
virtual uint8_t Release()
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
static const uint8_t epDataOutIndex
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
virtual uint8_t GetAddress()
virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid)
ADK(USB *pUsb, const char *manufacturer, const char *model, const char *description, const char *version, const char *uri, const char *serial)
EpInfo epInfo[ADK_MAX_ENDPOINTS]
#define ADK_MAX_ENDPOINTS
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)