1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00
Commit Graph

363 Commits

Author SHA1 Message Date
Stacey Sheldon
59cb489e01 usb: clean up pios hooks into stm32 usb_core
Reduced scope of many variables since they were being
exposed unnecessarily.

Renamed pios_usb_hid_prop code to pios_usbhook to reflect
the fact that it implements all of the callout functions
that are hooked into the stm32 usb library.
2011-12-30 23:05:33 -05:00
Stacey Sheldon
c0259dc616 usb cdc: USB composite device with HID + VCP 2011-12-30 23:05:33 -05:00
James Cotton
aa698f7b0a Increase the CC IRQ stack to avoid some memory warnings 2011-11-16 09:20:30 -06:00
Oleg Semyonov
f5e82b8242 spektrum: rename Spektrum to DSM (DSM2/DSMJ/DSMX used by Spektrum and JR radios)
No code changes, just file, variable and define names are changed.

First, it better describes the serial protocol used by DSMx satellite
receivers. Second, many people using Spektrum radio, assume Spektrum
protocol. This is the attempt to address those inaccuracies.
2011-11-04 21:40:34 +02:00
Oleg Semyonov
0116e6a007 spektrum: rework DSM2/DSMJ/DSMX driver for explicit DSMX resolution support
- both CC serial ports are now disabled by default (no telemetry);
- serial ports now have DSM2, DSMX (10bit) and DSMX (11bit) options;
- ReceiverGroups now have DSM (MainPort) and DSM (FlexiPort) options.

For DSM2 protocol there is an explicit resolution bit in the stream, so
the DSM2 should be selected. For DSMX there is no such bit, and user
should choose the resolution from the list configuring the spektrum port.
ReceiverGroups have single DSM option which is handled by the same driver.

Downside: this implementation saves received frame first, unrolls by the
end of frame. This should be ok, but may be improved by unrolling channels
on the fly in the rx callback.

Another minor difference is that a ChannelGroup is now bound to port:
DSM (MainPort) or DSM (FlexiPort). This was considered as acceptable
solution in order to not have 6 DSM options for each ChannelGroup and
even more in case of new DSM protocol variations.

Known problem: it is not possible to choose same protocols like
DSM2/DSM2 for two ports. It can be enabled by adding an exception to
common rule, though.

The DSMX throttle channel misbehavior (zero value) is not treated
specially yet. It should trigger the failsafe being out of bounds.
More info and data dumps are required to handle this properly.
2011-10-30 19:29:03 +02:00
Oleg Semyonov
a19bbba858 Merge branch 'next' into os/alternative_spektrum_driver 2011-10-25 11:55:05 +03:00
Oleg Semyonov
58d0812309 sbus: better frame syncronization, some cosmetic changes
In the previous version the decoder could in rare cases get synced from
the middle of data stream in case of data byte equal to the S.Bus start
of frame (SOF) byte (wrong data will be rejected but it was not perfect).
Now it waits for the real start of frame and then checks the SOF byte.
2011-10-22 00:44:09 +03:00
Oleg Semyonov
62bca651d5 spektrum: alternative DSMx (DSM2/DSMJ/DSMX) driver
- does not glitch when used in 2-frame mode (DM9, 9503, etc)
- does NOT provides yet DSMX stream decoding - do NOT merge
- uses a bit more time in the interrupt, but frees 16 bytes of RAM.
  This is done to help decoding the weird DSMX stream which does not
  contain explicit resolution/frame/lost frames info and needs special
  processing (to be done yet).
2011-10-21 23:35:17 +03:00
Oleg Semyonov
92b81e3f88 sbus: refactor the code using unified PIOS RCVR driver structure
- allow more than one S.Bus receiver (needs hardware support)
- use dynamic memory allocation (frees around 72 bytes of RAM when unused)
2011-10-20 18:23:23 +03:00
James Cotton
6457276438 Merge branch 'input_configuration' into next 2011-09-11 18:52:35 -05:00
Oleg Semyonov
f5369f9338 Input Configuration: support all 18 S.Bus input channels 2011-09-12 02:06:50 +03:00
James Cotton
4847a04db8 Mainboard: Get PWM working again. Had to add extra timer IRQ handlers for
TIM5-8.  Also TIM1 was not handled probably (for CC either) as the name of the
IRQ is TIM1_CC and TIM1_UP for the capture compare versus update.  I haven't
checked the downstream code that the registers it uses to map from a context to
event is invariant under timer channel.
2011-09-10 14:20:40 -05:00
James Cotton
eb191d869a Mainboard: Get spektrum working again. 2011-09-10 14:19:54 -05:00
James Cotton
8f7712435f Merge branch 'safer_failsafe' into next 2011-09-06 16:23:11 -05:00
Sambas
a8ef57c6d6 Redo DX8 changes 2011-09-06 08:40:10 +03:00
James Cotton
533ae9bb41 SBUS: Missed handling the S.Bus failsafe. Now returns PIOS_RVCR_TIMEOUT for
either SBus failsafe mode or when no data for 100 ms.
2011-09-04 12:15:34 -05:00
James Cotton
89e640ae7f Make sure all receiver drivers return correct constants for invalid channels. 2011-09-04 01:24:16 -05:00
James Cotton
51967ae63f OP-571 PIOS_PWM: Add back the PWM supervisor 2011-09-04 01:17:40 -05:00
James Cotton
697dbf4f5f OP-568 PIOS_RCVR: Standardize the values that are returned from the PIOS_RCVR and make
them symbolic constants.
- A timeout is 0
- A missing driver is 65534
- An invalid channel is 65535

