drv_pwm.h
Go to the documentation of this file.
1 /*
2  drv_pwm.h : PWM support for STM32F103CB
3 
4  Adapted from https://github.com/multiwii/baseflight/blob/master/src/drv_pwm.h
5 
6  This file is part of BreezySTM32.
7 
8  BreezySTM32 is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  BreezySTM32 is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 #define MAX_SERVOS 8
25 #define MAX_INPUTS 8
26 #define PULSE_MIN (750) // minimum PWM pulse width which is considered valid
27 #define PULSE_MAX (2250) // maximum PWM pulse width which is considered valid
28 
29 // This indexes into the read-only hardware definition structure in drv_pwm.c, as well as into pwmPorts[] structure with dynamic data.
30 enum {
31  PWM1 = 0,
46 };
47 
48 void pwmInit(bool useCPPM, bool usePwmFilter, bool fastPWM, uint32_t motorPwmRate, uint16_t idlePulseUsec);
49 void pwmWriteMotor(uint8_t index, uint16_t value);
50 uint16_t pwmRead(uint8_t channel);
51 
52 uint32_t pwmLastUpdate();
53 bool pwmNewData();
54 
55 bool sonarPresent();
56 float sonarRead(uint8_t channel);
57 
58 
bool sonarPresent()
Definition: drv_pwm.c:432
uint16_t pwmRead(uint8_t channel)
Definition: drv_pwm.c:409
Definition: drv_pwm.h:34
Definition: drv_pwm.h:38
Definition: drv_pwm.h:43
Definition: drv_pwm.h:32
Definition: drv_pwm.h:37
Definition: drv_pwm.h:40
Definition: drv_pwm.h:35
void pwmInit(bool useCPPM, bool usePwmFilter, bool fastPWM, uint32_t motorPwmRate, uint16_t idlePulseUsec)
Definition: drv_pwm.c:353
bool pwmNewData()
Definition: drv_pwm.c:422
Definition: drv_pwm.h:39
Definition: drv_pwm.h:36
float sonarRead(uint8_t channel)
Definition: drv_pwm.c:427
Definition: drv_pwm.h:42
uint32_t pwmLastUpdate()
Definition: drv_pwm.c:186
void pwmWriteMotor(uint8_t index, uint16_t value)
Definition: drv_pwm.c:403
Definition: drv_pwm.h:44
Definition: drv_pwm.h:31
Definition: drv_pwm.h:41
Definition: drv_pwm.h:33


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:24