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


C++ UTIL1_strcmp函数代码示例

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


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

示例1: VS_ParseCommand

uint8_t VS_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io)
{
  const uint8_t *p;
  uint32_t val32u;

  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "VS1053 help")==0) {
    *handled = TRUE;
    return PrintHelp(io);
  } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "VS1053 status")==0)) {
    *handled = TRUE;
    return PrintStatus(io);
  } else if (UTIL1_strncmp((char*)cmd, "VS1053 volume ", sizeof("VS1053 volume ")-1)==0) {
    *handled = TRUE;
    p = cmd+sizeof("VS1053 volume ")-1;
    if (UTIL1_xatoi(&p, &val32u)==ERR_OK) {
      return VS_SetVolume((uint16_t)val32u);
    } else {
      CLS1_SendStr("Failed reading volume", io->stdErr);
      return ERR_FAILED;
    }
  } else if (UTIL1_strncmp((char*)cmd, "VS1053 play ", sizeof("VS1053 play ")-1)==0) {
    *handled = TRUE;
    p = cmd+sizeof("VS1053 play ")-1;
    return VS_PlaySong(p, io);
  }
  return ERR_OK;
}
开发者ID:ADeadCat,项目名称:mcuoneclipse,代码行数:27,代码来源:VS1053.c

示例2: TRACE_ParseCommand

/*!
 * \brief Parses a command
 * \param cmd Command string to be parsed
 * \param handled Sets this variable to TRUE if command was handled
 * \param io I/O stream to be used for input/output
 * \return Error code, ERR_OK if everything was fine
 */
uint8_t TRACE_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace help")==0) {
    TRACE_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace status")==0) {
    TRACE_PrintStatus(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"trace shell")==0) {
    traceChannel = TRACE_TO_SHELL;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"trace none")==0) {
    traceChannel = TRACE_TO_NONE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel on")==0) {
    traceAccel = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel off")==0) {
    traceAccel = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"magnetometer on")==0) {
    traceMagnetometer = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"magnetometer off")==0) {
    traceMagnetometer = FALSE;
    *handled = TRUE;
  }
  return ERR_OK;
}
开发者ID:jeffyoon,项目名称:mcuoneclipse,代码行数:35,代码来源:Trace.c

示例3: BUZ_ParseCommand

uint8_t BUZ_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  const unsigned char *p;
  uint16_t freq, duration;

  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"buzzer help")==0) {
    *handled = TRUE;
    return BUZ_PrintHelp(io);
  } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"buzzer status")==0) {
    *handled = TRUE;
    return BUZ_PrintStatus(io);
  } else if (UTIL1_strncmp((char*)cmd, (char*)"buzzer buz ", sizeof("buzzer buz ")-1)==0) {
    *handled = TRUE;
    p = cmd+sizeof("buzzer buz ")-1;
    if (UTIL1_ScanDecimal16uNumber(&p, &freq)==ERR_OK && UTIL1_ScanDecimal16uNumber(&p, &duration)==ERR_OK) {
      if (BUZ_Beep(freq, duration)!=ERR_OK) {
        CLS1_SendStr((unsigned char*)"Starting buzzer failed\r\n", io->stdErr);
        return ERR_FAILED;
      }
      return ERR_OK;
    }
  } else if (UTIL1_strcmp((char*)cmd, (char*)"buzzer play tune")==0) {
    *handled = TRUE;
    return BUZ_PlayTune();
  }
  return ERR_OK;
}
开发者ID:cknuesel,项目名称:INTRO_Maze_it,代码行数:26,代码来源:Buzzer.c

示例4: REMOTE_ParseCommand

uint8_t REMOTE_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  uint8_t res = ERR_OK;

  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"remote help")==0) {
    REMOTE_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"remote status")==0) {
    REMOTE_PrintStatus(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote on")==0) {
    REMOTE_isOn = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote off")==0) {
#if PL_CONFIG_HAS_MOTOR
    MOT_SetSpeedPercent(MOT_GetMotorHandle(MOT_MOTOR_LEFT), 0);
    MOT_SetSpeedPercent(MOT_GetMotorHandle(MOT_MOTOR_RIGHT), 0);
#endif
    REMOTE_isOn = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote verbose on")==0) {
    REMOTE_isVerbose = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote verbose off")==0) {
    REMOTE_isVerbose = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote joystick on")==0) {
    REMOTE_useJoystick = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"remote joystick off")==0) {
    REMOTE_useJoystick = FALSE;
    *handled = TRUE;
  }
  return res;
}
开发者ID:troopa,项目名称:InfotronikRobot,代码行数:34,代码来源:Remote.c

