Skip to content

Instantly share code, notes, and snippets.

@rajivr
Created February 7, 2020 11:00
Show Gist options
  • Save rajivr/bdbcf473ab288e9505cfe4e5fc19be23 to your computer and use it in GitHub Desktop.
Save rajivr/bdbcf473ab288e9505cfe4e5fc19be23 to your computer and use it in GitHub Desktop.
#include "tusb.h"
/*
* Rust function
*/
extern void dcd_edpt_open_rust(uint8_t ep_addr, uint16_t max_packet_size, uint8_t xfer_type);
/*
* Workaround the lack of bitfields support in Rust
*/
bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const* p_endpoint_desc)
{
(void) rhport;
uint8_t const ep_addr = p_endpoint_desc->bEndpointAddress;
uint16_t const max_packet_size = p_endpoint_desc->wMaxPacketSize.size;
uint8_t const xfer_type = p_endpoint_desc->bmAttributes.xfer;
dcd_edpt_open_rust(ep_addr, max_packet_size, xfer_type);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment