[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / build / debug.h
bloba5a5e90ea6537336d5742b404c8cf407352328ce
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #include <stddef.h>
19 #include <stdint.h>
20 #include <stdbool.h>
22 #define DEBUG32_VALUE_COUNT 8
23 extern int32_t debug[DEBUG32_VALUE_COUNT];
24 extern uint8_t debugMode;
26 #define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}}
28 #define DEBUG_SECTION_TIMES
30 #ifdef DEBUG_SECTION_TIMES
31 #include "common/time.h"
32 extern timeUs_t sectionTimes[2][4];
34 #define TIME_SECTION_BEGIN(index) { \
35 extern timeUs_t sectionTimes[2][4]; \
36 sectionTimes[0][index] = micros(); \
39 #define TIME_SECTION_END(index) { \
40 extern timeUs_t sectionTimes[2][4]; \
41 sectionTimes[1][index] = micros(); \
42 debug[index] = sectionTimes[1][index] - sectionTimes[0][index]; \
44 #else
46 #define TIME_SECTION_BEGIN(index) {}
47 #define TIME_SECTION_END(index) {}
49 #endif
51 typedef enum {
52 DEBUG_NONE,
53 DEBUG_GYRO,
54 DEBUG_AGL,
55 DEBUG_FLOW_RAW,
56 DEBUG_FLOW,
57 DEBUG_SBUS,
58 DEBUG_FPORT,
59 DEBUG_ALWAYS,
60 DEBUG_SAG_COMP_VOLTAGE,
61 DEBUG_VIBE,
62 DEBUG_CRUISE,
63 DEBUG_REM_FLIGHT_TIME,
64 DEBUG_SMARTAUDIO,
65 DEBUG_ACC,
66 DEBUG_ITERM_RELAX,
67 DEBUG_ERPM,
68 DEBUG_RPM_FILTER,
69 DEBUG_RPM_FREQ,
70 DEBUG_NAV_YAW,
71 DEBUG_DYNAMIC_FILTER,
72 DEBUG_DYNAMIC_FILTER_FREQUENCY,
73 DEBUG_IRLOCK,
74 DEBUG_CD,
75 DEBUG_KALMAN,
76 DEBUG_COUNT
77 } debugType_e;