84 #include "stm32f4xx_gpio.h" 85 #include "stm32f4xx_rcc.h" 136 else if (GPIOx ==
GPIOB)
141 else if (GPIOx ==
GPIOC)
146 else if (GPIOx ==
GPIOD)
151 else if (GPIOx ==
GPIOE)
156 else if (GPIOx ==
GPIOF)
161 else if (GPIOx ==
GPIOG)
166 else if (GPIOx ==
GPIOH)
191 uint32_t pinpos = 0x00, pos = 0x00 , currentpin = 0x00;
201 for (pinpos = 0x00; pinpos < 0x10; pinpos++)
203 pos = ((uint32_t)0x01) << pinpos;
205 currentpin = (GPIO_InitStruct->
GPIO_Pin) & pos;
207 if (currentpin == pos)
210 GPIOx->
MODER |= (((uint32_t)GPIO_InitStruct->
GPIO_Mode) << (pinpos * 2));
226 GPIOx->
OTYPER |= (uint16_t)(((uint16_t)GPIO_InitStruct->
GPIO_OType) << ((uint16_t)pinpos));
231 GPIOx->
PUPDR |= (((uint32_t)GPIO_InitStruct->
GPIO_PuPd) << (pinpos * 2));
265 __IO uint32_t tmp = 0x00010000;
310 uint8_t bitstatus = 0x00;
322 bitstatus = (uint8_t)Bit_RESET;
338 return ((uint16_t)GPIOx->
IDR);
351 uint8_t bitstatus = 0x00;
363 bitstatus = (uint8_t)Bit_RESET;
379 return ((uint16_t)GPIOx->
ODR);
463 GPIOx->
ODR = PortVal;
554 uint32_t
temp = 0x00;
555 uint32_t temp_2 = 0x00;
562 temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;
563 GPIOx->
AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;
564 temp_2 = GPIOx->
AFR[GPIO_PinSource >> 0x03] |
temp;
565 GPIOx->
AFR[GPIO_PinSource >> 0x03] = temp_2;
void GPIO_PinAFConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
Changes the mapping of the specified pin.
#define RCC_AHB1Periph_GPIOC
GPIOOType_TypeDef GPIO_OType
#define IS_GPIO_MODE(MODE)
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Reads the specified input port pin.
#define IS_GPIO_OTYPE(OTYPE)
BitAction
GPIO Bit SET and Bit RESET enumeration.
#define IS_GPIO_ALL_PERIPH(PERIPH)
GPIOSpeed_TypeDef GPIO_Speed
#define RCC_AHB1Periph_GPIOG
void RCC_AHB1PeriphResetCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState)
Forces or releases AHB1 peripheral reset.
#define RCC_AHB1Periph_GPIOB
void assert_param(int val)
void GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_InitStruct)
Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStruct.
#define GPIO_OSPEEDER_OSPEEDR0
#define RCC_AHB1Periph_GPIOF
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
Fills each GPIO_InitStruct member with its default value.
void GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t PortVal)
Writes data to the specified GPIO data port.
#define RCC_AHB1Periph_GPIOI
#define GPIO_MODER_MODER0
#define IS_GET_GPIO_PIN(PIN)
GPIO Init structure definition.
#define IS_GPIO_SPEED(SPEED)
#define RCC_AHB1Periph_GPIOE
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
Sets or clears the selected data port bit.
#define RCC_AHB1Periph_GPIOA
static volatile int16_t temp
#define GPIO_PUPDR_PUPDR0
void GPIO_PinLockConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Locks GPIO Pins configuration registers.
GPIOMode_TypeDef GPIO_Mode
#define IS_GPIO_BIT_ACTION(ACTION)
uint16_t GPIO_ReadInputData(GPIO_TypeDef *GPIOx)
Reads the specified GPIO input data port.
#define RCC_AHB1Periph_GPIOD
void GPIO_DeInit(GPIO_TypeDef *GPIOx)
De-initializes the GPIOx peripheral registers to their default reset values.
uint16_t GPIO_ReadOutputData(GPIO_TypeDef *GPIOx)
Reads the specified GPIO output data port.
void GPIO_ResetBits(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Clears the selected data port bits.
#define RCC_AHB1Periph_GPIOH
void GPIO_ToggleBits(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Toggles the specified GPIO pins..
GPIOPuPd_TypeDef GPIO_PuPd
void GPIO_SetBits(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Sets the selected data port bits.
uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Reads the specified output data port bit.
#define IS_GPIO_PUPD(PUPD)
#define IS_GPIO_PIN_SOURCE(PINSOURCE)