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


C++ console_putc函数代码示例

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


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

示例1: console_poll

void console_poll()
{
	int ch = 0;

	if(!uart_getchar)
		return;
	ch = uart_getchar();
	if (ch == -1)
		return;

	console_putc((unsigned int)ch);

	if (console_buf_loc + 1 >= MAX_CONSOLE_BUF
		|| ch == '\r'
		|| ch == '\n') {
		console_buf[console_buf_loc++] = (char)ch;
		console_buf[console_buf_loc] = 0;
		console_putc('\n');
		console_rx_cmd_complete(console_buf);
		console_buf_loc = 0;
		console_buf[console_buf_loc] = 0;
	}
	else {
		console_buf[console_buf_loc++] = (char)ch;
	}
}
开发者ID:magnusjjj,项目名称:android_kernel_huawei_rle,代码行数:26,代码来源:console.c

示例2: console_puts

void console_puts(unsigned int ch, const char *str)
{
	const char *s = str;
	while (*s) {
		if (*s == '\n')
			console_putc(ch, '\r');
		console_putc(ch, *s);
		s++;
	}
}
开发者ID:cwyy,项目名称:barebox,代码行数:10,代码来源:console.c

示例3: console_puts

/*
 * void console_puts(char *s)
 *
 * Send a string to the console, one character at a time, return
 * after the last character, as indicated by a NUL character, is
 * reached.
 */
void console_puts(char *s)
{
	while (*s != '\000') {
		console_putc(*s);
		/* Add in a carraige return, after sending line feed */
		if (*s == '\n') {
			console_putc('\r');
		}
		s++;
	}
}
开发者ID:Guiller87,项目名称:libopencm3-examples,代码行数:18,代码来源:console.c

示例4: console_write

static ssize_t console_write(void *cookie, const char *buf, size_t size)
{
    cookie = cookie;            // -Wunused-parameter
    for (size_t i = 0; i < size; i++) {
        char c = buf[i];
        if (c == '\n')
            console_putc('\r');
        console_putc(c);
    }
    return size;
}
开发者ID:esden,项目名称:1bitsy-examples,代码行数:11,代码来源:console.c

示例5: line_editor_output

/**
 * Output the line and place the cursor at the current position.
 *
 * @param editor        Line editor state.
 */
void line_editor_output(line_editor_t *editor) {
  size_t i;

  for (i = 0; i <= editor->len; i++) {
    console_putc(editor->console, editor->buf[i]);
  }

  while (i > editor->offset) {
    console_putc(editor->console, '\b');
    i--;
  }
}
开发者ID:gil0mendes,项目名称:Initium,代码行数:17,代码来源:line_editor.c

示例6: reprint_from_current

/**
 * Reprint from the current offset, mainting cursor position.
 *
 * @param editor        Line editor state.
 * @param space         Whether to print an additional space at the end (after
 *                      removing a character).
 */
static void reprint_from_current(line_editor_t *editor, bool space) {
  size_t i;

  for (i = editor->offset; i < editor->len; i++) {
    console_putc(editor->console, editor->buf[i]);
  }

  if (space) { console_putc(editor->console, '\b'); }

  while (i > editor->offset) {
    console_putc(editor->console, '\b');
    i--;
  }
}
开发者ID:gil0mendes,项目名称:Initium,代码行数:21,代码来源:line_editor.c

示例7: console_puts

int console_puts(unsigned int ch, const char *str)
{
	int n = 0;

	while (*str) {
		if (*str == '\n')
			console_putc(CONSOLE_STDOUT, '\r');

		console_putc(CONSOLE_STDOUT, *str);
		str++;
		n++;
	}

	return n;
}
开发者ID:MinimumLaw,项目名称:ravion-barebox,代码行数:15,代码来源:console.c

示例8: vprintf_helper

/** Helper for vprintf().
 * @param ch            Character to display.
 * @param data          Unused.
 * @param total         Pointer to total character count. */
static void vprintf_helper(char ch, void *data, int *total) {
    console_putc(current_console, ch);
    console_putc(debug_console, ch);

    if (kboot_log) {
        kboot_log->buffer[(kboot_log->start + kboot_log->length) % kboot_log_size] = ch;
        if (kboot_log->length < kboot_log_size) {
            kboot_log->length++;
        } else {
            kboot_log->start = (kboot_log->start + 1) % kboot_log_size;
        }
    }

    *total = *total + 1;
}
开发者ID:Fluray,项目名称:kboot,代码行数:19,代码来源:console.c

示例9: console_puts

int console_puts(unsigned int ch, const char *str)
{
	const char *s = str;
	int i = 0;

	while (*s) {
		console_putc(ch, *s);
		if (*s == '\n')
			console_putc(ch, '\r');
		s++;
		i++;
	}

	return i;
}
开发者ID:cpdesign,项目名称:barebox,代码行数:15,代码来源:console_simple.c

示例10: console_puth

