mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 08:24:07 +08:00
usb_connected: add documentation
This commit is contained in:
parent
8e965a7a2a
commit
68d754b65e
@ -34,12 +34,11 @@
|
||||
/**
|
||||
* @file usb_connected.c
|
||||
*
|
||||
* utility to check if USB is connected. Used in startup scripts
|
||||
*
|
||||
* @author Andrew Tridgell
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_module.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -49,8 +48,23 @@
|
||||
|
||||
__EXPORT int usb_connected_main(int argc, char *argv[]);
|
||||
|
||||
static void print_usage()
|
||||
{
|
||||
|
||||
PRINT_MODULE_DESCRIPTION("Utility to check if USB is connected. Was previously used in startup scripts. "
|
||||
"A return value of 0 means USB is connected, 1 otherwise."
|
||||
);
|
||||
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("usb_connected", "command");
|
||||
}
|
||||
|
||||
int
|
||||
usb_connected_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user