Hi,
Do you mean that I use the component AccelXStreamC in DemoSensorStreamC like
following:
generic configuration DemoSensorStreamC() {
provides interface ReadStream<uint16_t>;
}
implementation {
components AccelXStreamC, AccelYStreamC;
ReadStream = AccelXStreamC.ReadStream;
ReadStream = AccelYStreamC.ReadStream;
}
need I post a buffer in this component? If yes, how can I do, as there it
seems posting a buffer is finished in the event Boot.booted()?
The compile results are:
In component `GetAccelC':
GetAccelC.nc:32: `ReadStream.readDone' not implemented
In file included from GetAccelAppC.nc:22:
In component `DemoSensorStreamC':
/opt/tinyos-2.x/tos/sensorboards/mts310/DemoSensorStreamC.nc:23: generic
compone
nt `AccelXStreamC' requires instantiation arguments
In file included from GetAccelAppC.nc:22:
/opt/tinyos-2.x/tos/sensorboards/mts310/DemoSensorStreamC.nc:23: generic
compone
nt `AccelYStreamC' requires instantiation arguments
make: *** [exe0] Error 1
Why AccelXstreamC and AccelYStreamC need be instantiated? How to do?
regards,
Fangming
On 5/16/07, Hugo Sousa <[EMAIL PROTECTED]> wrote:
For stream reading you have to use AccelReadStreamP and
AdcReadStreamClientC, but why don't you use the component AccelXStreamC? You
don't have to write your own component.
Note: you have to post a buffer for every read you do
Cheers,
Hugo
On 5/16/07, Fangming Zhang <[EMAIL PROTECTED]> wrote:
>
> Hi Philip,
>
> I still feel very difficult to finish this project. The main difficulty
> is how to write component AccelStreamC. I feel how to make a interface
> between ReadStream and Read as AdcReadClient only provide interface
> Read.I will explain in next.
>
> I define the packet name as 'GetAccel'. According to your method, I use
> interface ReadStream in 'GetAccelC.nc'. It was initialized in:
> event void Boot.booted() {
> ...
> call ReadStream.postBuffer(buf, BUF_SIZE);
> }
>
> Read was started at timer event as:
> event void Timer.fired() {
> if (call ReadStream.read(1) != SUCCESS)
> report_problem();
> }
>
> Read data as:
> event void ReadStream.bufferDone( error_t result,
> uint16_t* buffer, uint16_t count )
> {
> if (result != SUCCESS)
> {
> buffer[0] = 0xffff;
> buffer[1] = 0xffff;
> report_problem();
> }
> local.readings [0] = buffer[0];
> local.readings[1] = buffer[1];
> }
>
> I use DemoSensorStreamC in GetAccelAppC as:
> components new DemoSensorStreamC() as Sensor;
> GetAccelC.ReadStream -> Sensor;
>
> The DemoSensorStreamC in my MTS310 folder is written as:
> generic configuration DemoSensorStreamC() {
> provides interface ReadStream<uint16_t>;
> }
> implementation {
> components new AccelStreamC() as SensorStream;
> ReadStream = SensorStream;
> }
>
> But I feel difficult to write AccelStreamC. it is:
> #include "mts300.h"
> generic configuration AccelStreamC()
> {
> provides interface ReadStream<uint16_t>;
> }
> implementation {
> enum {
> ID = unique(UQ_ACCEL_RESOURCE)
> };
>
> components AccelReadP,AccelConfigP, new AdcReadClientC() as AdcX,new
> AdcReadClientC() as AdcY;
>
> ReadStream = AccelReadP.ReadX[ID]; //compile error here: no match
> AccelReadP.ActualX[ID] -> AdcX;
> AdcX.Atm128AdcConfig -> AccelConfigP.ConfigX;
>
> ReadStream = AccelReadP.ReadY[ID]; //compile error here: no match
> AccelReadP.ActualY [ID] -> AdcY;
> AdcY.Atm128AdcConfig -> AccelConfigP.ConfigY;
> }
>
> Beside this, every AccelConfigP make WarmupTimer, so in my AccelStreamC,
> it seems the sensor was Warmup again when I want to read Y
> axis. Could you give more detail direction?
>
> Regards,
> Fangming
>
>
>
> On 5/13/07, Philip Levis <[EMAIL PROTECTED] > wrote:
> >
> > On May 13, 2007, at 5:01 PM, Hugo Sousa wrote:
> >
> > > Hi Fangming,
> > >
> > > You don't have to wait for a readDone() to read the other, you can
> > > call both Reads because accelconfigp has an arbiter that prevents
> > > simultaneous access. It is also better that you call them both
> > > because that way the sensor is not turned off between the two
> > > readings, doubling your maximum sample frequency. That's 60Hz, not
> > > quite the 64Hz you want
> >
> > This is correct; in T2, the best way to sample multiple sensors is to
> > request all of them at once. In this case, "best" means "most power
> > efficient" and "fastest." Basically, by issuing a bunch of parallel
> > calls to the OS, you give it the flexibility to automatically
> > schedule I/O as efficiently as possible.
> >
> > Phil
> >
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help