示例5: MM_ParseCommand

uint8_t MM_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  const uint8_t *p;
  uint8_t res;
  int32_t tmp;

  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "midi help")==0) {
     CLS1_SendHelpStr((unsigned char*)"midi", (const unsigned char*)"Group of midi commands\r\n", io->stdOut);
     CLS1_SendHelpStr((unsigned char*)"  help|status", (unsigned char*)"Print help or status information\r\n", io->stdOut);
     CLS1_SendHelpStr((unsigned char*)"  play <number>", (const unsigned char*)"Play midi song (0, 1)\r\n", io->stdOut);
     *handled = TRUE;
     return ERR_OK;
   } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "midi status")==0)) {
     *handled = TRUE;
     return PrintStatus(io);
   } else if (UTIL1_strncmp((char*)cmd, "midi play", sizeof("midi play")-1)==0) {
     p = cmd+sizeof("midi play")-1;
     res = UTIL1_xatoi(&p, &tmp);
     if (res==ERR_OK && tmp>=0) {
       *handled = TRUE;
       if (tmp==0) {
         MM_Play();
       } else if (tmp==1) {
         MM_PlayPirate();
       }
     }
     return res;
   }
  return ERR_OK;
}
开发者ID:AdarshJayakumar,项目名称:mcuoneclipse,代码行数:29,代码来源:MidiMusic.c

示例6: ESP_PrintStatus

static uint8_t ESP_PrintStatus(const CLS1_StdIOType *io) {
  uint8_t buf[48];

  CLS1_SendStatusStr("ESP8266", "\r\n", io->stdOut);

  CLS1_SendStatusStr("  Webserver", ESP_WebServerIsOn?"ON\r\n":"OFF\r\n", io->stdOut);

  if (ESP_GetFirmwareVersionString(buf, sizeof(buf)) != ERR_OK) {
    UTIL1_strcpy(buf, sizeof(buf), "FAILED\r\n");
  } else {
    /* 00160901: 0016 is SDK version, 0901 is the AT version */
    UTIL1_strcat(buf, sizeof(buf), "\r\n");
  }
  CLS1_SendStatusStr("  AT+GMR", buf, io->stdOut);

  if (ESP_GetModeString(buf, sizeof(buf)) != ERR_OK) {
    UTIL1_strcpy(buf, sizeof(buf), "FAILED\r\n");
  } else {
    if (UTIL1_strcmp(buf, "1")==0) {
      UTIL1_strcat(buf, sizeof(buf), " (device)");
    } else if (UTIL1_strcmp(buf, "2")==0) {
      UTIL1_strcat(buf, sizeof(buf), " (AP)");
    } else if (UTIL1_strcmp(buf, "3")==0) {
      UTIL1_strcat(buf, sizeof(buf), " (device+AP)");
    } else {
      UTIL1_strcat(buf, sizeof(buf), " (ERROR)");
    }
    UTIL1_strcat(buf, sizeof(buf), "\r\n");
  }
  CLS1_SendStatusStr("  AT+CWMODE?", buf, io->stdOut);

  if (ESP_GetIPAddrString(buf, sizeof(buf)) != ERR_OK) {
    UTIL1_strcpy(buf, sizeof(buf), "FAILED\r\n");
  } else {
    UTIL1_strcat(buf, sizeof(buf), "\r\n");
  }
  CLS1_SendStatusStr("  AT+CIFSR", buf, io->stdOut);

  if (ESP_GetConnectedAPString(buf, sizeof(buf)) != ERR_OK) {
    UTIL1_strcpy(buf, sizeof(buf), "FAILED\r\n");
  } else {
    UTIL1_strcat(buf, sizeof(buf), "\r\n");
  }
  CLS1_SendStatusStr("  AT+CWJAP?", buf, io->stdOut);

  if (ESP_GetCIPMUXString(buf, sizeof(buf)) != ERR_OK) {
    UTIL1_strcpy(buf, sizeof(buf), "FAILED\r\n");
  } else {
    if (UTIL1_strcmp(buf, "0")==0) {
      UTIL1_strcat(buf, sizeof(buf), " (single connection)");
    } else if (UTIL1_strcmp(buf, "1")==0) {
      UTIL1_strcat(buf, sizeof(buf), " (multiple connections)");
    } else {
      UTIL1_strcat(buf, sizeof(buf), " (ERROR)");
    }
    UTIL1_strcat(buf, sizeof(buf), "\r\n");
  }
  CLS1_SendStatusStr("  CIPMUX", buf, io->stdOut);
  return ERR_OK;
}
开发者ID:maciekhtc,项目名称:ZRJ-microcontroller,代码行数:60,代码来源:ESP8266.c

