MCUXpresso SDK API Reference Manual  Rev 2.12.1
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
PORT: Port Control and Interrupts

Overview

The MCUXpresso SDK provides a driver for the Port Control and Interrupts (PORT) module of MCUXpresso SDK devices.

Data Structures

struct  port_pin_config_t
 PORT pin configuration structure. More...
 
struct  port_version_info_t
 PORT version information. More...
 

Enumerations

enum  _port_pull {
  kPORT_PullDisable = 0U,
  kPORT_PullDown = 2U,
  kPORT_PullUp = 3U
}
 Internal resistor pull feature selection. More...
 
enum  _port_pull_value {
  kPORT_LowPullResistor = 0U,
  kPORT_HighPullResistor = 1U
}
 Internal resistor pull value selection. More...
 
enum  _port_slew_rate {
  kPORT_FastSlewRate = 0U,
  kPORT_SlowSlewRate = 1U
}
 Slew rate selection. More...
 
enum  _port_open_drain_enable {
  kPORT_OpenDrainDisable = 0U,
  kPORT_OpenDrainEnable = 1U
}
 Open Drain feature enable/disable. More...
 
enum  _port_passive_filter_enable {
  kPORT_PassiveFilterDisable = 0U,
  kPORT_PassiveFilterEnable = 1U
}
 Passive filter feature enable/disable. More...
 
enum  _port_drive_strength {
  kPORT_LowDriveStrength = 0U,
  kPORT_HighDriveStrength = 1U
}
 Configures the drive strength. More...
 
enum  _port_drive_strength1 {
  kPORT_NormalDriveStrength = 0,
  kPORT_DoubleDriveStrength = 1
}
 Configures the drive strength1. More...
 
enum  _port_lock_register {
  kPORT_UnlockRegister = 0U,
  kPORT_LockRegister = 1U
}
 Unlock/lock the pin control register field[15:0]. More...
 
enum  port_mux_t {
  kPORT_PinDisabledOrAnalog = 0U,
  kPORT_MuxAsGpio = 1U,
  kPORT_MuxAlt2 = 2U,
  kPORT_MuxAlt3 = 3U,
  kPORT_MuxAlt4 = 4U,
  kPORT_MuxAlt5 = 5U,
  kPORT_MuxAlt6 = 6U,
  kPORT_MuxAlt7 = 7U,
  kPORT_MuxAlt8 = 8U,
  kPORT_MuxAlt9 = 9U,
  kPORT_MuxAlt10 = 10U,
  kPORT_MuxAlt11 = 11U,
  kPORT_MuxAlt12 = 12U,
  kPORT_MuxAlt13 = 13U,
  kPORT_MuxAlt14 = 14U,
  kPORT_MuxAlt15 = 15U
}
 Pin mux selection. More...
 
enum  port_voltage_range_t {
  kPORT_VoltageRange1Dot71V_3Dot6V = 0x0U,
  kPORT_VoltageRange2Dot70V_3Dot6V = 0x1U
}
 PORT voltage range. More...
 

Driver version

#define FSL_PORT_DRIVER_VERSION   (MAKE_VERSION(2, 3, 0))
 PORT driver version. More...
 

Configuration

static void PORT_GetVersionInfo (PORT_Type *base, port_version_info_t *info)
 Get PORT version information. More...
 
static void PORT_SecletPortVoltageRange (PORT_Type *base, port_voltage_range_t range)
 Get PORT version information. More...
 
static void PORT_SetPinConfig (PORT_Type *base, uint32_t pin, const port_pin_config_t *config)
 Sets the port PCR register. More...
 
static void PORT_SetMultiplePinsConfig (PORT_Type *base, uint32_t mask, const port_pin_config_t *config)
 Sets the port PCR register for multiple pins. More...
 
static void PORT_SetPinMux (PORT_Type *base, uint32_t pin, port_mux_t mux)
 Configures the pin muxing. More...
 

Interrupt

static void PORT_SetPinDriveStrength (PORT_Type *base, uint32_t pin, uint8_t strength)
 Configures the port pin drive strength. More...
 
static void PORT_EnablePinDoubleDriveStrength (PORT_Type *base, uint32_t pin, bool enable)
 Enables the port pin double drive strength. More...
 
