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

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

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

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

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

示例1: usbuart_set_line_coding

void usbuart_set_line_coding(struct usb_cdc_line_coding *coding){	usart_set_baudrate(USBUSART, coding->dwDTERate);	usart_set_databits(USBUSART, coding->bDataBits);	switch(coding->bCharFormat) {	case 0:		usart_set_stopbits(USBUSART, USART_STOPBITS_1);		break;	case 1:		usart_set_stopbits(USBUSART, USART_STOPBITS_1_5);		break;	case 2:		usart_set_stopbits(USBUSART, USART_STOPBITS_2);		break;	}	switch(coding->bParityType) {	case 0:		usart_set_parity(USBUSART, USART_PARITY_NONE);		break;	case 1:		usart_set_parity(USBUSART, USART_PARITY_ODD);		break;	case 2:		usart_set_parity(USBUSART, USART_PARITY_EVEN);		break;	}}
开发者ID:FlyingCampDesign,项目名称:blackmagic,代码行数:27,


示例2: UART_SetFormat

void UART_SetFormat(int bits, uart_parity parity, uart_stopbits stopbits){    // STM counts parity bit as part of databits length    // so bits and parity settings are interdependent.    if (bits == 8) {        if (parity == UART_PARITY_NONE) {            usart_set_databits(UART_CFG.uart, 8);            usart_set_parity(UART_CFG.uart, USART_PARITY_NONE);        } else {            usart_set_databits(UART_CFG.uart, 9);            if (parity == UART_PARITY_EVEN)                usart_set_parity(UART_CFG.uart, USART_PARITY_EVEN);            else                usart_set_parity(UART_CFG.uart, USART_PARITY_ODD);        }    } else if (bits == 7 && parity != UART_PARITY_NONE) {        usart_set_databits(UART_CFG.uart, 8);        if (parity == UART_PARITY_EVEN)            usart_set_parity(UART_CFG.uart, USART_PARITY_EVEN);        else            usart_set_parity(UART_CFG.uart, USART_PARITY_ODD);    }    switch (stopbits) {    case UART_STOPBITS_1:   usart_set_stopbits(UART_CFG.uart, USART_STOPBITS_1); break;    case UART_STOPBITS_1_5: usart_set_stopbits(UART_CFG.uart, USART_STOPBITS_1_5); break;    case UART_STOPBITS_2:   usart_set_stopbits(UART_CFG.uart, USART_STOPBITS_2); break;    }}
开发者ID:goebish,项目名称:deviation,代码行数:29,


示例3: uart_periph_set_bits_stop_parity

void uart_periph_set_bits_stop_parity(struct uart_periph *p, uint8_t bits, uint8_t stop, uint8_t parity){  /* Configure USART parity and data bits */  if (parity == UPARITY_EVEN) {    usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_EVEN);    if (bits == UBITS_7) {      usart_set_databits((uint32_t)p->reg_addr, 8);    } else { // 8 data bits by default      usart_set_databits((uint32_t)p->reg_addr, 9);    }  } else if (parity == UPARITY_ODD) {    usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_ODD);    if (bits == UBITS_7) {      usart_set_databits((uint32_t)p->reg_addr, 8);    } else { // 8 data bits by default      usart_set_databits((uint32_t)p->reg_addr, 9);    }  } else { // 8 data bist, NO_PARITY by default    usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_NONE);    usart_set_databits((uint32_t)p->reg_addr, 8); // is 7bits without parity possible ?  }  /* Configure USART stop bits */  if (stop == USTOP_2) {    usart_set_stopbits((uint32_t)p->reg_addr, USART_STOPBITS_2);  } else { // 1 stop bit by default    usart_set_stopbits((uint32_t)p->reg_addr, USART_STOPBITS_1);  }}
开发者ID:2seasuav,项目名称:paparuzzi,代码行数:28,


示例4: UART_Initialize

void UART_Initialize(){    /* Enable clocks for GPIO port containing _USART and USART */    rcc_peripheral_enable_clock(&_USART_RCC_APB_ENR_IOP,   _USART_RCC_APB_ENR_IOP_EN);    rcc_peripheral_enable_clock(&_USART_RCC_APB_ENR_USART, _USART_RCC_APB_ENR_USART_EN);    /* Enable DMA clock */    // TODO ENABLED ALREADY FOR ADC?    rcc_peripheral_enable_clock(&RCC_AHBENR, _RCC_AHBENR_DMAEN);    /* Setup GPIO pin GPIO_USARTX_TX on USART GPIO port for transmit. */    gpio_set_mode(_USART_GPIO, GPIO_MODE_OUTPUT_50_MHZ,                    GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, _USART_GPIO_USART_TX);    //gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT,                  //GPIO_USART1_RX);    /* Setup UART parameters. */    usart_set_baudrate(_USART, 115200);    usart_set_databits(_USART, 8);    usart_set_stopbits(_USART, USART_STOPBITS_1);    usart_set_mode(_USART, USART_MODE_TX);    usart_set_parity(_USART, USART_PARITY_NONE);    usart_set_flow_control(_USART, USART_FLOWCONTROL_NONE);    //usart_set_mode(USART1, USART_MODE_TX_RX);    /* Finally enable the USART. */    usart_enable(_USART);    nvic_set_priority(_USART_NVIC_DMA_CHANNEL_IRQ, 3);    nvic_enable_irq(_USART_NVIC_DMA_CHANNEL_IRQ);#if HAS_AUDIO_UART5    /* Enable clocks for GPIO port C (for GPIO_UART5_TX) and UART5. */    rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);    rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_UART5EN);    /* Setup GPIO pins to use UART5 */    gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,                    GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_UART5_TX);    /* Setup UART5 parameters. */    usart_set_baudrate(UART5, 9600);    usart_set_databits(UART5, 8);    usart_set_stopbits(UART5, USART_STOPBITS_1);    usart_set_parity(UART5, USART_PARITY_NONE);    usart_set_mode(UART5, USART_MODE_TX);    /* Finally enable the UART5. */    usart_enable(UART5);#endif}
开发者ID:F-D-R,项目名称:deviation,代码行数:51,


示例5: dbg_serial_init

void dbg_serial_init(void){    dbg_fifo_flush( &usart_rx_buf );    dbg_fifo_flush( &usart_tx_buf );    rcc_periph_clock_enable(RCC_AFIO);    rcc_periph_clock_enable(DBG_USART_PERIPH);    rcc_periph_clock_enable(DBG_USART_TX_PERIPH);#if (DBG_USART_RX_PERIPH != DBG_USART_TX_PERIPH)    rcc_periph_clock_enable(DBG_USART_RX_PERIPH);#endif    /* Enable the DBG_USART interrupt. */    nvic_enable_irq(DBG_USART_VECTOR);    /* Setup GPIO pins for USART transmit. */    gpio_set_mode(DBG_USART_TX_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, DBG_USART_TX_PIN);    /* Setup GPIO pins for USART receive. */    gpio_set_mode(DBG_USART_RX_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, DBG_USART_RX_PIN);    gpio_set(DBG_USART_RX_PORT, DBG_USART_RX_PIN);    /* Setup USART parameters. */    usart_set_baudrate    (DBG_USART, 57600);    usart_set_databits    (DBG_USART, 8);    usart_set_stopbits    (DBG_USART, USART_STOPBITS_1);    usart_set_mode        (DBG_USART, USART_MODE_TX_RX);    usart_set_parity      (DBG_USART, USART_PARITY_NONE);    usart_set_flow_control(DBG_USART, USART_FLOWCONTROL_NONE);    /* Enable USART Receive interrupt. */    usart_enable_rx_interrupt(DBG_USART);    /* Finally enable the USART. */    usart_enable(DBG_USART);}
开发者ID:nucleron,项目名称:yaplc,代码行数:34,


示例6: usart_init

void usart_init( int baudrate ){	gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX);	gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);#ifdef BUFFERED	buffer_reset (&u1rx);	buffer_reset (&u1tx);	nvic_enable_irq(NVIC_USART1_IRQ);	usart_enable_rx_interrupt(USART1);	usart_disable_tx_interrupt(USART1);#endif	// usart peripheral confguration	usart_set_baudrate(USART1, baudrate);	usart_set_databits(USART1, 8);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_mode(USART1, USART_MODE_TX_RX);	usart_set_stopbits(USART1, USART_STOPBITS_1);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_enable(USART1);}
开发者ID:alex-sever-h,项目名称:robot,代码行数:28,


示例7: comm_init

/** * Initializes the clocks, the UART peripheral, and the RX and TX buffer * structures. */static void comm_init(void){	os_char_buffer_init(&bsp_rx_buffer,	                    rx_buffer_mem,	                    BSP_RX_BUFFER_SIZE,	                    NULL);	os_char_buffer_init(&bsp_tx_buffer,	                    tx_buffer_mem,	                    BSP_TX_BUFFER_SIZE,	                    enable_usart1_tx_interrupt);	rcc_periph_clock_enable(RCC_GPIOA);	rcc_periph_clock_enable(RCC_USART1);	gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO9 | GPIO10);	gpio_set_af(GPIOA, GPIO_AF1, GPIO9 | GPIO10);	usart_set_baudrate(USART1, 115200);	usart_set_databits(USART1, 8);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_set_mode(USART1, USART_MODE_TX_RX);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_stopbits(USART1, USART_CR2_STOP_1_0BIT);	usart_enable_rx_interrupt(USART1);	usart_enable(USART1);	nvic_set_priority(NVIC_USART1_IRQ, 0);	nvic_enable_irq(NVIC_USART1_IRQ);}
开发者ID:mour,项目名称:ratfist-stm32,代码行数:37,


示例8: usart_setup

static void usart_setup(void){	/* Enable the USART1 interrupt. */	nvic_enable_irq(NVIC_USART1_IRQ);	/* Enable USART1 pin software remapping. */	AFIO_MAPR |= AFIO_MAPR_USART1_REMAP;	/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port B for transmit. */	gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,		      GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_RE_TX);	/* Setup GPIO pin GPIO_USART1_RE_RX on GPIO port B for receive. */	gpio_set_mode(GPIOB, GPIO_MODE_INPUT,		      GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RE_RX);	/* Setup UART parameters. */	usart_set_baudrate(USART1, 230400);	usart_set_databits(USART1, 8);	usart_set_stopbits(USART1, USART_STOPBITS_1);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_set_mode(USART1, USART_MODE_TX_RX);	/* Enable USART1 Receive interrupt. */	USART_CR1(USART1) |= USART_CR1_RXNEIE;	/* Finally enable the USART. */	usart_enable(USART1);}
开发者ID:balshetzer,项目名称:libopencm3-examples,代码行数:30,


示例9: bluetooth_init

void bluetooth_init(void){	rcc_periph_clock_enable(RCC_B_WAKE_SW_PORT);	rcc_periph_clock_enable(RCC_B_WAKE_HW_PORT);	rcc_periph_clock_enable(RCC_B_CMD_PORT);	gpio_mode_setup(B_WAKE_SW_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, B_WAKE_SW_PIN);	gpio_mode_setup(B_WAKE_HW_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, B_WAKE_HW_PIN);	gpio_mode_setup(B_CMD_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, B_CMD_PIN);	//uart	rcc_periph_clock_enable(RCC_B_USART);	gpio_mode_setup(B_USART_PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, B_USART_TX_PIN|B_USART_RX_PIN);	gpio_set_af(B_USART_PORT, GPIO_AF1, B_USART_TX_PIN|B_USART_RX_PIN);	usart_set_baudrate(B_USART, 115200);//9600 );	usart_set_databits(B_USART, 8);	usart_set_stopbits(B_USART, USART_CR2_STOP_1_0BIT);	usart_set_mode(B_USART, USART_MODE_TX_RX);	usart_set_parity(B_USART, USART_PARITY_NONE);	usart_set_flow_control(B_USART, USART_FLOWCONTROL_NONE);	usart_enable(B_USART);}
开发者ID:mattbrejza,项目名称:lora-tracker,代码行数:25,


示例10: usart_setup

static void usart_setup(void){	/* Enable the USART2 interrupt. */	nvic_enable_irq(NVIC_USART2_IRQ);	/* Setup GPIO pins for USART2 transmit. */	gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2);	/* Setup GPIO pins for USART2 receive. */	gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO3);	gpio_set_output_options(GPIOA, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, GPIO3);	/* Setup USART2 TX and RX pin as alternate function. */	gpio_set_af(GPIOA, GPIO_AF7, GPIO2);	gpio_set_af(GPIOA, GPIO_AF7, GPIO3);	/* Setup USART2 parameters. */	usart_set_baudrate(USART2, 38400);	usart_set_databits(USART2, 8);	usart_set_stopbits(USART2, USART_STOPBITS_1);	usart_set_mode(USART2, USART_MODE_TX_RX);	usart_set_parity(USART2, USART_PARITY_NONE);	usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);	/* Enable USART2 Receive interrupt. */	usart_enable_rx_interrupt(USART2);	/* Finally enable the USART. */	usart_enable(USART2);}
开发者ID:CNCBASHER,项目名称:libopencm3,代码行数:30,