示例7: RNETA_ParseCommand

uint8_t RNETA_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
    uint8_t res = ERR_OK;
    const uint8_t *p;
    uint16_t val16;

    if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"app help")==0) {
        PrintHelp(io);
        *handled = TRUE;
    } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"app status")==0) {
        *handled = TRUE;
        return PrintStatus(io);
    } else if (UTIL1_strncmp((char*)cmd, (char*)"app saddr", sizeof("app saddr")-1)==0) {
        p = cmd + sizeof("app saddr")-1;
        *handled = TRUE;
        if (UTIL1_ScanHex16uNumber(&p, &val16)==ERR_OK) {
            (void)RNWK_SetThisNodeAddr((RNWK_ShortAddrType)val16);
        } else {
            CLS1_SendStr((unsigned char*)"ERR: wrong address\r\n", io->stdErr);
            return ERR_FAILED;
        }
    } else if (UTIL1_strncmp((char*)cmd, (char*)"app daddr", sizeof("app daddr")-1)==0) {
        p = cmd + sizeof("app daddr")-1;
        *handled = TRUE;
        if (UTIL1_ScanHex16uNumber(&p, &val16)==ERR_OK) {
            APP_dstAddr = val16;
        } else {
            CLS1_SendStr((unsigned char*)"ERR: wrong address\r\n", io->stdErr);
            return ERR_FAILED;
        }
#if PL_HAS_RSTDIO
    } else if (UTIL1_strncmp((char*)cmd, (char*)"app send", sizeof("app send")-1)==0) {
        unsigned char buf[32];
        RSTDIO_QueueType queue;

        if (UTIL1_strncmp((char*)cmd, (char*)"app send in", sizeof("app send in")-1)==0) {
            queue = RSTDIO_QUEUE_TX_IN;
            cmd += sizeof("app send in");
        } else if (UTIL1_strncmp((char*)cmd, (char*)"app send out", sizeof("app send out")-1)==0) {
            queue = RSTDIO_QUEUE_TX_OUT;
            cmd += sizeof("app send out");
        } else if (UTIL1_strncmp((char*)cmd, (char*)"app send err", sizeof("app send err")-1)==0) {
            queue = RSTDIO_QUEUE_TX_ERR;
            cmd += sizeof("app send err");
        } else {
            return ERR_OK; /* not handled */
        }
        UTIL1_strcpy(buf, sizeof(buf), cmd);
        UTIL1_chcat(buf, sizeof(buf), '\n');
        buf[sizeof(buf)-2] = '\n'; /* have a '\n' in any case */
        if (RSTDIO_SendToTxStdio(queue, buf, UTIL1_strlen((char*)buf))!=ERR_OK) {
            CLS1_SendStr((unsigned char*)"failed!\r\n", io->stdErr);
        }
        *handled = TRUE;
#endif
    }
    return res;
}
开发者ID:Joteyo,项目名称:mcuoneclipse,代码行数:57,代码来源:RNet_App.c

示例8: TACHO_ParseCommand

uint8_t TACHO_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"tacho help")==0) {
    TACHO_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"tacho status")==0) {
    TACHO_PrintStatus(io);
    *handled = TRUE;
  }
  return ERR_OK;
}
开发者ID:infotronik,项目名称:sumo,代码行数:10,代码来源:Tacho.c

