[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / pg / bus_quadspi.c
blobe9015306214f060f01c19b7c6d205370e16c8e39
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 "platform.h"
23 #ifdef USE_QUADSPI
25 #include "drivers/io.h"
27 #include "pg/pg.h"
28 #include "pg/pg_ids.h"
30 #include "bus_quadspi.h"
32 typedef struct quadSpiDefaultConfig_s {
33 QUADSPIDevice device;
34 ioTag_t clk;
36 // Note: Either or both CS pin may be used in DUAL_FLASH mode, any unused pins should be IO_NONE
37 ioTag_t bk1IO0;
38 ioTag_t bk1IO1;
39 ioTag_t bk1IO2;
40 ioTag_t bk1IO3;
41 ioTag_t bk1CS;
43 ioTag_t bk2IO0;
44 ioTag_t bk2IO1;
45 ioTag_t bk2IO2;
46 ioTag_t bk2IO3;
47 ioTag_t bk2CS;
49 uint8_t mode;
51 // CS pins can be under software control, useful when using BK1CS as the CS pin for BK2 in non-DUAL-FLASH mode.
52 uint8_t csFlags;
53 } quadSpiDefaultConfig_t;
55 const quadSpiDefaultConfig_t quadSpiDefaultConfig[] = {
56 #ifdef USE_QUADSPI_DEVICE_1
58 QUADSPIDEV_1,
59 IO_TAG(QUADSPI1_SCK_PIN),
60 IO_TAG(QUADSPI1_BK1_IO0_PIN), IO_TAG(QUADSPI1_BK1_IO1_PIN), IO_TAG(QUADSPI1_BK1_IO2_PIN), IO_TAG(QUADSPI1_BK1_IO3_PIN), IO_TAG(QUADSPI1_BK1_CS_PIN),
61 IO_TAG(QUADSPI1_BK2_IO0_PIN), IO_TAG(QUADSPI1_BK2_IO1_PIN), IO_TAG(QUADSPI1_BK2_IO2_PIN), IO_TAG(QUADSPI1_BK2_IO3_PIN), IO_TAG(QUADSPI1_BK2_CS_PIN),
62 QUADSPI1_MODE,
63 QUADSPI1_CS_FLAGS
65 #endif
68 PG_REGISTER_ARRAY_WITH_RESET_FN(quadSpiConfig_t, QUADSPIDEV_COUNT, quadSpiConfig, PG_QUADSPI_CONFIG, 1);
70 void pgResetFn_quadSpiConfig(quadSpiConfig_t *quadSpiConfig)
72 for (size_t i = 0 ; i < ARRAYLEN(quadSpiDefaultConfig) ; i++) {
73 const quadSpiDefaultConfig_t *defconf = &quadSpiDefaultConfig[i];
74 quadSpiConfig[defconf->device].ioTagClk = defconf->clk;
76 quadSpiConfig[defconf->device].ioTagBK1IO0 = defconf->bk1IO0;
77 quadSpiConfig[defconf->device].ioTagBK1IO1 = defconf->bk1IO1;
78 quadSpiConfig[defconf->device].ioTagBK1IO2 = defconf->bk1IO2;
79 quadSpiConfig[defconf->device].ioTagBK1IO3 = defconf->bk1IO3;
80 quadSpiConfig[defconf->device].ioTagBK1CS = defconf->bk1CS;
82 quadSpiConfig[defconf->device].ioTagBK2IO0 = defconf->bk2IO0;
83 quadSpiConfig[defconf->device].ioTagBK2IO1 = defconf->bk2IO1;
84 quadSpiConfig[defconf->device].ioTagBK2IO2 = defconf->bk2IO2;
85 quadSpiConfig[defconf->device].ioTagBK2IO3 = defconf->bk2IO3;
86 quadSpiConfig[defconf->device].ioTagBK2CS = defconf->bk2CS;
88 quadSpiConfig[defconf->device].mode = defconf->mode;
89 quadSpiConfig[defconf->device].csFlags = defconf->csFlags;
92 #endif