示例11: usart_setup

void usart_setup(void){	/* Enable all required USART modules */	rcc_periph_clock_enable(USART_RCC_PORT);	rcc_periph_clock_enable(USART_RCC_ID);	/* Setup GPIO pins for USART transmit. */	gpio_mode_setup(USART_PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, USART_RX);	gpio_mode_setup(USART_PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, USART_TX);//	gpio_set_output_options(USART_PORT, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, USART_TX);	/* Setup USART TX pin as alternate function. */	gpio_set_af(USART_PORT, GPIO_AF7, USART_RX);	gpio_set_af(USART_PORT, GPIO_AF7, USART_TX);	/* Setup USART parameters. */	usart_set_baudrate(USART_ID, USART_BAUD_RATE);	usart_set_databits(USART_ID, 8);	usart_set_stopbits(USART_ID, USART_STOPBITS_1);	usart_set_mode(USART_ID, USART_MODE_TX_RX);	usart_set_parity(USART_ID, USART_PARITY_NONE);	usart_set_flow_control(USART_ID, USART_FLOWCONTROL_NONE);	/* Finally enable the USART. */	usart_enable(USART_ID);}
开发者ID:belnanosat,项目名称:i2cdevlib,代码行数:26,


示例12: setup

/* Set up all the peripherals */void setup(void){	rcc_clock_setup_in_hsi_out_48mhz();	rcc_peripheral_enable_clock(&RCC_APB2ENR, 			RCC_APB2ENR_IOPAEN |			RCC_APB2ENR_IOPBEN |			RCC_APB2ENR_AFIOEN | 			RCC_APB2ENR_USART1EN);	/* GPIO pin for the LED */	gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ,			GPIO_CNF_OUTPUT_PUSHPULL, GPIO2);	/* GPIO pin for USART TX */	gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,			GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO9);	/* Setup USART parameters. */	usart_set_baudrate(USART1, 19200);	usart_set_databits(USART1, 8);	usart_set_stopbits(USART1, USART_STOPBITS_1);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_set_mode(USART1, USART_MODE_TX);	/* Finally enable the USART. */	usart_enable(USART1);}
开发者ID:avian2,项目名称:vesna-hello-world,代码行数:30,


