MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
GPIO API Specification

Overview

This section describes functions and macros of the driver's API.

Macros

#define GPIO_Get(gpio)
 Returns state of pin(s). More...
 
#define GPIO_Set(gpio, mask)
 Sets pin(s) of the port. More...
 
#define GPIO_Clr(gpio, mask)
 Clears pin(s) of the port. More...
 
#define GPIO_Tgl(gpio, mask)
 Toggles pin(s) of the port. More...
 
#define PORT_InstallCallback(ip, callback)
 Installs callback function for interrupt vector 33. More...
 
#define PORT_EnableFilter(port, clksrc, length)
 Enables digital filter on PORTE. More...
 
#define PORT_Init(port, cfg, mask)
 PORT pin(s) initialization. More...
 
#define GPIO_Init(gpio, cfg, mask)
 GPIO pin(s) initialization. More...
 
#define GPIO_SetPortAttr(gpio, attr, lock)
 Configures and lock access attributes for specified GPIO port. More...
 
#define GPIO_LockAllPortsAttr()
 Lock access to all enabled gpio ports attributes. More...
 

Macro Definition Documentation

#define GPIO_Get (   gpio)

This macro returns state of pin(s).

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
Returns
uint8 value.
Note
Implemented as an inline macro. Select FGPIOx parameter to read port state via single cycle IOPORT peripheral access rather than via peripheral bridge (AIPS).
See also
GPIO_Set, GPIO_Clr, GPIO_Tgl
#define GPIO_Set (   gpio,
  mask 
)

This macro set(s) pins of the port.

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
maskSelect one or more OR'ed GPIO Pins.
Note
Implemented as an inline macro. Select FGPIOx parameter to read port state via single cycle IOPORT peripheral access rather than via peripheral bridge (AIPS).
See also
GPIO_Get, GPIO_Clr, GPIO_Tgl
#define GPIO_Clr (   gpio,
  mask 
)

This macro clears pin(s) of the port.

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
maskSelect one or more OR'ed GPIO Pins.
Note
Implemented as an inline macro. Select FGPIOx parameter to read port state via single cycle IOPORT peripheral access rather than via peripheral bridge (AIPS).
See also
GPIO_Get, GPIO_Set, GPIO_Tgl
#define GPIO_Tgl (   gpio,
  mask 
)

This macro toggles pin(s) of the port.

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
maskSelect one or more OR'ed GPIO Pins.
Note
Implemented as an inline macro. Select FGPIOx parameter to read port state via single cycle IOPORT peripheral access rather than via peripheral bridge (AIPS).
See also
GPIO_Get, GPIO_Set, GPIO_Clr
#define PORT_InstallCallback (   ip,
  callback 
)

This function install callback function for interrupt vector 33.

Parameters
ipSelect one of the ARM Cortex-M0+ Interrupt Priority Levels.
callbackPointer to the GPIO Callback Function.
Note
Implemented as a function call.
Warning
All PORT interrupt sources are OR'ed into single interrupt vector.
See also
PORT_Init
#define PORT_EnableFilter (   port,
  clksrc,
  length 
)

This macro enables digital filter on PORTE. The digital filter configuration is valid in all digital pin muxing modes. Configures the maximum size of the glitches, in clock cycles that the digital filter absorbs for the enabled digital filters.

Parameters
portPORTE.
clksrcSelect one of the PORT Digital Filter Clock Sources.
lengthuint8 filter length in range from 0 up 31; glitches that are longer than this setting will pass through the digital filter, and glitches that are equal to or less than this setting are filtered.
Note
Implemented as an inline macro.
Warning
The clock to the PORTE must be enabled otherwise software freezes.
If the digital filters for the PORTE are configured to use the bus clock, then the digital filters are bypassed for the duration of Stop mode.
#define PORT_Init (   port,
  cfg,
  mask 
)

This function initializes selected port pin(s).

Parameters
portPORTA,PORTB,PORTC,PORTD,PORTE,PORTF,PORTG,PORTH,PORTI,PORTJ, PORTK,PORTL,PORTM.
cfgSelect one of the PORT Configuration Structures.
maskSelect one or more OR'ed GPIO Pins.
Note
Implemented as a function call.
See also
GPIO_Init, PORT_InstallCallback, Pin Assignments
#define GPIO_Init (   gpio,
  cfg,
  mask 
)

This macro initializes selected pin(s) into either input or output mode.

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
cfgSelect one of the GPIO Configuration Structures.
maskSelect one or more OR'ed GPIO Pins.
Note
Implemented as an inline macro. Select FGPIOx parameter to perform single cycle peripheral access via IOPORT rather than via peripheral bridge (AIPS).
See also
PORT_Init, GPIO_SetPortAttr, GPIO_LockAllPortsAttr
#define GPIO_SetPortAttr (   gpio,
  attr,
  lock 
)

This macro configures and locks access attributes for specified GPIO port.

Parameters
gpioGPIOA,GPIOB,GPIOC,GPIOD,GPIOE,GPIOF,GPIOG,GPIOH,GPIOI,GPIOJ, GPIOK,GPIOL,GPIOM,FGPIOA,FGPIOB,FGPIOC,FGPIOD,FGPIOE,FGPIOF, FGPIOG,FGPIOH,FGPIOI,FGPIOJ,FGPIOK,FGPIOL,FGPIOM.
attrPORT Access Attributes to be applied to the selected gpio port.
lockTRUE (configuration locked until next power on reset)
FALSE (configuration left opened for further changes).
Note
Implemented as an inline macro. Select FGPIOx parameter to perform single cycle peripheral access via IOPORT rather than via peripheral bridge (AIPS).
See also
GPIO_LockAllPortsAttr
#define GPIO_LockAllPortsAttr ( )

This macro locks access to all enabled gpio ports attributes. Once locked, any attempts to change gpio port access attributes are ignored until the next system reset.

Note
Implemented as an inline macro.
See also
GPIO_SetPortAttr