STM8L15x Standard Peripherals Drivers: GPIO Read and Write

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

GPIO Read and Write

GPIO Read and Write. More...

Functions

uint8_t GPIO_ReadInputData (GPIO_TypeDef *GPIOx)
 Reads the specified GPIO input data port.
BitStatus GPIO_ReadInputDataBit (GPIO_TypeDef *GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
 Reads the specified GPIO input data pin.
uint8_t GPIO_ReadOutputData (GPIO_TypeDef *GPIOx)
 Reads the specified GPIO output data port.
BitStatus GPIO_ReadOutputDataBit (GPIO_TypeDef *GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
 Reads the specified GPIO Output data pin.
void GPIO_ResetBits (GPIO_TypeDef *GPIOx, uint8_t GPIO_Pin)
 Writes low level to the specified GPIO pins.
void GPIO_SetBits (GPIO_TypeDef *GPIOx, uint8_t GPIO_Pin)
 Writes high level to the specified GPIO pins.
void GPIO_ToggleBits (GPIO_TypeDef *GPIOx, uint8_t GPIO_Pin)
 Toggles the specified GPIO pins.
void GPIO_Write (GPIO_TypeDef *GPIOx, uint8_t GPIO_PortVal)
 Writes data to the specified GPIO data port.
void GPIO_WriteBit (GPIO_TypeDef *GPIOx, GPIO_Pin_TypeDef GPIO_Pin, BitAction GPIO_BitVal)
 Sets or clears the selected data port bit.

Detailed Description

GPIO Read and Write.

 ===============================================================================
                              GPIO Read and Write
 ===============================================================================  


Function Documentation

uint8_t GPIO_ReadInputData ( GPIO_TypeDef GPIOx)

Reads the specified GPIO input data port.

Note:
The port must be configured in input mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
Return values:
TheGPIOx input data port value.

Definition at line 341 of file stm8l15x_gpio.c.

References GPIO_struct::IDR.

BitStatus GPIO_ReadInputDataBit ( GPIO_TypeDef GPIOx,
GPIO_Pin_TypeDef  GPIO_Pin 
)

Reads the specified GPIO input data pin.

Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin: Specifies the pin number. This parameter can be one of the following values:
  • GPIO_Pin_0: Pin 0
  • GPIO_Pin_1: Pin 1
  • GPIO_Pin_2: Pin 2
  • GPIO_Pin_3: Pin 3
  • GPIO_Pin_4: Pin 4
  • GPIO_Pin_5: Pin 5
  • GPIO_Pin_6: Pin 6
  • GPIO_Pin_7: Pin 7
Return values:
BitStatus: GPIO input pin status.

Definition at line 372 of file stm8l15x_gpio.c.

References GPIO_struct::IDR.

uint8_t GPIO_ReadOutputData ( GPIO_TypeDef GPIOx)

Reads the specified GPIO output data port.

Note:
The port must be configured in input mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
Return values:
TheGPIOx output data port value.

Definition at line 352 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

BitStatus GPIO_ReadOutputDataBit ( GPIO_TypeDef GPIOx,
GPIO_Pin_TypeDef  GPIO_Pin 
)

Reads the specified GPIO Output data pin.

Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin: Specifies the pin number
Return values:
BitStatus: GPIO output pin status.

Definition at line 383 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

void GPIO_ResetBits ( GPIO_TypeDef GPIOx,
uint8_t  GPIO_Pin 
)

Writes low level to the specified GPIO pins.

Note:
The port must be configured in output mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin: Specifies the pins to be turned low This parameter can be one of the following values:
  • GPIO_Pin_0: Pin 0
  • GPIO_Pin_1: Pin 1
  • GPIO_Pin_2: Pin 2
  • GPIO_Pin_3: Pin 3
  • GPIO_Pin_4: Pin 4
  • GPIO_Pin_5: Pin 5
  • GPIO_Pin_6: Pin 6
  • GPIO_Pin_7: Pin 7
Return values:
None

Definition at line 318 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

void GPIO_SetBits ( GPIO_TypeDef GPIOx,
uint8_t  GPIO_Pin 
)

Writes high level to the specified GPIO pins.

Note:
The port must be configured in output mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin: Specifies the pins to be turned high. This parameter can be one of the following values:
  • GPIO_Pin_0: Pin 0
  • GPIO_Pin_1: Pin 1
  • GPIO_Pin_2: Pin 2
  • GPIO_Pin_3: Pin 3
  • GPIO_Pin_4: Pin 4
  • GPIO_Pin_5: Pin 5
  • GPIO_Pin_6: Pin 6
  • GPIO_Pin_7: Pin 7
Return values:
None

Definition at line 297 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

void GPIO_ToggleBits ( GPIO_TypeDef GPIOx,
uint8_t  GPIO_Pin 
)

Toggles the specified GPIO pins.

Note:
The port must be configured in output mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin: Specifies the pins to be toggled.
Return values:
None

Definition at line 330 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

void GPIO_Write ( GPIO_TypeDef GPIOx,
uint8_t  GPIO_PortVal 
)

Writes data to the specified GPIO data port.

Note:
The port must be configured in output mode.
Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_PortVal: Specifies the value to be written to the port output data register.
Return values:
None

Definition at line 242 of file stm8l15x_gpio.c.

References GPIO_struct::ODR.

void GPIO_WriteBit ( GPIO_TypeDef GPIOx,
GPIO_Pin_TypeDef  GPIO_Pin,
BitAction  GPIO_BitVal 
)

Sets or clears the selected data port bit.

Parameters:
GPIOx: Select the GPIO peripheral number (x = A to I).
GPIO_Pin,:Specifies the port bit to be written. This parameter can be one of the following values:
  • GPIO_Pin_0: Pin 0
  • GPIO_Pin_1: Pin 1
  • GPIO_Pin_2: Pin 2
  • GPIO_Pin_3: Pin 3
  • GPIO_Pin_4: Pin 4
  • GPIO_Pin_5: Pin 5
  • GPIO_Pin_6: Pin 6
  • GPIO_Pin_7: Pin 7
GPIO_BitVal,:specifies the desired status to be written. This parameter can be SET or RESET
Return values:
None

Definition at line 264 of file stm8l15x_gpio.c.

References IS_GPIO_PIN, IS_STATE_VALUE, GPIO_struct::ODR, and RESET.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com