[Tinyos-beta-commits] CVS: tinyos-1.x/beta/chips/AD524X AD5241C.nc,
1.1, 1.2 AD5242C.nc, 1.1, 1.2 AD524XM.nc, 1.2, 1.3
Joe Polastre
jpolastre at users.sourceforge.net
Mon Feb 7 03:36:04 PST 2005
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/AT45DB AT45Remap.nc, NONE,
1.1 HALAT45DBShare.nc, NONE, 1.1 Mount.nc, NONE,
1.1 StorageManagerC.nc, NONE, 1.1 StorageManagerM.nc, NONE,
1.1 issues, NONE, 1.1 BlockStorageC.nc, 1.1,
1.2 BlockStorageM.nc, 1.1, 1.2 HALAT45DB.nc, 1.1,
1.2 HALAT45DBC.nc, 1.1, 1.2 HALAT45DBM.nc, 1.1,
1.2 HPLAT45DB.nc, 1.1, 1.2 HPLAT45DBByte.nc, 1.1, 1.2
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/chips/AD524X AD524XM.nc,
1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/chips/AD524X
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23337
Modified Files:
AD5241C.nc AD5242C.nc AD524XM.nc
Log Message:
updates to the AD524X code include
* automatically setting or clearing the shutdown pin
* user counting for start and stop
* initialization of the underlying i2c packet component
Index: AD5241C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/chips/AD524X/AD5241C.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AD5241C.nc 1 Feb 2005 05:05:09 -0000 1.1
--- AD5241C.nc 7 Feb 2005 11:36:01 -0000 1.2
***************
*** 30,33 ****
--- 30,53 ----
* sets the physical hardware pin to turn the device on or off via the
* shutdown pin (if supported by the underlying platform).
+ *
+ * You *must* define the "AD524X_SD" pin in an included file, presumably
+ * your sensorboard.h file. The AD524X_SD pin is used to put the device
+ * into and out of shutdown when StdControl start() and stop() are called.
+ * These functions:
+ * TOSH_MAKE_AD524X_SD_OUTPUT()
+ * TOSH_MAKE_AD524X_SD_INPUT()
+ * TOSH_SET_AD524X_SD_PIN()
+ * TOSH_CLR_AD524X_SD_PIN()
+ * May be defined as empty functions for platforms that do not support the
+ * AD524X shutdown pin.
+ *
+ * The AD524X driver counts the number of users for systems with multiple
+ * pots and only causes the physical pin to initiate a shutdown when all
+ * users of the pot have called stop (in other words #start() == #stop())
+ *
+ * It is recommended that you use the SD bit in the AD524X by calling
+ * AD5241.start() and AD5241.stop() rather than toggling the actual
+ * shutdown pin. By setting the pin in the particular device, you can
+ * ensure that device has been shutdown.
*/
***************
*** 43,48 ****
AD5241 = AD524XM;
! StdControl = I2CPacketC;
AD524XM.I2CPacket -> I2CPacketC;
}
--- 63,69 ----
AD5241 = AD524XM;
! StdControl = AD524XM;
+ AD524XM.LowerControl -> I2CPacketC;
AD524XM.I2CPacket -> I2CPacketC;
}
Index: AD5242C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/chips/AD524X/AD5242C.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AD5242C.nc 1 Feb 2005 05:05:09 -0000 1.1
--- AD5242C.nc 7 Feb 2005 11:36:01 -0000 1.2
***************
*** 30,33 ****
--- 30,53 ----
* sets the physical hardware pin to turn the device on or off via the
* shutdown pin (if supported by the underlying platform).
+ *
+ * You *must* define the "AD524X_SD" pin in an included file, presumably
+ * your sensorboard.h file. The AD524X_SD pin is used to put the device
+ * into and out of shutdown when StdControl start() and stop() are called.
+ * These functions:
+ * TOSH_MAKE_AD524X_SD_OUTPUT()
+ * TOSH_MAKE_AD524X_SD_INPUT()
+ * TOSH_SET_AD524X_SD_PIN()
+ * TOSH_CLR_AD524X_SD_PIN()
+ * May be defined as empty functions for platforms that do not support the
+ * AD524X shutdown pin.
+ *
+ * The AD524X driver counts the number of users for systems with multiple
+ * pots and only causes the physical pin to initiate a shutdown when all
+ * users of the pot have called stop (in other words #start() == #stop())
+ *
+ * It is recommended that you use the SD bit in the AD524X by calling
+ * AD5242.start() and AD5242.stop() rather than toggling the actual
+ * shutdown pin. By setting the pin in the particular device, you can
+ * ensure that device has been shutdown.
*/
***************
*** 43,48 ****
AD5242 = AD524XM;
! StdControl = I2CPacketC;
AD524XM.I2CPacket -> I2CPacketC;
}
--- 63,69 ----
AD5242 = AD524XM;
! StdControl = AD524XM;
+ AD524XM.LowerControl -> I2CPacketC;
AD524XM.I2CPacket -> I2CPacketC;
}
Index: AD524XM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/chips/AD524X/AD524XM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AD524XM.nc 1 Feb 2005 17:26:33 -0000 1.2
--- AD524XM.nc 7 Feb 2005 11:36:01 -0000 1.3
***************
*** 30,37 ****
--- 30,39 ----
{
provides {
+ interface StdControl;
interface AD5241;
interface AD5242;
}
uses {
+ interface StdControl as LowerControl;
interface MSP430I2CPacket as I2CPacket;
}
***************
*** 76,80 ****
uint8_t data[2];
uint8_t device[4];
! uint8_t state = 0;
result_t startWriteCommand(uint8_t _addr, uint8_t _length, uint16_t _data, uint8_t _newstate) {
--- 78,83 ----
uint8_t data[2];
uint8_t device[4];
! uint8_t state;
! int8_t usercount;
result_t startWriteCommand(uint8_t _addr, uint8_t _length, uint16_t _data, uint8_t _newstate) {
***************
*** 118,121 ****
--- 121,166 ----
}
+ command result_t StdControl.init() {
+ atomic {
+ usercount = 0;
+ state = 0;
+ }
+ return call LowerControl.init();
+ }
+
+ command result_t StdControl.start() {
+ int8_t _localcount;
+ atomic {
+ if (usercount <= 0) {
+ TOSH_MAKE_AD524X_SD_OUTPUT();
+ TOSH_SET_AD524X_SD_PIN();
+ usercount = 0;
+ }
+ _localcount = usercount;
+ usercount++;
+ }
+ if (_localcount == 0)
+ return call LowerControl.start();
+ else
+ return SUCCESS;
+ }
+
+ command result_t StdControl.stop() {
+ int8_t _localcount;
+ atomic {
+ usercount--;
+ if (usercount <= 0) {
+ TOSH_MAKE_AD524X_SD_OUTPUT();
+ TOSH_SET_AD524X_SD_PIN();
+ usercount = 0;
+ }
+ _localcount = usercount;
+ }
+ if (_localcount == 0)
+ return call LowerControl.stop();
+ else
+ return SUCCESS;
+ }
+
/** START commands **/
command result_t AD5241.start(uint8_t addr) {
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/AT45DB AT45Remap.nc, NONE,
1.1 HALAT45DBShare.nc, NONE, 1.1 Mount.nc, NONE,
1.1 StorageManagerC.nc, NONE, 1.1 StorageManagerM.nc, NONE,
1.1 issues, NONE, 1.1 BlockStorageC.nc, 1.1,
1.2 BlockStorageM.nc, 1.1, 1.2 HALAT45DB.nc, 1.1,
1.2 HALAT45DBC.nc, 1.1, 1.2 HALAT45DBM.nc, 1.1,
1.2 HPLAT45DB.nc, 1.1, 1.2 HPLAT45DBByte.nc, 1.1, 1.2
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/chips/AD524X AD524XM.nc,
1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list