The section describes the programming interface of the PORT HAL driver, Port control and interrupts hardware driver configuration. Use these functions to set port control and external interrupt functions. Most functions can be configured independently for each pin in the 32-bit port and affect the pin regardless of its pin muxing state. To use these functions, pass to the instance number (HW_PORTA, HW_PORTB, HW_PORTC, and so on.).
|
file | fsl_port_hal.h |
| The port features such as digital filter, pull, and so on are valid when they are available in one of the pins.
|
|
|
enum | port_pull_t {
kPortPullDown = 0U,
kPortPullUp = 1U
} |
| Internal resistor pull feature selection. More...
|
|
enum | port_slew_rate_t {
kPortFastSlewRate = 0U,
kPortSlowSlewRate = 1U
} |
| Slew rate selection. More...
|
|
enum | port_drive_strength_t {
kPortLowDriveStrength = 0U,
kPortHighDriveStrength = 1U
} |
| Configures the drive strength. More...
|
|
enum | port_mux_t {
kPortPinDisabled = 0U,
kPortMuxAsGpio = 1U,
kPortMuxAlt2 = 2U,
kPortMuxAlt3 = 3U,
kPortMuxAlt4 = 4U,
kPortMuxAlt5 = 5U,
kPortMuxAlt6 = 6U,
kPortMuxAlt7 = 7U
} |
| Pin mux selection. More...
|
|
enum | port_interrupt_config_t {
kPortIntDisabled = 0x0U,
kPortIntLogicZero = 0x8U,
kPortIntRisingEdge = 0x9U,
kPortIntFallingEdge = 0xAU,
kPortIntEitherEdge = 0xBU,
kPortIntLogicOne = 0xCU
} |
| Digital filter clock source selection. More...
|
|
Enumerator |
---|
kPortPullDown |
Internal pull-down resistor is enabled.
|
kPortPullUp |
Internal pull-up resistor is enabled.
|
Enumerator |
---|
kPortFastSlewRate |
Fast slew rate is configured.
|
kPortSlowSlewRate |
Slow slew rate is configured.
|
Enumerator |
---|
kPortLowDriveStrength |
Low drive strength is configured.
|
kPortHighDriveStrength |
High drive strength is configured.
|
Enumerator |
---|
kPortPinDisabled |
Corresponding pin is disabled, but is used as an analog pin.
|
kPortMuxAsGpio |
Corresponding pin is configured as GPIO.
|
kPortMuxAlt2 |
Chip-specific.
|
kPortMuxAlt3 |
Chip-specific.
|
kPortMuxAlt4 |
Chip-specific.
|
kPortMuxAlt5 |
Chip-specific.
|
kPortMuxAlt6 |
Chip-specific.
|
kPortMuxAlt7 |
Chip-specific.
|
Configures the interrupt generation condition.
Enumerator |
---|
kPortIntDisabled |
Interrupt/DMA request is disabled.
|
kPortIntLogicZero |
Interrupt when logic zero.
|
kPortIntRisingEdge |
Interrupt on rising edge.
|
kPortIntFallingEdge |
Interrupt on falling edge.
|
kPortIntEitherEdge |
Interrupt on either edge.
|
kPortIntLogicOne |
Interrupt when logic one.
|
static void PORT_HAL_SetMuxMode |
( |
PORT_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
port_mux_t |
mux |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | port base pointer |
pin | port pin number |
mux | pin muxing slot selection
- kPortPinDisabled: Pin disabled.
- kPortMuxAsGpio : Set as GPIO.
- others : chip-specific.
|
void PORT_HAL_SetLowGlobalPinCtrl |
( |
PORT_Type * |
base, |
|
|
uint16_t |
lowPinSelect, |
|
|
uint16_t |
config |
|
) |
| |
This function operates pin 0 -15 of one specific port.
- Parameters
-
base | port base pointer |
lowPinSelect | update corresponding pin control register or not. For a specific bit:
- 0: corresponding low half of pin control register won't be updated according to configuration.
- 1: corresponding low half of pin control register will be updated according to configuration.
|
config | value is written to a low half port control register bits[15:0]. |
void PORT_HAL_SetHighGlobalPinCtrl |
( |
PORT_Type * |
base, |
|
|
uint16_t |
highPinSelect, |
|
|
uint16_t |
config |
|
) |
| |
This function operates pin 16 -31 of one specific port.
- Parameters
-
base | port base pointer |
highPinSelect | update corresponding pin control register or not. For a specific bit:
- 0: corresponding high half of pin control register won't be updated according to configuration.
- 1: corresponding high half of pin control register will be updated according to configuration.
|
config | value is written to a high half port control register bits[15:0]. |
- Parameters
-
base | port base pointer. |
pin | port pin number |
intConfig | interrupt configuration
- kPortIntDisabled : Interrupt/DMA request disabled.
- kPortDmaRisingEdge : DMA request on rising edge.
- kPortDmaFallingEdge: DMA request on falling edge.
- kPortDmaEitherEdge : DMA request on either edge.
- kPortIntLogicZero : Interrupt when logic zero.
- kPortIntRisingEdge : Interrupt on rising edge.
- kPortIntFallingEdge: Interrupt on falling edge.
- kPortIntEitherEdge : Interrupt on either edge.
- kPortIntLogicOne : Interrupt when logic one.
|
- Parameters
-
base | port base pointer |
pin | port pin number |
- Returns
- interrupt configuration
- kPortIntDisabled : Interrupt/DMA request disabled.
- kPortDmaRisingEdge : DMA request on rising edge.
- kPortDmaFallingEdge: DMA request on falling edge.
- kPortDmaEitherEdge : DMA request on either edge.
- kPortIntLogicZero : Interrupt when logic zero.
- kPortIntRisingEdge : Interrupt on rising edge.
- kPortIntFallingEdge: Interrupt on falling edge.
- kPortIntEitherEdge : Interrupt on either edge.
- kPortIntLogicOne : Interrupt when logic one.
static bool PORT_HAL_IsPinIntPending |
( |
PORT_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
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 base pointer |
pin | port pin number |
- Returns
- current pin interrupt status flag
- 0: interrupt is not detected.
- 1: interrupt is detected.
static void PORT_HAL_ClearPinIntFlag |
( |
PORT_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | port base pointer |
pin | port pin number |
static uint32_t PORT_HAL_GetPortIntFlag |
( |
PORT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
- Returns
- all 32 pin interrupt status flags. For specific bit:
- 0: interrupt is not detected.
- 1: interrupt is detected.
static void PORT_HAL_ClearPortIntFlag |
( |
PORT_Type * |
base | ) |
|
|
inlinestatic |