Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
pwm_sysfs.h File Reference
#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

◆ PWM_Sysfs

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

◆ PWM_SYSFS_PATH_LEN

#define PWM_SYSFS_PATH_LEN   64

Definition at line 32 of file pwm_sysfs.h.

Function Documentation

◆ pwm_sysfs_enable()

void pwm_sysfs_enable ( struct PWM_Sysfs pwm,
bool  enable 
)

Definition at line 114 of file pwm_sysfs.c.

References PS_DEBUG_PRINT, pwm(), 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:

◆ pwm_sysfs_init()

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 channel, PS_DEBUG_PRINT, pwm(), 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:

◆ pwm_sysfs_set_duty()

void pwm_sysfs_set_duty ( struct PWM_Sysfs pwm,
uint32_t  duty 
)

Definition at line 101 of file pwm_sysfs.c.

References PS_DEBUG_PRINT, pwm(), 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:

◆ pwm_sysfs_set_period()

void pwm_sysfs_set_period ( struct PWM_Sysfs pwm,
uint32_t  period 
)

Definition at line 91 of file pwm_sysfs.c.

References PS_DEBUG_PRINT, pwm(), and write_file().

Referenced by pwm_sysfs_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: