Merge pull request #11297 from SteveCEvans/baro_state
[betaflight.git] / src / main / drivers / dshot_command.h
blobd3691dde19d8a797b32ee3fdf9d87bc5a429b74e
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 #define DSHOT_MAX_COMMAND 47
26 DshotSettingRequest (KISS24). Spin direction, 3d and save Settings require 10 requests.. and the TLM Byte must always be high if 1-47 are used to send settings
28 3D Mode:
29 0 = stop
30 48 (low) - 1047 (high) -> negative direction
31 1048 (low) - 2047 (high) -> positive direction
34 typedef enum {
35 DSHOT_CMD_MOTOR_STOP = 0,
36 DSHOT_CMD_BEACON1,
37 DSHOT_CMD_BEACON2,
38 DSHOT_CMD_BEACON3,
39 DSHOT_CMD_BEACON4,
40 DSHOT_CMD_BEACON5,
41 DSHOT_CMD_ESC_INFO, // V2 includes settings
42 DSHOT_CMD_SPIN_DIRECTION_1,
43 DSHOT_CMD_SPIN_DIRECTION_2,
44 DSHOT_CMD_3D_MODE_OFF,
45 DSHOT_CMD_3D_MODE_ON,
46 DSHOT_CMD_SETTINGS_REQUEST, // Currently not implemented
47 DSHOT_CMD_SAVE_SETTINGS,
48 DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20,
49 DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21,
50 DSHOT_CMD_LED0_ON, // BLHeli32 only
51 DSHOT_CMD_LED1_ON, // BLHeli32 only
52 DSHOT_CMD_LED2_ON, // BLHeli32 only
53 DSHOT_CMD_LED3_ON, // BLHeli32 only
54 DSHOT_CMD_LED0_OFF, // BLHeli32 only
55 DSHOT_CMD_LED1_OFF, // BLHeli32 only
56 DSHOT_CMD_LED2_OFF, // BLHeli32 only
57 DSHOT_CMD_LED3_OFF, // BLHeli32 only
58 DSHOT_CMD_AUDIO_STREAM_MODE_ON_OFF = 30, // KISS audio Stream mode on/Off
59 DSHOT_CMD_SILENT_MODE_ON_OFF = 31, // KISS silent Mode on/Off
60 DSHOT_CMD_MAX = 47
61 } dshotCommands_e;
63 typedef enum {
64 DSHOT_CMD_TYPE_INLINE = 0, // dshot commands sent inline with motor signal (motors must be enabled)
65 DSHOT_CMD_TYPE_BLOCKING // dshot commands sent in blocking method (motors must be disabled)
66 } dshotCommandType_e;
68 void dshotCommandWrite(uint8_t index, uint8_t motorCount, uint8_t command, dshotCommandType_e commandType);
69 void dshotSetPidLoopTime(uint32_t pidLoopTime);
70 bool dshotCommandQueueEmpty(void);
71 bool dshotCommandIsProcessing(void);
72 uint8_t dshotCommandGetCurrent(uint8_t index);
73 bool dshotCommandOutputIsEnabled(uint8_t motorCount);
74 bool dshotStreamingCommandsAreEnabled(void);