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(GPIOA, USER_LED_Pin|NFC_LPD_Enb_Pin, GPIO_PIN_RESET);
57
58 /*Configure GPIO pin Output Level */
59 HAL_GPIO_WritePin(GPIOB, _3V3_Enb_Pin|Bat_Mon_Enb_Pin, GPIO_PIN_RESET);
60
61 /*Configure GPIO pin : NFC_INT_Pin */
62 GPIO_InitStruct.Pin = NFC_INT_Pin;
63 GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
64 GPIO_InitStruct.Pull = GPIO_PULLUP;
65 HAL_GPIO_Init(NFC_INT_GPIO_Port, &GPIO_InitStruct);
66
67 /*Configure GPIO pins : SPI1_CS_Pin USER_LED_Pin NFC_LPD_Enb_Pin */
68 GPIO_InitStruct.Pin = SPI1_CS_Pin|USER_LED_Pin|NFC_LPD_Enb_Pin;
69 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
70 GPIO_InitStruct.Pull = GPIO_NOPULL;
71 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
72 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
73
74 /*Configure GPIO pins : _3V3_Enb_Pin Bat_Mon_Enb_Pin */
75 GPIO_InitStruct.Pin = _3V3_Enb_Pin|Bat_Mon_Enb_Pin;
76 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
77 GPIO_InitStruct.Pull = GPIO_NOPULL;
78 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
79 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
80
81 /* EXTI interrupt init*/
82 HAL_NVIC_SetPriority(EXTI0_IRQn, 3, 0);
83 HAL_NVIC_EnableIRQ(EXTI0_IRQn);
84
85}
86
87/* USER CODE BEGIN 2 */
88
89/* USER CODE END 2 */
void MX_GPIO_Init(void)
Definition gpio.c:42
This file contains all the function prototypes for the gpio.c file.
#define NFC_INT_GPIO_Port
Definition main.h:147
#define _3V3_Enb_Pin
Definition main.h:153
#define SPI1_CS_Pin
Definition main.h:149
#define NFC_INT_Pin
Definition main.h:146
#define NFC_LPD_Enb_Pin
Definition main.h:157
#define USER_LED_Pin
Definition main.h:151
#define SPI1_CS_GPIO_Port
Definition main.h:150
#define Bat_Mon_Enb_Pin
Definition main.h:155