mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 07:01:35 +08:00
Tease the PWM driver out and fix some build issues after cleaning up behind the cpuload pieces.
This commit is contained in:
@@ -41,14 +41,15 @@
|
||||
* channel.
|
||||
*/
|
||||
|
||||
#ifndef _DRV_PWM_OUTPUT_H
|
||||
#define _DRV_PWM_OUTPUT_H
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "drv_orb_dev.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Path for the default PWM output device.
|
||||
*
|
||||
@@ -109,4 +110,63 @@ ORB_DECLARE(output_pwm);
|
||||
#define PWM_SERVO_GET(_servo) _IOC(_PWM_SERVO_BASE, 0x40 + _servo)
|
||||
|
||||
|
||||
#endif /* _DRV_PWM_OUTPUT_H */
|
||||
/*
|
||||
* Low-level PWM output interface.
|
||||
*
|
||||
* This is the low-level API to the platform-specific PWM driver.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Intialise the PWM servo outputs using the specified configuration.
|
||||
*
|
||||
* @param channel_mask Bitmask of channels (LSB = channel 0) to enable.
|
||||
* This allows some of the channels to remain configured
|
||||
* as GPIOs or as another function.
|
||||
* @return OK on success.
|
||||
*/
|
||||
__EXPORT extern int up_pwm_servo_init(uint32_t channel_mask);
|
||||
|
||||
/**
|
||||
* De-initialise the PWM servo outputs.
|
||||
*/
|
||||
__EXPORT extern void up_pwm_servo_deinit(void);
|
||||
|
||||
/**
|
||||
* Arm or disarm servo outputs.
|
||||
*
|
||||
* When disarmed, servos output no pulse.
|
||||
*
|
||||
* @bug This function should, but does not, guarantee that any pulse
|
||||
* currently in progress is cleanly completed.
|
||||
*
|
||||
* @param armed If true, outputs are armed; if false they
|
||||
* are disarmed.
|
||||
*/
|
||||
__EXPORT extern void up_pwm_servo_arm(bool armed);
|
||||
|
||||
/**
|
||||
* Set the servo update rate
|
||||
*
|
||||
* @param rate The update rate in Hz to set.
|
||||
* @return OK on success, -ERANGE if an unsupported update rate is set.
|
||||
*/
|
||||
__EXPORT extern int up_pwm_servo_set_rate(unsigned rate);
|
||||
|
||||
/**
|
||||
* Set the current output value for a channel.
|
||||
*
|
||||
* @param channel The channel to set.
|
||||
* @param value The output pulse width in microseconds.
|
||||
*/
|
||||
__EXPORT extern int up_pwm_servo_set(unsigned channel, servo_position_t value);
|
||||
|
||||
/**
|
||||
* Get the current output value for a channel.
|
||||
*
|
||||
* @param channel The channel to read.
|
||||
* @return The output pulse width in microseconds, or zero if
|
||||
* outputs are not armed or not configured.
|
||||
*/
|
||||
__EXPORT extern servo_position_t up_pwm_servo_get(unsigned channel);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user