Beispiel #1
0
void SerialCDC::setup(PinName tx, PinName rx, const char *name)
{
	_tx = tx;
	_rx = rx;
	_available = false;
	USBIOClkConfig();
	CDC_Init ();					// CDC Initialization
	USB_Init(); 					// USB Initialization
	USB_Connect(1);   				// USB Connect
	while (!USB_Configuration)
		continue;					// wait until USB is configured
}
Beispiel #2
0
/*----------------------------------------------------------------------------
  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*/
}
Beispiel #3
0
/*----------------------------------------------------------------------------
  CDC Initialisation
  Initializes the data structures and serial port
  Parameters:   None 
  Return Value: None
 *---------------------------------------------------------------------------*/
void
CDC_Init (void)
{
  USBIOClkConfig();

  CDC_DepInEmpty = TRUE;
  CDC_SerialState = 0x0000;

#ifdef  ENABLE_FREERTOS
  /* Create the queues used to hold Rx and Tx characters. */
  g_QueueRxUSB = xQueueCreate (USB_CDC_BUFSIZE*2, sizeof (uint8_t));
  g_QueueTxUSB = xQueueCreate (USB_CDC_BUFSIZE*2, sizeof (uint8_t));
#endif/*ENABLE_FREERTOS*/
}
Beispiel #4
0
/*----------------------------------------------------------------------------
  Main Program
 *---------------------------------------------------------------------------*/
int
main (void)
{
  uint32_t n;

  for (n = 0; n < MSC_ImageSize; n++)
    {				/* Copy Initial Disk Image */
      Memory[n] = DiskImage[n];	/*   from Flash to RAM     */
    }

  /* Basic chip initialization is taken care of in SystemInit() called
   * from the startup code. SystemInit() and chip settings are defined
   * in the CMSIS system_<part family>.c file.
   */

  /* Enable Timer32_1, IOCON, and USB blocks */
  LPC_SYSCON->SYSAHBCLKCTRL |= (EN_TIMER32_1 | EN_IOCON | EN_USBREG);


  USBIOClkConfig ();

  VCOM_Init ();			// VCOM Initialization

  USB_Init ();			// USB Initialization
  USB_Connect (TRUE);		// USB Connect

  while (!USB_Configuration);	// wait until USB is configured

  /* NVIC is installed inside UARTInit file. */
  SystemCoreClockUpdate ();
  UARTInit (115200, 0);

  VCOM_Usb2SerialTest ();

  while (1)
    {				// Loop forever
      VCOM_Serial2Usb ();	// read serial port and initiate USB event
      VCOM_CheckSerialState ();
      VCOM_Usb2Serial ();
    }				// end while                                                                                           
}				// end main ()
Beispiel #5
0
int main (void) 
{  
  SystemInit();

  USBIOClkConfig();

  /* P0.1 is push-button input, P2.0~3 are LED output. */
//  LPC_GPIO2->DIR |= (0x1<<0)|(0x1<<1)|(0x1<<2)|(0x1<<3);
//  LPC_GPIO0->DIR &= ~(0x1<<1);

  /* 16-bit timer 0. */
//  init_timer16(0, /*TIME_INTERVAL*/10);
//  enable_timer16(0);

  /* Set port 2_0 to output */
//  GPIOSetDir( 2, 0, 1 );
  USB_Init();                               /* USB Initialization */
  USB_Connect(TRUE);                        /* USB Connect */

  while (1)                                /* Loop forever */
  {
#if 0
	/* I/O configuration and LED setting pending. */
	if ( (timer16_0_counter > 0) && (timer16_0_counter <= 200) )
	{
	  GPIOSetValue( 2, 0, 0 );
	}
	if ( (timer16_0_counter > 200) && (timer16_0_counter <= 400) )
	{
	  GPIOSetValue( 2, 0, 1 );
	}
	else if ( timer16_0_counter > 400 )
	{
	  timer16_0_counter = 0;
	}
#endif
  }

}