void SerialCDC::CheckSerialState (void) { unsigned short temp = CDC_GetSerialState(); if (_serialState != temp) { _serialState = temp; CDC_NotificationIn(); // send SERIAL_STATE notification } }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init (char portNum ) { CDC_DepInEmpty = 1; CDC_SerialState = CDC_GetSerialState(); CDC_BUF_RESET(CDC_OutBuf); return; }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init (void) { CDC_DepInEmpty = 1; CDC_SerialState = CDC_GetSerialState(); CDC_BUF_RESET(CDC_OutBuf); CDC_BUF_RESET(CDC_InBuf); }
/*---------------------------------------------------------------------------- checks the serial state and initiates notification *---------------------------------------------------------------------------*/ void VCOM_CheckSerialState (void) { unsigned short temp; static unsigned short serialState; temp = CDC_GetSerialState(); if (serialState != temp) { serialState = temp; CDC_NotificationIn(); // send SERIAL_STATE notification } }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init(void) { ser_OpenPort(); ser_InitPort(CDC_LineCoding.dwDTERate, CDC_LineCoding.bDataBits, CDC_LineCoding.bParityType, CDC_LineCoding.bCharFormat); CDC_DepInEmpty = 1; CDC_SerialState = CDC_GetSerialState(); CDC_BUF_RESET(CDC_OutBuf); }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init (void) { USBIOClkConfig(); CDC_SerialState = CDC_GetSerialState (); #ifdef ENABLE_FREERTOS /* Create the queues used to hold Rx and Tx characters. */ g_QueueRxUSB = xQueueCreate (USB_CDC_QUEUE_SIZE, sizeof (uint8_t)); g_QueueTxUSB = xQueueCreate (USB_CDC_QUEUE_SIZE, sizeof (uint8_t)); #endif/*ENABLE_FREERTOS*/ }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init (void) { // ser_OpenPort (); // ser_InitPort (CDC_LineCoding.dwDTERate, // CDC_LineCoding.bDataBits, // CDC_LineCoding.bParityType, // CDC_LineCoding.bCharFormat); CDC_DepInEmpty = 1; CDC_SerialState = CDC_GetSerialState(); tx_idle = 1; }
void USB_EndPoint1 (uint32_t event) { uint16_t temp; static uint16_t serialState; switch (event) { case USB_EVT_IN: temp = CDC_GetSerialState(); if (serialState != temp) { serialState = temp; CDC_NotificationIn(); /* send SERIAL_STATE notification */ } break; } }
/*---------------------------------------------------------------------------- CDC Initialisation Initializes the data structures and serial port Parameters: None Return Value: None *---------------------------------------------------------------------------*/ void CDC_Init (char portNum ) { // if ( portNum == 0 ) // { // ser_OpenPort (0); // ser_InitPort0 (CDC_LineCoding.dwDTERate, // CDC_LineCoding.bDataBits, // CDC_LineCoding.bParityType, // CDC_LineCoding.bCharFormat); // } // else // { // ser_OpenPort (1); // ser_InitPort1 (CDC_LineCoding.dwDTERate, // CDC_LineCoding.bDataBits, // CDC_LineCoding.bParityType, // CDC_LineCoding.bCharFormat); // } CDC_DepInEmpty = 1; CDC_SerialState = CDC_GetSerialState(); CDC_BUF_RESET(CDC_OutBuf); }