您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ usart_send_blocking函数代码示例

51自学网 2021-06-03 09:18:25
  C++
这篇教程C++ usart_send_blocking函数代码示例写得很实用,希望能帮到您。

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

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

示例1: _write

int _write(int fd, const void *buf, size_t count){    int sent;    char *ptr;    if(fd <= 2){        sent = count;        ptr = (char *) buf;        while(count > 0){            if(*ptr == '/n'){                usart_send_blocking(STD_CON, '/r');            }            usart_send_blocking(STD_CON, *ptr++);            ++sent;            --count;        }    }else{        errno = EIO;        sent = -1;    }    return sent;}
开发者ID:Archer-sys,项目名称:atomthreads,代码行数:25,


示例2: BT_Test

void BT_Test(){    usleep(1000000);    PORT_pin_set(BT_KEY);    usleep(100000);    BT_ResetPtr();    usart_send_blocking(BTUART, 'A');    usart_send_blocking(BTUART, 'T');    usart_send_blocking(BTUART, '/r');    usart_send_blocking(BTUART, '/n');    while(1) {        char tmp[32];        while(ptr == bt_buf || *(ptr-1) != '/n') {        }        int len = ptr - bt_buf;        memcpy(tmp, (char *)bt_buf, len);        BT_ResetPtr();        tmp[len] = 0;        printf("%s", tmp);        if((tmp[0] == 'O' && tmp[1] == 'K') || (tmp[0] == 'F' && tmp[1] == 'A')) {            printf("CmdDone/n");            break;        }    }    PORT_pin_clear(BT_KEY);    usleep(150000);}
开发者ID:Chen-Leon,项目名称:DeviationX,代码行数:27,


示例3: uart_cinit

