Mbed OS Reference
Loading...
Searching...
No Matches
Port HAL functions

Functions

PinName port_pin (PortName port, int pin_n)
 Get the pin name from the port's pin number. More...
 
void port_init (port_t *obj, PortName port, int mask, PinDirection dir)
 Initilize the port. More...
 
void port_mode (port_t *obj, PinMode mode)
 Set the input port mode. More...
 
void port_dir (port_t *obj, PinDirection dir)
 Set port direction (in/out) More...
 
void port_write (port_t *obj, int value)
 Write value to the port. More...
 
int port_read (port_t *obj)
 Read the current value on the port. More...
 

Detailed Description

Function Documentation

◆ port_pin()

PinName port_pin ( PortName  port,
int  pin_n 
)

Get the pin name from the port's pin number.

Parameters
portThe port name
pin_nThe pin number within the specified port
Returns
The pin name for the port's pin number

◆ port_init()

void port_init ( port_t obj,
PortName  port,
int  mask,
PinDirection  dir 
)

Initilize the port.

Parameters
objThe port object to initialize
portThe port name
maskThe bitmask to identify which bits in the port should be included (0 - ignore)
dirThe port direction

◆ port_mode()

void port_mode ( port_t obj,
PinMode  mode 
)

Set the input port mode.

Parameters
objThe port object
modeTHe port mode to be set

◆ port_dir()

void port_dir ( port_t obj,
PinDirection  dir 
)

Set port direction (in/out)

Parameters
objThe port object
dirThe port direction to be set

◆ port_write()

void port_write ( port_t obj,
int  value 
)

Write value to the port.

Parameters
objThe port object
valueThe value to be set

◆ port_read()

int port_read ( port_t obj)

Read the current value on the port.

Parameters
objThe port object
Returns
An integer with each bit corresponding to an associated port pin setting