示例13: receive

/******************************************************************************Initialize the hardware to receive (USART based) CAN messages and start thetimer for the CANopen stack.INPUT	bitrate		bitrate in kilobit (fixed at 115200)OUTPUT	1 if successful	******************************************************************************/unsigned char canInit(unsigned int bitrate){	msg_recv_status = 0;	msg_received = 0;/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */	rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |				    RCC_APB2ENR_AFIOEN | RCC_APB2ENR_USART1EN);/* Enable the USART1 interrupt. */	nvic_enable_irq(NVIC_USART1_IRQ);/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port A for transmit. */	gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,		      GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);/* Setup GPIO pin GPIO_USART1_RE_RX on GPIO port A for receive. */	gpio_set_mode(GPIOA, GPIO_MODE_INPUT,		      GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX);/* Setup USART parameters. */	usart_set_baudrate(USART1, 115200);	usart_set_databits(USART1, 8);	usart_set_stopbits(USART1, USART_STOPBITS_1);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_set_mode(USART1, USART_MODE_TX_RX);/* Enable USART1 receive interrupts. */	usart_enable_rx_interrupt(USART1);	usart_disable_tx_interrupt(USART1);/* Finally enable the USART. */	usart_enable(USART1);/* Initialise the send and receive buffers */	buffer_init(send_buffer,BUFFER_SIZE);	buffer_init(receive_buffer,BUFFER_SIZE); 	return 1;}
开发者ID:JamesLinus,项目名称:ARM-Ports,代码行数:40,


