39 #include <px4_platform_common/time.h> 40 #include <px4_platform_common/px4_config.h> 42 #include <sys/types.h> 51 #include <arch/board/board.h> 67 printf(
"failed opening /dev/pwm_servo\n");
71 result =
read(fd, &data,
sizeof(data));
73 if (result !=
sizeof(data)) {
74 printf(
"failed bulk-reading channel values\n");
78 printf(
"Servo readback, pairs of values should match defaults\n");
84 warnx(
"PWM_SERVO_GET_COUNT");
88 for (
unsigned i = 0; i < servo_count; i++) {
92 printf(
"failed reading channel %u\n", i);
96 printf(
"%u: %u %u\n", i, pos, data[i]);
104 warnx(
"FAIL: PWM_SERVO_SET_ARM_OK");
112 warnx(
"FAIL: PWM_SERVO_ARM");
117 printf(
"Advancing channel 0 to 1500\n");
119 printf(
"Advancing channel 1 to 1800\n");
#define PWM_SERVO_SET_ARM_OK
set the 'ARM ok' bit, which activates the safety switch
uint16_t servo_position_t
Servo output signal type, value is actual servo output pulse width in microseconds.
#define PWM_SERVO_GET_COUNT
get the number of servos in *(unsigned *)arg
#define PWM_SERVO_ARM
arm all servo outputs handle by this driver
#define PWM_SERVO_SET(_servo)
set a single servo to a specific value
static void read(bootloader_app_shared_t *pshared)
#define PWM_OUTPUT0_DEVICE_PATH
#define PWM_OUTPUT_MAX_CHANNELS
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
#define PWM_SERVO_GET(_servo)
get a single specific servo value
int test_servo(int argc, char *argv[])