#include "mbed.h"
#include "USBHost.h"
#include "Utils.h"
#define PL23
u8 pl2303_buf[64];
void pl2303_Callback(int device, int endpoint, int status, u8* data, int len, void* userData)
{
for (int i = 0; i < len; i++) {
printf("%c", data[i]);
}
USBBulkTransfer(device, 0x83, pl2303_buf, sizeof(pl2303_buf), pl2303_Callback, userData);
}
int OnPL2303Insert(int device)
{
printf("PL-2303 inserted of %d\n",device);
USBBulkTransfer(device, 0x83, pl2303_buf, sizeof(pl2303_buf), pl2303_Callback, (void*)0);
u8 data[] = {0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x08};
USBControlTransfer(device, REQUEST_TYPE_CLASS | RECIPIENT_INTERFACE,
PL2303_SET_LINE_CODING, 0, 0, data, sizeof(data));
return 0;
}