示例14: usart_setup

void usart_setup(void){    /* Setup clock */    /* Enable GPIOA clock for USART. */    rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);        /* Enable clocks for USART2. */    rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);        /* Setup GPIO pins for USART2 transmit. */    gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2);        /* Setup USART2 TX pin as alternate function. */    gpio_set_af(GPIOA, GPIO_AF7, GPIO2);        /* Setup USART2 parameters. */    usart_set_baudrate(USART2, 115200);    usart_set_databits(USART2, 8);    usart_set_stopbits(USART2, USART_STOPBITS_1);    usart_set_mode(USART2, USART_MODE_TX);    usart_set_parity(USART2, USART_PARITY_NONE);    usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);        /* Finally enable the USART. */    usart_enable(USART2);}
开发者ID:Flauer82,项目名称:pcbwriter,代码行数:26,


示例15: usart_setup

void usart_setup(void) {  /* Enable clocks for GPIO port B (for GPIO_USART1_TX) and USART1. */  rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);  rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);  rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);  gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,                GPIO_CNF_OUTPUT_PUSHPULL, GPIO5);  gpio_clear(GPIOB, GPIO5);  AFIO_MAPR |= AFIO_MAPR_USART1_REMAP;  gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,                GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_RE_TX);  gpio_set_mode(GPIOB, GPIO_MODE_INPUT,                GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RE_RX);  /* Setup UART parameters. */  usart_set_baudrate(USART1, 115200);  usart_set_databits(USART1, 8);  usart_set_stopbits(USART1, USART_STOPBITS_1);  usart_set_mode(USART1, USART_MODE_TX_RX);  usart_set_parity(USART1, USART_PARITY_NONE);  usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);  /* Finally enable the USART. */  usart_enable(USART1);}
开发者ID:arpit15,项目名称:SubjuGator,代码行数:28,


