Commit Graph

66 Commits

Author SHA1 Message Date
Andrew Tridgell fe07a73935 HAL_PX4: don't clear buffers if no baudrate change 2018-07-12 11:41:31 +10:00
Michael du Breuil 512939a839 AP_HAL_PX4: Clear UART buffers when opening a port 2018-06-26 02:18:18 +01:00
Andrew Tridgell 36ebb14b2e HAL_PX4: take account of available bytes in receive_time_constraint_us 2018-05-21 14:53:18 +10:00
Andrew Tridgell 93cdb15aca HAL_PX4: implement uart timestamp API 2018-05-16 18:49:22 +10:00
Andrew Tridgell c62dbcdb62 HAL_PX4: allow for printf from multiple threads
this is useful for hal.console
2018-01-15 11:46:02 +11:00
Randy Mackay 9b81c133f6 AP_HAL_PX4: fix compiler warning in UARTDriver 2017-12-09 12:18:49 +09:00
Mark Whitehorn b1b1c0218f AP_HAL_PX4: clean whitespace 2017-11-30 10:20:04 +11:00
Mark Whitehorn 12ea8efa84 AP_HAL_PX4: support SBusOut
add unbuffered writes and uart config
2017-11-30 10:20:04 +11:00
murata d619d33374 AP_HAL_PX4: UARTDriver: Delete the condition that does not hold. 2016-12-05 16:53:36 -08:00
Lucas De Marchi a3140df24a AP_HAL_PX4: UARTDriver: remove commented out code
This is not working and there's no reason to keep it around.
2016-10-27 10:35:01 -03:00
Lucas De Marchi ec4d1eefca AP_HAL_PX4: UARTDriver: fix trailing whitespaces 2016-10-27 10:35:01 -03:00
Lucas De Marchi 4df627693d AP_HAL_PX4: UARTDriver: fix writting with failures
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.

While at it, just like in the write case, explain why we are stopping.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 4346f1dd83 AP_HAL_PX4: fix resetting TX buffer
We can't give the TX buffer 16 bytes more since next time begin() is
called it will compare the buffer size to the value the caller is trying
to set.  In this case we would free and alloc the buffer again each time
begin was called.
2016-10-27 14:23:43 +11:00
Murilo Belluzzo c7a65a026c AP_HAL_PX4: UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:23:43 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Murilo Belluzzo 077e03678f Global: Adapt Stream class to be used with Ringbuffer 2016-08-03 01:44:02 -03:00
Caio Marcelo de Oliveira Filho a76c9e0051 AP_HAL_PX4: use millis/micros/panic functions 2015-11-20 12:31:13 +09:00
Brad Bosch 6e9756ff79 HAL_PX4: Rework support for FLOW_CONTROL_AUTO.
Now instead of requiring the buffer to fill completely before we can
detect it is not draining, we use a time based mechanism to detect
when none of the first few bytes are transmitted after sitting in our
buffer a half second or more after flow control is enabled.  This
huristic is reliable only for the first several chracters because we
believe that the radio must still have plenty of room in it's own
buffers at that time even if it is not able to transmit them to the
other radio yet.  Note that the original algorithm made the same
assumption.

