usb_connected: add documentation

This commit is contained in:
Beat Küng
2017-05-04 16:44:01 +02:00
parent 8e965a7a2a
commit 68d754b65e
+16 -2
View File
@@ -34,12 +34,11 @@
/** /**
* @file usb_connected.c * @file usb_connected.c
* *
* utility to check if USB is connected. Used in startup scripts
*
* @author Andrew Tridgell * @author Andrew Tridgell
*/ */
#include <px4_config.h> #include <px4_config.h>
#include <px4_module.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -49,8 +48,23 @@
__EXPORT int usb_connected_main(int argc, char *argv[]); __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 int
usb_connected_main(int argc, char *argv[]) usb_connected_main(int argc, char *argv[])
{ {
if (argc > 1) {
print_usage();
return 0;
}
return px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1; return px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1;
} }