示例16: 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,


示例17: mew_bluetooth_init

void mew_bluetooth_init(void) {    gpio_mode_setup(MEW_BLUETOOTH_POWER_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, MEW_BLUETOOTH_POWER_PIN);    gpio_set_output_options(MEW_BLUETOOTH_POWER_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_100MHZ, MEW_BLUETOOTH_POWER_PIN);    gpio_clear(MEW_BLUETOOTH_POWER_PORT, MEW_BLUETOOTH_POWER_PIN);        gpio_mode_setup(MEW_BLUETOOTH_RESET_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, MEW_BLUETOOTH_RESET_PIN);    gpio_set_output_options(MEW_BLUETOOTH_RESET_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_100MHZ, MEW_BLUETOOTH_RESET_PIN);    gpio_set(MEW_BLUETOOTH_RESET_PORT, MEW_BLUETOOTH_RESET_PIN);        gpio_mode_setup(MEW_BLUETOOTH_PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, MEW_BLUETOOTH_PIN);    gpio_set_af(MEW_BLUETOOTH_PORT, MEW_BLUETOOTH_PORT_AF, MEW_BLUETOOTH_PIN);        usart_disable(MEW_BLUETOOTH_USART);    usart_set_baudrate(MEW_BLUETOOTH_USART, MEW_BLUETOOTH_SPEED);    usart_set_databits(MEW_BLUETOOTH_USART, 8);    usart_set_stopbits(MEW_BLUETOOTH_USART, USART_STOPBITS_1);    usart_set_mode(MEW_BLUETOOTH_USART, USART_MODE_TX_RX);    usart_set_parity(MEW_BLUETOOTH_USART, USART_PARITY_NONE);    usart_set_flow_control(MEW_BLUETOOTH_USART, USART_FLOWCONTROL_NONE);    usart_enable_rx_interrupt(MEW_BLUETOOTH_USART);    usart_disable_tx_interrupt(MEW_BLUETOOTH_USART);    usart_enable_tx_dma(MEW_BLUETOOTH_USART);    usart_enable(MEW_BLUETOOTH_USART);        nvic_enable_irq(MEW_BLUETOOTH_IRQ);    nvic_enable_irq(MEW_BLUETOOTH_DMA_NVIC_TX);        memset(_mew_bt_buffer, 0, MEW_BT_RECEIVE_BUFFER_SIZE);}
开发者ID:konachan700,项目名称:Mew,代码行数:29,


