Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pwm_sysfs.h File Reference

PWM servos handling using Linux sysfs. More...

#include "std.h"
+ Include dependency graph for pwm_sysfs.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PWM_Sysfs
 PWM structure. More...
 

Macros

#define PWM_SYSFS_PATH_LEN   64
 

Functions

int pwm_sysfs_init (struct PWM_Sysfs *pwm, char *base_path, char *_export, char *_enable, char *_duty, char *_period, uint8_t channel)
 
void pwm_sysfs_set_period (struct PWM_Sysfs *pwm, uint32_t period)
 
void pwm_sysfs_set_duty (struct PWM_Sysfs *pwm, uint32_t duty)
 
void pwm_sysfs_enable (struct PWM_Sysfs *pwm, bool enable)
 

Detailed Description

PWM servos handling using Linux sysfs.

Based on PWM_Sysfs driver from ardupilot released under GPL v3

Definition in file pwm_sysfs.h.


Data Structure Documentation

struct PWM_Sysfs

PWM structure.

Definition at line 36 of file pwm_sysfs.h.

Data Fields
int duty_cycle_fd file descriptor to write/update duty cycle
uint32_t duty_cycle_nsec current duty cycle (in nsec)
char duty_path[PWM_SYSFS_PATH_LEN] path to duty file
char enable_path[PWM_SYSFS_PATH_LEN] path to enable file
bool enabled true if pwm is enabled
uint32_t period_nsec current period (in nsec)
char period_path[PWM_SYSFS_PATH_LEN] path to period file

Macro Definition Documentation

#define PWM_SYSFS_PATH_LEN   64

Definition at line 32 of file pwm_sysfs.h.

Referenced by pwm_sysfs_init().

Function Documentation

void pwm_sysfs_enable ( struct PWM_Sysfs pwm,
bool  enable 
)

Definition at line 114 of file pwm_sysfs.c.

References PWM_Sysfs::enable_path, PWM_Sysfs::enabled, PS_DEBUG_PRINT, and write_file().

Referenced by pwm_sysfs_set_duty().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int pwm_sysfs_init ( struct PWM_Sysfs pwm,
char *  base_path,
char *  _export,
char *  _enable,
char *  _duty,
char *  _period,
uint8_t  channel 
)

Definition at line 52 of file pwm_sysfs.c.

References PS_DEBUG_PRINT, PWM_SYSFS_DEFAULT_PERIOD, PWM_SYSFS_PATH_LEN, pwm_sysfs_set_period(), and write_file().

Referenced by actuators_disco_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pwm_sysfs_set_duty ( struct PWM_Sysfs pwm,
uint32_t  duty 
)

Definition at line 101 of file pwm_sysfs.c.

References PWM_Sysfs::duty_cycle_fd, PWM_Sysfs::duty_cycle_nsec, PWM_Sysfs::duty_path, PWM_Sysfs::enabled, PS_DEBUG_PRINT, and pwm_sysfs_enable().

Referenced by actuators_disco_set().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pwm_sysfs_set_period ( struct PWM_Sysfs pwm,
uint32_t  period 
)

Definition at line 91 of file pwm_sysfs.c.

References PWM_Sysfs::period_nsec, PWM_Sysfs::period_path, PS_DEBUG_PRINT, and write_file().

Referenced by pwm_sysfs_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: