You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
486 B

/*
* gpio.c
*
* Created on: 25.10.2020
* Author: ftobler
*/
#include "stm32f0xx_hal.h"
#include "gpio.h"
uint8_t gpio_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) {
if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)
return 1;
else
return 0;
}
void gpio_SetPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) {
GPIOx->BSRR = (uint32_t)GPIO_Pin;
}
void gpio_ResetPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) {
GPIOx->BSRR = (uint32_t)(GPIO_Pin << 16);
}