/*********************************************************************************** * @fn usbUartInit * * @brief USB UART init function. * - Set initial line decoding to 8/NONE/1. * - Initialise the USB Firmware Library and the USB controller. * * @param none * * @return none */ void usbUartInit(uint32 baudrate) { // Set default line coding. currentLineCoding.dteRate = baudrate; currentLineCoding.charFormat = CDC_CHAR_FORMAT_1_STOP_BIT; currentLineCoding.parityType = CDC_PARITY_TYPE_NONE; currentLineCoding.dataBits = 8; // Initialise hardware flow control cdcRTS= 0; // TRUE when DCE connected cdcCTS= 1; // Indicate CTS to DCE (here handled internally as CDC does // not directly support CTC). // Init USB library usbfwInit(); // Initialize the USB interrupt handler with bit mask containing all processed USBIRQ events usbirqInit(0xFFFF); // Enable pullup on D+ HAL_USB_PULLUP_ENABLE(); // Enable global interrupts halIntOn(); }
/*********************************************************************************** * @fn usbUartInitUSB * * @brief USB UART init function. * - Set initial line decoding to 8/NONE/1. * - Initialise the USB Firmware Library and the USB controller. * * @param none * * @return none */ void HalUARTInitUSB(void) { // Set default line coding. currentLineCoding.dteRate = HAL_UART_BAUD_RATE; currentLineCoding.charFormat = CDC_CHAR_FORMAT_1_STOP_BIT; currentLineCoding.parityType = CDC_PARITY_TYPE_NONE; currentLineCoding.dataBits = 8; // Init USB library usbfwInit(); // Initialize the USB interrupt handler with bit mask containing all processed USBIRQ events usbirqInit(0xFFFF); #if defined HAL_SB_BOOT_CODE HAL_USB_PULLUP_ENABLE(); // Enable pullup on D+. #endif }
/****************************************************************************** * @fn HalUARTOpenUSB * * @brief Open a port according tp the configuration specified by parameter. * * @param config - contains configuration information * * @return none *****************************************************************************/ static void HalUARTOpenUSB(halUARTCfg_t *config) { usbCB = config->callBackFunc; HAL_USB_PULLUP_ENABLE(); // Enable pullup on D+ }