receiver.c

来自「MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis」· C语言 代码 · 共 59 行

C
59
字号
/*  This file is part of MANTIS OS, Operating System for Nymph.  See http://mantis.cs.colorado.edu/  Copyright (C) 2003 University of Colorado, Boulder  This program is free software; you can redistribute it and/or  modify it under the terms of the GNU General Public License  as published by the Free Software Foundation; either version 2  of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  (See http://www.gnu.org/copyleft/gpl.html)  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,  USA, or send email to mantis-users@cs.colorado.edu.*//** * File:     receiver.c       * Author:   Charles Gruenwald III * Date:     03-24-2004 * * Description: receiver will sit in a tight while loop looking for * values received over the radio. Any value it receives it will then * show on the leds and send over the serial line using the uart. It is * to be used with compatable hardware (nymph/mica2). *  */#include <inttypes.h>#include "led.h"#include "com.h"        //give us the communication layer#include "printf.h"#include "msched.h"void receiver();void start(void){   comBuf *recv_pkt;                     //give us a packet pointer   com_mode(IFACE_RADIO, IF_LISTEN);      while(1)   {      recv_pkt = com_recv(IFACE_RADIO); //blocking recv a packet      com_send(IFACE_SERIAL, recv_pkt); //send the packet over serial      com_free_buf(recv_pkt);           //free the recv'd packet to the pool      mos_led_toggle(0);   }}

⌨️ 快捷键说明

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