Ejemplo n.º 1
0
Archivo: main.c Proyecto: nvero/fmhobby
void app_transfer_to_usb(uint8_t* report1, uint8_t* report2)
{    
  uint8_t i;
  app_endpoint_cleared = true;

  for(i = 1; i < NRFR_LENGTH_REPORT_1; i++)
  {
    if(*(report1 + i) != 0)
    {
      app_endpoint_cleared = false;
      break;  
    }
  }
  
  for(i = 1; i < NRFR_LENGTH_REPORT_2; i++)
  {
    if(*(report2 + i) != 0)
    {
      app_endpoint_cleared = false;
      break;  
    }
  }

  while(app_pending_usb_write)
  ;
  app_pending_usb_write = true;                               
  hal_usb_send_data(0x80 | 1, report1, NRFR_LENGTH_REPORT_1);
              
  while(app_pending_usb_write)
  ;
  app_pending_usb_write = true;
  hal_usb_send_data(0x80 | 1, report2, NRFR_LENGTH_REPORT_2);
}
Ejemplo n.º 2
0
void usb_send_packet(uint8_t* in_data, uint8_t size)
{
    while(!ep1_sent)
        ;
    ep1_sent = false;
    hal_usb_send_data(0x81, in_data, size);
}
Ejemplo n.º 3
0
void usb_send_data(uint8_t ep_in, uint8_t* dat, uint8_t len)
{
	uint8_t res = 0;
    is_usb_writing = true; 
    if(len < USB_MSG_LEN)
    {
        memset(usb_buf_tx+len, 0, USB_MSG_LEN-len);
    }
    memcpy(usb_buf_tx, dat, len < USB_MSG_LEN ? len : USB_MSG_LEN);
	hal_usb_send_data(ep_in, usb_buf_tx, USB_MSG_LEN);
}