mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
usb_connected: add documentation
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user