コード例 #1
0
ファイル: capture.c プロジェクト: 0x8000-0000/lightBLUE
int main(int argc, char* argv[])
{
   if (argc < 2)
   {
      puts("COM port argument missing.");
      return 1;
   }

   if (os_initialize() < 0)
   {
      puts("Failed to initialize serial base");
      return 2;
   }

   myChannel = io_openSerialPort(argv[1], 115200, NULL);
   if (! myChannel)
   {
      printf("Failed to open port %s\n", argv[1]);
      goto done;
   }

   os_waitForKeyboardInterrupt();

done:

   if (myChannel)
   {
      io_closePort(myChannel);
   }

   os_cleanup();

   return 0;
}
コード例 #2
0
ファイル: app.c プロジェクト: zeppo21/demo_c
/*
 * Application and OS initialization.
 * Should be called prior to running the application.
 */
BOOL_t appInit()
{
	BOOL_t ok = FALSE;

	ok = os_initialize();

	if( ok == TRUE )
	{
		isInitialized = TRUE;
	}

	return ok;
}
コード例 #3
0
ファイル: echo_plus.c プロジェクト: 0x8000-0000/lightBLUE
int main(int argc, char* argv[])
{
   int status = -1;

   if (argc < 2)
   {
      puts("COM port argument missing.");
      return 1;
   }

   if (os_initialize() < 0)
   {
      puts("Failed to initialize serial base");
      return 2;
   }

   io_setDebugLevel(5);

   myChannel = io_openSerialPort(argv[1], 115200, NULL);
   if (! myChannel)
   {
      printf("Failed to open port %s\n", argv[1]);
      goto done;
   }

   io_sendData(myChannel, HELLO, sizeof(HELLO) - 1);

   os_waitForKeyboardInterrupt();

   status = 0;

done:

   if (myChannel)
   {
      io_closePort(myChannel);
   }

   os_cleanup();

   return status;
}