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

C++ send_char函数代码示例

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

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



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


示例16: send_uint32

void GameObjectMessage::send(uint32_t object_id, GameObject *game_object) {
  send_uint32(socket_, object_id);
  send_vector(socket_, game_object->body().position());
  send_char(socket_, game_object->game_object_type());
  send_object_points(socket_, game_object->characteristic_points());
  send_bool(socket_, game_object->alive());
}
开发者ID:tinchou,项目名称:bluesjackrabbit,代码行数:7,代码来源:GameObjectMessage.cpp


示例17: console_insert_char

static void console_insert_char( char c )
{
    uint32_t i;
    uint32_t len = strlen( console_buffer );

    /* move the end of the line out to make space */
    for ( i = len + 1; i > console_cursor_position; i-- )
    {
        console_buffer[i] = console_buffer[i - 1];
    }

    /* insert the character */
    len++;
    console_buffer[console_cursor_position] = c;

    /* print out the modified part of the ConsoleBuffer */
    send_str( &console_buffer[console_cursor_position] );

    /* move the cursor back to where it's supposed to be */
    console_cursor_position++;
    for ( i = len; i > console_cursor_position; i-- )
    {
        send_char( '\b' );
    }
}
开发者ID:119,项目名称:bcm-wiced-sdk,代码行数:25,代码来源:console.c


示例18: main

int main(int argc, char* argv[])
{
    char str[512];
    memset(str, 0, 512 );
        
    if ( argc > 1 )
        strncpy( str, argv[1], 511 );
    else
        return -1;
      
    int index = 0;
    int len = strlen(str);
    char* s = &str[0];
    while( *s )
    {
        char c = *s;
        if ( c == '\\' )
        {
            s++;
            c = *s;
            if ( c == 'r')
            {
                send_virtual_key_press(VK_RETURN);
            }
                
        }  
        else
            send_char( c ); 
        s++;
    }
    
    return 0;     
}
开发者ID:looooj,项目名称:gproject,代码行数:33,代码来源:sendkey.c


示例19: print

void print(char *str)
{
	while(*str != '\0')
	{
		send_char(*str++);
	}
}
开发者ID:Evgenij27,项目名称:newbieinmcu,代码行数:7,代码来源:usart.c


示例20: getPort

//Get the value from some port
void getPort(int portnum){
 
	unsigned char value;

	if(portnum==22) value=PORTA;
	else if(portnum==1) value=PORTB;
	else if(portnum==2) value=PORTC;
	else if(portnum==3) value=PORTD;
	else if(portnum==4) value=PORTE;
	else if(portnum==5) value=PORTF;
	else if(portnum==6) value=PORTG;
	else if(portnum==7) value=PORTH;
	else if(portnum==8) value=PORTJ;
	else if(portnum==9) value=PORTK;
	else if(portnum==10) value=PORTL;
	else if(portnum==11) value=DDRA;
	else if(portnum==12) value=DDRB;
	else if(portnum==13) value=DDRC;
	else if(portnum==14) value=DDRD;
	else if(portnum==15) value=DDRE;
	else if(portnum==16) value=DDRF;
	else if(portnum==17) value=DDRG;
	else if(portnum==18) value=DDRG;
	else if(portnum==19) value=DDRJ;
	else if(portnum==20) value=DDRK;
	else if(portnum==21) value=DDRL;
	send_char(value);
	//_delay_ms(1000);
}
开发者ID:eyantra,项目名称:CS308_Android-Interface---Firebird-API_2012,代码行数:30,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ send_cluster_message函数代码示例发布时间:2022-05-30
下一篇:
C++ send_byte函数代码示例发布时间: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