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


C++ send_char函数代码示例

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


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

示例1: do_read

static ssize_t do_read(int fd, void *buf, size_t count)
{
  ssize_t s = 0;
  unsigned char *p = buf;
  for ( ; s < count; ) {
    int ch = next_char();
    ++s;                        // Count the character.
    switch (ch) {
      // Some simple line handling.
    case 0x7F:
    case '\b':
      // Simple backspace handling.
      --s;
      if (s) {
        send_char('\b');
        send_char(' ');
        send_char('\b');
        --p;
        --s;
      }
      break;
    case '\n':
    case '\r':
      // Make sure we send both a CR and LF.
      send_char(ch == '\r' ? '\n' : '\r');
      *p = '\n';                // and send a newline back.
      return s;                 // This read is done.
    default:
      send_char(ch);            // Echo input.
      *p++ = ch;                // and send it back.
      break;
    }
  }
  return s;
}
开发者ID:cya410,项目名称:libraries,代码行数:35,代码来源:console.c

示例2: fputc

int fputc(int ch, FILE *f) {
 
 if ( ch == 0x0a	)
	send_char(0x0d);

	return (send_char(ch));
}
开发者ID:roland-wilhelm,项目名称:eds,代码行数:7,代码来源:Retarget.c

示例3: send_command

/////////////////////////////// string to display 5x8 ///////////////////////////////
void ssd0323::zeichen_small_1x(const uint8_t *font,unsigned char z, int spalte, int zeile, int back, int color, unsigned char offset){
	unsigned char a ,b ,c;
	unsigned int stelle;

	if((z<0x20)||(z>0x7f))z=0x20;
	stelle = 8*(z-0x20);

	send_command(0x15);
	send_command(3*spalte+floor(offset/2)); // die sind 6 breit => immer 2 auf einmal
	send_command((3*spalte)+2+floor(offset/2)); // (6*spalte)+5 => 0,1,2,3,4 das sind 5
	send_command(0x75);
	send_command(8*zeile);
	send_command((8*zeile)+7);

	for(c=0;c<8;c++){
		a = pgm_read_byte(&(font[stelle]));

		b=(back&0x0f)+((back&0x0f)<<4); /* default sende 2 pixel mit backlight */
		if(a&0x80)b = (b & 0x0f) + ((color&0x0f)<<4); /*alibi funktion für XX[1]X XXXX ... kommt nicht vor daher leerstelle */
		if(a&0x40)b = (b & 0xf0) + (color&0x0f); /*wenn XXX[1] XXXX dann sende 4 bit backlight/char, 4 bit char*/
		send_char(b);

		b=(back&0x0f)+((back&0x0f)<<4); /* default sende 2 pixel mit backlight */
		if(a&0x20)b = (b & 0x0f) + ((color&0x0f)<<4); /* wenn XXXX [1]XXX dann sende 4 bit char und dann 4 bit backlight */
		if(a&0x10)b = (b & 0xf0) + (color&0x0f); /* wenn XXXX X[1]XX dann sende 4 bit backlight und 4 bit back/char */
		send_char(b);

		b=(back&0x0f)+((back&0x0f)<<4);
		if(a&0x08)b = (b & 0x0f) + ((color&0x0f)<<4);/* wenn XXXX XX[1]X dann sende 4 bit char und dann 4 bit backlight */
		if(a&0x04)b = (b & 0xf0) + (color&0x0f);/* wenn XXXX XXX[1] dann sende 4 bit char und dann 4 bit back/char */
		send_char(b);

		stelle++;
	}
}
开发者ID:KoljaWindeler,项目名称:speedoino,代码行数:36,代码来源:ssd0323.cpp

示例4: __io_putchar

//implementation of __io_putchar for printf, to be used with STM's UART line
int __io_putchar(int c)
{
	if (c=='\n')
		send_char('\r'); //carriage return to remove starirs effect
	send_char(c);
	return c;
}
开发者ID:Czaper,项目名称:STM32_basics,代码行数:8,代码来源:main.c

示例5: show_tbl

void show_tbl(unsigned char *tbl)
{
	for (int i=0; i<256;i++)
	{
		send_byte(tbl[i]);
		send_char(' ');
	}
	send_char('\n');
}
开发者ID:wizest,项目名称:wingwing,代码行数:9,代码来源:SAMPLING.CPP

示例6: UART4_IRQHandler

void UART4_IRQHandler()
{
	if (USART_GetITStatus(UART4, USART_IT_RXNE) != RESET)
	{
		char gps_letter = USART_ReceiveData(UART4);
		if(gps_letter != 0) cbAdd(&GPS_BUFFER, gps_letter);
		send_char(gps_letter);	//potrzebne do debugowania
		send_char('a');
	}
	USART_ClearITPendingBit(UART4, USART_IT_RXNE);
}
开发者ID:siwucha,项目名称:Rob_inz,代码行数:11,代码来源:gps.c

示例7: key_handle_unmod

static void key_handle_unmod(kbd_event_t *ev)
{
	switch (ev->key) {
	case KC_ENTER:
		send_char('\n');
		break;
	default:
		if (ev->c >= 32 || ev->c == '\t' || ev->c == '\b') {
			send_char(ev->c);
		}
	}
}
开发者ID:pratikmankawde,项目名称:HelenOS_Nano,代码行数:12,代码来源:nterm.c

示例8: Example_UART_Print

void Example_UART_Print(void)
{

    /* Initialize system */
    SIO_Configuration(UART1);

    SIO_ChInit();

    /* enable SIO1 trx int */
    NVIC_EnableIRQ(INTTX1_IRQn);

    //Send char one by one
    send_char('C');
    send_char('o');
    send_char('o');
    send_char('C');
    send_char('o');
    send_char('x');
    send_char('\r');
    send_char('\n');
    
    //Send chars as string
    send_str("Hello, CooCox\r\n");

    while (1);
}
开发者ID:coocox,项目名称:Mplib,代码行数:26,代码来源:Example_UART_Print.c

