本文整理汇总了C++中serialPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ serialPrint函数的具体用法?C++ serialPrint怎么用?C++ serialPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serialPrint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: cliFuncHelp
void cliFuncHelp(void *cmd, char *cmdLine) {
int i;
serialPrint("Available commands:\r\n\n");
for (i = 0; i < CLI_N_CMDS; i++) {
serialPrint(cliCommandTable[i].name);
serialWrite(' ');
serialPrint(cliCommandTable[i].params);
serialPrint("\r\n");
}
}
开发者ID:739374663,项目名称:esc32,代码行数:12,代码来源:cli.c
示例17: cliHelp
int cliHelp(const char ** argv)
{
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
if (argv[1][0] == '\0' || !strcmp(command->name, argv[0])) {
serialPrint("%s %s", command->name, command->args);
if (argv[1][0] != '\0') {
return 0;
}
}
}
if (argv[1][0] != '\0') {
serialPrint("Invalid command \"%s\"", argv[0]);
}
return -1;
}
开发者ID:JASSoft1,项目名称:opentx,代码行数:15,代码来源:cli.cpp
示例18: gpsInitNmea
void gpsInitNmea(void)
{
#if defined(COLIBRI_RACE) || defined(LUX_RACE)
uint32_t now;
#endif
switch(gpsData.state) {
case GPS_INITIALIZING:
#if defined(COLIBRI_RACE) || defined(LUX_RACE)
now = millis();
if (now - gpsData.state_ts < 1000)
return;
gpsData.state_ts = now;
if (gpsData.state_position < 1) {
serialSetBaudRate(gpsPort, 4800);
gpsData.state_position++;
} else if (gpsData.state_position < 2) {
// print our FIXED init string for the baudrate we want to be at
serialPrint(gpsPort, "$PSRF100,1,115200,8,1,0*05\r\n");
gpsData.state_position++;
} else {
// we're now (hopefully) at the correct rate, next state will switch to it
gpsSetState(GPS_CHANGE_BAUD);
}
break;
#endif
case GPS_CHANGE_BAUD:
#if defined(COLIBRI_RACE) || defined(LUX_RACE)
now = millis();
if (now - gpsData.state_ts < 1000)
return;
gpsData.state_ts = now;
if (gpsData.state_position < 1) {
serialSetBaudRate(gpsPort, baudRates[gpsInitData[gpsData.baudrateIndex].baudrateIndex]);
gpsData.state_position++;
} else if (gpsData.state_position < 2) {
serialPrint(gpsPort, "$PSRF103,00,6,00,0*23\r\n");
gpsData.state_position++;
} else {
#else
serialSetBaudRate(gpsPort, baudRates[gpsInitData[gpsData.baudrateIndex].baudrateIndex]);
#endif
gpsSetState(GPS_RECEIVING_DATA);
#if defined(COLIBRI_RACE) || defined(LUX_RACE)
}
#endif
break;
}
}
开发者ID:Liquidas,项目名称:betaflight,代码行数:48,代码来源:gps.c
示例19: cmd_bluetooth_check
/*---------------------------------------------------------------------------
TITLE : cmd_bluetooth_check
WORK :
ARG : void
RET : void
---------------------------------------------------------------------------*/
void cmd_bluetooth_check( void )
{
uint32_t time_out;
uint8_t ch;
uint8_t ch_array[2];
uint8_t ch_i;
osStatus ret;
ret = osMutexWait( Mutex_Loop, 1000 );
if( ret != osOK )
{
_menu_printf("Fail to osMutexWait\r\n");
return;
}
core.blueport = uartOpen(USART2, NULL, 115200, MODE_RXTX);
_menu_printf("\r\n");
_menu_printf("AT -> ");
serialPrint(core.blueport, "AT");
ch_array[0] = 0;
ch_array[1] = 0;
ch_i = 0;
//-- 응답이 올때까지 기다림
time_out = 1000;
while(time_out--)
{
if( serialTotalBytesWaiting(core.blueport) )
{
ch = serialRead(core.blueport);
_menu_putch(ch);
ch_array[ch_i++] = ch;
if( ch_i >= 2 ) break;
}
osDelay(1);
}
if( ch_array[0] == 'O' && ch_array[1] == 'K' )
{
_menu_printf("\r\nBluetooth OK");
}
else
{
_menu_printf("\r\nBluetooth Fail");
}
_menu_printf("\r\n");
serialInit(mcfg.serial_baudrate);
osMutexRelease( Mutex_Loop );
}
开发者ID:oroca,项目名称:SkyRover_Nano,代码行数:66,代码来源:thread_menu.c
示例20: while
/**
* Writes an ADB message with payload to the ADB device.
*
* @param device USB device handle.
* @param command ADB command.
* @param arg0 first ADB argument (command dependent).
* @param arg0 second ADB argument (command dependent).
* @param length payload length.
* @param data command payload.
* @return error code or 0 for success.
*/
int ADB::writeMessage(usb_device * device, uint32_t command, uint32_t arg0, uint32_t arg1, uint32_t length, uint8_t * data)
{
adb_message message;
uint32_t count, sum = 0;
uint8_t * x;
uint8_t rcode;
// Calculate data checksum
count = length;
x = data;
while(count-- > 0) sum += *x++;
// Fill out the message record.
message.command = command;
message.arg0 = arg0;
message.arg1 = arg1;
message.data_length = length;
message.data_check = sum;
message.magic = command ^ 0xffffffff;
#ifdef DEBUG
serialPrint("OUT << "); adb_printMessage(&message);
#endif
rcode = USB::bulkWrite(device, sizeof(adb_message), (uint8_t*)&message);
if (rcode) return rcode;
rcode = USB::bulkWrite(device, length, data);
return rcode;
}
开发者ID:catabriga,项目名称:erus,代码行数:41,代码来源:Adb.cpp
注:本文中的serialPrint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论