I may have spoken out of turn but the 'provides' block in the T1 file is:
module NoCRCPacket {
provides {
interface StdControl as Control;
interface BareSendMsg as Send;
interface ReceiveMsg as Receive;
interface SendVarLenPacket;
command result_t txBytes(uint8_t *bytes, uint8_t numBytes);
/* Effects: start sending 'numBytes' bytes from 'bytes'
*/
}
uses {
interface ByteComm;
interface StdControl as ByteControl;
interface Leds;
}
}
Which seems to indicate that you could "call txBytes(...)" from your code,
but I'm resistant to becoming familiar with that special syntax.
If that doesn't work, then close study of the nesc doc is indicated.
MS
Mark Tsang wrote:
But NoCRCPacket doesn't have an interface. It looks to be a standalone
module. Or am I missing something?
-----Original Message-----
From: Michael Schippling [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2008 5:43 PM
To: Mark Tsang
Cc: tinyos-help@millennium.berkeley.edu
Subject: Re: [Tinyos-help] Utilizing a command from another module,
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