default f411 boards with timer 1 use to timer dshot
[betaflight.git] / src / main / pg / motor.h
blob1e257f2050f61e62140f799d79df65efd79eb538
1 /*
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)
8 * any later version.
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/>.
21 #pragma once
23 #include "pg/pg.h"
25 #include "drivers/io.h"
26 #include "drivers/dshot_bitbang.h"
28 typedef enum {
29 DSHOT_BITBANGED_TIMER_AUTO = 0,
30 DSHOT_BITBANGED_TIMER_TIM1,
31 DSHOT_BITBANGED_TIMER_TIM8,
32 } dshotBitbangedTimer_e;
34 typedef enum {
35 DSHOT_DMAR_OFF,
36 DSHOT_DMAR_ON,
37 DSHOT_DMAR_AUTO
38 } dshotDmar_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 } motorDevConfig_t;
53 typedef struct motorConfig_s {
54 motorDevConfig_t dev;
55 uint16_t digitalIdleOffsetValue; // Idle value for DShot protocol, full motor output = 10000
56 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.
57 uint16_t maxthrottle; // This is the maximum value for the ESCs at full power this value can be increased up to 2000
58 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
59 uint8_t motorPoleCount; // Magnetic poles in the motors for calculating actual RPM from eRPM provided by ESC telemetry
60 } motorConfig_t;
62 PG_DECLARE(motorConfig_t, motorConfig);