ManualControl: Make it deal with the values explicitly.  A timed out value
should not be treated like a minimum duration signal.  Instead it does not
updated the scaled value but marks the data window as invalid to trigger the
failsafe.
2011-09-03 23:50:56 -05:00
Stacey Sheldon
43b31efb76 pios: allocate driver instance data from heap
Allocate per-instance data for drivers from the heap
rather than as static variables from the .data segment.

This converts > 800 bytes of RAM from being always consumed
as static data into being allocated from the heap only when
a particular feature is enabled in the hwsettings object.

A minimal config (no receivers, flexi port disabled, main port
disabled) leaves 2448 bytes of free heap.  That's our new baseline.

Approximate RAM (heap) costs of enabling various features:
 + 632 Serial Telemetry (includes 400 bytes of Rx/Tx buffers)
 + 108 PWM Rcvr
 + 152 PPM Rcvr
 + 112 Spektrum Rcvr
 + 24  S.Bus (Should be closer to 68 since driver is still using
              static memory)

There are still some drivers that pre-allocate all of their memory
as static data.  It'll take some work to convert those over to
dynamically allocating their instance data.
2011-08-31 22:35:03 -04:00
Stacey Sheldon
2f86e4dd4f Make PWM/PPM and Servo drivers play nicely together
PWM and PPM can now coexist in the same load and be
selected at boot time via the hwsettings UAVObject.

This is basically a complete restructuring of the
way the drivers interact with the TIM peripheral in
the STM32.

As a side effect, the PWM and PPM drivers are now
ready to support multiple instances of each.

This also provides the first step toward being able
to reassign some of the PWM input pins to be servo
output pins.  Still more work required, but this is
a good start.
2011-08-27 21:39:56 -04:00
Stacey Sheldon
b3c43da90a stdperiph: Make TIM related APIs use const pointers
This allows the configuration parameters to be stored in
flash instead of copied to RAM.
2011-08-27 21:39:17 -04:00
James Cotton
dc340596f5 Merge branch 'next' into GCS_ChangesToUI-RuntimeCFG
Conflicts:
	flight/CopterControl/Makefile
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/UAVObjects.inc
	flight/PiOS/STM32F10x/pios_spektrum.c
	ground/openpilotgcs/src/plugins/config/config.pro
	ground/openpilotgcs/src/plugins/config/configgadget.qrc
	ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
	shared/uavobjectdefinition/hwsettings.xml
2011-08-27 15:26:05 -05:00
James Cotton
5f7a9b513a Merge branch 'sambas/dsmx_stuff' of ssh://git.openpilot.org/OpenPilot into next
Conflicts:
	shared/uavobjectdefinition/hwsettings.xml
2011-08-24 11:37:30 -05:00
James Cotton
9c7799dfe6 UAVObject Init: Get rid of deprecated linker init code 2011-08-10 22:48:42 -05:00
sambas
9f35b6939c Bind IO fix 2011-08-07 10:10:52 +03:00
sambas
1e67b5e3b5 DSMx_binder, hw setting 0 disabled, 1-10 bind pulses. Manual disable after successful bind. Only for flexiport. 2011-08-06 22:16:47 +03:00
sambas
a454cf844b DX8 support, BIND3 only 2011-08-04 19:20:05 +03:00
Stacey Sheldon
06cdeb7b61 rcvr: support multiple simultaneous receivers
Now also supports multiple instances of the Spektrum driver.
These are configured as Spektrum1 and Spektrum2.
2011-08-02 01:22:04 -04:00
Stacey Sheldon
2f79e4fa76 Merge remote branch 'origin/stac/refactor-usart-com' into next 2011-07-31 09:41:06 -04:00
James Cotton
568ea13471 Merge branch 'next' into stac/refactor-usart-com 2011-07-31 09:13:27 +09:00
Stacey Sheldon
8b0415d905 bl: alternate stopwatch for small bootloaders
The small bootloaders (CC and PipX) are out of flash space
so their stopwatch implementation has been swapped out for
one based on the DELAY clock that takes about 500 bytes less
of code space.