示例9: REF_ParseCommand

byte REF_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "ref help")==0) {
    *handled = TRUE;
    return PrintHelp(io);
  } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "ref status")==0)) {
    *handled = TRUE;
    return PrintStatus(io);
  }
  return ERR_OK;
}
开发者ID:chregubr85,项目名称:42,代码行数:10,代码来源:Reflectance.c

示例10: RMT_ParseCommand

uint8_t RMT_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  uint8_t res = ERR_OK;
  int32_t val;
  const unsigned char *p;

  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"remote help")==0) {
	RMT_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strncmp((char*)cmd, "remote send val", sizeof("remote send val")-1)==0) {
	  p = cmd+sizeof("remote send val");
	  if (UTIL1_xatoi(&p, &val)==ERR_OK && val>=0 && val<=4) {
		  res = RSTDIO_AddToQueue(RSTDIO_QUEUE_TX_OUT, (unsigned char*)"test", 4);
//		  RSTDIO_TxStdInSendChar('x');
//		  RADIO_setValueToSend(val);
		  *handled = TRUE;
	  }
  }/*else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"radio status")==0) {
    RADIO_PrintStatus(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"radio reset")==0) {
    RADIO_AppStatus = RADIO_RESET_STATE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"radio on")==0) {
    RADIO_isOn = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"radio off")==0) {
    RADIO_isOn = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"radio sniff on")==0) {
    RADIO_isSniffing = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)"radio sniff off")==0) {
    RADIO_isSniffing = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strncmp((char*)cmd, (char*)"radio channel", sizeof("radio channel")-1)==0) {
    p = cmd+sizeof("radio channel");
    if (UTIL1_xatoi(&p, &val)==ERR_OK && val>=0 && val<=15) {
      RADIO_SetChannel((uint8_t)val);
      *handled = TRUE;
    } else {
      CLS1_SendStr((unsigned char*)"Wrong argument, must be in the range 0..15\r\n", io->stdErr);
      res = ERR_FAILED;
    }
  } else if (UTIL1_strncmp((char*)cmd, "radio power", sizeof("radio power")-1)==0) {
    p = cmd+sizeof("radio power");
    if (UTIL1_xatoi(&p, &val)==ERR_OK && val>=0 && val<=15) {
      RADIO_SetOutputPower((uint8_t)val);
      *handled = TRUE;
    } else {
      CLS1_SendStr((unsigned char*)"Wrong argument, must be in the range 0..15\r\n", io->stdErr);
      res = ERR_FAILED;
    }
  }*/
  return res;
}
开发者ID:cbaechler,项目名称:intro_hs13,代码行数:55,代码来源:Remote.c

示例11: ParseCommand

/*!
 * \brief Parses a command
 * \param cmd Command string to be parsed
 * \param handled Sets this variable to TRUE if command was handled
 * \param io I/O stream to be used for input/output
 * \return Error code, ERR_OK if everything was fine
 */
static uint8_t ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  /* handling our own commands */
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0) {
    CLS1_SendHelpStr((const unsigned char*)"run benchmark", (const unsigned char*)"Run FatFS benchmark\r\n", io->stdOut);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, "run benchmark")==0) {
    benchmark(io);
    *handled = TRUE;
  }
  return ERR_OK;
}
开发者ID:sgukang,项目名称:mcuoneclipse,代码行数:18,代码来源:Shell.c

示例12: W5100_ParseCommand

uint8_t W5100_ParseCommand(const unsigned char *cmd, bool *handled, CLS1_ConstStdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "w5100 help")==0) {
    CLS1_SendHelpStr((unsigned char*)"w5100", (const unsigned char*)"Group of w5100 commands\r\n", io->stdOut);
    CLS1_SendHelpStr((unsigned char*)"  help|status", (const unsigned char*)"Print help or status information\r\n", io->stdOut);
    *handled = TRUE;
    return ERR_OK;
  } else if (UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, "w5100 status")==0) {
    *handled = TRUE;
    return PrintStatus(io);
  }
  return ERR_OK; /* no error */
}
开发者ID:appserver,项目名称:mcuoneclipse,代码行数:12,代码来源:w5100.c

