/****************************************************************
Global Variables Declared
*****************************************************************/
- norace uint16_t currentConfig;
+ norace uint16_t currentConfig = TDA5250_REG_DEFAULT_SETTING_CONFIG;
uint8_t currentClockDiv;
- norace uint8_t currentLpf;
+ norace uint8_t currentLpf = TDA5250_REG_DEFAULT_SETTING_LPF;
/****************************************************************
--- /dev/null
+/* -*- mode: c++ -*-
+ * Copyright (c) 2007, Technische Universitaet Berlin
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name of the Technische Universitaet Berlin nor the names
+ * of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+interface RfPower {
+ async command error_t set(uint8_t setting);
+}
interface RadioByteComm;
interface ResourceRequested;
interface ClkDiv;
+#ifdef LNDW
+ interface RfPower;
+#endif
}
uses {
interface HplTda5250Config;
radioMode_t radioMode; // Current Mode of the Radio
float onTime, offTime;
+#ifdef LNDW
+ norace bool rfpowerdirty = FALSE;
+ norace uint8_t rfpower = INITIAL_RF_POWER;
+ task void setRfPower() {
+ uint8_t rp, rd;
+ atomic {
+ rp = rfpower;
+ rd = rfpowerdirty;
+ }
+ if(rd) {
+ if(call ConfigResource.immediateRequest() == SUCCESS) {
+ call HplTda5250Config.SetRFPower(rp);
+ atomic rfpowerdirty = FALSE;
+ }
+ else {
+ post setRfPower();
+ }
+ }
+ }
+#endif
+
/**************** Radio Init *****************/
command error_t Init.init() {
radioMode = RADIO_MODE_OFF;
call HplTda5250Config.SetSleepMode();
atomic radioMode = RADIO_MODE_SLEEP;
signal Tda5250Control.SleepModeDone();
+ if(rfpowerdirty) post setRfPower();
break;
case RADIO_MODE_TX_TRANSITION:
call HplTda5250Config.SetSlaveMode();
}
default async event void ClkDiv.stopping() {
}
+#ifdef LNDW
+ async command error_t RfPower.set(uint8_t setting) {
+ atomic {
+ rfpower = setting;
+ rfpowerdirty = TRUE;
+ }
+ return SUCCESS;
+ }
+#endif
}