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)
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/>.
24 BLACKBOX_RESERVE_SUCCESS
,
25 BLACKBOX_RESERVE_TEMPORARY_FAILURE
,
26 BLACKBOX_RESERVE_PERMANENT_FAILURE
27 } blackboxBufferReserveStatus_e
;
30 * We want to limit how bursty our writes to the device are. Note that this will also restrict the maximum size of a
31 * header write we can make:
33 #define BLACKBOX_MAX_ACCUMULATED_HEADER_BUDGET 256
36 * Ideally, each iteration in which we are logging headers would write a similar amount of data to the device as a
37 * regular logging iteration. This way we won't hog the CPU by making a gigantic write:
39 #define BLACKBOX_TARGET_HEADER_BUDGET_PER_ITERATION 64
41 extern int32_t blackboxHeaderBudget
;
43 void blackboxOpen(void);
44 void blackboxWrite(uint8_t value
);
45 int blackboxWriteString(const char *s
);
47 void blackboxDeviceFlush(void);
48 bool blackboxDeviceFlushForce(void);
49 bool blackboxDeviceFlushForceComplete(void);
51 bool blackboxDeviceOpen(void);
52 void blackboxDeviceClose(void);
54 void blackboxEraseAll(void);
55 bool isBlackboxErased(void);
57 bool blackboxDeviceBeginLog(void);
58 bool blackboxDeviceEndLog(bool retainLog
);
60 bool isBlackboxDeviceFull(void);
61 bool isBlackboxDeviceWorking(void);
62 int32_t blackboxGetLogNumber(void);
64 void blackboxReplenishHeaderBudget(void);
65 blackboxBufferReserveStatus_e
blackboxDeviceReserveBufferSpace(int32_t bytes
);
66 int8_t blackboxGetLogFileNo(void);