当前位置: 首页>>代码示例>>C++>>正文


C++ serialPrint函数代码示例

本文整理汇总了C++中serialPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ serialPrint函数的具体用法?C++ serialPrint怎么用?C++ serialPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了serialPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cliFuncConfig

void cliFuncConfig(void *cmd, char *cmdLine) {
    char param[8];

    if (state > ESC_STATE_STOPPED) {
	serialPrint(stopError);
    }
    else if (sscanf(cmdLine, "%8s", param) != 1) {
	cliUsage((cliCommand_t *)cmd);
    }
    else if (!strcasecmp(param, "default")) {
	configLoadDefault();
	serialPrint("CONFIG: defaults loaded\r\n");
    }
    else if (!strcasecmp(param, "read")) {
	configReadFlash();
	serialPrint("CONFIG: read flash\r\n");
    }
    else if (!strcasecmp(param, "write")) {
	if (configWriteFlash()) {
	    serialPrint("CONFIG: wrote flash\r\n");
	}
	else {
	    serialPrint("CONFIG: write flash failed!\r\n");
	}
    }
    else {
    	cliUsage((cliCommand_t *)cmd);
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:29,代码来源:cli.c

示例2: serialPrint

void IMUTester::readSerialCommand() {
	int serialData = Serial.read();

	if (serialData != -1)
		// clear some space
		serialPrint("\n\n\n");

	switch (serialData)
	{
	case -1:
		break;
	case 'i':
		//initialize(Serial.read());
		break;
	case 'a':
		reportAccel = toggle(reportAccel);
		break;
	case 'y':
		reportGyro = toggle(reportGyro);
		break;
	case 'Y':
		reportGyroAll = toggle(reportGyroAll);
		break;
	case 'g':
		reportGPS = toggle(reportGPS);
		break;
	case 'c':
		reportComp = toggle(reportComp);
		break;

	default:
		serialPrint("unknown command: ");
		serialPrintln(serialData);
	}
}
开发者ID:graceyha,项目名称:gcc-quadrocopter,代码行数:35,代码来源:IMUTester.cpp

示例3: cliLs

int cliLs(const char ** argv)
{
  FILINFO fno;
  DIR dir;
  char *fn;   /* This function is assuming non-Unicode cfg. */
#if _USE_LFN
  TCHAR lfn[_MAX_LFN + 1];
  fno.lfname = lfn;
  fno.lfsize = sizeof(lfn);
#endif

  FRESULT res = f_opendir(&dir, argv[1]);        /* Open the directory */
  if (res == FR_OK) {
    for (;;) {
      res = f_readdir(&dir, &fno);                   /* Read a directory item */
      if (res != FR_OK || fno.fname[0] == 0) break;  /* Break on error or end of dir */

#if _USE_LFN
      fn = *fno.lfname ? fno.lfname : fno.fname;
#else
      fn = fno.fname;
#endif
      serialPrint(fn);
    }
  }
  else {
    serialPrint("%s: Invalid directory \"%s\"", argv[0], argv[1]);
  }
  return 0;
}
开发者ID:JASSoft1,项目名称:opentx,代码行数:30,代码来源:cli.cpp

示例4: cliUsage

void cliUsage(cliCommand_t *cmd) {
    serialPrint("usage: ");
    serialPrint(cmd->name);
    serialWrite(' ');
    serialPrint(cmd->params);
    serialPrint("\r\n");
}
开发者ID:739374663,项目名称:esc32,代码行数:7,代码来源:cli.c

示例5: cliDisplay

int cliDisplay(const char ** argv)
{
  int address = 0;

  for (const MemArea * area = memAreas; area->name != NULL; area++) {
    if (!strcmp(area->name, argv[1])) {
      dump((uint8_t *)area->start, area->size);
      return 0;
    }
  }

  if (!strcmp(argv[1], "adc")) {
    extern uint16_t Analog_values[NUMBER_ANALOG];
    for (int i=0; i<NUMBER_ANALOG; i++) {
      serialPrint("adc[%d] = %04X", i, Analog_values[i]);
    }
  }
  else if (!strcmp(argv[1], "outputs")) {
    for (int i=0; i<NUM_CHNOUT; i++) {
      serialPrint("outputs[%d] = %04X", i, channelOutputs[i]);
    }
  }
  else if (!strcmp(argv[1], "time")) {
    struct gtm utm;
    gettime(&utm);
    serialPrint("time = %4d-%02d-%02d %02d:%02d:%02d.%02d0", utm.tm_year+1900, utm.tm_mon+1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec, g_ms100);
  }
  else if (toInt(argv, 1, &address) > 0) {
    int size = 256;
    if (toInt(argv, 2, &size) >= 0) {
      dump((uint8_t *)address, size);
    }
  }
  return 0;
}
开发者ID:JASSoft1,项目名称:opentx,代码行数:35,代码来源:cli.cpp

示例6: cliDisplay

int cliDisplay(const char ** argv)
{
  int address = 0;

  for (const MemArea * area = memAreas; area->name != NULL; area++) {
    if (!strcmp(area->name, argv[1])) {
      dump((uint8_t *)area->start, area->size);
      return 0;
    }
  }

  if (!strcmp(argv[1], "adc")) {
    for (int i=0; i<NUMBER_ANALOG; i++) {
      serialPrint("adc[%d] = %04X", i, Analog_values[i]);
    }
  }
  else if (!strcmp(argv[1], "outputs")) {
    for (int i=0; i<NUM_CHNOUT; i++) {
      serialPrint("outputs[%d] = %04X", i, channelOutputs[i]);
    }
  }
  else if (toInt(argv, 1, &address) > 0) {
    int size = 256;
    if (toInt(argv, 2, &size) >= 0) {
      dump((uint8_t *)address, size);
    }
  }
  return 0;
}
开发者ID:RonDePrez,项目名称:opentx,代码行数:29,代码来源:cli.cpp

示例7: cliFuncRpm

void cliFuncRpm(void *cmd, char *cmdLine) {
    float target;

    if (state < ESC_STATE_RUNNING) {
	serialPrint(runError);
    }
    else {
	if (sscanf(cmdLine, "%f", &target) != 1) {
	    cliUsage((cliCommand_t *)cmd);
	}
	else if (p[FF1TERM] == 0.0f) {
	    serialPrint("Calibration parameters required\r\n");
	}
	else if (target < 100.0f || target > 10000.0f) {
	    serialPrint("RPM out of range: 100 => 10000\r\n");
	}
	else {
	    if (runMode != CLOSED_LOOP_RPM) {
		runRpmPIDReset();
		runMode = CLOSED_LOOP_RPM;
	    }
	    targetRpm = target;
	    sprintf(tempBuf, "RPM set to %6.0f\r\n", target);
	    serialPrint(tempBuf);
	}
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:27,代码来源:cli.c

示例8: millis

int IMUTester::timeComp()
{
	finish = millis();
	serialPrint(comp.getRawX()); serialPrint(",");
	serialPrint(comp.getRawY()); serialPrint(",");
	return millis() - finish;

}
开发者ID:graceyha,项目名称:gcc-quadrocopter,代码行数:8,代码来源:IMUTester.cpp

示例9: cliPrintParam

void cliPrintParam(int i) {
    const char *format = "%-20s = ";

    sprintf(tempBuf, format, configParameterStrings[i]);
    serialPrint(tempBuf);
    sprintf(tempBuf, configFormatStrings[i], p[i]);
    serialPrint(tempBuf);
    serialPrint("\r\n");
}
开发者ID:739374663,项目名称:esc32,代码行数:9,代码来源:cli.c

示例10: cliFuncBinary

void cliFuncBinary(void *cmd, char *cmdLine) {
    if (state > ESC_STATE_STOPPED) {
	serialPrint(stopError);
    }
    else {
	serialPrint("Entering binary command mode...\r\n");
	cliTelemetry = 0;
	commandMode = BINARY_MODE;
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:10,代码来源:cli.c

示例11: cliInit

void cliInit(void) {
    serialPrint(cliHome);
    serialPrint(cliClear);
    sprintf(version, "%s.%d", VERSION, getBuildNumber());

    cliFuncVer(0, 0);
    serialPrint("\r\nCLI ready.\r\n");

    cliPrompt();
}
开发者ID:739374663,项目名称:esc32,代码行数:10,代码来源:cli.c

示例12: cliFuncStop

void cliFuncStop(void *cmd, char *cmdLine) {
    if (state < ESC_STATE_NOCOMM) {
	serialPrint(runError);
    }
    else {
	runStop();
	cliFuncChangeInput(ESC_INPUT_UART);
	serialPrint("ESC stopping\r\n");
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:10,代码来源:cli.c

示例13: cliFuncBoot

void cliFuncBoot(void *cmd, char *cmdLine) {
    if (state != ESC_STATE_DISARMED) {
	serialPrint("ESC armed, disarm first\r\n");
    }
    else {
	serialPrint("Rebooting in boot loader mode...\r\n");
	timerDelay(0xffff);

	rccReset();
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:11,代码来源:cli.c

示例14: cliFuncArm

void cliFuncArm(void *cmd, char *cmdLine) {
    if (state > ESC_STATE_DISARMED) {
	serialPrint("ESC already armed\r\n");
    }
    else {
	if (runMode != SERVO_MODE)
	    cliFuncChangeInput(ESC_INPUT_UART);
	runArm();
	serialPrint("ESC armed\r\n");
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:11,代码来源:cli.c

示例15: cliFuncStart

void cliFuncStart(void *cmd, char *cmdLine) {
    if (state == ESC_STATE_DISARMED) {
	serialPrint("ESC disarmed, arm first\r\n");
    }
    else if (state > ESC_STATE_STOPPED) {
	serialPrint("ESC already running\r\n");
    }
    else {
	runStart();
	serialPrint("ESC started\r\n");
    }
}
开发者ID:739374663,项目名称:esc32,代码行数:12,代码来源:cli.c


注:本文中的serialPrint函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。