The new algorithm is especially helpful for cases where only keepalive
messages are transmitted before other packets can be requested by the
GCS.  In this situation, the original code required almost 2 minutes
to disable flow control and allow communication with the GCS.
2015-08-19 15:21:10 +10:00
Lucas De Marchi 83cfaf4a59 AP_HAL_PX4: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:51 +10:00
Gustavo Jose de Sousa 08333f1ffe AP_HAL_PX4: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Andrew Tridgell 1b61f6f636 HAL_PX4: fixed USB connected on AUAV-X2
this is the 2nd attempt at a fix for the usb_connected status on
AUAV-X2
2015-08-11 11:42:02 +10:00
Tom Pittenger 179c72bfa9 HAL_PX4: fix compile warning re member init order 2015-04-24 14:14:38 +09:00
Andrew Tridgell 7cd7ff89fd HAL_PX4: recover 12k of ram from USB buffers
faster NuttX means we don't need such larger buffers
2015-03-27 15:08:52 -07:00
Jonathan Challinger e908fcafb1 AP_HAL_PX4: attempt to initialize USB while soft-disarmed 2015-02-11 20:57:27 +11:00
Andrew Tridgell 464714f1ab HAL_PX4: fixed build warning 2015-01-09 11:37:46 +11:00
Andrew Tridgell 0c73dc2440 HAL_PX4: use common RingBuffer.h 2015-01-07 08:41:14 +11:00
Matthias Badaire 1d3a49e466 AP_HAL_PX4 : make UARTDriver capable to be called from different threads.
The modification allows the read and write functions to be called by any thread but the calling thread must be the last one that called the begin() function.
2014-11-14 13:51:16 +11:00
Andrew Tridgell 10b0ca7ea8 HAL_PX4: reduce the number of times we split up UART reads and writes 2014-10-09 12:29:25 +11:00
Andrew Tridgell 48247b6adc HAL_PX4: minimise usage of hrt_absolute_time() 2014-08-20 09:10:24 +10:00
Andrew Tridgell 0a20d0db60 HAL_PX4: prevent read past end of buffer 2014-08-19 10:08:17 +10:00
Andrew Tridgell a7d6a26bec HAL_PX4: fixed auto-flow control
the 6 bytes written to break the radio out of bootloader broke
auto flowcontrol detection
2014-05-19 22:02:39 +10:00
Andrew Tridgell 4e2e685d7a HAL_PX4: better fix for IFLOW on all ports
the tcsetattr() call fails to apply the baudrate if the port has no
RTS pin and we ask for IFLOW. So just make a separate call.
2014-02-12 17:47:23 +11:00
Andrew Tridgell b2cdd39a99 HAL_PX4: don't enable IFLOW on ports without flow control
this should have been harmless, but breaks the GPS on Pixhawk. This
disables it until we work out why.
2014-02-12 17:32:07 +11:00
Andrew Tridgell c5c1d1358a HAL_PX4: added automatic hardware flow control detection
this allows us to detect if hardware flow control is not available and
automatically disable it
2014-02-11 12:11:26 +11:00
Andrew Tridgell 3e637ac5d9 AP_HAL: added enable_flow_control() option in AP_HAL 2014-02-10 12:54:50 +11:00
Andrew Tridgell a95868e124 HAL_PX4: even larger tx buffer size for faster log transfer 2013-12-28 16:01:48 +11:00
Andrew Tridgell ff7004fcc5 HAL_PX4: use larger buffers on USB 2013-12-28 14:25:54 +11:00
Andrew Tridgell 0b25ff0a16 HAL_PX4: added uartD 2013-11-23 19:29:22 +11:00
Andrew Tridgell 24d1cf3bd6 HAL_PX4: don't check USB for data if not connected 2013-11-05 14:41:42 +11:00
Andrew Tridgell e34cc6dd9a HAL_PX4: added some UART debugging
this may help to track down USB issues
2013-10-13 12:43:25 +11:00
Andrew Tridgell ad30f8effa HAL_PX4: try to reopen UARTs if safety switch is disarmed
this allows attaching to the USB port after power on

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-05 15:47:28 +10:00
Andrew Tridgell 7067569103 HAL_PX4: fixed end() on UARTs 2013-09-29 12:04:36 +10:00
Andrew Tridgell 40af9ab674 AP_HAL_PX4: updates for new API 2013-09-22 12:22:05 +10:00
Andrew Tridgell 05b426c1fc HAL_PX4: use common printf implementation on UARTs 2013-09-21 14:23:52 +10:00
Andrew Tridgell 2340bb6220 PX4: use a minimum transmit buffer for UARTs of 512 bytes
this avoids writes stalling on the GPS port. We can't afford this
memory on APM2, but we can on PX4, and it means that while the GPS is
blocking at startup it doesn't cause any scheduler slips
2013-08-30 13:01:33 +10:00
Andrew Tridgell 0916388ab5 HAL_PX4: retry opening UARTs up to 5 times
this seems to help a lot with the USB port on PX4
2013-07-11 13:50:23 +10:00
Andrew Tridgell 8766e86091 HAL_PX4: fixed blocking bulk writes to UARTs
this fixes a problem with uBlox initialisation on PX4
2013-03-20 15:41:52 +11:00
Andrew Tridgell 14911eff6c HAL_PX4: added a (disabled) trick for handling blocking ttyACM0
this doesn't work yet, but is worth having for debugging
2013-03-20 11:20:43 +11:00
Andrew Tridgell c373429a6e HAL_PX4: fixed a buffer handling bug
BUF_SPACE() was badly buggy, which could lead to memory corruption
2013-02-20 18:15:56 +11:00
Andrew Tridgell 54e7bce75e HAL_PX4: cope with O_NONBLOCK not working in NuttX on ttyACM0
writes will block anyway, which clags up APM
2013-02-19 12:02:46 +11:00