The MCUXpresso SDK provides a driver for the Port Control and Interrupts (PORT) module of MCUXpresso SDK devices.
Typical configuration use case
Input PORT configuration
I2C PORT Configuration
|
enum | _port_pull {
kPORT_PullDisable = 0U,
kPORT_PullDown = 2U,
kPORT_PullUp = 3U
} |
| Internal resistor pull feature 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_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_interrupt_t {
kPORT_InterruptOrDMADisabled = 0x0U,
kPORT_DMARisingEdge = 0x1U,
kPORT_DMAFallingEdge = 0x2U,
kPORT_DMAEitherEdge = 0x3U,
kPORT_InterruptLogicZero = 0x8U,
kPORT_InterruptRisingEdge = 0x9U,
kPORT_InterruptFallingEdge = 0xAU,
kPORT_InterruptEitherEdge = 0xBU,
kPORT_InterruptLogicOne = 0xCU
} |
| Configures the interrupt generation condition. More...
|
|
enum | port_digital_filter_clock_source_t {
kPORT_BusClock = 0U,
kPORT_LpoClock = 1U
} |
| Digital filter clock source selection. 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...
|
|
static void | PORT_EnablePinsDigitalFilter (PORT_Type *base, uint32_t mask, bool enable) |
| Enables the digital filter in one port, each bit of the 32-bit register represents one pin. More...
|
|
static void | PORT_SetDigitalFilterConfig (PORT_Type *base, const port_digital_filter_config_t *config) |
| Sets the digital filter in one port, each bit of the 32-bit register represents one pin. More...
|
|
struct port_digital_filter_config_t |
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_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_UnlockRegister |
Pin Control Register fields [15:0] are not locked.
|
kPORT_LockRegister |
Pin Control Register fields [15:0] are locked.
|
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_InterruptOrDMADisabled |
Interrupt/DMA request is disabled.
|
kPORT_DMARisingEdge |
DMA request on rising edge.
|
kPORT_DMAFallingEdge |
DMA request on falling edge.
|
kPORT_DMAEitherEdge |
DMA request on either edge.
|
kPORT_InterruptLogicZero |
Interrupt when logic zero.
|
kPORT_InterruptRisingEdge |
Interrupt on rising edge.
|
kPORT_InterruptFallingEdge |
Interrupt on falling edge.
|
kPORT_InterruptEitherEdge |
Interrupt on either edge.
|
kPORT_InterruptLogicOne |
Interrupt when logic one.
|
Enumerator |
---|
kPORT_BusClock |
Digital filters are clocked by the bus clock.
|
kPORT_LpoClock |
Digital filters are clocked by the 1 kHz LPO clock.
|
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.
*
* kPORT_UnLockRegister,
* };
*
- Parameters
-
base | PORT peripheral base pointer. |
pin | PORT pin number. |
config | PORT 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.
*
* kPORT_PullEnable,
* };
*
- Parameters
-
base | PORT peripheral base pointer. |
mask | PORT pin number macro. |
config | PORT PCR register configuration structure. |
static void PORT_SetPinMux |
( |
PORT_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
port_mux_t |
mux |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | PORT peripheral base pointer. |
pin | PORT pin number. |
mux | pin muxing slot selection.
|
static void PORT_EnablePinsDigitalFilter |
( |
PORT_Type * |
base, |
|
|
uint32_t |
mask, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | PORT peripheral base pointer. |
mask | PORT pin number macro. |
- Parameters
-
base | PORT peripheral base pointer. |
config | PORT digital filter configuration structure. |
static void PORT_SetPinInterruptConfig |
( |
PORT_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
port_interrupt_t |
config |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | PORT peripheral base pointer. |
pin | PORT pin number. |
config | PORT pin interrupt configuration.
|
static uint32_t PORT_GetPinsInterruptFlags |
( |
PORT_Type * |
base | ) |
|
|
inlinestatic |
If a pin is configured to generate the DMA request, the corresponding flag is cleared automatically at the completion of the requested DMA transfer. Otherwise, the flag remains set until a logic one is written to that flag. If configured for a level sensitive interrupt that remains asserted, the flag is set again immediately.
- Parameters
-
base | PORT peripheral base pointer. |
- Returns
- Current port interrupt status flags, for example, 0x00010001 means the pin 0 and 16 have the interrupt.
static void PORT_ClearPinsInterruptFlags |
( |
PORT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | PORT peripheral base pointer. |
mask | PORT pin number macro. |