Hello, we are developing a keyboard with two types of connections, via USB and Bluetooth using the nRF52833 chip.
We have all the firmware developed in Arduino since it is an open hardware and open source product.
I have been able to compile some tests with the Arduino core arduino-nRF5 from sandeepmistry: https://github.com/sandeepmistry/arduino-nRF5
The problem is that we need USB support and this Arduino core doesn't have that yet.
Is there a quick way to add USB support? Perhaps porting the Nordic SDK libraries?
I have been looking at the Arduino USBAPI.h file and I think the way is to implement the following functions:
#ifndef __USBAPI__
#define __USBAPI__
#include <stdint.h>
namespace arduino {
//================================================================================
//================================================================================
// Low level API
typedef struct __attribute__((packed))
{
union {
uint8_t bmRequestType;
struct {
uint8_t direction : 5;
uint8_t type : 2;
uint8_t transferDirection : 1;
};
};
uint8_t bRequest;
uint8_t wValueL;
uint8_t wValueH;
uint16_t wIndex;
uint16_t wLength;
} USBSetup;
}
//================================================================================
// USB APIs (C scope)
//================================================================================
int USB_SendControl(uint8_t flags, const void* d, int len);
int USB_RecvControl(void* d, int len);
int USB_RecvControlLong(void* d, int len);
uint8_t USB_Available(uint8_t ep);
uint8_t USB_SendSpace(uint8_t ep);
int USB_Send(uint8_t ep, const void* data, int len); // blocking
int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
int USB_Recv(uint8_t ep); // non-blocking
void USB_Flush(uint8_t ep);
#endif
I appreciate any suggestions as we have very little time left until the estimated production date so I don't have the luxury of trying multiple forms.
From already thank you very much.