//prints a hex value of a string
void console_puth(const uint8_t *str,uint8_t count)
{
    uint8_t a;
    for(a=0;a<count;a++){
        console_puts(" 0x");
            if(((*str>>4)&0x0F)<=9)                     //check if the upper nibble is 0-9
                console_putc(((*str>>4)&0x0F)+48);      //hex 0x30 is ASCII 0
            else
                console_putc(((*str>>4)&0x0F)+55);      //hex 0x41 is ASCII 0
            if((*str&0x0F)<=9)                          //check if the upper nibble is 0-9
                console_putc((*str&0x0F)+48);           //hex 0x30 is ASCII 0
            else
                console_putc((*str&0x0F)+55);           //hex 0x41 is ASCII 0
        str++;                                          //increment pointer
    }
开发者ID:qzthrone,项目名称:telemetry,代码行数:16,代码来源:console.c

示例11: line_editor_input

/**
 * Handle input on the line editor.
 *
 * @param editor        Line editor state.
 * @param key           Key that was pressed.
 */
void line_editor_input(line_editor_t *editor, uint16_t key) {
  switch (key) {
  case CONSOLE_KEY_LEFT:
    if (editor->offset) {
      console_putc(editor->console, '\b');
      editor->offset--;
    }

    break;
  case CONSOLE_KEY_RIGHT:
    if (editor->offset != editor->len) {
      console_putc(editor->console, editor->buf[editor->offset]);
      editor->offset++;
    }

    break;
  case CONSOLE_KEY_HOME:
    while (editor->offset) {
      console_putc(editor->console, '\b');
      editor->offset--;
    }

    break;
  case CONSOLE_KEY_END:
    while (editor->offset < editor->len) {
      console_putc(editor->console, editor->buf[editor->offset]);
      editor->offset++;
    }

    break;
  case '\b':
    erase_char(editor, false);
    break;
  case 0x7f:
    erase_char(editor, true);
    break;
  case '\n':
    /* The shell code sends \n to place it at the end of the buffer. */
    editor->offset = editor->len;
    insert_char(editor, key);
    break;
  default:
    if (isprint(key))
      insert_char(editor, key);

    break;
  }
}
开发者ID:gil0mendes,项目名称:Initium,代码行数:54,代码来源:line_editor.c

示例12: console_rx_callback

void console_rx_callback(uint8_t c)
{
    switch(console_mode)
    {
        case CONSOLE_MODE_KEY:
            got_key = TRUE;
            last_key = c;
            break;

        case CONSOLE_MODE_LINE:
            if (got_line)   // throw away chars until the line is handled
                return;

            switch(c)
            {
                case 0x0D:
                //case '\r':
                    got_line = TRUE;
                    if (echo)
                        console_newline();
                    break;
                case '\b':  // backspace
                case 0x7F:  // del
                    if (cmdbuf_len > 0)
                    {
                        cmdbuf_len--;
                        if (echo)
                        {
                            console_putc('\b');
                            console_putc(' ');
                            console_putc('\b');
                        }
                    }
                    break;
                default:
                    if (cmdbuf_len < sizeof(cmdbuf)-1)
                    {
                        if (echo)
                            console_putc(c);
                        cmdbuf[cmdbuf_len++] = c;
                    }
                    else
                        console_putc('\a');  // bell
                    break;
            }
        break;
    }
}
开发者ID:pfalcon,项目名称:bus-ninja,代码行数:48,代码来源:console.c

示例13: console_puts

int console_puts(unsigned int ch, const char *str)
{
	const char *s = str;
	int n = 0;

	while (*s) {
		if (*s == '\n') {
			console_putc(ch, '\r');
			n++;
		}
		console_putc(ch, *s);
		n++;
		s++;
	}
	return n;
}
开发者ID:dgarnier,项目名称:barebox,代码行数:16,代码来源:console.c

示例14: console_set_cursor

void DMXMonitor::SetData(const uint8_t nPort, const uint8_t *pData, const uint16_t nLength) {
    uint8_t row = TOP_ROW;
    uint8_t *p = (uint8_t *)pData;
    uint16_t slot = 0;
    uint8_t i, j;

    for (i = 0; (i < 16) && (slot < nLength); i++) {

        console_set_cursor(4, ++row);

        for (j = 0; (j < 32) && (slot < nLength); j++) {
            const uint8_t d = *p++;
            if (d == (uint8_t) 0) {
                console_puts(" 0");
            } else {
                console_puthex_fg_bg(d, (uint16_t)(d > 92 ? CONSOLE_BLACK : CONSOLE_WHITE), (uint16_t)RGB(d,d,d));
            }
            (void) console_putc((int) ' ');
            slot++;
        }

        for (; j < 32; j++) {
            console_puts("-- ");
        }
    }

    for (; i < 16; i++) {
        console_set_cursor(4, ++row);
        console_puts("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
    }

}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:32,代码来源:dmxmonitor.cpp

示例15: console_status

int console_status(uint16_t color, const char *s) {
	char c;
	int i = 0;

	const uint16_t fore_current = cur_fore;
	const uint16_t back_current = cur_back;

	const uint16_t s_y = current_y;
	const uint16_t s_x = current_x;

	console_clear_line(29);

	cur_fore = color;
	cur_back = CONSOLE_BLACK;

	while ((c = *s++) != (char) 0) {
		i++;
		(void) console_putc((int) c);
	}

	current_y = s_y;
	current_x = s_x;

	cur_fore = fore_current;
	cur_back = back_current;

	return i;
}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:28,代码来源:console_fb.c


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