-/* $Id$
- * Copyright (c) 2006 Intel Corporation
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached INTEL-LICENSE
- * file. If you do not find these files, copies can be found by writing to
- * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
- * 94704. Attention: Intel License Inquiry.
- */
-/**
- * ADXL202JE accelerometer ADC configuration and power management.
- * @author David Gay <david.e.gay@intel.com>
- */
-module AccelP
-{
- provides {
- interface SplitControl;
- interface Atm128AdcConfig as ConfigX;
- interface Atm128AdcConfig as ConfigY;
- }
- uses {
- interface Timer<TMilli>;
- interface GeneralIO as AccelPin;
- interface MicaBusAdc as AccelAdcX;
- interface MicaBusAdc as AccelAdcY;
- }
-}
-implementation
-{
- async command uint8_t ConfigX.getChannel() {
- return call AccelAdcX.getChannel();
- }
-
- async command uint8_t ConfigX.getRefVoltage() {
- return ATM128_ADC_VREF_OFF;
- }
-
- async command uint8_t ConfigX.getPrescaler() {
- return ATM128_ADC_PRESCALE;
- }
-
- async command uint8_t ConfigY.getChannel() {
- return call AccelAdcY.getChannel();
- }
-
- async command uint8_t ConfigY.getRefVoltage() {
- return ATM128_ADC_VREF_OFF;
- }
-
- async command uint8_t ConfigY.getPrescaler() {
- return ATM128_ADC_PRESCALE;
- }
-
- command error_t SplitControl.start() {
- call AccelPin.makeOutput();
- call AccelPin.set();
- /* Startup time is 16.3ms for 0.1uF capacitors,
- according to the ADXL202E data sheet */
- call Timer.startOneShot(17);
- return SUCCESS;
- }
-
- event void Timer.fired() {
- signal SplitControl.startDone(SUCCESS);
- }
-
- task void stopDone() {
- call AccelPin.clr();
- signal SplitControl.stopDone(SUCCESS);
- }
-
- command error_t SplitControl.stop() {
- post stopDone();
- return SUCCESS;
- }
-}
+#include "mts300.h"\r
+#include "Timer.h"\r
+\r
+module AccelP\r
+{\r
+ provides interface Init;\r
+ provides interface StdControl;\r
+\r
+ provides interface Atm128AdcConfig as ConfigX;\r
+ provides interface Atm128AdcConfig as ConfigY;\r
+ provides interface ResourceConfigure as ResourceX;\r
+ provides interface ResourceConfigure as ResourceY;\r
+\r
+ uses interface GeneralIO as AccelPower;\r
+ uses interface MicaBusAdc as AccelAdcX;\r
+ uses interface MicaBusAdc as AccelAdcY;\r
+}\r
+\r
+implementation\r
+{\r
+ command error_t Init.init()\r
+ {\r
+ call AccelPower.makeOutput();\r
+ call AccelPower.clr();\r
+\r
+ return SUCCESS;\r
+ }\r
+\r
+ command error_t StdControl.start()\r
+ {\r
+ call AccelPower.set();\r
+ return SUCCESS;\r
+ }\r
+\r
+ command error_t StdControl.stop()\r
+ {\r
+ call AccelPower.clr();\r
+ call AccelPower.makeInput();\r
+\r
+ return SUCCESS;\r
+ }\r
+\r
+ async command uint8_t ConfigX.getChannel() {\r
+ return call AccelAdcX.getChannel();\r
+ }\r
+\r
+ async command uint8_t ConfigX.getRefVoltage() {\r
+ return ATM128_ADC_VREF_OFF;\r
+ }\r
+\r
+ async command uint8_t ConfigX.getPrescaler() {\r
+ return ATM128_ADC_PRESCALE;\r
+ }\r
+\r
+ async command uint8_t ConfigY.getChannel() {\r
+ return call AccelAdcY.getChannel();\r
+ }\r
+\r
+ async command uint8_t ConfigY.getRefVoltage() {\r
+ return ATM128_ADC_VREF_OFF;\r
+ }\r
+\r
+ async command uint8_t ConfigY.getPrescaler() {\r
+ return ATM128_ADC_PRESCALE;\r
+ }\r
+\r
+ async command void ResourceX.configure() { } \r
+ async command void ResourceX.unconfigure() { } \r
+ async command void ResourceY.configure() { } \r
+ async command void ResourceY.unconfigure() {}\r
+}
\ No newline at end of file