static void PORT_SetPinPullValue (PORT_Type *base, uint32_t pin, uint8_t value)
 Configures the port pin pull value. More...
 
static uint32_t PORT_GetEFTDetectFlags (PORT_Type *base)
 Get EFT detect flags. More...
 
static void PORT_EnableEFTDetectInterrupts (PORT_Type *base, uint32_t interrupt)
 Enable EFT detect interrupts. More...
 
static void PORT_DisableEFTDetectInterrupts (PORT_Type *base, uint32_t interrupt)
 Disable EFT detect interrupts. More...
 
static void PORT_ClearAllLowEFTDetectors (PORT_Type *base)
 Clear all low EFT detector. More...
 
static void PORT_ClearAllHighEFTDetectors (PORT_Type *base)
 Clear all high EFT detector. More...
 

Data Structure Documentation

struct port_pin_config_t

Data Fields

uint16_t pullSelect: 2
 No-pull/pull-down/pull-up select.
 
uint16_t pullValueSelect: 1
 Pull value select.
 
uint16_t slewRate: 1
 Fast/slow slew rate Configure.
 
uint16_t passiveFilterEnable: 1
 Passive filter enable/disable.
 
uint16_t openDrainEnable: 1
 Open drain enable/disable.
 
uint16_t driveStrength: 1
 Fast/slow drive strength configure.
 
uint16_t driveStrength1: 1
 Normal/Double drive strength enable/disable.
 
uint16_t mux: 4
 Pin mux Configure.
 
uint16_t lockRegister: 1
 Lock/unlock the PCR field[15:0].
 
struct port_version_info_t

Data Fields

uint16_t feature
 Feature Specification Number. More...
 
uint8_t minor
 Minor Version Number. More...
 
uint8_t major
 Major Version Number. More...
 

Field Documentation

uint16_t port_version_info_t::feature
uint8_t port_version_info_t::minor
uint8_t port_version_info_t::major

Macro Definition Documentation

#define FSL_PORT_DRIVER_VERSION   (MAKE_VERSION(2, 3, 0))

Enumeration Type Documentation

enum _port_pull
Enumerator
kPORT_PullDisable 

Internal pull-up/down resistor is disabled.

kPORT_PullDown 

Internal pull-down resistor is enabled.

kPORT_PullUp 

Internal pull-up resistor is enabled.

Enumerator
kPORT_LowPullResistor 

Low internal pull resistor value is selected.

kPORT_HighPullResistor 

High internal pull resistor value is selected.

Enumerator
kPORT_FastSlewRate 

Fast slew rate is configured.

kPORT_SlowSlewRate 

Slow slew rate is configured.

Enumerator
kPORT_OpenDrainDisable 

Open drain output is disabled.

kPORT_OpenDrainEnable 

Open drain output is enabled.

Enumerator
kPORT_PassiveFilterDisable 

Passive input filter is disabled.

kPORT_PassiveFilterEnable 

Passive input filter is enabled.

Enumerator
kPORT_LowDriveStrength 

Low-drive strength is configured.

kPORT_HighDriveStrength 

High-drive strength is configured.

Enumerator
kPORT_NormalDriveStrength 

Normal drive strength.

kPORT_DoubleDriveStrength 

Double drive strength.

Enumerator
kPORT_UnlockRegister 

Pin Control Register fields [15:0] are not locked.

kPORT_LockRegister 

Pin Control Register fields [15:0] are locked.

enum port_mux_t
Enumerator
kPORT_PinDisabledOrAnalog 

Corresponding pin is disabled, but is used as an analog pin.

kPORT_MuxAsGpio 

Corresponding pin is configured as GPIO.

kPORT_MuxAlt2 

Chip-specific.

kPORT_MuxAlt3 

Chip-specific.

kPORT_MuxAlt4 

Chip-specific.

kPORT_MuxAlt5 

Chip-specific.

kPORT_MuxAlt6 

Chip-specific.

kPORT_MuxAlt7 

Chip-specific.

kPORT_MuxAlt8 

Chip-specific.

kPORT_MuxAlt9 

Chip-specific.

kPORT_MuxAlt10 

Chip-specific.

kPORT_MuxAlt11 

Chip-specific.

kPORT_MuxAlt12 

Chip-specific.

kPORT_MuxAlt13 

