[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/FloatSize FloatMsg.h, NONE, 1.1 FloatMsgSender.nc, NONE, 1.1 FloatMsgSenderM.nc, NONE, 1.1 Makefile, NONE, 1.1 platforms.properties, NONE, 1.1

Chien-Liang Fok chien-liang at users.sourceforge.net
Thu Apr 5 00:58:07 PDT 2007


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/FloatSize
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8118

Added Files:
	FloatMsg.h FloatMsgSender.nc FloatMsgSenderM.nc Makefile 
	platforms.properties 
Log Message:
initial commit

--- NEW FILE: FloatMsg.h ---
// $Id: FloatMsg.h,v 1.1 2007/04/05 07:58:05 chien-liang Exp $

/**
 * @author Chien-Liang Fok
 */

struct FloatMsg
{
    float f;
};

enum {
  AM_FLOATMSG = 10,
};

--- NEW FILE: FloatMsgSender.nc ---
// $Id: FloatMsgSender.nc,v 1.1 2007/04/05 07:58:05 chien-liang Exp $

includes FloatMsg;

configuration FloatMsgSender { }
implementation
{
  components Main, FloatMsgSenderM
           , TimerC
           , LedsC
           , GenericComm as Comm;

  Main.StdControl -> FloatMsgSenderM;
  Main.StdControl -> TimerC;
  
  FloatMsgSenderM.Timer -> TimerC.Timer[unique("Timer")];
  FloatMsgSenderM.Leds -> LedsC;
  FloatMsgSenderM.CommControl -> Comm;
  FloatMsgSenderM.DataMsg -> Comm.SendMsg[AM_FLOATMSG];
}

--- NEW FILE: FloatMsgSenderM.nc ---
// $Id: FloatMsgSenderM.nc,v 1.1 2007/04/05 07:58:05 chien-liang Exp $

/**
 * @author Chien-Liang Fok
 */

includes FloatMsg;


module FloatMsgSenderM
{
  provides interface StdControl;
  uses {
    interface Timer;
    interface Leds;
    interface StdControl as CommControl;
    interface SendMsg as DataMsg;
  }
}
implementation
{
  TOS_Msg msg;
  float x;

  /**
   * Used to initialize this component.
   */
  command result_t StdControl.init() {
    call Leds.init();
    call Leds.yellowOff(); call Leds.redOff(); call Leds.greenOff();
    call CommControl.init();
    return SUCCESS;
  }

  /**
   * Starts the CommControl components and a timer that fires 1 per second..
   * @return Always returns SUCCESS.
   */
  command result_t StdControl.start() {
    x = 0;
    call Timer.start(TIMER_REPEAT, 1024);
    call CommControl.start();
    return SUCCESS;
  }

  /**
   * Stops the SensorControl and CommControl components.
   * @return Always returns SUCCESS.
   */
  command result_t StdControl.stop() {
    call Timer.stop();
    call CommControl.stop();
    return SUCCESS;
  }

  task void dataTask() {
    struct FloatMsg *fm;
    atomic {
      fm = (struct FloatMsg *)msg.data;
      fm->f = x;
    }
    x += 0.25;
    
    /* Try to send the packet. Note that this will return
     * failure immediately if the packet could not be queued for
     * transmission.
     */
    if (call DataMsg.send(TOS_UART_ADDR, sizeof(struct FloatMsg), &msg))
      {
        call Leds.greenToggle();
      } else call Leds.redToggle();
  }
  
 

  /**
   * Signalled when the clock ticks.
   * @return The result of calling ADC.getData().
   */
  event result_t Timer.fired() {
    return post dataTask();
  }
  
  /**
   * Signalled when the previous packet has been sent.
   * @return Always returns SUCCESS.
   */
  event result_t DataMsg.sendDone(TOS_MsgPtr sent, result_t success) {
    return SUCCESS;
  }
}

--- NEW FILE: Makefile ---
COMPONENT=FloatMsgSender
include $(TOSROOT)/tools/make/Makerules
--- NEW FILE: platforms.properties ---
##Initial properties for the known platforms
#This property file is used to associate the platforms specified in the comm
#ID string (e.g. serial at COM1:mica) with various plaftorm-specific parameters
#The entry format is as follows: 
#	<platform>=<platform package>, <integer ID>, <baudrate>
#	where
#<platform> -- that's the platform we compile for (i.e. valid nesc target
#<platform package> -- name of the common package family that uses the same AM format (e.g. avrmote)
#<integer ID> -- unique integer that is used by serial forwarder to identify the platform across the network
#<baudrate> -- default serial port datarate used to communicate with the mote

#Thu Nov 04 18:44:39 PST 2004
telos=telos,1,57600
tmote=tmote,1,57600
mica=avrmote,2,19200
eyes=eyes,4,19200
micaz=micaz,3,57600
mica2=avrmote,2,57600
mica2dot=avrmote,2,19200




More information about the Tinyos-contrib-commits mailing list