fw/altos
8 years agoaltos: Make STM clock configuration per-product. Fix 32MHz CPU speed
Keith Packard [Tue, 10 Apr 2012 05:17:33 +0000 (22:17 -0700)]
altos: Make STM clock configuration per-product. Fix 32MHz CPU speed

This moves all of the STM clock configuration into ao_pins.h so that
each product can configure it separately. While doing this, I
discovered that the flash memory mode (64-bit, prefetch, latency 1)
wasn't actually getting set, which is why the CPU refused to work at
32MHz.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add beeper driver to STM arch
Keith Packard [Tue, 10 Apr 2012 03:28:19 +0000 (20:28 -0700)]
altos: Add beeper driver to STM arch

Drives the MegaMetrum beeper

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Test I2C code on discovery board.
Keith Packard [Mon, 9 Apr 2012 07:10:43 +0000 (00:10 -0700)]
altos: Test I2C code on discovery board.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: ARM -O0 flag appears to generate buggy code
Keith Packard [Mon, 9 Apr 2012 07:10:01 +0000 (00:10 -0700)]
altos: ARM -O0 flag appears to generate buggy code

Use -Os always, which is annoying...

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Make ms5607 driver do something
Keith Packard [Mon, 9 Apr 2012 07:09:18 +0000 (00:09 -0700)]
altos: Make ms5607 driver do something

It's loading prom values and converting sensor data, but it's getting
the wrong answer at present.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: add STM I2C driver.
Keith Packard [Mon, 9 Apr 2012 07:08:20 +0000 (00:08 -0700)]
altos: add STM I2C driver.

Not well tested yet...

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Slow STM SPI down a bit so the MS5607 returns values
Keith Packard [Mon, 9 Apr 2012 07:06:35 +0000 (00:06 -0700)]
altos: Slow STM SPI down a bit so the MS5607 returns values

It's still not working right, but at least it returns something other
than all zeros...

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Allow STM DMA channels to be reserved for one use
Keith Packard [Mon, 9 Apr 2012 07:05:18 +0000 (00:05 -0700)]
altos: Allow STM DMA channels to be reserved for one use

This allows a single user of a DMA channel to reserve it for use
without needing to lock the mutex; this is required for DMA from the
ADC to work on megametrum as it wants to start DMA from an interrupt
handler, which cannot block on a mutex.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Show temperature in stm-demo
Keith Packard [Sun, 8 Apr 2012 03:35:17 +0000 (20:35 -0700)]
altos: Show temperature in stm-demo

Use the ADC to show current temperature

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Use 384 cycle ADC sample time
Keith Packard [Sun, 8 Apr 2012 03:33:27 +0000 (20:33 -0700)]
altos: Use 384 cycle ADC sample time

This is plenty fast, and provides nice stable readings.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add STM temperature sensor calibration data
Keith Packard [Sun, 8 Apr 2012 03:31:58 +0000 (20:31 -0700)]
altos: Add STM temperature sensor calibration data

Each stm32l has two-point factory temperature calibration data.
Provide access to that for displaying temperature data.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add ADC support to megametrum firmware
Keith Packard [Sun, 8 Apr 2012 01:55:53 +0000 (18:55 -0700)]
altos: Add ADC support to megametrum firmware

Measures all MM igniter and battery voltages.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add ADC tests to stm-demo
Keith Packard [Sun, 8 Apr 2012 01:55:20 +0000 (18:55 -0700)]
altos: Add ADC tests to stm-demo

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: STM SPI is not using interrupts itself
Keith Packard [Sun, 8 Apr 2012 01:54:32 +0000 (18:54 -0700)]
altos: STM SPI is not using interrupts itself

All SPI transfers are done via DMA, so the DMA interrupts suffice.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add support for STM ADC
Keith Packard [Sun, 8 Apr 2012 01:53:12 +0000 (18:53 -0700)]
altos: Add support for STM ADC

DMA-based driver for the STM analog to digital converter.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: remove debug printf from AltosFlightStats
Keith Packard [Sun, 8 Apr 2012 01:44:11 +0000 (18:44 -0700)]
altosui: remove debug printf from AltosFlightStats

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: When computing flight stats, auto-detect boost time
Keith Packard [Sun, 8 Apr 2012 01:36:36 +0000 (18:36 -0700)]
altosui: When computing flight stats, auto-detect boost time

