Dear Janos,
Thank you for the answer, the information about wiring directly to
HplAtm128GeneralIOC helped a lot. So I moved forward, but I am still
lost.
Now I have:
HplUserButtonC.nc
******************************************
configuration HplUserButtonC {
provides interface GeneralIO as GeneralIOUB1;
provides interface GpioInterrupt as GpioInterruptUB1;
}
implementation {
components HplAtm128GeneralIOC as GeneralIOC;
components HplAtm128InterruptC as InterruptC;
GeneralIOUB1 = GeneralIOC.PortD0;
components new Atm128GpioInterruptC() as InterruptUserButton1C;
InterruptUserButton1C.Atm128Interrupt -> InterruptC.Int0;
GpioInterruptUB1 = InterruptUserButton1C.Interrupt;
}
******************************************
UserButtonC.nc
******************************************
#include <UserButton.h>
configuration UserButtonC {
provides interface Get<button_state_t>;
provides interface Notify<button_state_t>;
}
implementation {
components HplUserButtonC;
components new SwitchToggleC();
SwitchToggleC.GeneralIOUB1 -> HplUserButtonC.GeneralIOUB1; // line 55
SwitchToggleC.GpioInterruptUB1 -> HplUserButtonC.GpioInterruptUB1; //
line 56
components UserButtonP;
Get = UserButtonP;
Notify = UserButtonP;
UserButtonP.GetLower -> SwitchToggleC.Get;
UserButtonP.NotifyLower -> SwitchToggleC.Notify;
}
******************************************
when I am compiling I also get:
In component `UserButtonC':
tos/platforms/plxincirc/UserButtonC.nc: At top level:
tos/platforms/plxincirc/UserButtonC.nc:54: no match
tos/platforms/plxincirc/UserButtonC.nc:55: no match
Can you (or somebody else) explain me what is wrong here? How can I use
the interface in UserButtonC.nc what HplUserButtonC.nc provides?
Of course I tried to understand the documentation, check other codes,
but I need more practice in order the NesC system to become clear.
regards,
Zsolt
On Mon, 2010-09-27 at 21:49 -0500, Janos Sallai wrote:
> Zsolt:
>
> If the user button is connected to any of the int0, int1, int2, or
> int3 pins (i.e. Port D0 to Port D3), you can wire against
> HplAtm128Interrupt. Note that HplAtm128Interrupt provides
> HplAtm128Interrupt interfaces. You will want to use
> Atm128GpioInterruptC to convert to the GpioInterrupt interface.
>
> You don't want to use Msp430GpioC, because that's for a completely
> different MCU.
>
> From the error message you quote, I notice that you have a couple of
> syntax errors in the top-level code. Also, your HplUserButtonC.nc
> looks good, but you'll need to double check the component names (i.e.
> there's no such thing as Atm128GpioC). The GeneralIO interface is
> provided by HplAtm128GeneralIOC , you can wire that directly to the
> GeneralIO interface HplUserButtonC provides.
>
> Janos
>
>
> On Mon, Sep 27, 2010 at 2:36 PM, Zsolt Varady <[email protected]> wrote:
> > Dear List,
> >
> > I have a node with Atmel1281 MCU, I already have some working tinyOS
> > apps on it. Now I would like to implement a button, so I used
> > apps/tests/telosb/TestUserButton as a base.
> >
> > I copied the related files from app dir and from the telosb platform
> > directory as well (UserButtonP.nc, UserButton.h, UserButtonC.nc,
> > SwitchToggleC.nc, HplUserButtonC.nc), and even the Msp430GpioC.nc file
> > from chips/Msp430/pins, as it "kind of missing" in the Atmel dir.
> >
> > I tried to modify all of them to pass the Atmel MCU, but I guess I am
> > still missing something as I get the following error:
> >
> > In file included from ButtonsAppC.nc:15:
> > In component `ButtonsC':
> > ButtonsC.nc:48: syntax error before `button_state_t'
> > In file included from ButtonsAppC.nc:15:
> > ButtonsC.nc:49: syntax error before `button_state_t'
> > ButtonsC.nc:101: syntax error before `state'
> > ButtonsC.nc:101: unknown interface `Notify'
> > ButtonsC.nc: In function `Notify.notify':
> > ButtonsC.nc:102: `state' undeclared (first use in this function)
> > ButtonsC.nc:102: (Each undeclared identifier is reported only once
> > ButtonsC.nc:102: for each function it appears in.)
> > ButtonsC.nc:102: `BUTTON_PRESSED' undeclared (first use in this
> > function)
> > ButtonsC.nc:104: `BUTTON_RELEASED' undeclared (first use in this
> > function)
> > ButtonsC.nc: In function `Timer.fired':
> > ButtonsC.nc:110: `button_state_t' undeclared (first use in this
> > function)
> > ButtonsC.nc:110: syntax error before `bs'
> > ButtonsC.nc:112: `bs' undeclared (first use in this function)
> > ButtonsC.nc:112: `Get' undeclared (first use in this function)
> > ButtonsC.nc:113: `BUTTON_PRESSED' undeclared (first use in this
> > function)
> > ButtonsC.nc:115: `BUTTON_RELEASED' undeclared (first use in this
> > function)
> > In component `HplUserButtonC':
> > tos/platforms/plxincirc/HplUserButtonC.nc: At top level:
> > tos/platforms/plxincirc/HplUserButtonC.nc:48: no match
> > In component `ButtonsAppC':
> > ButtonsAppC.nc:41: cannot find `Get'
> > ButtonsAppC.nc:42: cannot find `Notify'
> > make: *** [exe0] Error 1
> >
> >
> > I am quite new to tinyOS, so I am just guessing, that the problem is in
> > the Hpl file:
> >
> > ********************************
> > configuration HplUserButtonC {
> > provides interface GeneralIO;
> > provides interface GpioInterrupt;
> > }
> > implementation {
> > components HplAtm128GeneralIOC as GeneralIOC;
> > components HplAtm128InterruptC as InterruptC;
> >
> > components new Atm128GpioC() as UserButtonC;
> > UserButtonC -> GeneralIOC.PortD0; // line 48
> > GeneralIO = UserButtonC;
> >
> > components new Atm128GpioInterruptC() as InterruptUserButtonC;
> > InterruptUserButtonC.Atm128Interrupt -> InterruptC.Int0;
> > GpioInterrupt = InterruptUserButtonC.Interrupt;
> > }
> > ********************************
> >
> > or in Atm128GpioC:
> >
> > ********************************
> > generic module Atm128GpioC() @safe() {
> > provides interface GeneralIO;
> > uses interface HplAtm128GeneralIO as HplGeneralIO;
> > }
> > implementation {
> >
> > async command void GeneralIO.set() { call HplGeneralIO.set(); }
> > async command void GeneralIO.clr() { call HplGeneralIO.clr(); }
> > async command void GeneralIO.toggle() { call HplGeneralIO.toggle(); }
> > async command bool GeneralIO.get() { return call HplGeneralIO.get(); }
> > async command void GeneralIO.makeInput() { call
> > HplGeneralIO.makeInput(); }
> > async command bool GeneralIO.isInput() { return call
> > HplGeneralIO.isInput(); }
> > async command void GeneralIO.makeOutput() { call
> > HplGeneralIO.makeOutput(); }
> > async command bool GeneralIO.isOutput() { return call
> > HplGeneralIO.isOutput(); }
> >
> > }
> > ********************************
> >
> >
> > Any help, suggestion would be very nice.
> > Thanks in advance.
> >
> > All the best,
> > Zsolt
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
--
Plexipi Prototyping GmbH
Türrschmidtstraße 22
D-10317 Berlin
Tel.: +49-(0)30-577-99662
[email protected]
www.plexipi.com
Registergericht: Amtsgericht Charlottenburg
Handelsregisternummer: HRB 111472
USt-IdNr.: DE 258431695
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help