示例9: send_str

int	send_str(pid_t pid, const char *str)
{
  int	x;

  x = 0;
  send_pid(pid);
  while (str[x] != '\0')
    {
      if (send_char(pid, str[x]))
	return (1);
      x += 1;
    }
  send_char(pid, 0);
  return (0);
}
开发者ID:mouuff,项目名称:minitalk,代码行数:15,代码来源:main.c

示例10: uplink_cmd_handler

void uplink_cmd_handler(void) {
    
    static char cmd[20];
    static uint8_t index = 0;
    
    // No data received, return
    if(buffer_level(UPLINK_USART,RX) < 1) return;
    
    // flush cmd buffer if cmd is out of a valid length
    if(index == MAX_CMD_LENGTH) {
        index = 0;
    }

    // append char to cmd
    recv_char(UPLINK_USART, &cmd[index]);
    
    switch(cmd[index]) {
        case '\r':
            // carriage return received, replace with stringtermination and parse
            send_str(UPLINK_USART, "\r\n");
            cmd[index] = '\0';
            parse_cmd(cmd);
            index = 0;
        break;
        case '\n':
            // do nothing, but avoid index from incrementing
        break;
        case '\b':
            // backspace, remove last received char
            index--;
            send_char(UPLINK_USART, '\b');
        break;
            // char is part of an ESC sequence
        case 0x1B:
        case 0x5B:
            index++;
        break;
            // each other if the last two char was not part of an ESC sequence
        default:
            if(cmd[index - 1] == 0x5B && cmd[index - 2] == 0x1B) {
                    index = index - 2;
            } else {
                send_char(UPLINK_USART, cmd[index]);
                index++;
            }
    }
  
}
开发者ID:Yondbee,项目名称:MateDealer,代码行数:48,代码来源:uplink.c

示例11: _ttywrch

void _ttywrch(int ch) {

  send_char(ch);
  


}
开发者ID:roland-wilhelm,项目名称:eds,代码行数:7,代码来源:Retarget.c

示例12: send_char_show

void send_char_show(int portnum, char showchar)
{
  char s[80];
  sprintf(s,"%02X ",(unsigned char) showchar);
  print_string_to(s,0);
  send_char(portnum,showchar);
}
开发者ID:jeske,项目名称:GTalk,代码行数:7,代码来源:PROTOCOL.C

示例13: consdrv_intrproc

static int consdrv_intrproc(struct consreg *cons) {
  unsigned char c;
  char *p;

  if(serial_is_recv_enable(cons->index)) {
    c = serial_recv_byte(cons->index);
    if(c == '\r') c = '\n';

    send_string(cons, &c, 1);

    if(cons->id) {
      if(c != '\n') cons->recv_buf[cons->recv_len++] = c;

      else {
	p = svc_memalloc(CONS_BUF_SIZE);
	memcpy(p, cons->recv_buf, cons->recv_len);
	svc_send(MLBOX_ID_CONSINPUT, cons->recv_len, p);
	cons->recv_len = 0;
      }
    }
  }

  if(serial_is_send_enable(cons->index)) {
    if(!cons->id || !cons->send_len) serial_intr_send_disable(cons->index);
    else send_char(cons);
  }

  return 0;
}
开发者ID:Plemling138,项目名称:REI-N,代码行数:29,代码来源:consdrv.c

示例14: send_command

// grafix has to be stored at /gfx/
int speedo_disp::sd2ssd(char filename[10],int frame){
	send_command(0x15);
	send_command(0x00);
	send_command(0x7F);
	send_command(0x75);
	send_command(0x00);
	send_command(0x3F);

	SdFile root;
	SdFile file;
	SdFile subdir;
	root.openRoot(&pSD->volume);

	if(!subdir.open(&root, "gfx", O_READ))    {  return 1; };
	if(!file.open(&subdir, filename, O_READ)) {  return 2; };
	unsigned long frame_seeker=(unsigned long)frame*64*64;
	if(!file.seekSet(frame_seeker))			  {  return 3; }; // ein bild ist 64*64 Byte groß, da wir 64 lines zu je 64*2*4 Bit Breite haben

	uint8_t buf[65];
	//int n;
	//while ((n = file.read(buf, sizeof(byte)*64)) > 0) {
	for (int zeile=0;	(file.read(buf, sizeof(byte)*64)>0)	&& zeile<64;	zeile++ ) {
		for(int j=0;j<64;j++){
			send_char(buf[j]);
		};
	};
	file.close();
	subdir.close();
	root.close();
	return 0;
};
开发者ID:KoljaWindeler,项目名称:speedoino,代码行数:32,代码来源:display.cpp

示例15: process_execute

/*
 * Send execute messae. "conn" should at the point right after the message
 * kind was read.
 */
void
process_execute(char *buf, PGconn *conn)
{
	int			len;
	char	   *portal;
	int			maxrows;
	char	   *bufp;

	SKIP_TABS(buf);

	len = sizeof(int);

	portal = buffer_read_string(buf, &bufp);
	buf = bufp;
	len += strlen(portal) + 1;

	SKIP_TABS(buf);

	fprintf(stderr, "FE=> Execute(portal=\"%s\")\n", portal);

	SKIP_TABS(buf);

	maxrows = buffer_read_int(buf, &bufp);

	len += sizeof(int);

	send_char('E', conn);
	send_int(len, conn);
	send_string(portal, conn);
	send_int(maxrows, conn);
}
开发者ID:pgpool,项目名称:pgpool2,代码行数:35,代码来源:extended_query.c


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