Detect when boost actually starts by looking for the last low
acceleration value before the recorded boost time. This improves the
computation of the boost state data.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Integrate accel speed from very start of eeprom record
Keith Packard [Sun, 8 Apr 2012 01:35:26 +0000 (18:35 -0700)]
altosui: Integrate accel speed from very start of eeprom record

Don't wait for the flight computer to have detected boost--that's
often several samples after boost actually occurred, which can leave a
bunch of acceleration out of the speed computation.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add ability to change radio frequency in TeleTerra
Keith Packard [Sat, 7 Apr 2012 08:01:33 +0000 (01:01 -0700)]
altos: Add ability to change radio frequency in TeleTerra

Provide a way to set the frequency locally.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Make ao_config_set_radio public
Keith Packard [Sat, 7 Apr 2012 08:01:06 +0000 (01:01 -0700)]
altos: Make ao_config_set_radio public

Allows other bits of code to reset the radio parameters.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Force radio channel to zero when setting frequency
Keith Packard [Sat, 7 Apr 2012 07:25:50 +0000 (00:25 -0700)]
altos: Force radio channel to zero when setting frequency

Otherwise, the actual radio frequency will include the channel offset,
which is not useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Make ao_freq_to_set reentrant
Keith Packard [Sat, 7 Apr 2012 07:25:26 +0000 (00:25 -0700)]
altos: Make ao_freq_to_set reentrant

Save a bunch of data space this way.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Shorten help strings
Keith Packard [Sat, 7 Apr 2012 07:24:59 +0000 (00:24 -0700)]
altos: Shorten help strings

Save a bit of code space

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Save memory in ao_config.c
Keith Packard [Sat, 7 Apr 2012 07:23:55 +0000 (00:23 -0700)]
altos: Save memory in ao_config.c

Shorten help messages.
Stop setting aes_key on products not using aes key.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Save memory in ao_cmd.c
Keith Packard [Sat, 7 Apr 2012 07:22:41 +0000 (00:22 -0700)]
altos: Save memory in ao_cmd.c

Shrink a couple of help strings
move a variable in ao_cmd from data to pdata.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add fake install/uninstall targets for stm-bringup
Keith Packard [Sat, 7 Apr 2012 07:22:02 +0000 (00:22 -0700)]
altos: Add fake install/uninstall targets for stm-bringup

Keep global 'make install' from failing.
Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Radio channel gets set to zero by altos when frequency is set
Keith Packard [Sat, 7 Apr 2012 07:21:03 +0000 (00:21 -0700)]
altosui: Radio channel gets set to zero by altos when frequency is set

Just remember what the channe is going to get set to.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Shuffle stm-demo SPI test code around a bit
Keith Packard [Sat, 7 Apr 2012 05:40:49 +0000 (22:40 -0700)]
altos: Shuffle stm-demo SPI test code around a bit

Move a debug printf beyond the chip select boundary to
allow for more accurate timing.

Send four bytes instead of just one.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Declare stm DMA address registers as volatile void *
Keith Packard [Sat, 7 Apr 2012 05:40:17 +0000 (22:40 -0700)]
altos: Declare stm DMA address registers as volatile void *

Eliminates a cast when assigning to them.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Disable DMA unit when idle
Keith Packard [Sat, 7 Apr 2012 05:39:45 +0000 (22:39 -0700)]
altos: Disable DMA unit when idle

Should save a bit of power

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Disable STM SPI transceiver when idle
Keith Packard [Sat, 7 Apr 2012 05:39:12 +0000 (22:39 -0700)]
altos: Disable STM SPI transceiver when idle

Should save a bit of power.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add DMA, SPI and MS5607 drivers
Keith Packard [Sat, 7 Apr 2012 01:07:07 +0000 (18:07 -0700)]
altos: Add DMA, SPI and MS5607 drivers

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: megametrum builds an ELF file, not an IHX file
Keith Packard [Tue, 3 Apr 2012 06:00:29 +0000 (23:00 -0700)]
altos: megametrum builds an ELF file, not an IHX file

Name it appropriately.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Move SPI functions to architecture-specific location
Keith Packard [Tue, 3 Apr 2012 05:58:54 +0000 (22:58 -0700)]
altos: Move SPI functions to architecture-specific location

Some architecture specific stuff needs to use core altos code, so
create new ao_arch_funcs.h files per architecture that get pulled in
at the end of ao.h

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Oops. Set per-USART STM baud rate register instead of usart1
Keith Packard [Tue, 3 Apr 2012 02:27:53 +0000 (19:27 -0700)]
altos: Oops. Set per-USART STM baud rate register instead of usart1

