EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
em_gpio.h File Reference

Detailed Description

General Purpose IO (GPIO) peripheral API.

Version
5.1.2

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file em_gpio.h.

#include "em_device.h"
#include <stdbool.h>
#include "em_bus.h"
#include "em_assert.h"

Go to the source code of this file.

Enumerations

enum  GPIO_DriveMode_TypeDef {
  gpioDriveModeStandard = GPIO_P_CTRL_DRIVEMODE_STANDARD,
  gpioDriveModeLowest = GPIO_P_CTRL_DRIVEMODE_LOWEST,
  gpioDriveModeHigh = GPIO_P_CTRL_DRIVEMODE_HIGH,
  gpioDriveModeLow = GPIO_P_CTRL_DRIVEMODE_LOW
}
 
enum  GPIO_Mode_TypeDef {
  gpioModeDisabled = _GPIO_P_MODEL_MODE0_DISABLED,
  gpioModeInput = _GPIO_P_MODEL_MODE0_INPUT,
  gpioModeInputPull = _GPIO_P_MODEL_MODE0_INPUTPULL,
  gpioModeInputPullFilter = _GPIO_P_MODEL_MODE0_INPUTPULLFILTER,
  gpioModePushPull = _GPIO_P_MODEL_MODE0_PUSHPULL,
  gpioModePushPullDrive = _GPIO_P_MODEL_MODE0_PUSHPULLDRIVE,
  gpioModeWiredOr = _GPIO_P_MODEL_MODE0_WIREDOR,
  gpioModeWiredOrPullDown = _GPIO_P_MODEL_MODE0_WIREDORPULLDOWN,
  gpioModeWiredAnd = _GPIO_P_MODEL_MODE0_WIREDAND,
  gpioModeWiredAndFilter = _GPIO_P_MODEL_MODE0_WIREDANDFILTER,
  gpioModeWiredAndPullUp = _GPIO_P_MODEL_MODE0_WIREDANDPULLUP,
  gpioModeWiredAndPullUpFilter = _GPIO_P_MODEL_MODE0_WIREDANDPULLUPFILTER,
  gpioModeWiredAndDrive = _GPIO_P_MODEL_MODE0_WIREDANDDRIVE,
  gpioModeWiredAndDriveFilter = _GPIO_P_MODEL_MODE0_WIREDANDDRIVEFILTER,
  gpioModeWiredAndDrivePullUp = _GPIO_P_MODEL_MODE0_WIREDANDDRIVEPULLUP,
  gpioModeWiredAndDrivePullUpFilter = _GPIO_P_MODEL_MODE0_WIREDANDDRIVEPULLUPFILTER
}
 
enum  GPIO_Port_TypeDef
 

Functions

void GPIO_DbgLocationSet (unsigned int location)
 Sets the pin location of the debug pins (Serial Wire interface). More...
 
__STATIC_INLINE void GPIO_DbgSWDClkEnable (bool enable)
 Enable/disable serial wire clock pin. More...
 
__STATIC_INLINE void GPIO_DbgSWDIOEnable (bool enable)
 Enable/disable serial wire data I/O pin. More...
 
__STATIC_INLINE void GPIO_DbgSWOEnable (bool enable)
 Enable/Disable serial wire output pin. More...
 
void GPIO_DriveModeSet (GPIO_Port_TypeDef port, GPIO_DriveMode_TypeDef mode)
 Sets the drive mode for a GPIO port. More...
 
void GPIO_ExtIntConfig (GPIO_Port_TypeDef port, unsigned int pin, unsigned int intNo, bool risingEdge, bool fallingEdge, bool enable)
 Configure GPIO external pin interrupt. More...
 
__STATIC_INLINE void GPIO_InputSenseSet (uint32_t val, uint32_t mask)
 Enable/disable input sensing. More...
 
__STATIC_INLINE void GPIO_IntClear (uint32_t flags)
 Clear one or more pending GPIO interrupts. More...
 
__STATIC_INLINE void GPIO_IntConfig (GPIO_Port_TypeDef port, unsigned int pin, bool risingEdge, bool fallingEdge, bool enable)
 Configure GPIO interrupt. More...
 
__STATIC_INLINE void GPIO_IntDisable (uint32_t flags)
 Disable one or more GPIO interrupts. More...
 
__STATIC_INLINE void GPIO_IntEnable (uint32_t flags)
 Enable one or more GPIO interrupts. More...
 
__STATIC_INLINE uint32_t GPIO_IntGet (void)
 Get pending GPIO interrupts. More...
 
__STATIC_INLINE uint32_t GPIO_IntGetEnabled (void)
 Get enabled and pending GPIO interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More...
 
__STATIC_INLINE void GPIO_IntSet (uint32_t flags)
 Set one or more pending GPIO interrupts from SW. More...
 
__STATIC_INLINE void GPIO_Lock (void)
 Locks the GPIO configuration.
 
__STATIC_INLINE unsigned int GPIO_PinInGet (GPIO_Port_TypeDef port, unsigned int pin)
 Read the pad value for a single pin in a GPIO port. More...
 
GPIO_Mode_TypeDef GPIO_PinModeGet (GPIO_Port_TypeDef port, unsigned int pin)
 Get the mode for a GPIO pin. More...
 
void GPIO_PinModeSet (GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
 Set the mode for a GPIO pin. More...
 
__STATIC_INLINE void GPIO_PinOutClear (GPIO_Port_TypeDef port, unsigned int pin)
 Set a single pin in GPIO data out port register to 0. More...
 
__STATIC_INLINE unsigned int GPIO_PinOutGet (GPIO_Port_TypeDef port, unsigned int pin)
 Get current setting for a pin in a GPIO port data out register. More...
 
__STATIC_INLINE void GPIO_PinOutSet (GPIO_Port_TypeDef port, unsigned int pin)
 Set a single pin in GPIO data out register to 1. More...
 
__STATIC_INLINE void GPIO_PinOutToggle (GPIO_Port_TypeDef port, unsigned int pin)
 Toggle a single pin in GPIO port data out register. More...
 
__STATIC_INLINE uint32_t GPIO_PortInGet (GPIO_Port_TypeDef port)
 Read the pad values for GPIO port. More...
 
__STATIC_INLINE void GPIO_PortOutClear (GPIO_Port_TypeDef port, uint32_t pins)
 Set bits in DOUT register for a port to 0. More...
 
__STATIC_INLINE uint32_t GPIO_PortOutGet (GPIO_Port_TypeDef port)
 Get current setting for a GPIO port data out register. More...
 
__STATIC_INLINE void GPIO_PortOutSet (GPIO_Port_TypeDef port, uint32_t pins)
 Set bits GPIO data out register to 1. More...
 
__STATIC_INLINE void GPIO_PortOutSetVal (GPIO_Port_TypeDef port, uint32_t val, uint32_t mask)
 Set GPIO port data out register. More...
 
__STATIC_INLINE void GPIO_PortOutToggle (GPIO_Port_TypeDef port, uint32_t pins)
 Toggle pins in GPIO port data out register. More...
 
__STATIC_INLINE void GPIO_Unlock (void)
 Unlocks the GPIO configuration.