look for documentation on NESC. Basically anything in the interface
for a module can be "call"ed from another module.
MS

Mark Tsang wrote:
I was wondering how I would go about calling a command from another module to utilize in my own module. For instance, I want to use the command “txBytes” in NoCRCPacket in my own program MyApp. What do I have to add in my program to do so. I’ve read in other threads that I need to wire NoCRCPacket to UART and I have done so, but I’m still receiving the following error message during compilation: NOTE: I’m calling txBytes in my Timer.fired command below in the module

In component `NoCRCPacket':

/opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc: In function `receiveTask':

/opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc:306: Receive.receive not connected

The error message isn’t pointing to my program, instead the platform file. What am I doing wrong. Thanks in advance!

configuration MyApp {

  provides {

                command result_t txBytes(uint8_t *bytes, uint8_t numBytes);

  }

}

implementation {

  components Main, MyAppM, TimerC, LedsC, NoCRCPacket as NoPacket, UART;

  Main.StdControl -> TimerC.StdControl;

  Main.StdControl -> MyAppM.StdControl;

  Main.StdControl -> NoPacket.Control;

  MyAppM.Timer -> TimerC.Timer[unique("Timer")];

  MyAppM.Leds -> LedsC.Leds;

  txBytes = NoPacket.txBytes;

  NoPacket.ByteControl -> UART;

  NoPacket.ByteComm -> UART;

}

module MyAppM {

  provides {

    interface StdControl;

  }

  uses {

    interface Timer;

    interface Leds;

                interface StdControl as PhotoControl;

                interface SendUART;

                command result_t txBytes(uint8_t *bytes, uint8_t numBytes);

  }

}

implementation {

  /**

* Toggle the red LED in response to the <code>Timer.fired</code> event.
   * Start the Light sensor control and sample the data

   *

   * @return Always returns <code>SUCCESS</code>

   **/

  event result_t Timer.fired()

  {

call Leds.redToggle();
                // send message to UART (serial) port

if (call txBytes((uint8_t *)0x41,(uint8_t *)0x01) != SUCCESS)

                  sending_packet = FALSE;

    return SUCCESS;

  }

  command result_t StdControl.init() {

    call Leds.init();

    }

  command result_t StdControl.start() {

    // Start a repeating timer that fires every 1000ms

    return call Timer.start(TIMER_REPEAT, 1000);

  }

  /**

   * Halt execution of the application.

   * This just disables the clock component.

   *

   * @return Always returns <code>SUCCESS</code>

   **/

  command result_t StdControl.stop() {

    return call Timer.stop();

  }


------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to