I am trying to understand how nesC's modules, configurations, interfaces, and components work. To do this I have tried to implement a very simple application; when its done booting up, it should turn on its three LED's to show its ID. But I get the error:
/home/tinyos/WSN-Project/src/CoolLed/CoolLedM.nc: In function `CL.setCoolLed':
/home/tinyos/WSN-Project/src/CoolLed/CoolLedM.nc:12: Leds.led0On not connected
/home/tinyos/WSN-Project/src/CoolLed/CoolLedM.nc:14: Leds.led0Off not connected
I have used the Blink
and BlinkToRadio
examples as guides, but have not seen each individual led connected.
So what does this error message mean?
And how do i fix this problem?
Here is my program with the comment showing in which file it is placed.
// AppC.nc
configuration AppC{}
implementation{
components AppM;
components MainC;
AppM.Boot -> MainC;
components CoolLedM;
AppM.CL -> CoolLedM;
}
// AppM.nc
module AppM{
uses interface Boot;
uses interface CoolLedI as CL;
}
implementation{
event void Boot.booted(){
call CL.setCoolLed((uint8_t)TOS_NODE_ID);
}
}
// CoolLedI.nc
interface CoolLedI{
command void setCoolLed(uint8_t mask);
}
// CoolLedC.nc
configuration CoolLedC{}
implementation
{
components CoolLedM;
components LedsC;
CoolLedM.Leds -> LedsC;
}
// CoolLedM.nc
module CoolLedM{
provides interface CoolLedI as CL;
uses interface Leds;
}
implementation{
command void CL.setCoolLed(uint8_t mask){
if(mask & 0x01)
call Leds.led0On();
else
call Leds.led0Off();
...
}
}