示例18: usart_setup

void usart_setup(void){/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */    rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN |                    RCC_APB2ENR_AFIOEN | RCC_APB2ENR_USART1EN);/* Enable the USART1 interrupt. */    nvic_enable_irq(NVIC_USART1_IRQ);/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port A for transmit. */    gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,              GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);/* Setup GPIO pin GPIO_USART1_RE_RX on GPIO port A for receive. */    gpio_set_mode(GPIOA, GPIO_MODE_INPUT,              GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX);/* Setup UART parameters. */    usart_set_baudrate(USART1, 115200);    usart_set_databits(USART1, 8);    usart_set_stopbits(USART1, USART_STOPBITS_1);    usart_set_parity(USART1, USART_PARITY_NONE);    usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);    usart_set_mode(USART1, USART_MODE_TX_RX);/* Enable USART1 receive interrupts. */    usart_enable_rx_interrupt(USART1);    usart_disable_tx_interrupt(USART1);/* Finally enable the USART. */    usart_enable(USART1);}
开发者ID:JamesLinus,项目名称:ARM-Ports,代码行数:26,


示例19: usart_setup

static void usart_setup(void){	/* Initialize output ring buffer. */	ring_init(&output_ring, output_ring_buffer, BUFFER_SIZE);	/* Enable the USART2 interrupt. */	nvic_enable_irq(NVIC_USART2_IRQ);	/* Setup GPIO pin GPIO_USART2_TX on GPIO port A for transmit. */	gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,		      GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);	/* Setup GPIO pin GPIO_USART2_RX on GPIO port A for receive. */	gpio_set_mode(GPIOA, GPIO_MODE_INPUT,		      GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);	/* Setup UART parameters. */	usart_set_baudrate(USART2, 230400);	usart_set_databits(USART2, 8);	usart_set_stopbits(USART2, USART_STOPBITS_1);	usart_set_parity(USART2, USART_PARITY_NONE);	usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);	usart_set_mode(USART2, USART_MODE_TX_RX);	/* Enable USART2 Receive interrupt. */	USART_CR1(USART2) |= USART_CR1_RXNEIE;	/* Finally enable the USART. */	usart_enable(USART2);}
开发者ID:paulfertser,项目名称:libopencm3-examples,代码行数:30,


