GPIO driver modules. More...
Data Structures | |
struct | GPIO_InitTypeDef |
GPIO Init structure definition. More... | |
Modules | |
GPIO_Exported_Constants | |
GPIO_Private_Functions | |
Defines | |
#define | IS_GPIO_ALL_PERIPH(PERIPH) |
#define | IS_GPIO_MODE(MODE) |
#define | IS_GPIO_OTYPE(OTYPE) (((OTYPE) == GPIO_OType_PP) || ((OTYPE) == GPIO_OType_OD)) |
#define | IS_GPIO_SPEED(SPEED) |
#define | IS_GPIO_PUPD(PUPD) |
#define | IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET)) |
Enumerations | |
enum | GPIOMode_TypeDef { GPIO_Mode_IN = 0x00, GPIO_Mode_OUT = 0x01, GPIO_Mode_AF = 0x02, GPIO_Mode_AN = 0x03 } |
GPIO Configuration Mode enumeration. More... | |
enum | GPIOOType_TypeDef { GPIO_OType_PP = 0x00, GPIO_OType_OD = 0x01 } |
GPIO Output type enumeration. | |
enum | GPIOSpeed_TypeDef { GPIO_Speed_2MHz = 0x00, GPIO_Speed_25MHz = 0x01, GPIO_Speed_50MHz = 0x02, GPIO_Speed_100MHz = 0x03 } |
GPIO Output Maximum frequency enumeration. More... | |
enum | GPIOPuPd_TypeDef { GPIO_PuPd_NOPULL = 0x00, GPIO_PuPd_UP = 0x01, GPIO_PuPd_DOWN = 0x02 } |
GPIO Configuration PullUp PullDown enumeration. | |
enum | BitAction { Bit_RESET = 0, Bit_SET } |
GPIO Bit SET and Bit RESET enumeration. | |
Functions | |
void | GPIO_DeInit (GPIO_TypeDef *GPIOx) |
Deinitializes the GPIOx peripheral registers to their default reset values. | |
void | GPIO_Init (GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_InitStruct) |
Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStruct. | |
void | GPIO_StructInit (GPIO_InitTypeDef *GPIO_InitStruct) |
Fills each GPIO_InitStruct member with its default value. | |
void | GPIO_PinLockConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Locks GPIO Pins configuration registers. | |
uint8_t | GPIO_ReadInputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Reads the specified input port pin. | |
uint16_t | GPIO_ReadInputData (GPIO_TypeDef *GPIOx) |
Reads the specified GPIO input data port. | |
uint8_t | GPIO_ReadOutputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Reads the specified output data port bit. | |
uint16_t | GPIO_ReadOutputData (GPIO_TypeDef *GPIOx) |
Reads the specified GPIO output data port. | |
void | GPIO_SetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Sets the selected data port bits. | |
void | GPIO_ResetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Clears the selected data port bits. | |
void | GPIO_WriteBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal) |
Sets or clears the selected data port bit. | |
void | GPIO_Write (GPIO_TypeDef *GPIOx, uint16_t PortVal) |
Writes data to the specified GPIO data port. | |
void | GPIO_ToggleBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) |
Toggles the specified GPIO pins.. | |
void | GPIO_PinAFConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF) |
Changes the mapping of the specified pin. |
GPIO driver modules.
#define IS_GPIO_ALL_PERIPH | ( | PERIPH | ) |
(((PERIPH) == GPIOA) || \ ((PERIPH) == GPIOB) || \ ((PERIPH) == GPIOC) || \ ((PERIPH) == GPIOD) || \ ((PERIPH) == GPIOE) || \ ((PERIPH) == GPIOF) || \ ((PERIPH) == GPIOG) || \ ((PERIPH) == GPIOH) || \ ((PERIPH) == GPIOI))
#define IS_GPIO_MODE | ( | MODE | ) |
(((MODE) == GPIO_Mode_IN) || ((MODE) == GPIO_Mode_OUT) || \ ((MODE) == GPIO_Mode_AF)|| ((MODE) == GPIO_Mode_AN))
#define IS_GPIO_PUPD | ( | PUPD | ) |
(((PUPD) == GPIO_PuPd_NOPULL) || ((PUPD) == GPIO_PuPd_UP) || \ ((PUPD) == GPIO_PuPd_DOWN))
#define IS_GPIO_SPEED | ( | SPEED | ) |
(((SPEED) == GPIO_Speed_2MHz) || ((SPEED) == GPIO_Speed_25MHz) || \ ((SPEED) == GPIO_Speed_50MHz)|| ((SPEED) == GPIO_Speed_100MHz))
enum GPIOMode_TypeDef |
enum GPIOSpeed_TypeDef |
void GPIO_DeInit | ( | GPIO_TypeDef * | GPIOx | ) |
Deinitializes the GPIOx peripheral registers to their default reset values.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. |
None |
void GPIO_Init | ( | GPIO_TypeDef * | GPIOx, | |
GPIO_InitTypeDef * | GPIO_InitStruct | |||
) |
Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStruct.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_InitStruct,: | pointer to a GPIO_InitTypeDef structure that contains the configuration information for the specified GPIO peripheral. |
None |
void GPIO_PinAFConfig | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_PinSource, | |||
uint8_t | GPIO_AF | |||
) |
Changes the mapping of the specified pin.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_PinSource,: | specifies the pin for the Alternate function. This parameter can be GPIO_PinSourcex where x can be (0..15). | |
GPIO_AFSelection,: | selects the pin to used as Alternate function. This parameter can be one of the following values:
|
None |
void GPIO_PinLockConfig | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Locks GPIO Pins configuration registers.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bit to be locked. This parameter can be any combination of GPIO_Pin_x where x can be (0..15). |
None |
uint16_t GPIO_ReadInputData | ( | GPIO_TypeDef * | GPIOx | ) |
Reads the specified GPIO input data port.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. |
GPIO | input data port value. |
uint8_t GPIO_ReadInputDataBit | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Reads the specified input port pin.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..15). |
The | input port pin value. |
uint16_t GPIO_ReadOutputData | ( | GPIO_TypeDef * | GPIOx | ) |
Reads the specified GPIO output data port.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. |
GPIO | output data port value. |
uint8_t GPIO_ReadOutputDataBit | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Reads the specified output data port bit.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..15). |
The | output port pin value. |
void GPIO_ResetBits | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Clears the selected data port bits.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15). |
None |
void GPIO_SetBits | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Sets the selected data port bits.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15). |
None |
void GPIO_StructInit | ( | GPIO_InitTypeDef * | GPIO_InitStruct | ) |
Fills each GPIO_InitStruct member with its default value.
GPIO_InitStruct | : pointer to a GPIO_InitTypeDef structure which will be initialized. |
None |
void GPIO_ToggleBits | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin | |||
) |
Toggles the specified GPIO pins..
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | Specifies the pins to be toggled. |
None |
void GPIO_Write | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | PortVal | |||
) |
Writes data to the specified GPIO data port.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
PortVal,: | specifies the value to be written to the port output data register. |
None |
void GPIO_WriteBit | ( | GPIO_TypeDef * | GPIOx, | |
uint16_t | GPIO_Pin, | |||
BitAction | BitVal | |||
) |
Sets or clears the selected data port bit.
GPIOx,: | where x can be (A..I) to select the GPIO peripheral. | |
GPIO_Pin,: | specifies the port bit to be written. This parameter can be one of GPIO_Pin_x where x can be (0..15). | |
BitVal,: | specifies the value to be written to the selected bit. This parameter can be one of the BitAction enum values:
|
None |