Chip-specific.

kPORT_MuxAlt14 

Chip-specific.

kPORT_MuxAlt15 

Chip-specific.

Enumerator
kPORT_VoltageRange1Dot71V_3Dot6V 

Port voltage range is 1.71 V - 3.6 V.

kPORT_VoltageRange2Dot70V_3Dot6V 

Port voltage range is 2.70 V - 3.6 V.

Function Documentation

static void PORT_GetVersionInfo ( PORT_Type *  base,
port_version_info_t info 
)
inlinestatic
Parameters
basePORT peripheral base pointer
infoPORT version information
static void PORT_SecletPortVoltageRange ( PORT_Type *  base,
port_voltage_range_t  range 
)
inlinestatic
Note
: PORTA_CONFIG[RANGE] controls the voltage ranges of Port A, B, and C. Read or write PORTB_CONFIG[RANGE] and PORTC_CONFIG[RANGE] does not take effect.
Parameters
basePORT peripheral base pointer
rangeport voltage range
static void PORT_SetPinConfig ( PORT_Type *  base,
uint32_t  pin,
const port_pin_config_t config 
)
inlinestatic

This is an example to define an input pin or output pin PCR configuration.

* // Define a digital input pin PCR configuration
* port_pin_config_t config = {
* kPORT_UnLockRegister,
* };
*
Parameters
basePORT peripheral base pointer.
pinPORT pin number.
configPORT PCR register configuration structure.
static void PORT_SetMultiplePinsConfig ( PORT_Type *  base,
uint32_t  mask,
const port_pin_config_t config 
)
inlinestatic

This is an example to define input pins or output pins PCR configuration.

* Define a digital input pin PCR configuration
* port_pin_config_t config = {
* kPORT_PullEnable,
* };
*
Parameters
basePORT peripheral base pointer.
maskPORT pin number macro.
configPORT PCR register configuration structure.
static void PORT_SetPinMux ( PORT_Type *  base,
uint32_t  pin,
port_mux_t  mux 
)
inlinestatic
Parameters
basePORT peripheral base pointer.
pinPORT pin number.
muxpin muxing slot selection.
Note
: This function is NOT recommended to use together with the PORT_SetPinsConfig, because the PORT_SetPinsConfig need to configure the pin mux anyway (Otherwise the pin mux is reset to zero : kPORT_PinDisabledOrAnalog). This function is recommended to use to reset the pin mux
static void PORT_SetPinDriveStrength ( PORT_Type *  base,
uint32_t  pin,
uint8_t  strength 
)
inlinestatic
Parameters
basePORT peripheral base pointer.
pinPORT pin number.
strengthPORT pin drive strength
static void PORT_EnablePinDoubleDriveStrength ( PORT_Type *  base,
uint32_t  pin,
bool  enable 
)
inlinestatic
Parameters
basePORT peripheral base pointer.
pinPORT pin number.
enablePORT pin drive strength configuration.
static void PORT_SetPinPullValue ( PORT_Type *  base,
uint32_t  pin,
uint8_t  value 
)
inlinestatic
Parameters
basePORT peripheral base pointer.
pinPORT pin number.
valuePORT pin pull value
static uint32_t PORT_GetEFTDetectFlags ( PORT_Type *  base)
inlinestatic
Parameters
basePORT peripheral base pointer
Returns
EFT detect flags
static void PORT_EnableEFTDetectInterrupts ( PORT_Type *  base,
uint32_t  interrupt 
)
inlinestatic
Parameters
basePORT peripheral base pointer
interruptEFT detect interrupt
static void PORT_DisableEFTDetectInterrupts ( PORT_Type *  base,
uint32_t  interrupt 
)
inlinestatic
Parameters
basePORT peripheral base pointer
interruptEFT detect interrupt
static void PORT_ClearAllLowEFTDetectors ( PORT_Type *  base)
inlinestatic
Note
: Port B and Port C pins share the same EFT detector clear control from PORTC_EDCR register. Any write to the PORTB_EDCR does not take effect.
Parameters
basePORT peripheral base pointer
interruptEFT detect interrupt
static void PORT_ClearAllHighEFTDetectors ( PORT_Type *  base)
inlinestatic
Parameters
basePORT peripheral base pointer
interruptEFT detect interrupt