Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / drivers / opflow / opflow_fake.c
blob517b14cfe15669a70e7319a3f6d89f2e90f5d48f
1 /*
2 * This file is part of INAV Project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
25 #include <stdbool.h>
26 #include <stdint.h>
27 #include <string.h>
29 #include <platform.h>
31 #include "build/build_config.h"
33 #include "common/utils.h"
35 #include "opflow.h"
36 #include "opflow_fake.h"
38 #ifdef USE_OPFLOW_FAKE
39 static opflowData_t fakeData;
41 void fakeOpflowSet(timeDelta_t deltaTime, int32_t flowRateX, int32_t flowRateY, int16_t quality)
43 fakeData.deltaTime = deltaTime;
44 fakeData.flowRateRaw[0] = flowRateX;
45 fakeData.flowRateRaw[1] = flowRateY;
46 fakeData.flowRateRaw[2] = 0;
47 fakeData.quality = quality;
50 static bool fakeOpflowInit(opflowDev_t * dev)
52 UNUSED(dev);
53 return true;
56 static bool fakeOpflowUpdate(opflowDev_t * dev)
58 memcpy(&dev->rawData, &fakeData, sizeof(opflowData_t));
59 return true;
62 bool fakeOpflowDetect(opflowDev_t * dev)
64 dev->initFn = &fakeOpflowInit;
65 dev->updateFn = &fakeOpflowUpdate;
67 memset(&dev->rawData, 0, sizeof(opflowData_t));
69 return true;
71 #endif