Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / drivers / pwm_output.h
blob1041ace04fa84b645a8e02103b126b8cd07e9a86
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "drivers/io_types.h"
21 #include "drivers/time.h"
24 #if defined(WS2811_PIN)
25 #define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS + 1)
26 #else
27 #define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS)
28 #endif
29 typedef enum {
30 DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20,
31 DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21,
32 } dshotCommands_e;
34 typedef struct {
35 dshotCommands_e cmd;
36 int remainingRepeats;
37 } currentExecutingCommand_t;
39 void pwmRequestMotorTelemetry(int motorIndex);
41 ioTag_t pwmGetMotorPinTag(int motorIndex);
43 void pwmWriteMotor(uint8_t index, uint16_t value);
44 void pwmShutdownPulsesForAllMotors(uint8_t motorCount);
45 void pwmCompleteMotorUpdate(void);
46 bool isMotorProtocolDigital(void);
47 bool isMotorProtocolDshot(void);
49 void pwmWriteServo(uint8_t index, uint16_t value);
51 void pwmDisableMotors(void);
52 void pwmEnableMotors(void);
53 struct timerHardware_s;
55 void pwmMotorPreconfigure(void);
56 bool pwmMotorConfig(const struct timerHardware_s *timerHardware, uint8_t motorIndex, bool enableOutput);
58 void pwmServoPreconfigure(void);
59 bool pwmServoConfig(const struct timerHardware_s *timerHardware, uint8_t servoIndex, uint16_t servoPwmRate, uint16_t servoCenterPulse, bool enableOutput);
60 void pwmWriteBeeper(bool onoffBeep);
61 void beeperPwmInit(ioTag_t tag, uint16_t frequency);
63 void sendDShotCommand(dshotCommands_e cmd);
64 void initDShotCommands(void);
66 uint32_t getEscUpdateFrequency(void);