Was accidentally always setting usart1 instead of the per-usart
register. Didn't work too well for other usarts...

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agobe explicit in a couple places about only using single-cell LiPo batteries
Bdale Garbee [Sat, 31 Mar 2012 23:53:25 +0000 (17:53 -0600)]
be explicit in a couple places about only using single-cell LiPo batteries

8 years agouse explicit path not $(HOME) to find ARM toolchain for now
Bdale Garbee [Sat, 31 Mar 2012 22:43:39 +0000 (16:43 -0600)]
use explicit path not $(HOME) to find ARM toolchain for now

8 years agoadd config file for gdb use with MegaMetrum via Olimex dongle
Bdale Garbee [Sat, 31 Mar 2012 22:43:11 +0000 (16:43 -0600)]
add config file for gdb use with MegaMetrum via Olimex dongle

8 years agoBuild megametrum-v0.1 by default
Keith Packard [Sat, 31 Mar 2012 19:44:14 +0000 (12:44 -0700)]
Build megametrum-v0.1 by default

8 years agoaltos: Add stub cc1120 driver
Keith Packard [Sat, 31 Mar 2012 19:43:58 +0000 (12:43 -0700)]
altos: Add stub cc1120 driver

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Move cc1111 DMA engine interface to cc1111/ao_arch.h from ao.h
Keith Packard [Thu, 29 Mar 2012 04:54:32 +0000 (21:54 -0700)]
altos: Move cc1111 DMA engine interface to cc1111/ao_arch.h from ao.h

It's hardware specific

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Move cc1111 AES driver to cc1111 directory
Keith Packard [Thu, 29 Mar 2012 04:53:30 +0000 (21:53 -0700)]
altos: Move cc1111 AES driver to cc1111 directory

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoopenocd config file for MegaMetrum
Bdale Garbee [Sat, 31 Mar 2012 19:29:15 +0000 (13:29 -0600)]
openocd config file for MegaMetrum

8 years agoBump version to 1.0.9.4 1.0.9.4
Keith Packard [Thu, 29 Mar 2012 04:45:44 +0000 (21:45 -0700)]
Bump version to 1.0.9.4

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Add ao_freq.c to megametrum build
Keith Packard [Thu, 29 Mar 2012 04:45:02 +0000 (21:45 -0700)]
altos: Add ao_freq.c to megametrum build

I think this will be needed to compute radio settings on the cc1120

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agostm-demo does not use altitude.h
Keith Packard [Sun, 25 Mar 2012 20:08:05 +0000 (13:08 -0700)]
stm-demo does not use altitude.h

8 years agoUse -Os for STM apps. Fix altos.ld to matchall .rodata* sections
Keith Packard [Fri, 23 Mar 2012 08:42:32 +0000 (01:42 -0700)]
Use -Os for STM apps. Fix altos.ld to matchall .rodata* sections

Without .rodata*, it would stick the flash copy of the data on top of
any further .rodata* sections. Fortunately, the linker catches that
and complains...

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoGet config stuff hooked up for MegaMetrum
Keith Packard [Fri, 23 Mar 2012 07:55:53 +0000 (00:55 -0700)]
Get config stuff hooked up for MegaMetrum

This stubs out enough stuff to let ao_config link and work

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd preliminary MegaMetrum v0.1 support
Keith Packard [Fri, 23 Mar 2012 07:43:47 +0000 (00:43 -0700)]
Add preliminary MegaMetrum v0.1 support

This turns on an LED, enables the internal R/C clock, hooks USART3 to
the GPS chip and USART1 to the console.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoUse new Makefile.defs in stm-demo
Keith Packard [Fri, 23 Mar 2012 07:43:17 +0000 (00:43 -0700)]
Use new Makefile.defs in stm-demo

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoUse 16-bits for STM32 LED mask. Export serial I/O functions
Keith Packard [Fri, 23 Mar 2012 07:42:13 +0000 (00:42 -0700)]
Use 16-bits for STM32 LED mask. Export serial I/O functions

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAllow skytraq to be on non-default serial port
Keith Packard [Fri, 23 Mar 2012 07:40:48 +0000 (00:40 -0700)]
Allow skytraq to be on non-default serial port

Provide ao_gps_getchar, ao_gps_putchar and ao_gps_set_speed hooks to
let product specify functions for serial access.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAllow for more than 8 LEDs
Keith Packard [Fri, 23 Mar 2012 07:40:09 +0000 (00:40 -0700)]
Allow for more than 8 LEDs

Provide hook for architecture-specific LED mask (AO_LED_TYPE)

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoClean up STM build by moving common defs to Makefile.defs
Keith Packard [Fri, 23 Mar 2012 07:19:06 +0000 (00:19 -0700)]
Clean up STM build by moving common defs to Makefile.defs

Shortens default Makefile a bit

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoMake stm-demo display a scrolling message
Keith Packard [Fri, 23 Mar 2012 07:04:47 +0000 (00:04 -0700)]
Make stm-demo display a scrolling message

Instead of trying to frob the LEDs, which are now owned by the serial
port.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoFlush LCD changes each time the text is updated
Keith Packard [Fri, 23 Mar 2012 07:04:21 +0000 (00:04 -0700)]
Flush LCD changes each time the text is updated

Rather than requiring the caller to do it.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAutomatically set ALTERNATE pin mode when setting alternate function
Keith Packard [Fri, 23 Mar 2012 07:03:29 +0000 (00:03 -0700)]
Automatically set ALTERNATE pin mode when setting alternate function

When selecting an alternate function, set the pin to alternate mode as
well; there's no sense requiring two separate calls everywhere.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAllow any STM usart to be used for stdio
Keith Packard [Fri, 23 Mar 2012 07:02:38 +0000 (00:02 -0700)]
Allow any STM usart to be used for stdio

This also adds the alternate pin configurations for the other two
usarts

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAllow for more than one serial port in core AltOS
Keith Packard [Fri, 23 Mar 2012 07:01:50 +0000 (00:01 -0700)]
Allow for more than one serial port in core AltOS

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoMove LCD string output code to ao_lcd_font.c
Keith Packard [Fri, 23 Mar 2012 03:02:30 +0000 (20:02 -0700)]
Move LCD string output code to ao_lcd_font.c

It's all very specific to the 14-segment display, so
stick it there.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd LCD device driver to STM32L port
Keith Packard [Fri, 23 Mar 2012 02:43:29 +0000 (19:43 -0700)]
Add LCD device driver to STM32L port

This enables the 6-digit 14-character display on the STM32L discovery
board and provides an ascii output to it.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd defines for LCD controller and RTC clocking
Keith Packard [Fri, 23 Mar 2012 02:42:18 +0000 (19:42 -0700)]
Add defines for LCD controller and RTC clocking

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoActually enable usarts with the new usart code
Keith Packard [Fri, 23 Mar 2012 02:41:23 +0000 (19:41 -0700)]
Actually enable usarts with the new usart code

And move USART1 to PB6/PB7 to avoid conflicting with
the LCD pins.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoClean up multiple serial port support for STM32L
Keith Packard [Wed, 21 Mar 2012 23:24:06 +0000 (16:24 -0700)]
Clean up multiple serial port support for STM32L

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd support for multiple serial ports on STM32L
Keith Packard [Wed, 21 Mar 2012 23:18:26 +0000 (16:18 -0700)]
Add support for multiple serial ports on STM32L

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoSave/restore PRIMASK register on Cortex-M3
Keith Packard [Mon, 19 Mar 2012 18:25:40 +0000 (11:25 -0700)]
Save/restore PRIMASK register on Cortex-M3

This preserves the interrupt-enabled bit across context switches

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoDon't disable interrupts before saving interrupt flag on AVR
Keith Packard [Mon, 19 Mar 2012 18:24:43 +0000 (11:24 -0700)]
Don't disable interrupts before saving interrupt flag on AVR

This ignores the interrupt disabled state, so we'd always leave
ao_yield with interrupts disabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd .gitignore file to stm-bringup
Keith Packard [Mon, 19 Mar 2012 05:29:51 +0000 (22:29 -0700)]
Add .gitignore file to stm-bringup

Ignore generated binaries

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoFix STM LED driver and blink LEDs on discovery board
Keith Packard [Mon, 19 Mar 2012 05:26:43 +0000 (22:26 -0700)]
Fix STM LED driver and blink LEDs on discovery board

This adds a task to blink the LEDs, after first fixing up the LED
output code to enable the GPIO and talk to the right pins for the
discovery board.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoBasic OS running on STM32L
Keith Packard [Mon, 19 Mar 2012 05:10:02 +0000 (22:10 -0700)]
Basic OS running on STM32L

This gets stm-demo working

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd AO_PANIC_STACK
Keith Packard [Mon, 19 Mar 2012 05:09:20 +0000 (22:09 -0700)]
Add AO_PANIC_STACK

Provide a panic code for stack overflow.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoWhen debugging, send ao_panic message to ao_debug_out
Keith Packard [Mon, 19 Mar 2012 05:08:48 +0000 (22:08 -0700)]
When debugging, send ao_panic message to ao_debug_out

Use the low-level debug hooks to get the panic state sent to the
serial port.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoWhen debugging, send pre-init output to ao_debug_out
Keith Packard [Mon, 19 Mar 2012 05:07:07 +0000 (22:07 -0700)]
When debugging, send pre-init output to ao_debug_out

Before tasking is running, send output to ao_debug_out to help debug
system initialization.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoIncorrect type in ao_task_info for wchan
Keith Packard [Mon, 19 Mar 2012 05:05:46 +0000 (22:05 -0700)]
Incorrect type in ao_task_info for wchan

Would truncate 32-bit pointers on arm.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd stm-demo program
Keith Packard [Sat, 17 Mar 2012 07:06:59 +0000 (00:06 -0700)]
Add stm-demo program

This runs AltOS and talks over the serial port.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoThese were moved to the src/stm directory
Keith Packard [Sat, 17 Mar 2012 03:24:29 +0000 (20:24 -0700)]
These were moved to the src/stm directory

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd stm bringup timers and move most of the setup code to the stm dir
Keith Packard [Sat, 17 Mar 2012 03:23:31 +0000 (20:23 -0700)]
Add stm bringup timers and move most of the setup code to the stm dir

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd STM platform and stm-bringup demo program
Keith Packard [Sat, 17 Mar 2012 03:21:09 +0000 (20:21 -0700)]
Add STM platform and stm-bringup demo program

The stm-bringup doesn't run altos, it just initializes the device and
writes stuff over a serial port. Works on the STM32L Discovery board
at least, should do stuff on other boards too.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoAdd example STM32L programs
Keith Packard [Fri, 16 Mar 2012 21:25:37 +0000 (14:25 -0700)]
Add example STM32L programs

This loads to flash and sends data over the serial link.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years ago'stdin' is a special name in some compiler environments, don't use it.
Keith Packard [Wed, 22 Feb 2012 10:26:03 +0000 (23:26 +1300)]
'stdin' is a special name in some compiler environments, don't use it.

Switch to 'in' in the prototype for altos_serial_set_stdin.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Disable launch controller button
Keith Packard [Wed, 28 Mar 2012 07:49:29 +0000 (00:49 -0700)]
altosui: Disable launch controller button

