24 #include <avr/pgmspace.h>
31 #if defined(ARDUINO) && ARDUINO >=100
43 #define ADK_VID 0x18D1
44 #define ADK_PID 0x2D00
45 #define ADB_PID 0x2D01
47 #define XOOM //enables repeating getProto() and getConf() attempts
53 #define ADK_GETPROTO 51 //check USB accessory protocol version
54 #define ADK_SENDSTR 52 //send identifying string
55 #define ADK_ACCSTART 53 //start device in accessory mode
57 #define bmREQ_ADK_GET USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
58 #define bmREQ_ADK_SEND USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
60 #define ACCESSORY_STRING_MANUFACTURER 0
61 #define ACCESSORY_STRING_MODEL 1
62 #define ACCESSORY_STRING_DESCRIPTION 2
63 #define ACCESSORY_STRING_VERSION 3
64 #define ACCESSORY_STRING_URI 4
65 #define ACCESSORY_STRING_SERIAL 5
67 #define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT
75 const char* manufacturer;
77 const char* description;
83 uint8_t getProto( uint8_t* adkproto );
84 uint8_t sendStr( uint8_t index,
const char* str );
85 uint8_t switchAcc(
void );
107 const char* description,
113 uint8_t
RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
114 uint8_t
SndData(uint16_t nbytes, uint8_t *dataptr);
118 virtual uint8_t
Init(uint8_t parent, uint8_t port,
bool lowspeed);
130 inline uint8_t ADK::getProto( uint8_t* adkproto )
132 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_GET,
ADK_GETPROTO, 0, 0, 0, 2, 2, adkproto, NULL ));
135 inline uint8_t ADK::sendStr( uint8_t index,
const char* str )
137 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_SEND,
ADK_SENDSTR, 0, 0, index, strlen(str) + 1, strlen(str) + 1, (uint8_t*)str, NULL));
140 inline uint8_t ADK::switchAcc(
void )
142 return(
pUsb->
ctrlReq(
bAddress, 0,
bmREQ_ADK_SEND,
ADK_ACCSTART, 0, 0, 0, 0, 0, NULL, NULL));