• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ console_putc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: console_gets

/*
 * int console_gets(char *s, int len)
 *
 * Wait for a string to be entered on the console, limited
 * support for editing characters (back space and delete)
 * end when a <CR> character is received.
 */
int console_gets(char *s, int len)
{
	char *t = s;
	char c;

	*t = '\000';
	/* read until a <CR> is received */
	while ((c = console_getc(1)) != '\r') {
		if ((c == '\010') || (c == '\127')) {
			if (t > s) {
				/* send ^H ^H to erase previous character */
				console_puts("\010 \010");
				t--;
			}
		} else {
			*t = c;
			console_putc(c);
			if ((t - s) < len) {
				t++;
			}
		}
		/* update end of string with NUL */
		*t = '\000';
	}
	return t - s;
}
开发者ID:Guiller87,项目名称:libopencm3-examples,代码行数:33,代码来源:console.c


示例17: tty_native_setc

/* Put a character on the screen at the given position */
void tty_native_setc(tty_t t, int pos, char c)
{
	if(pos < 0) pos = 0;
	if(pos >= CONSOLE_ROWS * CONSOLE_COLS)
		pos = (CONSOLE_ROWS * CONSOLE_COLS) - 1;

        /* Is this a serial tty? */
        if(t->type==TTY_TYPE_SERIAL)
        {
                // if(t->active) serial_write(&c, 1);
                return;
        }

        /* If this tty is active, print out to the screen */
        if(t->active)
        {
                console_putc(pos, c, t->sgr.color,
                                t->type==TTY_TYPE_COLOR,
                                (char*)t->mem_start);
        }

        /* Update back buffer */
        if(t->type == TTY_TYPE_COLOR)
        {
                char* vid_addr = t->buffer + (pos * 2);
                *(vid_addr)     = c;
                *(vid_addr + 1) = t->sgr.color;
        } else {
                char* vid_addr = t->buffer + (pos);
                *(vid_addr)     = c;
        }
}
开发者ID:jdetter,项目名称:Chronos,代码行数:33,代码来源:tty_codes.c


示例18: serial_store

static
int
serial_store(unsigned cpunum, void *d, uint32_t offset, uint32_t val)
{
    struct ser_data *sd = d;

    (void)cpunum;

    switch (offset) {
    case SERREG_CHAR:
        if (!sd->sd_wbusy) {
            sd->sd_wbusy = 1;
            g_stats.s_wchars++;
            console_putc(val);
            schedule_event(SERIAL_NSECS, sd, 0,
                           serial_writedone, "serial write");
        }
        return 0;
    case SERREG_RIRQ:
        storeirq(&sd->sd_rirq, val);
        setirq(sd);
        return 0;
    case SERREG_WIRQ:
        storeirq(&sd->sd_wirq, val);
        setirq(sd);
        return 0;
    }
    return -1;
}
开发者ID:ops-class,项目名称:sys161,代码行数:29,代码来源:dev_serial.c


示例19: console_puts

void console_puts(const char *str)
{
    const char *c;

    for (c = str; *c; c++)
        console_putc(*c);
}
开发者ID:cpehle,项目名称:NyuziProcessor,代码行数:7,代码来源:console.cpp


示例20: console_puts

/*
 * Diag print handler
 */
static void
console_puts(char *str)
{
	size_t count;
	char c;

	sched_lock();
	for (count = 0; count < 128; count++) {
		c = *str;
		if (c == '\0')
			break;
		console_putc(c);
#if defined(CONFIG_DIAG_BOCHS)
		if (inb(0xe9) == 0xe9) {
			if (c == '\n')
				outb((int)'\r', 0xe9);
			outb(c, 0xe9);
		}
#endif
		str++;
	}
	move_cursor();
	esc_index = 0;
	sched_unlock();
}
开发者ID:AndrewD,项目名称:prex,代码行数:28,代码来源:console.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ console_unlock函数代码示例发布时间:2022-05-30
下一篇:
C++ console_print函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap