R. Steve McKown [Thu, 8 Apr 2010 01:16:46 +0000 (19:16 -0600)]
USCI fixes.
* Watch out for sendData() clobbering TXBUF.
* May solve a loss of UART TX chars.
* USCI UartStream.send() gains nothing by immediately sending the 1st byte.
* m_sobuf cannot be null in Interrupts.tx, so remove the check.
R. Steve McKown [Thu, 8 Apr 2010 00:02:56 +0000 (18:02 -0600)]
Improve interrupt handling for USCI.
Because some interrupts share an interrupt vector, we use the relevant interrupt
enable bit to decide if any user is interested in the interrupt. If not, that
interrupt is skipped so that another interrupt in the if/then/elseif chain can
be taken. We also defensively try to prevent I2C interrupts from being a
problem if not used, although no I2C code using these interrupts has yet been
written.
R. Steve McKown [Thu, 8 Apr 2010 19:50:41 +0000 (13:50 -0600)]
Teach tos-storage-stm25p to derive NUM_SECTORS and SECTOR_SIZE.
The stm25p driver is suitable for different sizes of flash parts, such as the
commonly used 8Mb M25P80 and the less commonly used 1Mb M25P10A. The driver
defines the flash configuration in Stm25p.h. By having tos-storage-stm25p walk
the @includes for the platform, as found in the .platform file, each platform
can ensure that a Stm25p.h with correct content for its flash part is found
for use by the driver and this script.
R. Steve McKown [Wed, 2 Dec 2009 23:37:00 +0000 (16:37 -0700)]
Remove sensors code from tmirws platform.
The sensors code is not stable enough for inclusion into core tinyos, nor is
there yet a clean separation between platform code and application code. The
sensors code removed here was imported with its history into the RWS
application repository.
smckown [Mon, 9 Nov 2009 19:30:58 +0000 (19:30 +0000)]
Redo Average interface.
There is no point in having the averagers pre-know their number of samples.
The user should know this information. Therefore we have a more flexible
solution and avoid a signal to return the averate to the user when that user is
very likely to want to call a command instead.
smckown [Mon, 9 Nov 2009 19:30:52 +0000 (19:30 +0000)]
Enhancements to AeroVaneReadC.
* Anemometer is read immediately after the Timer fires to reduce jitter.
* Count interface is renamed Revolutions to be more meaningful.
* m_count is now uint8_t to reflect a more reasonable real life range.
* Direction data is returned no as degrees but as a 10-bit unsigned value.
* m_sum accumulates the correct, updated angle values.
* Rounding is done properly when m_sum is negative.
smckown [Sat, 7 Nov 2009 23:58:55 +0000 (23:58 +0000)]
Add AeroVane infrastructure to support physical/reading of the sensor.
AeroVaneReadC implements a timer every 28800 ticks of the 32KHz clock (or 900
binary ms). At each timer event it reads the wind vane via WindVaneReadC.
On every 4th read it reads the anemometer via AnemometerReadC, calculates the
average vane position over the last 4 reads (it's been summing all along),
and uses Notify.notify() to send out the aerovector structure. This means
that the user should get an AeroVane vector (reading) every 3.516 seconds, where
both the direction and the speed have been averaged over 4 reads during that
period.
smckown [Wed, 4 Nov 2009 19:17:56 +0000 (19:17 +0000)]
Replace a cardinal value with its proper template argument in WindVaneP.
The wind vane infrastructure works with 128 sectors, the max, which offers
approximately a 3 degree resolution. This comes at the cost of an additional
129 bytes of RAM over using 32 sectors.
smckown [Mon, 2 Nov 2009 20:43:24 +0000 (20:43 +0000)]
Ensure that uC input pin P1.2_CP_RTS is valid when the CP2103 is off.
We accomplish this by enabling an internal pull-down on P1.2 of the MSP430.
It would be better to enable a pull-up, but then we are sending a voltage to
the CP2103 when it is off, which may cause a latch-up problem. The pull-down
isn't terrible, since it represents the condition whereby the USB host is ready
to receive data from the RWS. When the USB is connected, this is likely to be
the most common condition.
smckown [Wed, 5 Aug 2009 02:57:10 +0000 (02:57 +0000)]
tmirws sets outputs going to cp2103 to low (zero) by default.
If any of these drive a high value toward the cp2103, the cp2103 is not
connected to USB power, and VIO is disconnected from Vuc, then funky things
happen that can cause GPIO_3, tied to !UC_RST, to sink current and cause the
uC to go into reset. Similar bad behavior can happen with !USB_SUSPEND.
smckown [Wed, 5 Aug 2009 02:57:08 +0000 (02:57 +0000)]
Reorganize scp1000 driver code.
The Scp1000P module now only uses GeneralIO and is not tied to anything msp430
specific. The msp430 specific bits are in the platform dependent file
Scp1000PinsP.
smckown [Wed, 5 Aug 2009 02:57:07 +0000 (02:57 +0000)]
Move weather instrument sensors code out of TOSDIR/chips, as they aren't.
For now, we'll place them in TOSDIR/platforms/tmirws/sensors. Also, renamed
are the OwwSpeed files, to Anemometer, and OwwVane files to WindVane, as these
names better reflect the fact that the code isn't all that OWW or Davis
specific.
smckown [Sun, 10 May 2009 00:00:32 +0000 (00:00 +0000)]
This change is required to remove async warnings in the phase2 app.
Need to look into this closer. This doesn't make sense, as the sporian0010_02
platform, which uses the usart SPI peripheral, doesn't generate these errors
and that peripheral's SpiPacket.sendDone() doesn't specifically signal
atomically.
smckown [Fri, 8 May 2009 22:27:16 +0000 (22:27 +0000)]
Return a real error code and actual bytes written in SpiPacket.sendDone.
Be careful with this one. The usart SPI peripheral always returned the length
it was given and an error of SUCCESS, so this could create some regressions.
smckown [Fri, 8 May 2009 22:27:14 +0000 (22:27 +0000)]
Implement chip select query for SPI peripheral.
If the SPI peripheral is in slave mode, a transaction could be halted at any
time by the host unasserting (high) the chip select line. This code implements
a check on chip select to allow SPI slaves to see the early abort and act
accordingly.
This reverts commit 50fa36081d963e9da0c4544d753e77c53c1b0ac8 (svn r152). With
PxREN manipulation in usci/Msp430SpiP, the phase2 app does not send packets to
the gateway.
Per the TI datasheet, PxREN bits shouldn't be set at the same time as the
corresponding PxSEL (module function) bits as unintended current consumption
could be triggered.
smckown [Sun, 12 Oct 2008 22:05:44 +0000 (22:05 +0000)]
Start a davis anemometer 'chip' directory from the one for oww. These two
components actually share a good deal of information, especially the
interfaces.
Don't leave the iopin attached to the sht1x SCK pin floating when the
controlling Resource is released. Also, set the DATA pin in a manner
consistent with the fact that it is a pulled-up line by default, either
via an external resistor or one internal to the uC.