mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Merge pull request #2852 from azolyoung/add-runcam-split-support
Add runcam split support
This commit is contained in:
parent
53eb07c56a
commit
32fa109a64
13 changed files with 706 additions and 10 deletions
56
src/main/io/rcsplit.h
Normal file
56
src/main/io/rcsplit.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "common/time.h"
|
||||
#include "fc/fc_msp.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t boxId;
|
||||
bool isActivated;
|
||||
} rcsplit_switch_state_t;
|
||||
|
||||
typedef enum {
|
||||
RCSPLIT_STATE_UNKNOWN = 0,
|
||||
RCSPLIT_STATE_INITIALIZING,
|
||||
RCSPLIT_STATE_IS_READY,
|
||||
} rcsplit_state_e;
|
||||
|
||||
// packet header and tail
|
||||
#define RCSPLIT_PACKET_HEADER 0x55
|
||||
#define RCSPLIT_PACKET_CMD_CTRL 0x01
|
||||
#define RCSPLIT_PACKET_TAIL 0xaa
|
||||
|
||||
|
||||
// the commands of RunCam Split serial protocol
|
||||
typedef enum {
|
||||
RCSPLIT_CTRL_ARGU_INVALID = 0x0,
|
||||
RCSPLIT_CTRL_ARGU_WIFI_BTN = 0x1,
|
||||
RCSPLIT_CTRL_ARGU_POWER_BTN = 0x2,
|
||||
RCSPLIT_CTRL_ARGU_CHANGE_MODE = 0x3,
|
||||
RCSPLIT_CTRL_ARGU_WHO_ARE_YOU = 0xFF,
|
||||
} rcsplit_ctrl_argument_e;
|
||||
|
||||
bool rcSplitInit(void);
|
||||
void rcSplitProcess(timeUs_t currentTimeUs);
|
||||
|
||||
// only for unit test
|
||||
extern rcsplit_state_e cameraState;
|
||||
extern serialPort_t *rcSplitSerialPort;
|
||||
extern rcsplit_switch_state_t switchStates[BOXCAMERA3 - BOXCAMERA1 + 1];
|
Loading…
Add table
Add a link
Reference in a new issue