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

📄 terminal.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)/**************************************************************************//* File:    terminal_driver.c                                             *//* Author     Charles Gruenwald III : gruenwal@cs.colorado.edu            *//*   Date: 03/12/04                                                       *//*                                                                        *//* test app for the terminal driver                                       *//**************************************************************************/#include "msched.h"  // MANTIS scheduler (gives us start)#include "com.h"#include "mos.h"comBuf *packet;uint8_t str_to_packet(comBuf * packet, char * string);void test_recv(void){  comBuf to_send;  str_to_packet(&to_send,"hi mom\n");  com_send(IFACE_TERMINAL, &to_send);  str_to_packet(&to_send,"type something to test (it should echo)\n");  com_send(IFACE_TERMINAL, &to_send);  packet = com_recv(IFACE_TERMINAL);  if(packet != NULL)    {      com_send(IFACE_TERMINAL,packet);      com_free_buf(packet);    }}uint8_t str_to_packet(comBuf * packet,char * string){  char * cursor=string;  if(strlen(string) > 64)    return -1;  //reset size  packet->size=0;  while(*cursor)    packet->data[packet->size++]=*cursor++;  packet->data[packet->size]='\0';    }void start(void){  mos_thread_new(test_recv,128,PRIORITY_NORMAL);}

⌨️ 快捷键说明

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