L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
gpio.c
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file gpio.c
5 * @brief This file provides code for the configuration
6 * of all used GPIO pins.
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2025 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20
21/* Includes ------------------------------------------------------------------*/
22#include "gpio.h"
23
24/* USER CODE BEGIN 0 */
25
26/* USER CODE END 0 */
27
28/*----------------------------------------------------------------------------*/
29/* Configure GPIO */
30/*----------------------------------------------------------------------------*/
31/* USER CODE BEGIN 1 */
32
33/* USER CODE END 1 */
34
35/** Configure pins as
36 * Analog
37 * Input
38 * Output
39 * EVENT_OUT
40 * EXTI
41*/
42void MX_GPIO_Init(void)
43{
44
45 GPIO_InitTypeDef GPIO_InitStruct = {0};
46
47 /* GPIO Ports Clock Enable */
48 __HAL_RCC_GPIOB_CLK_ENABLE();
49 __HAL_RCC_GPIOA_CLK_ENABLE();
50 __HAL_RCC_GPIOC_CLK_ENABLE();
51
52 /*Configure GPIO pin Output Level */
53 HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, GPIO_PIN_SET);
54
55 /*Configure GPIO pin Output Level */
56 HAL_GPIO_WritePin(USER_LED_GPIO_Port, USER_LED_Pin, GPIO_PIN_RESET);
57
58 /*Configure GPIO pin : NFC_INT_Pin */
59 GPIO_InitStruct.Pin = NFC_INT_Pin;
60 GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
61 GPIO_InitStruct.Pull = GPIO_PULLUP;
62 HAL_GPIO_Init(NFC_INT_GPIO_Port, &GPIO_InitStruct);
63
64 /*Configure GPIO pins : SPI1_CS_Pin USER_LED_Pin */
65 GPIO_InitStruct.Pin = SPI1_CS_Pin|USER_LED_Pin;
66 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
67 GPIO_InitStruct.Pull = GPIO_NOPULL;
68 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
69 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
70
71 /* EXTI interrupt init*/
72 HAL_NVIC_SetPriority(EXTI0_IRQn, 3, 0);
73 HAL_NVIC_EnableIRQ(EXTI0_IRQn);
74
75}
76
77/* USER CODE BEGIN 2 */
78
79/* USER CODE END 2 */
void MX_GPIO_Init(void)
Initialise all GPIO pins and ports as configured by STM32CubeMX. Enables GPIO clocks,...
Definition gpio.c:42
This file contains all the function prototypes for the gpio.c file.
#define NFC_INT_GPIO_Port
Definition main.h:140
#define SPI1_CS_Pin
Definition main.h:142
#define NFC_INT_Pin
Definition main.h:139
#define USER_LED_Pin
Definition main.h:144
#define USER_LED_GPIO_Port
Definition main.h:145
#define SPI1_CS_GPIO_Port
Definition main.h:143