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

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

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

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

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

示例1: lpc_uart_io_handler

static intlpc_uart_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,		    uint32_t *eax, void *arg){	int offset;	struct lpc_uart_softc *sc = arg;	offset = port - sc->iobase;	switch (bytes) {	case 1:		if (in)			*eax = uart_read(sc->uart_softc, offset);		else			uart_write(sc->uart_softc, offset, *eax);		break;	case 2:		if (in) {			*eax = uart_read(sc->uart_softc, offset);			*eax |= uart_read(sc->uart_softc, offset + 1) << 8;		} else {			uart_write(sc->uart_softc, offset, *eax);			uart_write(sc->uart_softc, offset + 1, *eax >> 8);		}		break;	default:		return (-1);	}	return (0);}
开发者ID:2asoft,项目名称:freebsd,代码行数:31,


示例2: _send

static int _send(netdev2_t *netdev, const struct iovec *vector, int count){    ethos_t * dev = (ethos_t *) netdev;    (void)dev;    /* count total packet length */    size_t pktlen = iovec_count_total(vector, count);    /* lock line in order to prevent multiple writes */    mutex_lock(&dev->out_mutex);    /* send start-frame-delimiter */    uint8_t frame_delim = ETHOS_FRAME_DELIMITER;    uart_write(dev->uart, &frame_delim, 1);    /* send iovec */    while(count--) {        size_t n = vector->iov_len;        uint8_t *ptr = vector->iov_base;        while(n--) {            _write_escaped(dev->uart, *ptr++);        }        vector++;    }    uart_write(dev->uart, &frame_delim, 1);    mutex_unlock(&dev->out_mutex);    return pktlen;}
开发者ID:amagnasco,项目名称:RIOT,代码行数:31,


示例3: ethos_send_frame

void ethos_send_frame(ethos_t *dev, const uint8_t *data, size_t len, unsigned frame_type){    uint8_t frame_delim = ETHOS_FRAME_DELIMITER;    if (!irq_is_in()) {        mutex_lock(&dev->out_mutex);    }    else {        /* Send frame delimiter. This cancels the current frame,         * but enables in-ISR writes.  */        uart_write(dev->uart, &frame_delim, 1);    }    /* send frame delimiter */    uart_write(dev->uart, &frame_delim, 1);    /* set frame type */    if (frame_type) {        uint8_t out[2] = { ETHOS_ESC_CHAR, (frame_type ^ 0x20) };        uart_write(dev->uart, out, 2);    }    /* send frame content */    while(len--) {        _write_escaped(dev->uart, *(uint8_t*)data++);    }    /* end of frame */    uart_write(dev->uart, &frame_delim, 1);    if (!irq_is_in()) {        mutex_unlock(&dev->out_mutex);    }}
开发者ID:MichelRottleuthner,项目名称:RIOT,代码行数:34,


示例4: _send

static int _send(netdev_t *netdev, const iolist_t *iolist){    ethos_t * dev = (ethos_t *) netdev;    (void)dev;    /* count total packet length */    size_t pktlen = iolist_count_total(iolist);    /* lock line in order to prevent multiple writes */    mutex_lock(&dev->out_mutex);    /* send start-frame-delimiter */    uint8_t frame_delim = ETHOS_FRAME_DELIMITER;    uart_write(dev->uart, &frame_delim, 1);    /* send iolist */    for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {        size_t n = iol->iol_len;        uint8_t *ptr = iol->iol_base;        while(n--) {            _write_escaped(dev->uart, *ptr++);        }    }    uart_write(dev->uart, &frame_delim, 1);    mutex_unlock(&dev->out_mutex);    return pktlen;}
开发者ID:MichelRottleuthner,项目名称:RIOT,代码行数:30,


示例5: packet_sanity_check

uint8_t*packet_process(){	uint8_t ret;	uint8_t message[MESSAGE_SIZE];	/* simple surface check of incoming data */	ret = packet_sanity_check(packet_in, NETWORK_PACKET_SIZE);	if (ret != OK)	{		make_response(NACK, packet_out);		uart_write("Packet failed sanity test/n");		return packet_out;	}	/* verify hmac and decrypt data */	ret = verify_and_decrypt_client_message(packet_in, message);	if (ret == HMAC_FAILURE)	{		make_response(HMAC_FAILURE, packet_out);		uart_write("Packet has invalid hmac/n");		return packet_out;	}	else if (ret == DEC_FAILURE)	{		make_response(DEC_FAILURE, packet_out);		uart_write("Packet encryption failed/n");		return packet_out;	}	/* parse received, decrypted command */	ret = parse_command(message);	make_response(ret, packet_out);	return packet_out;}
开发者ID:davidnieder,项目名称:remote-sockets,代码行数:32,


示例6: shackbus_init

void shackbus_init(void){    // Initialize MCP2515    can_init(BITRATE_125_KBPS);#ifdef UART_DEBUG    uart_write("can_init(BITRATE_125_KBPS);");#endif	    // Load filters and masks    can_static_filter(can_filter);#ifdef UART_DEBUG    uart_write("can_static_filter(can_filter);");#endif	fifo_init (&can_outfifo,   can_outbuf, 10);	framestorage_init();	// Create a test messsage	send_msg_blink_ret.id = ((3L<<26)+(4L<<22)+(6L<<14)+(5L<<6)+11L);  //Absender = 2   Empf
C++ uart_writeb函数代码示例
C++ uart_update_timeout函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。