PX4 Firmware
PX4 Autopilot Software http://px4.io
drv_input_capture.h File Reference
#include <px4_platform_common/defines.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include "drv_hrt.h"
Include dependency graph for drv_input_capture.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  input_capture_element_t
 
struct  input_capture_stats_t
 
struct  input_capture_config_t
 input capture values for a channel More...
 

Macros

#define INPUT_CAPTURE_BASE_DEVICE_PATH   "/dev/capture"
 Path for the default capture input device. More...
 
#define INPUT_CAPTURE0_DEVICE_PATH   "/dev/capture0"
 
#define INPUT_CAPTURE_MAX_CHANNELS   6
 Maximum number of PWM input channels supported by the device. More...
 
#define _INPUT_CAP_BASE   0x2d00
 
#define INPUT_CAP_SET   _PX4_IOC(_INPUT_CAP_BASE, 0)
 Set Enable a channel arg is pointer to input_capture_config with all parameters set. More...
 
#define INPUT_CAP_SET_CALLBACK   _PX4_IOC(_INPUT_CAP_BASE, 1)
 Set the call back on a capture channel - arg is pointer to input_capture_config with channel call back and context set context may be null. More...
 
#define INPUT_CAP_GET_CALLBACK   _PX4_IOC(_INPUT_CAP_BASE, 2)
 Get the call back on a capture channel - arg is pointer to input_capture_config with channel set. More...
 
#define INPUT_CAP_SET_EDGE   _PX4_IOC(_INPUT_CAP_BASE, 3)
 Set Edge a channel arg is pointer to input_capture_config with channel and edge set. More...
 
#define INPUT_CAP_GET_EDGE   _PX4_IOC(_INPUT_CAP_BASE, 4)
 Get Edge for a channel arg is pointer to input_capture_config with channel set. More...
 
#define INPUT_CAP_SET_FILTER   _PX4_IOC(_INPUT_CAP_BASE, 5)
 Set Filter input filter channel arg is pointer to input_capture_config with channel and filter set. More...
 
#define INPUT_CAP_GET_FILTER   _PX4_IOC(_INPUT_CAP_BASE, 6)
 Set Filter input filter channel arg is pointer to input_capture_config with channel set. More...
 
#define INPUT_CAP_GET_COUNT   _PX4_IOC(_INPUT_CAP_BASE, 7)
 Get the number of capture in *(unsigned *)arg. More...
 
#define INPUT_CAP_SET_COUNT   _PX4_IOC(_INPUT_CAP_BASE, 8)
 Set the number of capture in (unsigned)arg - allows change of split between servos and capture. More...
 
#define INPUT_CAP_GET_STATS   _PX4_IOC(_INPUT_CAP_BASE, 9)
 Get channel stats - arg is pointer to input_capture_config with channel set. More...
 
#define INPUT_CAP_GET_CLR_STATS   _PX4_IOC(_INPUT_CAP_BASE, 10)
 Get channel stats - arg is pointer to input_capture_config with channel set. More...
 

Typedefs

typedef void(* capture_callback_t) (void *context, uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow)
 
typedef uint16_t capture_filter_t
 
typedef uint16_t capture_t
 
typedef enum input_capture_edge input_capture_edge
 
typedef struct input_capture_element_t input_capture_element_t
 
typedef struct input_capture_stats_t input_capture_stats_t
 
typedef struct input_capture_config_t input_capture_config_t
 input capture values for a channel More...
 

Enumerations

enum  input_capture_edge { Disabled = 0, Rising = 1, Falling = 2, Both = 3 }
 

Functions

__EXPORT int up_input_capture_set (unsigned channel, input_capture_edge edge, capture_filter_t filter, capture_callback_t callback, void *context)
 
__EXPORT int up_input_capture_get_filter (unsigned channel, capture_filter_t *filter)
 
__EXPORT int up_input_capture_set_filter (unsigned channel, capture_filter_t filter)
 
__EXPORT int up_input_capture_get_trigger (unsigned channel, input_capture_edge *edge)
 
__EXPORT int up_input_capture_set_trigger (unsigned channel, input_capture_edge edge)
 
__EXPORT int up_input_capture_get_callback (unsigned channel, capture_callback_t *callback, void **context)
 
__EXPORT int up_input_capture_set_callback (unsigned channel, capture_callback_t callback, void *context)
 
__EXPORT int up_input_capture_get_stats (unsigned channel, input_capture_stats_t *stats, bool clear)
 

Macro Definition Documentation

◆ _INPUT_CAP_BASE

#define _INPUT_CAP_BASE   0x2d00

Definition at line 114 of file drv_input_capture.h.

◆ INPUT_CAP_GET_CALLBACK

#define INPUT_CAP_GET_CALLBACK   _PX4_IOC(_INPUT_CAP_BASE, 2)

Get the call back on a capture channel - arg is pointer to input_capture_config with channel set.

Definition at line 135 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), DShotOutput::capture_ioctl(), and PX4FMU::test().

◆ INPUT_CAP_GET_CLR_STATS

#define INPUT_CAP_GET_CLR_STATS   _PX4_IOC(_INPUT_CAP_BASE, 10)

Get channel stats - arg is pointer to input_capture_config with channel set.

Definition at line 168 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_GET_COUNT

#define INPUT_CAP_GET_COUNT   _PX4_IOC(_INPUT_CAP_BASE, 7)

Get the number of capture in *(unsigned *)arg.

Definition at line 154 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), DShotOutput::capture_ioctl(), CameraCapture::set_capture_control(), and PX4FMU::test().

◆ INPUT_CAP_GET_EDGE

#define INPUT_CAP_GET_EDGE   _PX4_IOC(_INPUT_CAP_BASE, 4)

Get Edge for a channel arg is pointer to input_capture_config with channel set.

Definition at line 143 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_GET_FILTER

#define INPUT_CAP_GET_FILTER   _PX4_IOC(_INPUT_CAP_BASE, 6)

Set Filter input filter channel arg is pointer to input_capture_config with channel set.

Definition at line 151 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_GET_STATS

#define INPUT_CAP_GET_STATS   _PX4_IOC(_INPUT_CAP_BASE, 9)

Get channel stats - arg is pointer to input_capture_config with channel set.

Definition at line 163 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), DShotOutput::capture_ioctl(), and PX4FMU::test().

◆ INPUT_CAP_SET

#define INPUT_CAP_SET   _PX4_IOC(_INPUT_CAP_BASE, 0)

Set Enable a channel arg is pointer to input_capture_config with all parameters set.

edge controls the mode: Disable will free the capture channel. (When edge is Disabled call back and context are ignored) context may be null. If callback and context are null the callback will be disabled.

Definition at line 124 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_SET_CALLBACK

#define INPUT_CAP_SET_CALLBACK   _PX4_IOC(_INPUT_CAP_BASE, 1)

Set the call back on a capture channel - arg is pointer to input_capture_config with channel call back and context set context may be null.

If both ate null the call back will be disabled

Definition at line 130 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), DShotOutput::capture_ioctl(), CameraCapture::set_capture_control(), and PX4FMU::test().

◆ INPUT_CAP_SET_COUNT

#define INPUT_CAP_SET_COUNT   _PX4_IOC(_INPUT_CAP_BASE, 8)

Set the number of capture in (unsigned)arg - allows change of split between servos and capture.

Definition at line 158 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_SET_EDGE

#define INPUT_CAP_SET_EDGE   _PX4_IOC(_INPUT_CAP_BASE, 3)

Set Edge a channel arg is pointer to input_capture_config with channel and edge set.

Definition at line 139 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAP_SET_FILTER

#define INPUT_CAP_SET_FILTER   _PX4_IOC(_INPUT_CAP_BASE, 5)

Set Filter input filter channel arg is pointer to input_capture_config with channel and filter set.

Definition at line 147 of file drv_input_capture.h.

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

◆ INPUT_CAPTURE0_DEVICE_PATH

#define INPUT_CAPTURE0_DEVICE_PATH   "/dev/capture0"

Definition at line 57 of file drv_input_capture.h.

◆ INPUT_CAPTURE_BASE_DEVICE_PATH

#define INPUT_CAPTURE_BASE_DEVICE_PATH   "/dev/capture"

Path for the default capture input device.

Definition at line 56 of file drv_input_capture.h.

◆ INPUT_CAPTURE_MAX_CHANNELS

#define INPUT_CAPTURE_MAX_CHANNELS   6

Maximum number of PWM input channels supported by the device.

Definition at line 66 of file drv_input_capture.h.

Referenced by PX4FMU::test().

Typedef Documentation

◆ capture_callback_t

typedef void(* capture_callback_t) (void *context, uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow)

Definition at line 59 of file drv_input_capture.h.

◆ capture_filter_t

typedef uint16_t capture_filter_t

Definition at line 69 of file drv_input_capture.h.

◆ capture_t

typedef uint16_t capture_t

Definition at line 70 of file drv_input_capture.h.

◆ input_capture_config_t

input capture values for a channel

This allows for Capture input driver values to be set without a param_get() dependency

◆ input_capture_edge

◆ input_capture_element_t

◆ input_capture_stats_t

Enumeration Type Documentation

◆ input_capture_edge

Enumerator
Disabled 
Rising 
Falling 
Both 

Definition at line 72 of file drv_input_capture.h.

Function Documentation

◆ up_input_capture_get_callback()

__EXPORT int up_input_capture_get_callback ( unsigned  channel,
capture_callback_t callback,
void **  context 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_get_filter()

__EXPORT int up_input_capture_get_filter ( unsigned  channel,
capture_filter_t filter 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_get_stats()

__EXPORT int up_input_capture_get_stats ( unsigned  channel,
input_capture_stats_t stats,
bool  clear 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_get_trigger()

__EXPORT int up_input_capture_get_trigger ( unsigned  channel,
input_capture_edge edge 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_set()

__EXPORT int up_input_capture_set ( unsigned  channel,
input_capture_edge  edge,
capture_filter_t  filter,
capture_callback_t  callback,
void *  context 
)

Referenced by PX4FMU::capture_ioctl(), DShotOutput::capture_ioctl(), DShotOutput::set_mode(), and PX4FMU::set_mode().

Here is the caller graph for this function:

◆ up_input_capture_set_callback()

__EXPORT int up_input_capture_set_callback ( unsigned  channel,
capture_callback_t  callback,
void *  context 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_set_filter()

__EXPORT int up_input_capture_set_filter ( unsigned  channel,
capture_filter_t  filter 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function:

◆ up_input_capture_set_trigger()

__EXPORT int up_input_capture_set_trigger ( unsigned  channel,
input_capture_edge  edge 
)

Referenced by PX4FMU::capture_ioctl(), and DShotOutput::capture_ioctl().

Here is the caller graph for this function: