From 46407f7f3e4d2b6e74b3a2e90b38736a792cfc54 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 10 Jul 2012 22:41:59 -0700 Subject: [PATCH] altos: Force 434.550Mhz by connecting debug gnd and clk (trac #41) 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 --- src/cc1111/ao_pins.h | 1 + src/core/ao.h | 7 +++++++ src/core/ao_config.c | 4 ++++ src/product/ao_telemini.c | 13 +++++++++++++ 4 files changed, 25 insertions(+) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index e28a7b65..fc6ed3ec 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -163,6 +163,7 @@ #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 diff --git a/src/core/ao.h b/src/core/ao.h index 2e012f08..06daf48f 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -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 diff --git a/src/core/ao_config.c b/src/core/ao_config.c index e0dabcd9..ced8b1f2 100644 --- a/src/core/ao_config.c +++ b/src/core/ao_config.c @@ -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; diff --git a/src/product/ao_telemini.c b/src/product/ao_telemini.c index fa23de01..21551ee9 100644 --- a/src/product/ao_telemini.c +++ b/src/product/ao_telemini.c @@ -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(); -- 2.30.2