Gyroscope with kalman

Dependencies:   LSM6DS3 mbed

Fork of Gyroscope by João Pereira

Committer:
einsteingustavo
Date:
Sat Sep 29 19:13:42 2018 +0000
Revision:
0:cd56e3a52a36
123

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:cd56e3a52a36 1 /*
einsteingustavo 0:cd56e3a52a36 2 ******************************************************************************
einsteingustavo 0:cd56e3a52a36 3 * @file SysClockConf.c
einsteingustavo 0:cd56e3a52a36 4 * @author Zoltan Hudak
einsteingustavo 0:cd56e3a52a36 5 * @version
einsteingustavo 0:cd56e3a52a36 6 * @date 05-July-2016
einsteingustavo 0:cd56e3a52a36 7 * @brief System Clock configuration for STM32F103C8T6
einsteingustavo 0:cd56e3a52a36 8 ******************************************************************************
einsteingustavo 0:cd56e3a52a36 9 * @attention
einsteingustavo 0:cd56e3a52a36 10 *
einsteingustavo 0:cd56e3a52a36 11 * <h2><center>&copy; COPYRIGHT(c) 2016 Zoltan Hudak <hudakz@outlook.com>
einsteingustavo 0:cd56e3a52a36 12 *
einsteingustavo 0:cd56e3a52a36 13 * All rights reserved.
einsteingustavo 0:cd56e3a52a36 14
einsteingustavo 0:cd56e3a52a36 15 This program is free software: you can redistribute it and/or modify
einsteingustavo 0:cd56e3a52a36 16 it under the terms of the GNU General Public License as published by
einsteingustavo 0:cd56e3a52a36 17 the Free Software Foundation, either version 3 of the License, or
einsteingustavo 0:cd56e3a52a36 18 (at your option) any later version.
einsteingustavo 0:cd56e3a52a36 19
einsteingustavo 0:cd56e3a52a36 20 This program is distributed in the hope that it will be useful,
einsteingustavo 0:cd56e3a52a36 21 but WITHOUT ANY WARRANTY; without even the implied warranty of
einsteingustavo 0:cd56e3a52a36 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
einsteingustavo 0:cd56e3a52a36 23 GNU General Public License for more details.
einsteingustavo 0:cd56e3a52a36 24
einsteingustavo 0:cd56e3a52a36 25 You should have received a copy of the GNU General Public License
einsteingustavo 0:cd56e3a52a36 26 along with this program. If not, see <http://www.gnu.org/licenses/>.
einsteingustavo 0:cd56e3a52a36 27 */
einsteingustavo 0:cd56e3a52a36 28
einsteingustavo 0:cd56e3a52a36 29 #include "SysClockConf.h"
einsteingustavo 0:cd56e3a52a36 30 #include "mbed.h"
einsteingustavo 0:cd56e3a52a36 31
einsteingustavo 0:cd56e3a52a36 32 void HSE_SystemClock_Config(void) {
einsteingustavo 0:cd56e3a52a36 33 RCC_OscInitTypeDef RCC_OscInitStruct;
einsteingustavo 0:cd56e3a52a36 34 RCC_ClkInitTypeDef RCC_ClkInitStruct;
einsteingustavo 0:cd56e3a52a36 35 RCC_PeriphCLKInitTypeDef PeriphClkInit;
einsteingustavo 0:cd56e3a52a36 36
einsteingustavo 0:cd56e3a52a36 37 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
einsteingustavo 0:cd56e3a52a36 38 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
einsteingustavo 0:cd56e3a52a36 39 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
einsteingustavo 0:cd56e3a52a36 40 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
einsteingustavo 0:cd56e3a52a36 41 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
einsteingustavo 0:cd56e3a52a36 42 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
einsteingustavo 0:cd56e3a52a36 43 HAL_RCC_OscConfig(&RCC_OscInitStruct);
einsteingustavo 0:cd56e3a52a36 44 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
einsteingustavo 0:cd56e3a52a36 45 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
einsteingustavo 0:cd56e3a52a36 46 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
einsteingustavo 0:cd56e3a52a36 47 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
einsteingustavo 0:cd56e3a52a36 48 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
einsteingustavo 0:cd56e3a52a36 49 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
einsteingustavo 0:cd56e3a52a36 50 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB;
einsteingustavo 0:cd56e3a52a36 51 PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
einsteingustavo 0:cd56e3a52a36 52 PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
einsteingustavo 0:cd56e3a52a36 53 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
einsteingustavo 0:cd56e3a52a36 54 }
einsteingustavo 0:cd56e3a52a36 55
einsteingustavo 0:cd56e3a52a36 56 void confSysClock(void) {
einsteingustavo 0:cd56e3a52a36 57 HAL_RCC_DeInit();
einsteingustavo 0:cd56e3a52a36 58 HSE_SystemClock_Config();
einsteingustavo 0:cd56e3a52a36 59 SystemCoreClockUpdate();
einsteingustavo 0:cd56e3a52a36 60 }