Files
@ 3324e1dda444
Branch filter:
Location: protofuse-firmware/src/gpio.c - annotation
3324e1dda444
1.3 KiB
text/plain
Got initial software filtered push button working
ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d ad3725832a9d 48ae84f03494 ad3725832a9d ad3725832a9d 47fdd16b7231 47fdd16b7231 47fdd16b7231 47fdd16b7231 48ae84f03494 47fdd16b7231 47fdd16b7231 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 7e9d097bfe72 47fdd16b7231 7e9d097bfe72 7e9d097bfe72 ad3725832a9d ad3725832a9d | //
// GPIO: configure general-purpose inputs/outputs
//
#include "stm32f3xx_hal.h"
#include "gpio.h"
// Initialize GPIOs
void gpio_init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
// GPIO Ports Clock Enable
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
__GPIOF_CLK_ENABLE();
// Configure LED GPIO pins
GPIO_InitStruct.Pin = LED_RED_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_RED_GPIO_Port, &GPIO_InitStruct);
// Configure Gate Drive GPIO pins
GPIO_InitStruct.Pin = GATE_DRIVE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GATE_DRIVE_GPIO_Port, &GPIO_InitStruct);
GPIO_InitStruct.Pin = SW_A_Pin|SW_BTN_Pin|SW_C_Pin|SW_D_Pin
|SW_B_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
// Define startup State
HAL_GPIO_WritePin(LED_RED, 0);
HAL_GPIO_WritePin(GATE_DRIVE, 0);
}
|