Identical functionality is preserved.
2011-07-29 15:33:01 -04:00
Stacey Sheldon
13f9b0e09d Merge remote branch 'origin/OP-498_jwhitlock_add-ppm-to-cc' into next 2011-07-28 22:15:01 -04:00
Stacey Sheldon
a3888ecd48 usart: ensure callbacks are bound in the correct order 2011-07-27 23:21:39 -04:00
Stacey Sheldon
5f8760a55c com: Move buffering out of USART/HID layer and into COM layer
This allows the spektrum and sbus receiver drivers to bind
directly to the usart layer using a properly exported API
rather than overriding the interrupt handler.

Bytes are now pushed directly from the usart layer into the
com layer without any buffering.  The com layer performs all
of the buffering.

A further benefit from this approach is that we can put all
blocking/non-blocking behaviour into the COM layer and not
in the underlying drivers.

Misc related changes:
 - Remove obsolete .handler field from irq configs
 - Adapt all users of PIOS_COM_* functions to new API
 - Fixup callers of PIOS_USB_HID_Init()
2011-07-27 19:45:38 -04:00
James
60136f0464 Add support for PPM transmitters up to 12 channels. Small array indexing issue in PIOS_PPM_Get. 2011-07-27 00:33:32 +01:00
Mike Smith
df5569c758 Fix a stupid off-by-one that prevented this code from working.
Update to use 32-bit microsecond values.

Remove PIOS_DELAY_DiffuS per consensus (caller can do it easily themselves).

Update the core delay logic per Stac's suggestion to a version that is
resistant to various overflows.
2011-07-25 20:55:48 -07:00
James Whitlock
6a6ec41809 Build fixes 2011-07-23 22:10:17 +01:00
Mike Smith
480f07a264 Typo fix. 2011-07-23 13:58:56 -07:00
Mike Smith
0df3bb2c37 Restore functions lost due to inept merging, and refactor to take advantage of them.
Address the following review feedback items:
 - use stdint types
 - avoid the use of magic numbers (define CYCCNTENA)
 - remove expository comment about sneakiness and corresponding code, replace with something simpler based on the API
 - remove commented/#if 0 code
2011-07-23 13:53:16 -07:00
James Whitlock
11c568ec50 Add in a PPM input frame size tracker.
Move update of capture values to start of new frame.
Fix an issue with setting channels to invalid.
2011-07-23 01:38:51 +01:00
James Whitlock
7a58b4cceb A quick clean of ppm code to remove white space and duplicated comments 2011-07-23 01:32:57 +01:00
Mike Smith
6bc5339015 Change the pios_delay implementation to use the CPU cycle counter rather than burning a timer. 2011-07-21 23:21:26 -07:00
Stacey Sheldon
a7cce25252 usart: fix lower usarts clobbering higher ones
The break statements are clearly missing from this
switch statement.

This would lead to problems when using more than one
USART on CC.
2011-07-22 00:30:49 -04:00
James Whitlock
7ce5daef8f Clean up of PPM code in master. 2011-07-19 20:46:24 -04:00
Stacey Sheldon
8dbace5ee2 Merge branch 'rcvr_mem_reduction'
Conflicts:
	flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld
2011-07-17 17:14:40 -04:00
James Cotton
2da65014c7 Fix typo in servo doxygen header 2011-07-16 03:25:33 -05:00
James Cotton
b83f731c03 Remove all references to vTaskDelay in the flash code as it can run before the
FreeRTOS scheduler

Also increaes init stack size from 0x80 to 0x100
2011-07-15 18:16:16 -05:00
Stacey Sheldon
6580462916 rcvr: specify drivers for groups of channels
Each channel was previously tracking a separate driver.
Now, channels are grouped within a channel group to save
RAM used for tracking and to better reflect how channels
are actually mapped.
2011-07-14 23:22:42 -04:00
Stacey Sheldon
442d56c1c5 linker: Add section to record unused RAM
Note that this section will be absorbed by the heap at runtime.
2011-07-14 23:22:42 -04:00