You should use CC2420Control.setRFPower() and pass RESOURCE_NONE as
the resource handler. Do not use the HPL commands.
The resources are described in the API documentation in
/opt/moteiv/doc/nesdoc and in TEP 108:
http://www.tinyos.net/teps/doc/html/tep108.html
-Joe
On 6/7/06, Ole Bischoff <[EMAIL PROTECTED]> wrote:
Hi,
I'm using Boomerang and TelosB and want to read/write some
registers of the CC2420. I know that I can use the functions of
the CC2420Control-interface, but I really would like to know how
the resource handler works. So I wrote a little module that increases
the RF-power of the radio and displays the value on the LEDs.
My program should work like a simple 3-bit counter (Blink example),
but when I start it on my tmote the default RF-power value (0x1F)
is displayed on the LEDs. When I change line37 of RegCC2420M.nc
to "call Radio.SetRFPower(rh, m_value) " the whole thing works fine.
Perhaps someone can help me with this problem a.k.a. resource handler.
Best regards,
Ole Bischoff
RegCC2420.nc
01 configuration RegCC2420 {
02 }
03 implementation {
04 components Main
05 , RegCC2420M
06 , TimerC
07 , LedsC
08 , CC2420RadioC
09 , HPLCC2420C;
10
11 components new CC2420ResourceC() as RadioResource;
12
13 Main.StdControl -> TimerC;
14 Main.StdControl -> RegCC2420M;
15
16 RegCC2420M.TimerRFPower -> TimerC.Timer[unique("Timer")];
17
18 RegCC2420M.Resource -> RadioResource.ResourceCmdAsync;
19
20 RegCC2420M.HPLRadio -> HPLCC2420C.HPLCC2420;
21 RegCC2420M.Radio -> CC2420RadioC.CC2420Control;
22
23 RegCC2420M.Leds -> LedsC;
24 }
RegCC2420M.nc
01 module RegCC2420M {
02 provides {
03 interface StdControl;
04 }
05 uses {
06 interface Leds;
07 interface Timer as TimerRFPower;
08 interface CC2420Control as Radio;
09 interface HPLCC2420 as HPLRadio;
10 interface ResourceCmdAsync as Resource;
11 }
12 }
13 implementation {
14
15 /************************* VARIABLES
*******************************/
16 uint8_t m_value = 3;
17
18 /************************* STD CONTROL *****************************/
19 command result_t StdControl.init() { return SUCCESS; }
20
21 command result_t StdControl.start() {
22 call TimerRFPower.start( TIMER_REPEAT, 1000 );
23 return SUCCESS;
24 }
25
26 command result_t StdControl.stop() {
27 return SUCCESS;
28 }
29
30 /************************* TIMER
***********************************/
31 event result_t TimerRFPower.fired() {
32 call Resource.request(RESOURCE_NONE);
33 return SUCCESS;
34 }
35
36 async event void Resource.granted(uint8_t rh) {
37 call HPLRadio.write(rh, CC2420_TXCTRL, m_value);
38
39 call Leds.set(call Radio.GetRFPower()/4);
40
41 if (m_value == 31) {
42 call TimerRFPower.stop();
43 call Leds.set(0);
44 }
45
46 m_value += 4;
47
48 call Resource.release();
49 }
50 }
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help