Can we call USBD_API->hw->WriteEP from outside EPHandler?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can we call USBD_API->hw->WriteEP from outside EPHandler?

542 Views
ssudhir
Contributor II

Hi,

In the HID generic sample code the call that sends input report through interrupt pipe

(USBD_API->hw->WriteEP(hUsb, pHidCtrl->epin_adr, inbuffer, 64)) is inside EPHandler.

Suppose we have an input report we want to send through interrupt pipe can we call this function (WriteEP) from outside the EPHandler? The parameter  pHidCtrl, hUSB are from  EPHandler .

Thanks

0 Kudos
4 Replies

447 Views
ssudhir
Contributor II

thanks

0 Kudos

447 Views
jeremyzhou
NXP Employee
NXP Employee

Hi S S ,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Suppose we have an input report we want to send through interrupt pipe can we call this function (WriteEP) from outside the EPHandler?
-- Yes, It's Okay.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

447 Views
ssudhir
Contributor II

Thanks for your response TIC.

What about parameter passing ? Parameters pHidCtrl, hUSB are from

EPHandler. Atleast hUSB is a global variable.

0 Kudos

447 Views
jeremyzhou
NXP Employee
NXP Employee

Hi S S ,

To provide the fastest possible support, I'd like to suggest that you can refer to the USB ROM examples in the LPCOpen library, for instance, there's the code of the hid_mouse demo which is from the lpcopen_3_01_keil_iar_mcb_4357.

/* Mouse tasks */
void Mouse_Tasks(void)
{
 /* check device is configured before sending report. */
 if ( USB_IsConfigured(g_mouse.hUsb)) {
  if (g_mouse.tx_busy == 0) {
   /* update report based on board state */
   Mouse_UpdateReport();
   /* send report data */
   g_mouse.tx_busy = 1;
   USBD_API->hw->WriteEP(g_mouse.hUsb, HID_EP_IN, &g_mouse.report[0], MOUSE_REPORT_SIZE);
  }
 }
 else {
  /* reset busy flag if we get disconnected. */
  g_mouse.tx_busy = 0;
 }

}

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos