fw/altos
10 years agoaltos/lpc: Add boot loader
Keith Packard [Mon, 24 Jun 2013 21:23:53 +0000 (14:23 -0700)]
altos/lpc: Add boot loader

Support the USB boot loader, add USB pull-up support.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/telefire-v0.1: Use same LED selection as the v0.2 setup
Keith Packard [Sat, 22 Jun 2013 07:53:38 +0000 (00:53 -0700)]
altos/telefire-v0.1: Use same LED selection as the v0.2 setup

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Don't disable all interrupts when disabling one interrupt
Keith Packard [Sat, 22 Jun 2013 02:40:59 +0000 (19:40 -0700)]
altos/lpc: Don't disable all interrupts when disabling one interrupt

The nvic iser and icer registers read value indicates all enabled
interrupts, icer writes disable the set interrupts. Re-writing icer
with the current value ends up disabling all interrupts, not exactly
what we wanted.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Remove ao_usb_task structure
Keith Packard [Sat, 22 Jun 2013 02:40:03 +0000 (19:40 -0700)]
altos/lpc: Remove ao_usb_task structure

It's not used

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Enable brown-out-detector
Keith Packard [Sat, 22 Jun 2013 02:39:27 +0000 (19:39 -0700)]
altos/lpc: Enable brown-out-detector

Make sure the processor does something sensible when the power disappears.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/telefire: Radio status (no data, weak data, good data) on LEDs
Keith Packard [Thu, 20 Jun 2013 05:45:54 +0000 (22:45 -0700)]
altos/telefire: Radio status (no data, weak data, good data) on LEDs

Instead of blinking RX/TX, report the radio status on the telefire
nodes, just like telelco does. This makes the LEDs on telefire
*exactly the same* as the LEDs on telelco, which seems like a good idea.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: PCA9922 LED driver needs Enable driven low to latch values
Keith Packard [Thu, 20 Jun 2013 05:44:16 +0000 (22:44 -0700)]
altos: PCA9922 LED driver needs Enable driven low to latch values

Driving Enable high means anything going past on the clock and data
pair is reflected on the LEDs, which isn't terribly useful

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/cc1111: Fetch RSSI for TeleFire from correct byte
Keith Packard [Thu, 20 Jun 2013 05:42:58 +0000 (22:42 -0700)]
altos/cc1111: Fetch RSSI for TeleFire from correct byte

Reading the status byte doesn't provide very useful RSSI info

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Get rid of ADC filter
Keith Packard [Mon, 17 Jun 2013 21:52:32 +0000 (14:52 -0700)]
altos/lpc: Get rid of ADC filter

Now that the source of the Vcc noise has been identified, remove the
unnecessary ADC filtering.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltosui: Add raw pressure to the AltosUI graph
Keith Packard [Mon, 17 Jun 2013 21:00:43 +0000 (14:00 -0700)]
altosui: Add raw pressure to the AltosUI graph

A nice addition, and useful when diagnosing baro sensor issues

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Get the IRC turned off after boot time
Keith Packard [Mon, 17 Jun 2013 21:00:11 +0000 (14:00 -0700)]
altos/lpc: Get the IRC turned off after boot time

This involved carefully moving the USB away from the IRC before
turning it off.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Disable USB on all flight computers when in flight mode
Keith Packard [Mon, 17 Jun 2013 20:58:41 +0000 (13:58 -0700)]
altos: Disable USB on all flight computers when in flight mode

There was a check to only disable USB on boards with radios, but for
EasyMini, we want to disable USB too for flight mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Declare m25 write-in-progress as 'ao_port_t'
Keith Packard [Mon, 17 Jun 2013 05:32:16 +0000 (22:32 -0700)]
altos: Declare m25 write-in-progress as 'ao_port_t'

This lets us use port bits greater than 7 for M25 chip selects

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Remove spurious semicolon
Keith Packard [Mon, 17 Jun 2013 05:31:58 +0000 (22:31 -0700)]
altos/lpc: Remove spurious semicolon

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Don't disable all of the clocks just yet, USB doesn't work
Keith Packard [Mon, 17 Jun 2013 05:31:31 +0000 (22:31 -0700)]
altos/lpc: Don't disable all of the clocks just yet, USB doesn't work

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Turn off more clocks, disable USART for easymini
Keith Packard [Sun, 16 Jun 2013 22:07:54 +0000 (15:07 -0700)]
altos/lpc: Turn off more clocks, disable USART for easymini

Try to reduce noise on the power supply.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Filter ADC inputs
Keith Packard [Sat, 15 Jun 2013 08:20:49 +0000 (01:20 -0700)]
altos/lpc: Filter ADC inputs

They're amazingly noisy on EasyMini, so just filter them as the only
thing we use them for is battery and pyro numbers.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Make ADC inputs work
Keith Packard [Fri, 14 Jun 2013 11:38:11 +0000 (04:38 -0700)]
altos/lpc: Make ADC inputs work

They're still very unstable (bouncing around a lot), but at least they
seem to report useful stuff now.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltosui: Use preferred units for main deployment height configuration
Keith Packard [Tue, 11 Jun 2013 23:31:20 +0000 (16:31 -0700)]
altosui: Use preferred units for main deployment height configuration

Show and accept values in the preferred units; create a separate list
of preferred values for each set of units

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/telelco: Add 30ms delay in search after finding a box
Keith Packard [Mon, 10 Jun 2013 06:18:09 +0000 (23:18 -0700)]
altos/telelco: Add 30ms delay in search after finding a box

This gives the remote boxes time to get back to listening for messages
after receiving the packet from the found box.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add fast-timer API. Use for quadrature and button drivers
Keith Packard [Mon, 10 Jun 2013 05:09:13 +0000 (22:09 -0700)]
altos: Add fast-timer API. Use for quadrature and button drivers

This splits the fast-timer portion out of the debounce helper code and
shares that with the quadrature driver which now uses it directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add debounce helper. Use in button and quadrature drivers for TeleLCO
Keith Packard [Tue, 14 May 2013 05:34:19 +0000 (22:34 -0700)]
altos: Add debounce helper. Use in button and quadrature drivers for TeleLCO

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/telefire: Leave siren on all the time. Add siren/strobe debugging.
Keith Packard [Sun, 9 Jun 2013 19:13:06 +0000 (12:13 -0700)]
altos/telefire: Leave siren on all the time. Add siren/strobe debugging.

The 50% duty cycle wasn't actually loud enough outside.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add telefire v0.2 support
Keith Packard [Sun, 9 Jun 2013 17:00:54 +0000 (10:00 -0700)]
altos: Add telefire v0.2 support

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add driver for 74hc165 shift register
Keith Packard [Sun, 9 Jun 2013 16:53:07 +0000 (09:53 -0700)]
altos: Add driver for 74hc165 shift register

Just reads one byte from the shift register using the SPI driver and returns it

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add pyro operations to regular ignite commands
Keith Packard [Mon, 27 May 2013 04:38:56 +0000 (22:38 -0600)]
altos: Add pyro operations to regular ignite commands

Instead of having separate commands, just mix the two sets together.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoSet version to 1.2.9.1
Keith Packard [Mon, 27 May 2013 01:41:22 +0000 (19:41 -0600)]
Set version to 1.2.9.1

Mark bits to be used on Monday of NSL 2013

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Make manual pyro firing command work again
Keith Packard [Mon, 27 May 2013 01:48:03 +0000 (19:48 -0600)]
altos: Make manual pyro firing command work again

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: write pyro fired to correct log field
Keith Packard [Mon, 27 May 2013 01:47:02 +0000 (19:47 -0600)]
altos: write pyro fired to correct log field

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Light pyro charges simultaneously if so configured
Keith Packard [Mon, 27 May 2013 01:39:13 +0000 (19:39 -0600)]
altos: Light pyro charges simultaneously if so configured

Don't try to be nice to the battery, just let the pyro circuit deal
with it and try to get all of the specified circuits going at the same
time if they're configured to do so.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos,altosui: Add pyro state logging for TeleMega
Keith Packard [Mon, 27 May 2013 01:03:12 +0000 (19:03 -0600)]
altos,altosui: Add pyro state logging for TeleMega

Only in the log file (no obvious space in the telem packets), but at
least we should be able to check for pyro failures.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add pyro code testing to ao_flight_test for TeleMega
Keith Packard [Mon, 27 May 2013 01:01:58 +0000 (19:01 -0600)]
altos: Add pyro code testing to ao_flight_test for TeleMega

This parses the pyro settings and signals when the pyro channels are
fired in the output.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoao-tools/ao-mega: Dump 'pyro' state from mega log
Keith Packard [Mon, 27 May 2013 00:58:41 +0000 (18:58 -0600)]
ao-tools/ao-mega: Dump 'pyro' state from mega log

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoao-tools: Add ao-mega tool to parse TeleMega eeprom files
Keith Packard [Mon, 27 May 2013 00:57:58 +0000 (18:57 -0600)]
ao-tools: Add ao-mega tool to parse TeleMega eeprom files

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltosui: Missing 'break' after selecting 'mega' format detection
Keith Packard [Mon, 27 May 2013 00:54:02 +0000 (18:54 -0600)]
altosui: Missing 'break' after selecting 'mega' format detection

Caused 'mega' logs to be dumped in 'mini' format which didn't work well.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltosui: Stop downloading mega eeprom on empty block
Keith Packard [Mon, 27 May 2013 00:50:10 +0000 (18:50 -0600)]
altosui: Stop downloading mega eeprom on empty block

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodoc: Update description of graph window to note new tabs (config and map)
Keith Packard [Tue, 21 May 2013 04:41:01 +0000 (21:41 -0700)]
doc: Update description of graph window to note new tabs (config and map)

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoCreate release notes for 1.2.1
Keith Packard [Tue, 21 May 2013 04:37:20 +0000 (21:37 -0700)]
Create release notes for 1.2.1

Move most of the 1.2 content to the 1.2.1 block

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoSeparate out cortex-m0 compiler tests in configure
Keith Packard [Tue, 21 May 2013 18:31:05 +0000 (11:31 -0700)]
Separate out cortex-m0 compiler tests in configure

The summon arm toolchain doesn't work for cortex-m0 parts, but the
linaro toolchain does. Look in /usr/bin for the -m0 compiler but
continue to use /opt/cortex/bin for the -m3 compiler

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Can't use inline functions because SDCC doesn't do that
Keith Packard [Tue, 21 May 2013 18:30:44 +0000 (11:30 -0700)]
altos: Can't use inline functions because SDCC doesn't do that

Sigh.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge branch 'lpc'
Keith Packard [Tue, 21 May 2013 18:16:54 +0000 (11:16 -0700)]
Merge branch 'lpc'

10 years agoBump master version to 1.2.9 to avoid confusion with 1.2 releases
Keith Packard [Tue, 21 May 2013 18:16:33 +0000 (11:16 -0700)]
Bump master version to 1.2.9 to avoid confusion with 1.2 releases

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Set the path for the STM32L compiler explicitly
Keith Packard [Tue, 21 May 2013 18:08:15 +0000 (11:08 -0700)]
altos: Set the path for the STM32L compiler explicitly

This makes sure we use the known toolchain for STM32L builds

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltosui: Add TeleBT firmware to release
Keith Packard [Tue, 21 May 2013 18:04:25 +0000 (11:04 -0700)]
altosui: Add TeleBT firmware to release

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoAdd Mini logging format. Use in EasyMini lpc
Keith Packard [Mon, 20 May 2013 06:07:54 +0000 (23:07 -0700)]
Add Mini logging format. Use in EasyMini

