Sorry I can't help any further as I don't use ReadStream or any other TOS2 interfaces... You are probably on the right track in looking at Microphone sampling apps.
MS Kushal Sarkara wrote: > Michael, > > Thank you for your response. In keeping with the topic of our original > conversation, I am still trying to implement the ReadStream interface to > sample the MicaZ accelerometer. > > After sampling at the prescaler setting that guarantees full precision > (which is ATM128_ADC_PRESCALE_64 for the MicaZ, according to my > calculations) and reading up on the SoundLocalizer application in the > TinyOS Programming Manual, I was wondering if there was any way to alter > the prescaler and use ReadStream (necessary, in my opinion, because I > want to append samples to the log as they are obtained and ReadStream > provides this facility). > > The plethora of ADC configuration interfaces makes it confusing for a > TinyOS 2.x and programming novice such as myself to figure out where the > prescaler is altered but I think that I've managed to figure out how > this can be done. What I am having a lot more trouble doing is figuring > out how the ReadStream interface configures the ADC. There must be a > point at which the ReadStream interface specifies what prescaler it > wants to use, right? This led me to search for a module for the > ReadStream interface but I have had no luck. > > So, > > * Is there a module for the ReadStream interface where the prescaler > etc is set? > * Is it possible to modify the prescaler for ReadStream at all or is > it perpetually set to ATM128_ADC_PRESCALE? > * Is it a good idea to try to mimic the ReadStream operation by > using something like Atm128AdcSingle.getData (like the > SoundLocalizer does) and then trying to store each sample in a > buffer, which would then be appended to the log? My opinion is > that this will result in a lot of processing overheads (and make > it really tough to program, but I don't see just that being a > problem). > > I apologize for the lengthy post. > > Kushal > > On Mon, Nov 14, 2011 at 12:04 PM, Michael Schippling <sc...@santafe.edu > <mailto:sc...@santafe.edu>> wrote: > > Changing the return value will have no effect on the ADC. > There used to be an interface for this that was actually > documented in the code: > ADCControl.setSamplingRate(__uint8_t rate); > The name may have changed to setPrescaler() or something > more obvious. > > MS > > > Kushal Sarkara wrote: > > Hello, > > I am using TinyOS 2.1.1 on Ubuntu 9.10 with MicaZ motes. I am > looking to alter the value of the prescaler while sampling the X > axis of the accelerometer on the mts300 sensorboard. > > After doing some digging, I found the file > /tos/sensorboards/mts300/__AccelP.nc which returns the value of > the prescaler for configuring the Adc, the getdata() function > for which leads me back to the > /tos/chips/atm128/adc/__Atm128AdcP.nc file. > > The code in the AccelP.nc file that I am referring to is as follows: > / > / > / async command uint8_t ConfigX.getPrescaler() {/ > / return ATM128_ADC_PRESCALE;/ > / }/ > / > / > Will it suffice to change the returned value to, for example, > /ATM128_ADC_PRESCALE_32 (/as provided in the > /tos/chips/atm128/adc/__Atm128Adc.h) if I want to use the adc > prescaler (32)? > > Thanks in advance, > Kushal > > > > ------------------------------__------------------------------__------------ > > _________________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.__berkeley.edu > <mailto:Tinyos-help@millennium.berkeley.edu> > > https://www.millennium.__berkeley.edu/cgi-bin/mailman/__listinfo/tinyos-help > > <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