CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
PORT Interface

Driver API for PORT (plib_port.h) More...

Macros

#define PORT_PLIB_OK   (0)
 Operation completed successfully.
 
#define PORT_PLIB_ERROR   (-1)
 Unspecified error occurred.
 
#define PORT_PLIB_ERROR_BUSY   (-2)
 Resource is busy.
 
#define PORT_PLIB_ERROR_TIMEOUT   (-3)
 Operation timed out.
 
#define PORT_PLIB_ERROR_UNSUPPORTED   (-4)
 Operation is not supported.
 
#define PORT_PLIB_ERROR_PARAMETER   (-5)
 Invalid parameter provided.
 
#define PORT_PLIB_ERROR_SPECIFIC   (-6)
 Specific error code for driver implementation.
 

Typedefs

typedef uint32_t PORT_PIN
 GPIO pin identifier.
 

Enumerations

enum  GPIO_DIRECTION { GPIO_INPUT , GPIO_OUTPUT }
 GPIO port pin direction. More...
 
enum  GPIO_OUTPUT_MODE { GPIO_PUSH_PULL , GPIO_OPEN_DRAIN }
 GPIO output mode. More...
 
enum  GPIO_PULL_RESISTOR { GPIO_PULL_NONE , GPIO_PULL_UP , GPIO_PULL_DOWN }
 GPIO pull resistor configuration. More...
 
enum  PORT_EVENT_INPUT_CHANNEL { PORT_EVENT_INPUT_CHANNEL_0 = PORT_EVCTRL_PORTEI0_Pos , PORT_EVENT_INPUT_CHANNEL_1 = PORT_EVCTRL_PORTEI1_Pos , PORT_EVENT_INPUT_CHANNEL_2 = PORT_EVCTRL_PORTEI2_Pos , PORT_EVENT_INPUT_CHANNEL_3 = PORT_EVCTRL_PORTEI3_Pos }
 GPIO port event input channel. More...
 
enum  PORT_EVENT_ACTION { PORT_EVENT_ACTION_OUT , PORT_EVENT_ACTION_SET , PORT_EVENT_ACTION_CLR , PORT_EVENT_ACTION_TGL }
 GPIO port event action. More...
 
enum  PORT_PERIPHERAL_FUNCTION
 GPIO port peripheral function selection. More...
 

Description

Driver API for PORT (plib_port.h)

Macro Definition Documentation

◆ PORT_PLIB_ERROR

#define PORT_PLIB_ERROR   (-1)

Unspecified error occurred.

◆ PORT_PLIB_ERROR_BUSY

#define PORT_PLIB_ERROR_BUSY   (-2)

Resource is busy.

◆ PORT_PLIB_ERROR_PARAMETER

#define PORT_PLIB_ERROR_PARAMETER   (-5)

Invalid parameter provided.

◆ PORT_PLIB_ERROR_SPECIFIC

#define PORT_PLIB_ERROR_SPECIFIC   (-6)

Specific error code for driver implementation.

◆ PORT_PLIB_ERROR_TIMEOUT

#define PORT_PLIB_ERROR_TIMEOUT   (-3)

Operation timed out.

◆ PORT_PLIB_ERROR_UNSUPPORTED

#define PORT_PLIB_ERROR_UNSUPPORTED   (-4)

Operation is not supported.

◆ PORT_PLIB_OK

#define PORT_PLIB_OK   (0)

Operation completed successfully.

Typedef Documentation

◆ PORT_PIN

GPIO pin identifier.

GPIO pins are identified by a single numeric value that encodes both the GPIO port and the pin number.

The value of a pin identifier is defined by the device DFP and must be one of the DFP-provided pin macros, for example:

  • PIN_PA00, PIN_PA01, ... PIN_PA31
  • PIN_PB00, PIN_PB01, ... PIN_PB31
  • PIN_PC00, PIN_PC01, ... etc.

The numeric encoding follows this rule:

pin_id = (port_index * 32U) + pin_number

Where:

  • port_index is the zero-based GPIO port number (e.g. PA = 0, PB = 1, PC = 2, ...)
  • pin_number is the pin index within the port (0–31)

This encoding allows the driver to determine the GPIO port and pin number using simple arithmetic operations.

Note
Users must not define custom pin values. Only pin macros provided by the device DFP are supported.

Enumeration Type Documentation

◆ GPIO_DIRECTION

GPIO port pin direction.

This enumeration defines the direction of a GPIO pin.

Enumerator
GPIO_INPUT 

Input (default)

GPIO_OUTPUT 

Output.

◆ GPIO_OUTPUT_MODE

GPIO output mode.

This enumeration specifies the output mode for a GPIO pin.

Enumerator
GPIO_PUSH_PULL 

Push-pull (default)

GPIO_OPEN_DRAIN 

Open-drain.

◆ GPIO_PULL_RESISTOR

GPIO pull resistor configuration.

This enumeration specifies the pull resistor configuration for a GPIO pin.

Enumerator
GPIO_PULL_NONE 

None (default)

GPIO_PULL_UP 

Pull-up.

GPIO_PULL_DOWN 

Pull-down.

◆ PORT_EVENT_ACTION

GPIO port event action.

This enumeration defines the possible actions triggered by a port event.

Enumerator
PORT_EVENT_ACTION_OUT 
PORT_EVENT_ACTION_SET 
PORT_EVENT_ACTION_CLR 
PORT_EVENT_ACTION_TGL 

◆ PORT_EVENT_INPUT_CHANNEL

GPIO port event input channel.

This enumeration specifies the event input channels for the GPIO port.

Enumerator
PORT_EVENT_INPUT_CHANNEL_0 
PORT_EVENT_INPUT_CHANNEL_1 
PORT_EVENT_INPUT_CHANNEL_2 
PORT_EVENT_INPUT_CHANNEL_3 

◆ PORT_PERIPHERAL_FUNCTION

GPIO port peripheral function selection.

This enumeration specifies the peripheral function assigned to a GPIO pin.