⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart_test_raw.c

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 C
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)/**************************************************************************//* This shows an example of using the UART in raw-mode, rather than the   *//*   packetized protocol which the com layer uses. If you need to         *//*   communicate with something that isn't running MOS, this is probably  *//*   what you want to look at. If you want to use this, note that you     *//*   uncomment the appropriate NEED_RAW_MODE define in uart.h             *//**************************************************************************/#include "mos.h"#include "msched.h"  // MANTIS scheduler (gives us start)#include "led.h"#include "com.h"#include "clock.h"#include "uart.h"uint8_t buffer[] = "hello world!\n";uint8_t read_buf;comBuf send_buf;void uart_test(void){   memcpy(send_buf->data, "adamo!", sizeof("adamo!"));   send_buf->size = sizeof("adamo!");   com_ioctl(IFACE_SERIAL, UART_IOCTL_RAW_MODE0);      uart_write(0, buffer, sizeof(buffer));      while(1) {      uart_read(0, &read_buf, sizeof(read_buf));      uart_write(0, &read_buf, sizeof(read_buf));   }}void start(void){   mos_thread_new(uart_test, 128, PRIORITY_NORMAL);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -