Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pwm_sysfs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3 *
4 * This file is part of Paparazzi.
5 *
6 * Paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * Paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
27#ifndef PWM_SYSFS_H
28#define PWM_SYSFS_H
29
30#include "std.h"
31
32#define PWM_SYSFS_PATH_LEN 64
33
45
46extern int pwm_sysfs_init(struct PWM_Sysfs *pwm, char *base_path,
47 char *_export, char *_enable,
48 char *_duty, char *_period,
49 uint8_t channel);
50extern void pwm_sysfs_set_period(struct PWM_Sysfs *pwm, uint32_t period);
51extern void pwm_sysfs_set_duty(struct PWM_Sysfs *pwm, uint32_t duty);
52extern void pwm_sysfs_enable(struct PWM_Sysfs *pwm, bool enable);
53
54#endif
55
uint16_t foo
Definition main_demo5.c:58
void pwm_sysfs_set_period(struct PWM_Sysfs *pwm, uint32_t period)
Definition pwm_sysfs.c:91
void pwm_sysfs_set_duty(struct PWM_Sysfs *pwm, uint32_t duty)
Definition pwm_sysfs.c:101
char enable_path[PWM_SYSFS_PATH_LEN]
path to enable file
Definition pwm_sysfs.h:41
int duty_cycle_fd
file descriptor to write/update duty cycle
Definition pwm_sysfs.h:40
uint32_t duty_cycle_nsec
current duty cycle (in nsec)
Definition pwm_sysfs.h:37
void pwm_sysfs_enable(struct PWM_Sysfs *pwm, bool enable)
Definition pwm_sysfs.c:114
uint32_t period_nsec
current period (in nsec)
Definition pwm_sysfs.h:38
char duty_path[PWM_SYSFS_PATH_LEN]
path to duty file
Definition pwm_sysfs.h:42
char period_path[PWM_SYSFS_PATH_LEN]
path to period file
Definition pwm_sysfs.h:43
int pwm_sysfs_init(struct PWM_Sysfs *pwm, char *base_path, char *_export, char *_enable, char *_duty, char *_period, uint8_t channel)
Definition pwm_sysfs.c:52
#define PWM_SYSFS_PATH_LEN
Definition pwm_sysfs.h:32
bool enabled
true if pwm is enabled
Definition pwm_sysfs.h:39
PWM structure.
Definition pwm_sysfs.h:36
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.