This is a 16-byte record that includes all of the sensor data in each
sensor record, along with records for flight state changes.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge branch 'master' into lpc
Keith Packard [Mon, 20 May 2013 03:40:42 +0000 (20:40 -0700)]
Merge branch 'master' into lpc

10 years agoaltos/telemega: The last two igniters are apogee and main
Keith Packard [Mon, 20 May 2013 03:35:42 +0000 (20:35 -0700)]
altos/telemega: The last two igniters are apogee and main

Not the first two. TeleMega v0.3 has these marked on the silk

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/easymini: Initialize beep and ADC. Declare use of igniter bits.
Keith Packard [Mon, 20 May 2013 03:33:35 +0000 (20:33 -0700)]
altos/easymini: Initialize beep and ADC. Declare use of igniter bits.

This makes easymini actually work!

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/easymini: Use different pins for igniter outputs
Keith Packard [Mon, 20 May 2013 03:32:34 +0000 (20:32 -0700)]
altos/easymini: Use different pins for igniter outputs

Was using the I2C outputs which are open drain, which makes it
impossible to force them high as needed to driver our igniters.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/easymini: MS5607 chip select bits were defined wrong
Keith Packard [Mon, 20 May 2013 03:31:48 +0000 (20:31 -0700)]
altos/easymini: MS5607 chip select bits were defined wrong

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/easymini: Easymini doesn't have USB connect or VBUS wiring
Keith Packard [Mon, 20 May 2013 03:30:49 +0000 (20:30 -0700)]
altos/easymini: Easymini doesn't have USB connect or VBUS wiring

Disable these in ao_pins.h

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Force idle mode if USB gets an address during boot time
Keith Packard [Mon, 20 May 2013 03:27:53 +0000 (20:27 -0700)]
altos/lpc: Force idle mode if USB gets an address during boot time

This lets EasyMini be booted to idle mode by simply plugging it into USB.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Reset SPI device at startup time
Keith Packard [Mon, 20 May 2013 03:27:05 +0000 (20:27 -0700)]
altos/lpc: Reset SPI device at startup time

Wasn't doing the reset sequence correctly (write 0, then write 1).

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Configuring wrong pin for SPI1 MOSI
Keith Packard [Mon, 20 May 2013 03:26:07 +0000 (20:26 -0700)]
altos/lpc: Configuring wrong pin for SPI1 MOSI

Was setting configuration for PIO1_21 instead of PIO0_21.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Allow for alternate SPI SCLK0 pin usage
Keith Packard [Mon, 20 May 2013 03:25:13 +0000 (20:25 -0700)]
altos/lpc: Allow for alternate SPI SCLK0 pin usage

SPI SCLK0 can appear on three different pins; let the application
configure which one it wants.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Leave SPI enabled all the time
Keith Packard [Mon, 20 May 2013 03:24:11 +0000 (20:24 -0700)]
altos/lpc: Leave SPI enabled all the time

Might be able to turn it off with some care; more experimentation required.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Create TX/RX busy macros for SPI driver
Keith Packard [Mon, 20 May 2013 03:22:20 +0000 (20:22 -0700)]
altos/lpc: Create TX/RX busy macros for SPI driver

Check for both fifo status *and* device busy to make sure the device
is idle before we touch any registers.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Fix beeper driver
Keith Packard [Mon, 20 May 2013 03:19:15 +0000 (20:19 -0700)]
altos/lpc: Fix beeper driver

Set prescale limit, not current prescale value (pr instead of pc).
Flip output 1 on PWM match (set emc toggle for channel 1).
Don't hold counter in reset (turn off CRST bit).

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Missing parens around ao_gpio_set macro
Keith Packard [Mon, 20 May 2013 03:18:44 +0000 (20:18 -0700)]
altos/lpc: Missing parens around ao_gpio_set macro

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: SPI runs off main clock (48MHz), not sysclk (24MHz)
Keith Packard [Mon, 20 May 2013 03:17:48 +0000 (20:17 -0700)]
altos/lpc: SPI runs off main clock (48MHz), not sysclk (24MHz)

Update SPI speed definitions to match

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Pull ADC data from the correct registers
Keith Packard [Mon, 20 May 2013 03:07:52 +0000 (20:07 -0700)]
altos/lpc: Pull ADC data from the correct registers

Was just stepping through register space arbitrarily, which would have
worked for EasyMini, but might have failed later if the ADC pin usage
wasn't consecutive.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Don't use loader to place USB endpoint data in USB ram
Keith Packard [Mon, 20 May 2013 03:06:03 +0000 (20:06 -0700)]
altos/lpc: Don't use loader to place USB endpoint data in USB ram

Instead, just assign a fixed address in registers.ld. This avoids a
confusing section in the elf file.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add EXTI_PIN_NOCONFIGURE to exti interface, use for MS5607
Keith Packard [Mon, 20 May 2013 03:04:29 +0000 (20:04 -0700)]
altos: Add EXTI_PIN_NOCONFIGURE to exti interface, use for MS5607

This asks the EXTI code to not mess with the pin configuration so that
the MS5607 driver can get interrupts on the MISO pin while still using
it for SPI.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Make EXTI code work.
Keith Packard [Mon, 20 May 2013 03:00:24 +0000 (20:00 -0700)]
altos/lpc: Make EXTI code work.

Clear rise/fall bits in ISR to avoid re-entering.
Block interrupts around enable/disable bits.
Create shared _ao_exti_set_enable function to control mask changes.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Use ao_spi_get/put_bit in MS5607 driver
Keith Packard [Mon, 20 May 2013 02:57:23 +0000 (19:57 -0700)]
altos: Use ao_spi_get/put_bit in MS5607 driver

Replace open-coded ao_spi_get/put and ao_gpio_set sequences

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/attiny: Fix ao_spi_get_bit/ao_spi_put_bit macros
Keith Packard [Mon, 20 May 2013 02:51:32 +0000 (19:51 -0700)]
altos/attiny: Fix ao_spi_get_bit/ao_spi_put_bit macros

These were never written, so just use ao_spi_get/put_mask.

A precursor to changing how the MS5607 drives the SPI bus

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: ignore built files in easymini-v0.1
Keith Packard [Sat, 18 May 2013 10:54:30 +0000 (03:54 -0700)]
altos: ignore built files in easymini-v0.1

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Build easymini-v0.1
Keith Packard [Sat, 18 May 2013 10:53:32 +0000 (03:53 -0700)]
altos: Build easymini-v0.1

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Initialize SPI for easymini
Keith Packard [Sat, 18 May 2013 10:52:59 +0000 (03:52 -0700)]
altos: Initialize SPI for easymini

Doesn't work very well without this

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Stick USB control structure in USB memory
Keith Packard [Sat, 18 May 2013 10:52:14 +0000 (03:52 -0700)]
altos/lpc: Stick USB control structure in USB memory

No reason to have that in regular ram, and it means we've got space
for large enough stacks now

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add easymini-v0.1 product
Keith Packard [Sat, 18 May 2013 10:22:10 +0000 (03:22 -0700)]
altos: Add easymini-v0.1 product

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Use separate interrupt stack
Keith Packard [Sat, 18 May 2013 10:21:43 +0000 (03:21 -0700)]
altos/lpc: Use separate interrupt stack

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Try a smaller stack.
Keith Packard [Sat, 18 May 2013 10:21:20 +0000 (03:21 -0700)]
altos/lpc: Try a smaller stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Add pin interrupt driver
Keith Packard [Sat, 18 May 2013 10:19:41 +0000 (03:19 -0700)]
altos/lpc: Add pin interrupt driver

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Add beep driver
Keith Packard [Sat, 18 May 2013 10:18:55 +0000 (03:18 -0700)]
altos/lpc: Add beep driver

Hardwired to our current beeper pin

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Add ADC driver
Keith Packard [Sat, 18 May 2013 10:18:19 +0000 (03:18 -0700)]
altos/lpc: Add ADC driver

Uses burst mode to get the whole set of values in one interrupt

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: add gpio int, spi, adc and ct32b defines to lpc.h
Keith Packard [Sat, 18 May 2013 10:16:41 +0000 (03:16 -0700)]
altos/lpc: add gpio int, spi, adc and ct32b defines to lpc.h

Lots more devices

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Clean up broken IOCONF defines
Keith Packard [Sat, 18 May 2013 10:15:58 +0000 (03:15 -0700)]
altos/lpc: Clean up broken IOCONF defines

Missing comment closes

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Fix ao_enable_input, add ao_enable_analog
Keith Packard [Sat, 18 May 2013 10:14:57 +0000 (03:14 -0700)]
altos/lpc: Fix ao_enable_input, add ao_enable_analog

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: LPC interrupt priorities are just 0-3
Keith Packard [Sat, 18 May 2013 10:14:16 +0000 (03:14 -0700)]
altos: LPC interrupt priorities are just 0-3

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Add LPC spi driver
Keith Packard [Sat, 18 May 2013 10:13:17 +0000 (03:13 -0700)]
altos: Add LPC spi driver

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Use ao_port_t in m25 driver
Keith Packard [Sat, 18 May 2013 10:02:38 +0000 (03:02 -0700)]
altos: Use ao_port_t in m25 driver

This uses ao_port_t for all of the chip select masks

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Use ao_data_pres macro in ao_log_tiny
Keith Packard [Sat, 18 May 2013 10:02:01 +0000 (03:02 -0700)]
altos: Use ao_data_pres macro in ao_log_tiny

Now it works on easymini too

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Check for packet mode before trying to disable it in flight code
Keith Packard [Sat, 18 May 2013 09:54:55 +0000 (02:54 -0700)]
altos: Check for packet mode before trying to disable it in flight code

This is only relevant for telemini

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: ao_data_get is in ao_data.c now, not ao_adc.c
Keith Packard [Sat, 18 May 2013 09:54:30 +0000 (02:54 -0700)]
altos: ao_data_get is in ao_data.c now, not ao_adc.c

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Allow architecture to define the type of port registers
Keith Packard [Sat, 18 May 2013 09:53:32 +0000 (02:53 -0700)]
altos: Allow architecture to define the type of port registers

LPC11U14 has 32-bit ports, STM32 has 16 bit ports.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Move ao_data.c from stm to core
Keith Packard [Sat, 18 May 2013 09:52:49 +0000 (02:52 -0700)]
altos: Move ao_data.c from stm to core

This should be used on every processor

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Get USB working
Keith Packard [Fri, 17 May 2013 10:36:47 +0000 (03:36 -0700)]
altos/lpc: Get USB working

The lpc demo now has a USB command line.
Also allocates system stack so we know when ram is tight at build time

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Allow target-specific USB endpoint specifications
Keith Packard [Fri, 17 May 2013 01:58:24 +0000 (18:58 -0700)]
altos: Allow target-specific USB endpoint specifications

The LPC has only a small number of endpoints, and those are not
configurable. Let the LPC USB driver pick the IN and OUT endpoints by itself.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos: Finish off LPC USB register definitions
Keith Packard [Wed, 8 May 2013 02:27:17 +0000 (19:27 -0700)]
altos: Finish off LPC USB register definitions

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Start adding USB register defines
Keith Packard [Fri, 26 Apr 2013 03:38:32 +0000 (20:38 -0700)]
altos/lpc: Start adding USB register defines

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Start adding USB register definitions
Keith Packard [Mon, 22 Apr 2013 22:10:24 +0000 (17:10 -0500)]
altos/lpc: Start adding USB register definitions

Just the bare struct, no defines yet.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Take advantage of USART TX fifo
Keith Packard [Sat, 20 Apr 2013 05:40:38 +0000 (00:40 -0500)]
altos/lpc: Take advantage of USART TX fifo

The USART has a 16-byte TX fifo; keep rough track of how full it is to
avoid waiting for an interrupt after every TX byte.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Get USART running
Keith Packard [Sat, 20 Apr 2013 05:20:55 +0000 (00:20 -0500)]
altos/lpc: Get USART running

Adds a simple demo thread that spews data to the serial port

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/lpc: Get 100Hz timer running
Keith Packard [Thu, 18 Apr 2013 21:15:52 +0000 (16:15 -0500)]
altos/lpc: Get 100Hz timer running

Use systick, which is built into the ARM core

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agolpcxpresso: Add ao_demo.c
Keith Packard [Thu, 18 Apr 2013 20:55:26 +0000 (15:55 -0500)]
lpcxpresso: Add ao_demo.c

Kinda necessary for the demo to build

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agolpc: Initial lpcxpresso bits
Keith Packard [Thu, 18 Apr 2013 20:54:13 +0000 (15:54 -0500)]
lpc: Initial lpcxpresso bits

This gets the LPC11U14 clock set to the PLL and blinks the LED.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agolibaltos: use PurgeComm in Windows altos_close to abort in-progress ops
Keith Packard [Fri, 17 May 2013 10:34:50 +0000 (03:34 -0700)]
libaltos: use PurgeComm in Windows altos_close to abort in-progress ops

Instead of manually signalling the related events, use PurgeComm which
can then abort the operations itself. Also make sure all of the
relevant handles are set to INVALID before closing them to avoid race conditions.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agolibaltos: Build the linux library targets when doing a 'fat' build
Keith Packard [Fri, 17 May 2013 10:27:20 +0000 (03:27 -0700)]
libaltos: Build the linux library targets when doing a 'fat' build

These are necessary for the fat release, so make sure they're built then.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoaltos/cc1111: Hack on USB driver to make Windows happy
Keith Packard [Fri, 17 May 2013 10:21:08 +0000 (03:21 -0700)]
altos/cc1111: Hack on USB driver to make Windows happy

The Windows modem driver is quite chatty at startup time, getting and
setting the comm parameters each time the device is opened. Sometimes,
when setting the parameters, the cc1111 would STALL EP0.

Most of the time, Windows would happily pass this as an error back to
AltosUI which would then re-try the open (and succeed, most of the
time).

Sometimes, Windows would stall for 30 seconds before passing the error
back. This made the whole UI freeze, and I suspect most people assumed
our app had died.

A bit of analysis with the beagle USB sniffer and I discovered the
STALL settings, but there wasn't any correlation between the data on
the wire and when the STALL would be generated.

So, I found a couple of other cc1111 USB stacks on the net and just
looked to see how our driver differed. There wasn't anything clearly
related, but there were a list of small differences:

 1) Other drivers didn't bother waiting for the hardware to
    ack the USBADDR setting; doing it this way means we can set
    the address *before* acking the setup packet. It'll get
    set eventually, at which point the device will start responding to
    packets again.

    Easy to fix, and saves a bit of code space too.

 2) The other drivers set the STALL bit for setup packets which aren't
    understood. This shouldn't have any effect on 'good' systems as
    those shouldn't ever be generating bogus setup packets anyways.

    The driver already handled the STALL state in the interrupt
    handler, the only requirement was to figure out when to explicitly
    set the STALL bit.

    That required moving the state updating code from the start of the
    ep0 setup handling to the end, after the setup packet had been
    examined and data queued in or out as appropriate.

 3) Our driver explicitly queued an IN packet for any setup request
    that wasn't waiting for an OUT pack. This appears to tie in with
    the USBADDR change above as before I made that change, this change
    caused the driver to fail to respond to most setup packets.

    This was simple once the above change was made, just move the
    generation of the IN packet inside the code that switched to the
    IN state.

Signed-off-by: Keith Packard <keithp@keithp.com>