diff options
author | Keith Packard <keithp@keithp.com> | 2017-05-04 22:07:51 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-05-04 22:10:36 -0700 |
commit | 178d7c0aa32267ea71be2ccff146ea6ff990d7dc (patch) | |
tree | 56b8e97c76d0f871afe6c3e7196ac04337ead647 /src/telemini-v3.0/ao_telemini.c | |
parent | 3b4e3189211801c6f8f41c5d08c5a8551f28976c (diff) |
altos/telemini-v3.0: Add 'recovery mode' on PA14 (pin 6 on dbg header)
Connect this pin to GND (pin 3) and TeleMini will come up with N0CALL
at 434.550MHz using the original frequency calibration. Helps recover
from accidental mis-configuration.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/telemini-v3.0/ao_telemini.c')
-rw-r--r-- | src/telemini-v3.0/ao_telemini.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/telemini-v3.0/ao_telemini.c b/src/telemini-v3.0/ao_telemini.c index ecd16dd2..a50268b9 100644 --- a/src/telemini-v3.0/ao_telemini.c +++ b/src/telemini-v3.0/ao_telemini.c @@ -19,9 +19,26 @@ #include <ao.h> #include <ao_exti.h> +static void +ao_check_recovery(void) +{ + int i; + ao_enable_input(AO_RECOVERY_PORT, AO_RECOVERY_PIN, AO_RECOVERY_MODE); + for (i = 0; i < 100; i++) + ao_arch_nop(); + if (ao_gpio_get(AO_RECOVERY_PORT, AO_RECOVERY_PIN, AO_RECOVERY) == AO_RECOVERY_VALUE) { + ao_flight_force_idle = 1; + ao_force_freq = 1; + } + ao_gpio_set_mode(AO_RECOVERY_PORT, AO_RECOVERY_PIN, 0); + ao_disable_port(AO_RECOVERY_PORT); +} + void main(void) { + ao_check_recovery(); + ao_clock_init(); ao_task_init(); ao_timer_init(); |