示例13: US_ParseCommand

uint8_t US_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  uint8_t res = ERR_OK;

  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"ultrasonic help")==0) {
    US_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"ultrasonic status")==0) {
    US_PrintStatus(io);
    *handled = TRUE;
  }
  return res;
}
开发者ID:3ben1189,项目名称:mcuoneclipse,代码行数:12,代码来源:Ultrasonic.c

示例14: ESC_ParseCommand

uint8_t ESC_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  uint8_t res = ERR_OK;
  int32_t val;
  const unsigned char *p;
  ESC_MotorID id;

  if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"esc help")==0) {
    ESC_PrintHelp(io);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"esc status")==0) {
    ESC_PrintStatus(io);
    *handled = TRUE;
  } else if (UTIL1_strncmp((char*)cmd, (char*)"esc on", sizeof("esc on")-1)==0) {
    ESC_isMotorOn = TRUE;
    *handled = TRUE;
  } else if (UTIL1_strncmp((char*)cmd, (char*)"esc off", sizeof("esc off")-1)==0) {
    for(id=0; id<ESC_MOTOR_NOF; id++) {
      ESC_SetSpeedPercent(&ESC_motors[id], 0);
    }
    ESC_isMotorOn = FALSE;
    *handled = TRUE;
  } else if (UTIL1_strncmp((char*)cmd, (char*)"esc duty ", sizeof("esc duty ")-1)==0) {
    if (!ESC_isMotorOn) {
      CLS1_SendStr((unsigned char*)"Motors are OFF, cannot set duty.\r\n", io->stdErr);
      res = ERR_FAILED;
    } else {
      p = cmd+sizeof("esc duty ")-1;
      if (UTIL1_strncmp((char*)p, (char*)"fl ", sizeof("fl ")-1)==0) {
        id = ESC_MOTOR_FRONT_LEFT;
      } else if (UTIL1_strncmp((char*)p, (char*)"fr ", sizeof("fr ")-1)==0) {
        id = ESC_MOTOR_FRONT_RIGHT;
      } else if (UTIL1_strncmp((char*)p, (char*)"bl ", sizeof("bl ")-1)==0) {
        id = ESC_MOTOR_BACK_LEFT;
      } else if (UTIL1_strncmp((char*)p, (char*)"br ", sizeof("br ")-1)==0) {
        id = ESC_MOTOR_BACK_RIGHT;
      } else {
        CLS1_SendStr((unsigned char*)"Wrong argument, motor must be either fl, fr, bl or br\r\n", io->stdErr);
        res = ERR_FAILED;
      }
      if (res==ERR_OK) {
        p = cmd+sizeof("esc duty xx ")-1;
        if (UTIL1_xatoi(&p, &val)==ERR_OK && val >=0 && val<=100) {
          ESC_SetSpeedPercent(&ESC_motors[id], (ESC_SpeedPercent)val);
          *handled = TRUE;
        } else {
          CLS1_SendStr((unsigned char*)"Wrong argument, must be in the range 0..100\r\n", io->stdErr);
          res = ERR_FAILED;
        }
      }
    }
  }
  return res;
}
开发者ID:jlcalavia,项目名称:mcuoneclipse,代码行数:53,代码来源:ESC.c

示例15: BUZ_ParseCommand

uint8_t BUZ_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io)
{
	  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "BUZ1 help")==0) {
	    *handled = TRUE;
	    CLS1_SendHelpStr((unsigned char*)"BUZ", (unsigned char*)"Group of BUZ commands\r\n", io->stdOut);
	    CLS1_SendHelpStr((unsigned char*)"  beep", (unsigned char*)"Beep with 1kHz for 1 sec\r\n", io->stdOut);
	    return ERR_OK;
	  } else if (UTIL1_strcmp((char*)cmd, "BUZ beep")==0) {
		  *handled = TRUE;
		  return BUZ_Beep(1000, 1000);
	    }
  return ERR_OK;
}
开发者ID:sisem,项目名称:intro,代码行数:13,代码来源:Buzzer.c


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