示例20: UART_setspeed

/** * Set UART speed * @param lc - UART parameters or NULL for value from cdcacm.c (started - B115200,8,N,1) */void UART_setspeed(uint32_t UART) {    usart_set_baudrate(UART, 9600);    usart_set_databits(UART, 8);    usart_set_stopbits(UART, USART_STOPBITS_1);    usart_set_parity(UART, USART_PARITY_NONE);    usart_set_flow_control(UART, USART_FLOWCONTROL_NONE);    usart_set_mode(UART, USART_MODE_TX_RX);}
开发者ID:alkyl1978,项目名称:stm32samples,代码行数:12,


示例21: usart_setup

/* Debug output over USART1. */void usart_setup(void) {	usart_set_baudrate(USART1, 460800);	usart_set_databits(USART1, 8);	usart_set_stopbits(USART1, USART_STOPBITS_1);	usart_set_mode(USART1, USART_MODE_TX_RX);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	usart_enable(USART1);}
开发者ID:iqyx,项目名称:kiwi-basic,代码行数:10,


示例22: uart_setup

/* Configure USART2 as a 38400, 8N1 serial port that has an interrupt * driven receive function (transmit is blocking) */void uart_setup(int baud){    /* Setup GPIO pins for USART2 transmit. */    gpio_mode_setup(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO6);    gpio_mode_setup(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO7);    gpio_set_output_options(GPIOC, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, GPIO7);    gpio_set_af(GPIOC, GPIO_AF8, GPIO6);    gpio_set_af(GPIOC, GPIO_AF8, GPIO7);    /* Setup USART6 parameters. */    usart_set_baudrate(USART6, baud);    usart_set_databits(USART6, 8);    usart_set_stopbits(USART6, USART_STOPBITS_1);    usart_set_mode(USART6, USART_MODE_TX_RX);    usart_set_parity(USART6, USART_PARITY_NONE);    usart_set_flow_control(USART6, USART_FLOWCONTROL_NONE);    /* Allow for receive interrupts */    buf_ndx = 0;    read_ndx = 0;    nvic_enable_irq(NVIC_USART6_IRQ);    /* Finally enable the USART. */    usart_enable(USART6);    usart_enable_rx_interrupt(USART6);    /* Setup USART2 parameters. */    usart_set_baudrate(USART2, 38400);    usart_set_databits(USART2, 8);    usart_set_stopbits(USART2, USART_STOPBITS_1);    usart_set_mode(USART2, USART_MODE_TX_RX);    usart_set_parity(USART2, USART_PARITY_NONE);    usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);    /* Allow for receive interrupts */    buf_ndx = 0;    read_ndx = 0;    nvic_enable_irq(NVIC_USART2_IRQ);    /* Finally enable the USART. */    usart_enable(USART2);    usart_enable_rx_interrupt(USART2);}
开发者ID:ChuckM,项目名称:bb-lcd,代码行数:47,


示例23: serial_initialize

