Logging of the S -term values in blackbox for Fixed wings. (#14012)
[betaflight.git] / src / main / pg / timerup.c
blob39c6ecf435e506c2b8ee4de1b6a51a79c03f371c
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 #include <string.h>
23 #include "platform.h"
25 #if defined(USE_TIMER_MGMT) && defined(USE_TIMER_UP_CONFIG)
27 #include "drivers/dma_reqmap.h"
28 #include "drivers/timer.h"
30 #include "timerup.h"
32 PG_REGISTER_ARRAY_WITH_RESET_FN(timerUpConfig_t, HARDWARE_TIMER_DEFINITION_COUNT, timerUpConfig, PG_TIMER_UP_CONFIG, 0);
34 void pgResetFn_timerUpConfig(timerUpConfig_t *config)
36 for (unsigned timno = 0; timno < HARDWARE_TIMER_DEFINITION_COUNT; timno++) {
37 config[timno].dmaopt = DMA_OPT_UNUSED;
40 #if defined(TIMUP1_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 0)
41 config[0].dmaopt = TIMUP1_DMA_OPT;
42 #endif
43 #if defined(TIMUP2_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 1)
44 config[1].dmaopt = TIMUP2_DMA_OPT;
45 #endif
46 #if defined(TIMUP3_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 2)
47 config[2].dmaopt = TIMUP3_DMA_OPT;
48 #endif
49 #if defined(TIMUP4_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 3)
50 config[3].dmaopt = TIMUP4_DMA_OPT;
51 #endif
52 #if defined(TIMUP5_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 4)
53 config[4].dmaopt = TIMUP5_DMA_OPT;
54 #endif
55 #if defined(TIMUP8_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 7)
56 config[7].dmaopt = TIMUP8_DMA_OPT;
57 #endif
58 #if defined(TIMUP9_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 8)
59 config[8].dmaopt = TIMUP9_DMA_OPT;
60 #endif
61 #if defined(TIMUP10_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 9)
62 config[9].dmaopt = TIMUP10_DMA_OPT;
63 #endif
64 #if defined(TIMUP11_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 10)
65 config[10].dmaopt = TIMUP11_DMA_OPT;
66 #endif
67 #if defined(TIMUP12_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 11)
68 config[11].dmaopt = TIMUP12_DMA_OPT;
69 #endif
70 #if defined(TIMUP13_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 12)
71 config[12].dmaopt = TIMUP13_DMA_OPT;
72 #endif
73 #if defined(TIMUP14_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 13)
74 config[13].dmaopt = TIMUP14_DMA_OPT;
75 #endif
76 #if defined(TIMUP15_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 14)
77 config[14].dmaopt = TIMUP15_DMA_OPT;
78 #endif
79 #if defined(TIMUP16_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 15)
80 config[15].dmaopt = TIMUP16_DMA_OPT;
81 #endif
82 #if defined(TIMUP17_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 16)
83 config[16].dmaopt = TIMUP17_DMA_OPT;
84 #endif
85 #if defined(TIMUP20_DMA_OPT) && (HARDWARE_TIMER_DEFINITION_COUNT > 19)
86 config[19].dmaopt = TIMUP20_DMA_OPT;
87 #endif
89 #endif