Support programming of Arduino devices in serial passthrough mode (#5129)
commit5558174d339ba4d75ddd5e42f4a9741400d458ca
authorSteveCEvans <SteveCEvans@users.noreply.github.com>
Wed, 21 Mar 2018 10:17:31 +0000 (21 10:17 +0000)
committerMichael Keller <github@ike.ch>
Wed, 21 Mar 2018 10:17:31 +0000 (21 23:17 +1300)
treed316d9b5059a5a56a01c1579565d618f5b6eca13
parent46291a8374a08df8e7a81230d999962419a081bd
Support programming of Arduino devices in serial passthrough mode  (#5129)

* Support DTR in serial passthrough mode to enable programming of Arduino
based devices such as MinimOSD.

Use 'serialpassthrough 5 57600 rxtx 56' and then use Ardino to program MinimOSD
Use 'serialpassthrough 5 115200' and then use MWOSD configurator to setup

* Fix comment for CDC_SetCtrlLineStateCb routine

* Handle F7 CDC interface

* Use strToPin() to allow easy port/pin specification

* Fix use of CDC_SetCtrlLineStateCb for all processor types

* Only set baud when specified

* Fix unit tests for cli

* Only register callback if needed

* Fix white space

* Provide implementation of IOConfigGPIO in SITL

* Update serialpassthrough help text

* DTR handling through serial drivers

* Fix F3, F7 and SITL builds

* If serialpassthrough command specifies baud rate of 0, set baud rate over USB. MWOSD configurator can now access config and reflash MinimOSD without rebooting and changing baud rate.

* Fix F3 build

* Fix failing unit tests

* Use resources to declare DTR pin assignment

* Don't assert DTR during normal operation as MW_OSD doesn't like it

* MW_OSD must be built with MAX_SOFTRESET defined in order to support DTR resets

* Minimise changes after dropping DTR pin param from serialpassthrough cmd

* Remove DTR pin param from serialpassthrough cmd

* Treat ioDtrTag as boolean in conditional statements

* Tidy buffer check

* Check buffer size in CDC_Itf_Control

* Fix unit test

* Add documentation for DTR

* Add note on MAX_SOFTRESET to documentation

* Remove superfluous function definitions

* Fix tabs

* Fix tabs

* Removed superfluous entried from vtable

* Backout whitespace changes unrelated to this PR

* Pass true/false to IOWrite()

* Fix line coding packing

* Add LINE_CODING structure defintion

* Revise serial documentation

* Prevent tx buffer overflow in serialPassthrough()

* Revert change unrelated to PR

* Review feedback from ledvinap

* Fix unit test

* Use PINIO to drive DTR

* Fix unit test

* Remove change unrelated to PR

* Fix SITL build

* Use shifted bits for mask definition

* Fix serialpassthrough documentation

* Only compile PINIO functionality if USE_PINIO defined

* IOConfigGPIO not needed

* Move cbCtrlLine callback to cli.c

* serialPassthrough params changed

* Check packed structure size

* Fix unit test

* Tidy up baud rate handling
23 files changed:
docs/Serial.md
lib/main/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
src/main/drivers/serial.c
src/main/drivers/serial.h
src/main/drivers/serial_escserial.c
src/main/drivers/serial_softserial.c
src/main/drivers/serial_tcp.c
src/main/drivers/serial_uart.c
src/main/drivers/serial_uart_hal.c
src/main/drivers/serial_usb_vcp.c
src/main/interface/cli.c
src/main/io/serial.c
src/main/target/REVO/target.h
src/main/target/REVONANO/target.h
src/main/vcp/hw_config.c
src/main/vcp/hw_config.h
src/main/vcp/usb_prop.h
src/main/vcp_hal/usbd_cdc_interface.c
src/main/vcp_hal/usbd_cdc_interface.h
src/main/vcpf4/usbd_cdc_vcp.c
src/main/vcpf4/usbd_cdc_vcp.h
src/test/unit/cli_unittest.cc
src/test/unit/io_serial_unittest.cc