voiduart_cinit(void *config){	usart = (uint32_t)config;	/* board is expected to do pin and clock setup */	/* do usart setup */	//USART_CR1(usart) |= (1 << 15);	/* because libopencm3 doesn't know the OVER8 bit */	usart_set_baudrate(usart, 115200);	usart_set_databits(usart, 8);	usart_set_stopbits(usart, USART_STOPBITS_1);	usart_set_mode(usart, USART_MODE_TX_RX);	usart_set_parity(usart, USART_PARITY_NONE);	usart_set_flow_control(usart, USART_FLOWCONTROL_NONE);	/* and enable */	usart_enable(usart);#if 0	usart_send_blocking(usart, 'B');	usart_send_blocking(usart, 'B');	usart_send_blocking(usart, 'B');	usart_send_blocking(usart, 'B');	while (true) {		int c;		c = usart_recv_blocking(usart);		usart_send_blocking(usart, c);	}#endif}
开发者ID:1ee7,项目名称:Bootloader,代码行数:34,


示例4: _write_r

int _write_r (struct _reent *r, int fd, char * ptr, int len){      (void)r;    if(fd==1 || fd==2) {        int index;        if (0 == (USART_CR1(USART1) & USART_CR1_UE))            return len; //Don't send if USART is disabled        for(index=0; index<len; index++) {            if (ptr[index] == '/n') {                usart_send_blocking(USART1,'/r');            }              usart_send_blocking(USART1, ptr[index]);        }            return len;    } else if(fd>2) {        if(file_open[fd-3]) {#ifdef MEDIA_DRIVE            _drive_num = fd == 3 ? 0 : 1;#endif            WORD bytes_written;            pf_switchfile(&fat[fd-3]);            int res=pf_write(ptr, len, &bytes_written);            dbgprintf("_write_r: len %d, bytes_written %d, result %d/r/n",len, bytes_written, res);            if(res==FR_OK) return bytes_written;        }    }    errno=EINVAL;    return -1;}
开发者ID:caoqing32,项目名称:galee-devo7e,代码行数:31,


示例5: back_up

/* back up the cursor one space */static inline void back_up(void){	end_ndx = dec_ndx(end_ndx);	usart_send_blocking(USART2, '/010');	usart_send_blocking(USART2, ' ');	usart_send_blocking(USART2, '/010');}
开发者ID:insane-adding-machines,项目名称:unicore-mx-examples,代码行数:8,


示例6: bt_update_characteristic

void bt_update_characteristic(uint8_t *data, uint8_t len, const char *uuid){	bt_last_query = UPDATE;	uint8_t i,d;	bt_send_string(B_USART,"SUW,");	bt_send_string(B_USART,uuid);	bt_send_string(B_USART,",");	for (i=0; i < len; i++)	{		d = (data[i] & 0xF0) >> 4;		if (d <= 9)			d += 48;		else			d+= 55;		usart_send_blocking(B_USART, d);		d = data[i] & 0xF;		if (d <= 9)			d += 48;		else			d+= 55;		usart_send_blocking(B_USART, d);	}	bt_send_string(B_USART,"/r/n");	bt_query_result = 0;	waiting_for_response = 1;}
开发者ID:mattbrejza,项目名称:lora-tracker,代码行数:26,


示例7: my_usart_print_int

static void my_usart_print_int(uint32_t usart, int32_t value){	int8_t i;	int8_t nr_digits = 0;	char buffer[25];	if (value < 0) {		usart_send_blocking(usart, '-');		value = value * -1;	}	if (value == 0) {		usart_send_blocking(usart, '0');	}	while (value > 0) {		buffer[nr_digits++] = "0123456789"[value % 10];		value /= 10;	}	for (i = nr_digits-1; i >= 0; i--) {		usart_send_blocking(usart, buffer[i]);	}	usart_send_blocking(usart, '/r');	usart_send_blocking(usart, '/n');}
开发者ID:BuFran,项目名称:libopencm3-examples,代码行数:27,


示例8: send_USART_str

void send_USART_str(const unsigned char* in){    int i;    for(i = 0; in[i] != 0; i++) {        usart_send_blocking(USART2, in[i]);    }    usart_send_blocking(USART2, '/r');    usart_send_blocking(USART2, '/n');}
开发者ID:joostrijneveld,项目名称:STM32-getting-started,代码行数:9,


示例9: main

int main(void){	int i, j = 0, c = 0;	clock_setup();	gpio_setup();	usart_setup();	/* Blink the LED (PE10) on the board with every transmitted byte. */	while (1) {		gpio_toggle(GPIO_PE10);			/* LED on/off */		usart_send_blocking(USART1, c + '0');	/* USART1: Send byte. */		usart_send_blocking(USART2, c + '0');	/* USART2: Send byte. */		usart_send_blocking(USART3, c + '0');	/* USART3: Send byte. */		c = (c == 9) ? 0 : c + 1;	/* Increment c. */		if ((j++ % 80) == 0) {	/* Newline after line full. */			usart_send_blocking(USART1, '/r');			usart_send_blocking(USART1, '/n');			usart_send_blocking(USART2, '/r');			usart_send_blocking(USART2, '/n');			usart_send_blocking(USART3, '/r');			usart_send_blocking(USART3, '/n');		}		for (i = 0; i < 800000; i++)	/* Wait a bit. */			__asm__ ("nop");	}	return 0;}
开发者ID:tyoshid,项目名称:libopenstm32l1,代码行数:29,


示例10: mandel

static void mandel(float cX, float cY, float scale){	int x, y;	for (x = -60; x < 60; x++) {		for (y = -50; y < 50; y++) {			int i = iterate(cX + x*scale, cY + y*scale);			usart_send_blocking(USART2, color[i]);		}		usart_send_blocking(USART2, '/r');		usart_send_blocking(USART2, '/n');	}}
开发者ID:ChuckM,项目名称:libopencm3-examples,代码行数:12,


示例11: print

void print(const char *s){    // loop through entire string    while (*s) {    	if ( *s == '/n') {        usart_send_blocking(USART1,'/r');        //usart_send_blocking(USART1,'/n');    	}    	usart_send_blocking(USART1,*s);        s++;    }}
开发者ID:MrSpock,项目名称:stm32f0-libopencm3-template,代码行数:13,


示例12: main

int main(void){	uint8_t channel_array[16];	uint16_t temperature = 0;	rcc_clock_setup_in_hse_12mhz_out_72mhz();	gpio_setup();	usart_setup();	timer_setup();	adc_setup();	gpio_set(GPIOA, GPIO8);	                /* LED1 on */	gpio_set(GPIOC, GPIO15);		/* LED2 on */	/* Send a message on USART1. */	usart_send_blocking(USART2, 's');	usart_send_blocking(USART2, 't');	usart_send_blocking(USART2, 'm');	usart_send_blocking(USART2, '/r');	usart_send_blocking(USART2, '/n');	/* Select the channel we want to convert. 16=temperature_sensor. */	channel_array[0] = 16;	/* Set the injected sequence here, with number of channels */	adc_set_injected_sequence(ADC1, 1, channel_array);	/* Continously convert and poll the temperature ADC. */	while (1) {		/*		 * Since the injected sampling is triggered by the timer, it gets		 * updated automatically, we just need to periodically read out the value.		 * It would be better to check if the JEOC bit is set, and clear it following		 * so that you do not read the same value twice, especially for a slower		 * sampling rate.		 */		temperature = adc_read_injected(ADC1,1); //get the result from ADC_JDR1 on ADC1 (only bottom 16bits)		/*		 * That's actually not the real temperature - you have to compute it		 * as described in the datasheet.		 */		my_usart_print_int(USART2, temperature);		gpio_toggle(GPIOA, GPIO8); /* LED2 on */	}	return 0;}
开发者ID:balshetzer,项目名称:libopencm3-examples,代码行数:50,


示例13: printstr

void printstr(char * ptr, int len){    int index;    if (0 == (USART_CR1(_USART) & USART_CR1_UE))        return; //Don't send if USART is disabled    for(index=0; index<len; index++) {        if (ptr[index] == '/n') {            usart_send_blocking(_USART,'/r');        }          usart_send_blocking(_USART, ptr[index]);    }        return;}
开发者ID:Chen-Leon,项目名称:DeviationX,代码行数:15,


示例14: _write

int _write(int file, char *ptr, int len) {	int i;	if (file == STDOUT_FILENO || file == STDERR_FILENO) {		for (i = 0; i < len; i++) {			if (ptr[i] == '/n') {				usart_send_blocking(USART1, '/r');			}			usart_send_blocking(USART1, ptr[i]);		}		return i;	}	errno = EIO;	return -1;}
开发者ID:iqyx,项目名称:kiwi-basic,代码行数:15,


示例15: _write

int _write(int file, char *ptr, int len){	int i;	if (file == 1) {		for (i = 0; i < len; i++) {			if (ptr[i] == '/n') {				usart_send_blocking(USART2, '/r');			}			usart_send_blocking(USART2, ptr[i]);		}		return i;	}	errno = EIO;	return -1;}
开发者ID:ADDTech,项目名称:simrf,代码行数:16,


示例16: uart7_cout

void uart7_cout(uint32_t whichUsart,uint8_t *buf,unsigned len){	while (len--) {			usart_send_blocking(whichUsart, *buf++);			while(usart_get_flag(UART7, USART_SR_TC) !=1);		}}
开发者ID:liangzelang,项目名称:Bootloader_PX4_SD,代码行数:7,


示例17: puts

void puts(const unsigned char *s){    while(*s) {        usart_send_blocking(USART1,*s);        s++;    }}
开发者ID:MrSpock,项目名称:stm32f0-libopencm3-template,代码行数:7,


示例18: handleEnd

 void handleEnd() {   // make sure write finishes   usart_send_blocking(USART1, 0);   usart_wait_send_ready(USART1);      gpio_clear(GPIOB, GPIO5); }
开发者ID:arpit15,项目名称:SubjuGator,代码行数:7,


示例19: command

static int command(char *command, size_t length){    size_t i;    calculate_crc_and_ack(command, length);    for (i = 0; i < length; i++)        usart_send_blocking(USART2, command[i]);    timer_set_counter(TIM5, 0);    timer_clear_flag(TIM5, TIM_SR_UIF);    timer_enable_counter(TIM5);    for (i = 0; i < sizeof(expect_ack); )    {        while (!timer_get_flag(TIM5, TIM_SR_UIF) &&               !usart_get_flag(USART2, USART_SR_RXNE));        if (timer_get_flag(TIM5, TIM_SR_UIF))            break;        if (expect_ack[i] != usart_recv(USART2))            break;    }    timer_disable_counter(TIM5);    return (i == sizeof(expect_ack));}
开发者ID:cuspaceflight,项目名称:DorMouse,代码行数:29,


示例20: send_USART_bytes

void send_USART_bytes(const unsigned char* in, int n){    int i;    for(i = 0; i < n; i++) {        usart_send_blocking(USART2, in[i]);    }}
开发者ID:joostrijneveld,项目名称:STM32-getting-started,代码行数:7,


示例21: uart_cout

voiduart_cout(uint8_t *buf, unsigned len){	while (len--) {		usart_send_blocking(usart, *buf++);	}}
开发者ID:1ee7,项目名称:Bootloader,代码行数:7,


示例22: get_buffered_line

/* * A buffered line editing function. */voidget_buffered_line(void) {	char	c;	if (start_ndx != end_ndx) {		return;	}	while (1) {		c = usart_recv_blocking(USART2);		if (c == '/r') {			buf[end_ndx] = '/n';			end_ndx = inc_ndx(end_ndx);			buf[end_ndx] = '/0';			usart_send_blocking(USART2, '/r');			usart_send_blocking(USART2, '/n');			return;		}		/* ^H or DEL erase a character */		if ((c == '/010') || (c == '/177')) {			if (buf_len == 0) {				usart_send_blocking(USART2, '/a');			} else {				back_up();			}		/* ^W erases a word */		} else if (c == 0x17) {			while ((buf_len > 0) &&					(!(isspace((int) buf[end_ndx])))) {				back_up();			}		/* ^U erases the line */		} else if (c == 0x15) {			while (buf_len > 0) {				back_up();			}		/* Non-editing character so insert it */		} else {			if (buf_len == (BUFLEN - 1)) {				usart_send_blocking(USART2, '/a');			} else {				buf[end_ndx] = c;				end_ndx = inc_ndx(end_ndx);				usart_send_blocking(USART2, c);			}		}	}}
开发者ID:insane-adding-machines,项目名称:unicore-mx-examples,代码行数:50,


示例23: main

int main(void){	u8 channel_array[16];	rcc_clock_setup_in_hse_12mhz_out_72mhz();	gpio_setup();	usart_setup();	timer_setup();	irq_setup();	adc_setup();	gpio_set(GPIOA, GPIO8);	                /* LED1 on */	gpio_set(GPIOC, GPIO15);		/* LED2 on */	/* Send a message on USART1. */	usart_send_blocking(USART2, 's');	usart_send_blocking(USART2, 't');	usart_send_blocking(USART2, 'm');	usart_send_blocking(USART2, '/r');	usart_send_blocking(USART2, '/n');	/* Select the channel we want to convert. 16=temperature_sensor. */	channel_array[0] = 16;	/* Set the injected sequence here, with number of channels */	adc_set_injected_sequence(ADC1, 1, channel_array);	/* Continously convert and poll the temperature ADC. */	while (1) {		/*		 * Since sampling is triggered by the timer and copying the value		 * out of the data register is handled by the interrupt routine,		 * we just need to print the value and toggle the LED. It may be useful		 * to buffer the adc values in some cases.		 */		/*		 * That's actually not the real temperature - you have to compute it		 * as described in the datasheet.		 */		my_usart_print_int(USART2, temperature);		gpio_toggle(GPIOA, GPIO8); /* LED2 on */	}	return 0;}
开发者ID:CNCBASHER,项目名称:libopencm3,代码行数:47,


示例24: term_Run

/** Run the terminal */void term_Run(){   char args[TERM_BUFSIZE];   const TERM_CMD *pCurCmd = NULL;   int lastIdx = 0;   while (1)   {      int currentIdx = TERM_BUFSIZE - TERM_USART_CNDTR;      if (0 == TERM_USART_CNDTR)         ResetDMA();      while (lastIdx < currentIdx) //echo         usart_send_blocking(TERM_USART, inBuf[lastIdx++]);      if (currentIdx > 0)      {         if (inBuf[currentIdx - 1] == '/n' || inBuf[currentIdx - 1] == '/r')         {            inBuf[currentIdx] = 0;            lastIdx = 0;            char *space = (char*)my_strchr(inBuf, ' ');            if (0 == *space) //No args after command, look for end of line            {               space = (char*)my_strchr(inBuf, '/n');               args[0] = 0;            }            else //There are arguments, copy everything behind the space            {               my_strcpy(args, space + 1);            }            if (0 == *space) //No /n found? try /r               space = (char*)my_strchr(inBuf, '/r');            *space = 0;            pCurCmd = CmdLookup(inBuf);            ResetDMA();            if (NULL != pCurCmd)            {               pCurCmd->CmdFunc(args);            }            else if (currentIdx > 1)            {               term_send(TERM_USART, "Unknown command sequence/r/n");            }         }         else if (inBuf[0] == '!' && NULL != pCurCmd)         {            ResetDMA();            lastIdx = 0;            pCurCmd->CmdFunc(args);         }      }   } /* while(1) */} /* term_Run */
开发者ID:tumanako,项目名称:tumanako-inverter-fw-motorControl,代码行数:60,


示例25: usart_puts

static void usart_puts(uint32_t usart, const char *s){    while(*s != '/0')    {        usart_send_blocking(usart, *s);        s++;    }}
开发者ID:ericwahahaha,项目名称:nucleo_tests,代码行数:8,


示例26: usart_send_string

static void usart_send_string(u32 usart, u8 *string, u16 str_size){	u16 iter = 0;	do	{		usart_send_blocking(usart, string[iter++]);	}while(string[iter] != 0 && iter < str_size);}
开发者ID:karlp,项目名称:libopencm3-examples,代码行数:8,


示例27: _debug_send

void _debug_send(const char *data){    while (*data)    {        usart_send_blocking(USART1, *data);        data++;    }}
开发者ID:cuspaceflight,项目名称:DorMouse,代码行数:8,


示例28: send_string_blocking

void send_string_blocking(char * string){	u16 len = strlen(string);	u16 i;	for(i = 0; i < len; i++)	{		usart_send_blocking(USART, string[i]);	}}
开发者ID:hymanc,项目名称:lram-casting,代码行数:9,


示例29: _write

int _write(int file, char *ptr, int len) {    int i;    if (file == 1) {	for (i = 0; i < len; i++)	    usart_send_blocking(USART1, ptr[i]);	return i;    }    errno = EIO;    return -1;}
开发者ID:GBert,项目名称:misc,代码行数:10,


示例30: write_std_err

/** *  write_std_err - writes errors to the UART specified in config.h */int write_std_err(const void *buffer, int len) {  int c = len;  char *cp = (char *)buffer;    while(c--) {    usart_send_blocking(STD_ERR_UART, *cp++);  }  return len;}
开发者ID:mitlab,项目名称:oggbox,代码行数:13,



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


C++ usart_set_baudrate函数代码示例
C++ usart_send函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。