The launch controller should just be a separate program.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Add Configure Ground Station dialog (trac #29)
Keith Packard [Wed, 28 Mar 2012 07:37:52 +0000 (00:37 -0700)]
altosui: Add Configure Ground Station dialog (trac #29)

Allows the user to configure the teledongle frequency without opening
up the flight monitor window, and also shows the teledongle fixed
values like radio calibration, serial number and software version.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Make sure config values are loaded in 'c s' command
Keith Packard [Wed, 28 Mar 2012 07:38:37 +0000 (00:38 -0700)]
altos: Make sure config values are loaded in 'c s' command

ao_config_get may not have been called when ao_config_show is invoked
by the user, so make sure the config values are loaded before showing
uninitialized data.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Sanity check values from device configuration
Keith Packard [Wed, 28 Mar 2012 05:54:17 +0000 (22:54 -0700)]
altosui: Sanity check values from device configuration

If someone has down-graded and re up-graded the firmware, the config
entries may be garbage. Sanity check them to avoid crashing the UI.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Reset config version if it's too large as well
Keith Packard [Wed, 28 Mar 2012 05:53:08 +0000 (22:53 -0700)]
altos: Reset config version if it's too large as well

Any future config values will get trashed if we down grade the
firmware, so we must reset the firmware version whenever it gets
written.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Make 'monitor idle' work with older TeleMetrum firmware (trac #28)
Keith Packard [Wed, 28 Mar 2012 05:02:13 +0000 (22:02 -0700)]
altosui: Make 'monitor idle' work with older TeleMetrum firmware (trac #28)

Older TM firmware did not have the 'done' line at the end of the GPS
report, rather it would just stop after showing the Flags value. Check
the TM version and stop looking for GPS data when the Flags line appears.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Mark data 'Age' in monitor idle UI too
Keith Packard [Wed, 28 Mar 2012 04:49:58 +0000 (21:49 -0700)]
altosui: Mark data 'Age' in monitor idle UI too

Just like with the flight monitor UI, it's nice to know how old the
data in the monitor idle UI is, in case the data link to the TM isn't reliable.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Catch attempt to set radio frequency to 0.0 -- use default
Keith Packard [Wed, 28 Mar 2012 04:48:43 +0000 (21:48 -0700)]
altosui: Catch attempt to set radio frequency to 0.0 -- use default

Monitor idle was setting the frequency to 0, which takes a while with
the new native radio frequency setting code. Don't do that, instead
pull out the preferred frequency for that, as is done in other places
where a frequency of 0.0 is used.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Find actual landing time when computing stats (trac #23)
Keith Packard [Wed, 28 Mar 2012 04:13:31 +0000 (21:13 -0700)]
altosui: Find actual landing time when computing stats (trac #23)

Look for the last time the height went from >10m to <2m from the
nominal landing altitude and use that as the landing time when
computing things like main descent speed, time under main etc.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Change flight data saving UI to separate download/delete selections
Keith Packard [Wed, 28 Mar 2012 01:24:51 +0000 (18:24 -0700)]
altosui: Change flight data saving UI to separate download/delete selections

First pop up a dialog to select flights for download. Download
them. Then, after that, pop up a *new* dialog to select flights for
delete. Offer to delete all of the downloaded flights by default. Then
delete the flights.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Optimize ao_freq_to_set a bit
Keith Packard [Wed, 28 Mar 2012 01:19:05 +0000 (18:19 -0700)]
altos: Optimize ao_freq_to_set a bit

Reduces size from 327 bytes to 287 bytes

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Show only supported telemetry version
Keith Packard [Tue, 27 Mar 2012 18:58:39 +0000 (11:58 -0700)]
altosui: Show only supported telemetry version

Make it clear in the UI which telemetry versions are supported,
providing the combobox only for new firmware which supports all versions.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Configure radio with new direct frequency setting
Keith Packard [Tue, 27 Mar 2012 17:38:32 +0000 (10:38 -0700)]
altosui: Configure radio with new direct frequency setting

Instead of computing the radio setting in altosui, let the radio do it directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoDo radio settings solely by frequency
Keith Packard [Tue, 27 Mar 2012 06:35:35 +0000 (23:35 -0700)]
Do radio settings solely by frequency

Compute the radio setting needed based on the calibration value
provided and the requested frequency.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Use ConcurrentHashMap for maps
Keith Packard [Tue, 27 Mar 2012 05:05:04 +0000 (22:05 -0700)]
altosui: Use ConcurrentHashMap for maps

This data structure is accessed by multiple threads, so it needs to be
re-entrant.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Show time since last packet in flight status window
Keith Packard [Tue, 27 Mar 2012 05:04:13 +0000 (22:04 -0700)]
altosui: Show time since last packet in flight status window

Makes it easy to see when the UI is wedged, and when telemetry data
are being successfully received.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltosui: Restructure telemetry classes to be more sane
Keith Packard [Tue, 27 Mar 2012 03:11:34 +0000 (20:11 -0700)]
altosui: Restructure telemetry classes to be more sane

 * Make AltosTelemetryRecord be a class, rather than an interface.

 * Inherit from this for AltosTelemetryRecordLegacy and
   AltosTelemetryRecordRaw.

 * Remove bogus AltosTelemetryRecordGeneral class.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoaltos: Require callsign match in packet code
Keith Packard [Wed, 28 Sep 2011 06:50:43 +0000 (23:50 -0700)]
altos: Require callsign match in packet code

Ignore packets with mismatching callsigns to avoid accidental
connections between devices controlled by different stations.

As a special case, if the device is configured with the default
callsign (N0CALL), then let anyone connect. This allows configuration
of new devices without needing to change the ground station callsign.

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agodoc: Add companion SPI message protocol doc
Keith Packard [Fri, 13 Jan 2012 18:40:30 +0000 (10:40 -0800)]
doc: Add companion SPI message protocol doc

Signed-off-by: Keith Packard <keithp@keithp.com>
8 years agoupdate turnon_telemetrum to v1.2, add more turnon scripts
Bdale Garbee [Fri, 13 Jan 2012 17:44:23 +0000 (10:44 -0700)]
update turnon_telemetrum to v1.2, add more turnon scripts