void serial_initialize(u32 baud){	usart_set_baudrate(USART, baud);	usart_set_databits(USART, 8);	usart_set_stopbits(USART, USART_STOPBITS_1);	usart_set_parity(USART, USART_PARITY_NONE);	usart_set_flow_control(USART, USART_FLOWCONTROL_NONE);	usart_enable(USART);	usart_enable_rx_interrupt(USART);	//usart_enable_tx_interrupt(USART);}
开发者ID:hymanc,项目名称:lram-casting,代码行数:11,


示例24: usart_console_setup

void usart_console_setup(void){	usart_set_baudrate(USART_CONSOLE, 115200);	usart_set_databits(USART_CONSOLE, 8);	usart_set_stopbits(USART_CONSOLE, USART_STOPBITS_1);	usart_set_mode(USART_CONSOLE, USART_MODE_TX);	usart_set_parity(USART_CONSOLE, USART_PARITY_NONE);	usart_set_flow_control(USART_CONSOLE, USART_FLOWCONTROL_NONE);	usart_enable(USART_CONSOLE);}
开发者ID:karlp,项目名称:karlnet,代码行数:11,


示例25: usart_setup

void usart_setup(int baud){    usart_set_baudrate(USART2, baud);    usart_set_databits(USART2, 8);    usart_set_stopbits(USART2, USART_CR2_STOP_1_0BIT);    usart_set_mode(USART2, USART_MODE_TX_RX);    usart_set_parity(USART2, USART_PARITY_NONE);    usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);    usart_enable(USART2);}
开发者ID:joostrijneveld,项目名称:STM32-getting-started,代码行数:11,


示例26: usart_init

/** * Initalize the Output (TX) mode only (log) */static void usart_init(void){	usart_set_baudrate(USART6, 921600);	usart_set_databits(USART6, 8);	usart_set_flow_control(USART6, USART_FLOWCONTROL_NONE);	usart_set_mode(USART6, USART_MODE_TX);	usart_set_parity(USART6, USART_PARITY_NONE);	usart_set_stopbits(USART6, USART_STOPBITS_1);	usart_enable(USART6);}
开发者ID:insane-adding-machines,项目名称:unicore-mx-examples,代码行数:14,


示例27: usart_init

void usart_init(uint32_t arg_usart, uint32_t baudrate){	usart_set_baudrate(arg_usart, baudrate);	usart_set_databits(arg_usart, 8);	usart_set_flow_control(arg_usart, USART_FLOWCONTROL_NONE);	usart_set_mode(arg_usart, USART_MODE_TX | USART_MODE_RX);	usart_set_parity(arg_usart, USART_PARITY_NONE);	usart_set_stopbits(arg_usart, USART_STOPBITS_1);	usart_enable_rx_interrupt(arg_usart);	usart_enable(arg_usart);	usart = arg_usart;}
开发者ID:libusbhost,项目名称:libusbhost,代码行数:13,


示例28: usart_setup

static void usart_setup(void){	/* Setup USART2 parameters. */	usart_set_baudrate(USART2, 115200);	usart_set_databits(USART2, 8);	usart_set_stopbits(USART2, USART_STOPBITS_1);	usart_set_mode(USART2, USART_MODE_TX_RX);	usart_set_parity(USART2, USART_PARITY_NONE);	usart_set_flow_control(USART2, USART_FLOWCONTROL_NONE);	/* Finally enable the USART. */	usart_enable(USART2);}
开发者ID:insane-adding-machines,项目名称:unicore-mx-examples,代码行数:13,


示例29: usart_setup

static void usart_setup(void){	/* Setup USART2 parameters. */	usart_set_baudrate(USART1, 38400);	usart_set_databits(USART1, 8);	usart_set_parity(USART1, USART_PARITY_NONE);	usart_set_stopbits(USART1, USART_CR2_STOP_1_0BIT);	usart_set_mode(USART1, USART_MODE_TX);	usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);	/* Finally enable the USART. */	usart_enable(USART1);}
开发者ID:BuFran,项目名称:libopencm3-examples,代码行数:13,


示例30: usart_peripheral_setup

void usart_peripheral_setup(void) {    gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);    gpio_set_af(GPIOA, GPIO_AF7, GPIO9);    usart_set_baudrate(USART1, 38400);    usart_set_databits(USART1, 8);    usart_set_stopbits(USART1, USART_STOPBITS_1);    usart_set_mode(USART1, USART_MODE_TX);    usart_set_parity(USART1, USART_PARITY_NONE);    usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);    usart_enable(USART1);}
开发者ID:adamgreig,项目名称:wombat,代码行数:13,



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


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