MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / usb_initialise

Function usb_initialise

libraries/AP_HAL_ChibiOS/UARTDriver.cpp:1865–1887  ·  view source on GitHub ↗

initialise the USB bus, called from both UARTDriver and stdio for startup debug This can be called before the hal is initialised so must not call any hal functions */

Source from the content-addressed store, hash-verified

1863 This can be called before the hal is initialised so must not call any hal functions
1864 */
1865void usb_initialise(void)
1866{
1867 static bool initialised;
1868 if (initialised) {
1869 return;
1870 }
1871 initialised = true;
1872 sduObjectInit(&SDU1);
1873 sduStart(&SDU1, &serusbcfg1);
1874#if HAL_HAVE_DUAL_USB_CDC
1875 sduObjectInit(&SDU2);
1876 sduStart(&SDU2, &serusbcfg2);
1877#endif
1878 /*
1879 * Activates the USB driver and then the USB bus pull-up on D+.
1880 * Note, a delay is inserted in order to not have to disconnect the cable
1881 * after a reset.
1882 */
1883 usbDisconnectBus(serusbcfg1.usbp);
1884 chThdSleep(chTimeUS2I(1500));
1885 usbStart(serusbcfg1.usbp, &usbcfg);
1886 usbConnectBus(serusbcfg1.usbp);
1887}
1888#endif
1889
1890// disable TX/RX pins for unusued uart

Callers 3

__wrap_vprintfFunction · 0.85
runMethod · 0.85
_beginMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected