From 0f2ea7deaf0cba2f0ca07f6611c5a9e87d531f5b Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 17:03:24 +0000 Subject: Initial commit --- project_starter_files/Core/Src/GPIO.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 project_starter_files/Core/Src/GPIO.c (limited to 'project_starter_files/Core/Src/GPIO.c') diff --git a/project_starter_files/Core/Src/GPIO.c b/project_starter_files/Core/Src/GPIO.c new file mode 100644 index 0000000..f3812fa --- /dev/null +++ b/project_starter_files/Core/Src/GPIO.c @@ -0,0 +1,50 @@ +/* + * gpio.c + * + * Created on: Nov 4, 2021 + * Author: Mitesh Parikh + */ + + +/* Includes ------------------------------------------------------------------*/ +#include "GPIO.h" +#include +#include "stm32l4xx.h" + +// External Global Variables that we will need access to + + +/*----------------------------------------------------------------------------*/ +/* Configure GPIO */ +/*----------------------------------------------------------------------------*/ +void GPIO_Init(void) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* GPIO Ports Clock Enable */ + __HAL_RCC_GPIOC_CLK_ENABLE(); + __HAL_RCC_GPIOH_CLK_ENABLE(); + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + + /*Configure GPIO pin : PtPin */ + GPIO_InitStruct.Pin = B1_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = S1_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; + HAL_GPIO_Init(S1_GPIO_Port, &GPIO_InitStruct); + + /* EXTI15_10_IRQn interrupt init*/ + // Note you will have to add EXTI15_10_IRQn Interrupt handler function as well + // This is the interrupt handler for the blue button + + + /* EXTI9_5_IRQn interrupt init*/ + // Note you will have to add EXTI9_15_IRQn Interrupt handler function as well + // This is the interrupt handler for the external buttons (S1) +} + -- cgit v1.2.3