update serTcpOpen declaration to fix compile errors (#14113)
[betaflight.git] / src / main / drivers / opticalflow / opticalflow.h
blob8f3ad6dd29a2de07658d87c3ab179e582f9a9293
1 /*
2 * This file is part of Betaflight.
4 * Betaflight is free software. You can redistribute this software
5 * and/or modify this software under the terms of the GNU General
6 * Public License as published by the Free Software Foundation,
7 * either version 3 of the License, or (at your option) any later
8 * version.
10 * Betaflight is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this software.
19 * If not, see <http://www.gnu.org/licenses/>.
22 #pragma once
24 #include <stdint.h>
25 #include "common/vector.h"
27 #define OPTICALFLOW_OUT_OF_RANGE -1
28 #define OPTICALFLOW_HARDWARE_FAILURE -2
29 #define OPTICALFLOW_NO_NEW_DATA -3
31 #define OPTICALFLOW_HARDWARE_TIMEOUT_US 100000 // 100ms
33 typedef struct opticalflowData_s {
34 uint32_t timeStampUs;
35 int16_t quality;
36 vector2_t flowRate;
37 } opticalflowData_t;
39 struct opticalflowDev_s;
40 typedef void opflowOpInitFunc(struct opticalflowDev_s * dev);
41 typedef void opflowOpUpdateFunc(struct opticalflowDev_s * dev);
42 typedef void opflowOpReadFunc(struct opticalflowDev_s * dev, opticalflowData_t * result);
44 typedef struct opticalflowDev_s {
45 unsigned delayMs;
46 int16_t minRangeCm;
47 uint8_t minQualityThreshold;
49 opflowOpInitFunc *init;
50 opflowOpUpdateFunc *update;
51 opflowOpReadFunc *read;
52 } opticalflowDev_t;