altos: Force 434.550Mhz by connecting debug gnd and clk (trac #41)
authorKeith Packard <keithp@keithp.com>
Wed, 11 Jul 2012 05:41:59 +0000 (22:41 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 11 Jul 2012 05:41:59 +0000 (22:41 -0700)
Check for pin P2_2 low at startup and set the frequency to
434.550MHz. This value won't get written to flash, so rebooting again
will restore the configured frequency.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/cc1111/ao_pins.h
src/core/ao.h
src/core/ao_config.c
src/product/ao_telemini.c

index e28a7b65da256149e7a49de478bfa563644b1cd6..fc6ed3ec280a0287fe1fe6b3b800cce4cc0364f6 100644 (file)
        #define HAS_ADC                 1
        #define HAS_EEPROM              1
        #define HAS_LOG                 1
+       #define HAS_FORCE_FREQ          1
        #define USE_INTERNAL_FLASH      1
        #define HAS_DBG                 0
        #define IGNITE_ON_P2            0
index 2e012f083e597ed4ad2d252e2e773e6d3d523dae..06daf48f98aa4af597bfe0a7344c6c665f7cdaf8 100644 (file)
@@ -682,6 +682,13 @@ ao_igniter_init(void);
  * ao_config.c
  */
 
+#if HAS_FORCE_FREQ
+/*
+ * Set this to force the frequency to 434.550MHz
+ */
+extern __xdata uint8_t ao_force_freq;
+#endif
+
 #define AO_CONFIG_MAJOR        1
 #define AO_CONFIG_MINOR        11
 
index e0dabcd9cc60120ac9dfa153bc80c3a9ca433626..ced8b1f28f7f0f0389cc4b334d969d32621b3d86 100644 (file)
@@ -135,6 +135,10 @@ _ao_config_get(void)
                ao_config_dirty = 1;
        }
 #if HAS_RADIO
+#if HAS_FORCE_FREQ
+       if (ao_force_freq)
+               ao_config.frequency = 434550;
+#endif
        ao_config_set_radio();
 #endif
        ao_config_loaded = 1;
index fa23de018c2d5b67abfbda2a57ddf120d809fc60..21551ee902b2c59359d3c44441ca0ad653328712 100644 (file)
@@ -18,6 +18,8 @@
 #include "ao.h"
 #include "ao_pins.h"
 
+__xdata uint8_t ao_force_freq;
+
 void
 main(void)
 {
@@ -33,6 +35,17 @@ main(void)
        ao_led_init(LEDS_AVAILABLE);
        ao_led_on(AO_LED_RED);
 
+       /* A hack -- look at the debug clock pin, if it's sitting at
+        *  ground, then we force the computer to idle mode instead of
+        *  flight mode
+        */
+       if (P2_2 == 0) {
+               ao_flight_force_idle = 1;
+               ao_force_freq = 1;
+               while (P2_2 == 0)
+                       ;
+       }
+
        ao_timer_init();
        ao_adc_init();
        ao_cmd_init();