static void APP_DeviceCDCBasicDemoInitialize() { CDCInitEP(); line_coding.bCharFormat = 0; line_coding.bDataBits = 8; line_coding.bParityType = 0; line_coding.dwDTERate = 115200; }
/********************************************************************* * Function: void APP_DeviceCDCBasicDemoInitialize(void); * * Overview: Initializes the demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceCDCBasicDemoInitialize() { CDCInitEP(); line_coding.bCharFormat = 0; line_coding.bDataBits = 8; line_coding.bParityType = 0; line_coding.dwDTERate = 9600; buttonPressed = false; }
bool USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event, void *pdata, uint16_t size) { switch ((int) event) { case EVENT_CONFIGURED: CDCInitEP(); break; case EVENT_EP0_REQUEST: USBCheckCDCRequest(); break; } return true; }
// this is the USB Event CallBack function void USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event_usb) { switch(event_usb) { case EVENT_EP0_REQUEST: USBCheckCDCRequest(); break; case EVENT_CONFIGURED: CDCInitEP(); break; } }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP,USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP); #endif USBMSDInit(); CDCInitEP(); }
/********************************************************************* * Function: void APP_DeviceCDCBasicDemoInitialize(void); * * Overview: Initializes the demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceCDCBasicDemoInitialize() { CDCInitEP(); line_coding.bCharFormat = 0; line_coding.bDataBits = 8; line_coding.bParityType = 0; line_coding.dwDTERate = 9600; memset(buttons_state, 0x00, 3 * sizeof(button_state_s)); buttons_state[0].pos = 0; buttons_state[0].state = BUTTON_UNMOUNTED | BUTTON_RELEASED; buttons_state[1].pos = 1; buttons_state[1].state = BUTTON_UNMOUNTED | BUTTON_RELEASED; buttons_state[2].pos = 2; buttons_state[2].state = BUTTON_UNMOUNTED | BUTTON_RELEASED; }
/******************************************************************* * Function: void USBCBInitEP(void) * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. *******************************************************************/ void USBCBInitEP(void) { #if (MSD_DATA_IN_EP == MSD_DATA_OUT_EP) USBEnableEndpoint(MSD_DATA_IN_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED| USB_DISALLOW_SETUP); #else USBEnableEndpoint(MSD_DATA_IN_EP, USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP); USBEnableEndpoint(MSD_DATA_OUT_EP, USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED| USB_DISALLOW_SETUP); #endif #if defined(DISPLAY_ENABLED) oled_cmd(OLEDREG_DISPLAY_OFF); // to avoid interference disp_start_usb(); #endif USBMSDInit(); // init Mass Sstorage Device over USB CDCInitEP(); // init serial line over USB }
/****************************************************************************** * Function: void USBStdSetCfgHandler(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This routine first disables all endpoints by clearing * UEP registers. It then configures (initializes) endpoints * specified in the modifiable section. * * Note: None *****************************************************************************/ void USBStdSetCfgHandler(void) { ctrl_trf_session_owner = MUID_USB9; mDisableEP1to15(); // See usbdrv.h ClearArray((byte*)&usb_alt_intf,MAX_NUM_INT); usb_active_cfg = SetupPkt.bCfgValue; if(SetupPkt.bCfgValue == 0) usb_device_state = ADDRESS_STATE; else { usb_device_state = CONFIGURED_STATE; /* Modifiable Section */ #if defined(USB_USE_CDC) // See autofiles\usbcfg.h CDCInitEP(); #endif /* End modifiable section */ }//end if(SetupPkt.bcfgValue == 0) }//end USBStdSetCfgHandler
/********************************************************************* * Function: void APP_DeviceCDCEmulatorInitialize(void); * * Overview: Initializes the demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_DeviceCDCEmulatorInitialize() { CDCInitEP(); line_coding.bCharFormat = 0; line_coding.bDataBits = 8; line_coding.bParityType = 0; line_coding.dwDTERate = 19200; unsigned char i; UART_Initialize(); // Initialize the arrays for (i=0; i<sizeof(USB_Out_Buffer); i++) { USB_Out_Buffer[i] = 0; } NextUSBOut = 0; LastRS232Out = 0; lastTransmission = 0; }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { CDCInitEP(); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { //Enable the CDC data endpoints CDCInitEP(); }
/********************************************************************* * Function: void APP_CustomHIDInitialize(void); * (legacy USBCBInitEP();) * * Overview: Initializes the Custom HID demo code * * PreCondition: None * * Input: None * * Output: None * ********************************************************************/ void APP_CustomCDCInitialize() { CDCInitEP(); }
/******************************************************************* * Function: void USBCBInitEP(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This function is called when the device becomes * initialized, which occurs after the host sends a * SET_CONFIGURATION (wValue not = 0) request. This * callback function should initialize the endpoints * for the device's usage according to the current * configuration. * * Note: None *******************************************************************/ void USBCBInitEP(void) { int i; for (i = 0; i < NUM_CDC_INTERFACES; i++) CDCInitEP(i); }