2019-2020 Multisensor project using the X_NUCLEO_IKS01A3 sensor platform

Dependencies:   X_NUCLEO_IKS01A3

Committer:
martlefebvre94
Date:
Tue Nov 26 11:45:01 2019 +0000
Revision:
19:35f7b17d4bb5
Parent:
18:17f5509ac69b
Code cleaned

Who changed what in which revision?

UserRevisionLine numberNew contents of line
martlefebvre94 18:17f5509ac69b 1 /**
martlefebvre94 18:17f5509ac69b 2 ******************************************************************************
martlefebvre94 18:17f5509ac69b 3 * File Name : gpio.c
martlefebvre94 18:17f5509ac69b 4 * Description : This file provides code for the configuration
martlefebvre94 18:17f5509ac69b 5 * of all used GPIO pins.
martlefebvre94 18:17f5509ac69b 6 ******************************************************************************
martlefebvre94 18:17f5509ac69b 7 ** This notice applies to any and all portions of this file
martlefebvre94 18:17f5509ac69b 8 * that are not between comment pairs USER CODE BEGIN and
martlefebvre94 18:17f5509ac69b 9 * USER CODE END. Other portions of this file, whether
martlefebvre94 18:17f5509ac69b 10 * inserted by the user or by software development tools
martlefebvre94 18:17f5509ac69b 11 * are owned by their respective copyright owners.
martlefebvre94 18:17f5509ac69b 12 *
martlefebvre94 18:17f5509ac69b 13 * COPYRIGHT(c) 2019 STMicroelectronics
martlefebvre94 18:17f5509ac69b 14 *
martlefebvre94 18:17f5509ac69b 15 * Redistribution and use in source and binary forms, with or without modification,
martlefebvre94 18:17f5509ac69b 16 * are permitted provided that the following conditions are met:
martlefebvre94 18:17f5509ac69b 17 * 1. Redistributions of source code must retain the above copyright notice,
martlefebvre94 18:17f5509ac69b 18 * this list of conditions and the following disclaimer.
martlefebvre94 18:17f5509ac69b 19 * 2. Redistributions in binary form must reproduce the above copyright notice,
martlefebvre94 18:17f5509ac69b 20 * this list of conditions and the following disclaimer in the documentation
martlefebvre94 18:17f5509ac69b 21 * and/or other materials provided with the distribution.
martlefebvre94 18:17f5509ac69b 22 * 3. Neither the name of STMicroelectronics nor the names of its contributors
martlefebvre94 18:17f5509ac69b 23 * may be used to endorse or promote products derived from this software
martlefebvre94 18:17f5509ac69b 24 * without specific prior written permission.
martlefebvre94 18:17f5509ac69b 25 *
martlefebvre94 18:17f5509ac69b 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
martlefebvre94 18:17f5509ac69b 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
martlefebvre94 18:17f5509ac69b 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
martlefebvre94 18:17f5509ac69b 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
martlefebvre94 18:17f5509ac69b 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
martlefebvre94 18:17f5509ac69b 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
martlefebvre94 18:17f5509ac69b 32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
martlefebvre94 18:17f5509ac69b 33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
martlefebvre94 18:17f5509ac69b 34 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
martlefebvre94 18:17f5509ac69b 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
martlefebvre94 18:17f5509ac69b 36 *
martlefebvre94 18:17f5509ac69b 37 ******************************************************************************
martlefebvre94 18:17f5509ac69b 38 */
martlefebvre94 18:17f5509ac69b 39
martlefebvre94 18:17f5509ac69b 40 /* Includes ------------------------------------------------------------------*/
martlefebvre94 18:17f5509ac69b 41 #include "gpio.h"
martlefebvre94 18:17f5509ac69b 42
martlefebvre94 18:17f5509ac69b 43 /*----------------------------------------------------------------------------*/
martlefebvre94 18:17f5509ac69b 44 /* Configure GPIO */
martlefebvre94 18:17f5509ac69b 45 /*----------------------------------------------------------------------------*/
martlefebvre94 18:17f5509ac69b 46
martlefebvre94 18:17f5509ac69b 47 /** Configure pins as
martlefebvre94 18:17f5509ac69b 48 * Analog
martlefebvre94 18:17f5509ac69b 49 * Input
martlefebvre94 18:17f5509ac69b 50 * Output
martlefebvre94 18:17f5509ac69b 51 * EVENT_OUT
martlefebvre94 18:17f5509ac69b 52 * EXTI
martlefebvre94 18:17f5509ac69b 53 */
martlefebvre94 18:17f5509ac69b 54 void MX_GPIO_Init(void)
martlefebvre94 18:17f5509ac69b 55 {
martlefebvre94 18:17f5509ac69b 56 GPIO_InitTypeDef GPIO_InitStruct;
martlefebvre94 18:17f5509ac69b 57
martlefebvre94 18:17f5509ac69b 58 /* GPIO Ports Clock Enable */
martlefebvre94 18:17f5509ac69b 59 __HAL_RCC_GPIOC_CLK_ENABLE();
martlefebvre94 18:17f5509ac69b 60 __HAL_RCC_GPIOH_CLK_ENABLE();
martlefebvre94 18:17f5509ac69b 61 __HAL_RCC_GPIOA_CLK_ENABLE();
martlefebvre94 18:17f5509ac69b 62
martlefebvre94 18:17f5509ac69b 63 /*Configure GPIO pin Output Level */
martlefebvre94 18:17f5509ac69b 64 HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
martlefebvre94 18:17f5509ac69b 65
martlefebvre94 18:17f5509ac69b 66 /* Configure GPIO pin : PtPin */
martlefebvre94 18:17f5509ac69b 67 GPIO_InitStruct.Pin = B1_Pin;
martlefebvre94 18:17f5509ac69b 68 GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
martlefebvre94 18:17f5509ac69b 69 GPIO_InitStruct.Pull = GPIO_NOPULL;
martlefebvre94 18:17f5509ac69b 70 HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
martlefebvre94 18:17f5509ac69b 71
martlefebvre94 18:17f5509ac69b 72 /* Configure GPIO pin : PtPin */
martlefebvre94 18:17f5509ac69b 73 GPIO_InitStruct.Pin = LD2_Pin;
martlefebvre94 18:17f5509ac69b 74 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
martlefebvre94 18:17f5509ac69b 75 GPIO_InitStruct.Pull = GPIO_NOPULL;
martlefebvre94 18:17f5509ac69b 76 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
martlefebvre94 18:17f5509ac69b 77 HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
martlefebvre94 18:17f5509ac69b 78
martlefebvre94 18:17f5509ac69b 79 /* Configure GPIO pin : IR ctrl , RED ctrl */
martlefebvre94 18:17f5509ac69b 80 GPIO_InitStruct.Pin = GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
martlefebvre94 18:17f5509ac69b 81 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
martlefebvre94 18:17f5509ac69b 82 GPIO_InitStruct.Pull = GPIO_NOPULL;
martlefebvre94 18:17f5509ac69b 83 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
martlefebvre94 18:17f5509ac69b 84 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
martlefebvre94 18:17f5509ac69b 85 }
martlefebvre94 18:17f5509ac69b 86
martlefebvre94 18:17f5509ac69b 87 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/