2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
25 #include "drivers/io.h"
26 #include "drivers/dshot_bitbang.h"
29 DSHOT_BITBANGED_TIMER_AUTO
= 0,
30 DSHOT_BITBANGED_TIMER_TIM1
,
31 DSHOT_BITBANGED_TIMER_TIM8
,
32 } dshotBitbangedTimer_e
;
40 typedef struct motorDevConfig_s
{
41 uint16_t motorPwmRate
; // The update rate of motor outputs (50-498Hz)
42 uint8_t motorPwmProtocol
; // Pwm Protocol
43 uint8_t motorPwmInversion
; // Active-High vs Active-Low. Useful for brushed FCs converted for brushless operation
44 uint8_t useUnsyncedPwm
;
45 uint8_t useBurstDshot
;
46 uint8_t useDshotTelemetry
;
47 ioTag_t ioTags
[MAX_SUPPORTED_MOTORS
];
48 uint8_t motorTransportProtocol
;
49 uint8_t useDshotBitbang
;
50 uint8_t useDshotBitbangedTimer
;
51 uint8_t motorOutputReordering
[MAX_SUPPORTED_MOTORS
]; // Reindexing motors for "remap motors" feature in Configurator
54 typedef struct motorConfig_s
{
56 uint16_t digitalIdleOffsetValue
; // Idle value for DShot protocol, full motor output = 10000
57 uint16_t minthrottle
; // Set the minimum throttle command sent to the ESC (Electronic Speed Controller). This is the minimum value that allow motors to run at a idle speed.
58 uint16_t maxthrottle
; // This is the maximum value for the ESCs at full power this value can be increased up to 2000
59 uint16_t mincommand
; // This is the value for the ESCs when they are not armed. In some cases, this value must be lowered down to 900 for some specific ESCs
60 uint8_t motorPoleCount
; // Magnetic poles in the motors for calculating actual RPM from eRPM provided by ESC telemetry
63 PG_DECLARE(motorConfig_t
, motorConfig
);