Update FrSky SPI RX.md
[betaflight.git] / src / main / drivers / mco.c
blob33eb6674f7ed4d94dbb373a58cab310d9860192a
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 <stdbool.h>
22 #include <stdint.h>
23 #include <string.h>
25 #include "platform.h"
27 #ifdef USE_MCO
29 #include "drivers/io.h"
30 #include "pg/mco.h"
32 void mcoInit(const mcoConfig_t *mcoConfig)
34 // Only configure MCO2 with PLLI2SCLK as source for now.
35 // Other MCO1 and other sources can easily be added.
36 // For all F4 and F7 varianets, MCO1 is on PA8 and MCO2 is on PC9.
38 if (mcoConfig->enabled[1]) {
39 IO_t io = IOGetByTag(DEFIO_TAG_E(PC9));
40 IOInit(io, OWNER_MCO, 2);
41 HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_PLLI2SCLK, RCC_MCODIV_4);
42 IOConfigGPIOAF(io, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_NOPULL), GPIO_AF0_MCO);
45 #endif