Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
PWM servos handling using Linux sysfs. More...
#include "mcu_periph/pwm_sysfs.h"
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
Go to the source code of this file.
Macros | |
#define | PWM_SYSFS_DEFAULT_PERIOD 10000000 |
#define | PS_DEBUG_PRINT(...) {} |
Functions | |
static int | write_file (const char *path, const char *fmt,...) |
static int | read_file (const char *path, const char *fmt,...) |
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) |
PWM servos handling using Linux sysfs.
Based on PWM_Sysfs driver from ardupilot released under GPL v3
Definition in file pwm_sysfs.c.
#define PS_DEBUG_PRINT | ( | ... | ) | {} |
Definition at line 44 of file pwm_sysfs.c.
#define PWM_SYSFS_DEFAULT_PERIOD 10000000 |
Definition at line 38 of file pwm_sysfs.c.
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().
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().
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().
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().
|
static |
Definition at line 152 of file pwm_sysfs.c.
|
static |
Definition at line 127 of file pwm_sysfs.c.
References fd.
Referenced by pwm_sysfs_enable(), pwm_sysfs_init(), and pwm_sysfs_set_period().