Merge pull request #11297 from SteveCEvans/baro_state
[betaflight.git] / src / main / drivers / camera_control.h
blob320f6352b89ff627cd77012d27cb9af65bb2b385
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 "io_types.h"
24 #include "pg/pg.h"
26 typedef enum {
27 CAMERA_CONTROL_KEY_ENTER,
28 CAMERA_CONTROL_KEY_LEFT,
29 CAMERA_CONTROL_KEY_UP,
30 CAMERA_CONTROL_KEY_RIGHT,
31 CAMERA_CONTROL_KEY_DOWN,
32 CAMERA_CONTROL_KEYS_COUNT
33 } cameraControlKey_e;
35 typedef enum {
36 CAMERA_CONTROL_MODE_HARDWARE_PWM,
37 CAMERA_CONTROL_MODE_SOFTWARE_PWM,
38 CAMERA_CONTROL_MODE_DAC,
39 CAMERA_CONTROL_MODES_COUNT
40 } cameraControlMode_e;
42 typedef struct cameraControlConfig_s {
43 cameraControlMode_e mode;
44 // measured in 10 mV steps
45 uint16_t refVoltage;
46 uint16_t keyDelayMs;
47 // measured 100 Ohm steps
48 uint16_t internalResistance;
50 ioTag_t ioTag;
51 uint8_t inverted;
52 uint16_t buttonResistanceValues[CAMERA_CONTROL_KEYS_COUNT]; // resistance in 100ohm steps
53 } cameraControlConfig_t;
55 PG_DECLARE(cameraControlConfig_t, cameraControlConfig);
57 void cameraControlInit(void);
59 void cameraControlProcess(uint32_t currentTimeUs);
60 void cameraControlKeyPress(cameraControlKey_e key, uint32_t holdDurationMs);