Macros | Functions
Peripheral Parallel Input/Output (PIO) Controller

Macros

#define FREQ_SLOW_CLOCK_EXT   32768
 

Functions

void pio_clear (Pio *p_pio, const uint32_t ul_mask)
 Set a low output level on all the PIOs defined in ul_mask. This has no immediate effects on PIOs that are not output, but the PIO controller will save the value if they are changed to outputs. More...
 
uint32_t pio_configure (Pio *p_pio, const pio_type_t ul_type, const uint32_t ul_mask, const uint32_t ul_attribute)
 Perform complete pin(s) configuration; general attributes and PIO init if necessary. More...
 
void pio_configure_interrupt (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_attr)
 Configure the given interrupt source. Interrupt can be configured to trigger on rising edge, falling edge, high level, low level or simply on level change. More...
 
uint32_t pio_configure_pin (uint32_t ul_pin, const uint32_t ul_flags)
 Perform complete pin(s) configuration; general attributes and PIO init if necessary. More...
 
uint32_t pio_configure_pin_group (Pio *p_pio, uint32_t ul_mask, const uint32_t ul_flags)
 Perform complete pin(s) configuration; general attributes and PIO init if necessary. More...
 
void pio_disable_interrupt (Pio *p_pio, const uint32_t ul_mask)
 Disable a given interrupt source, with no added side effects. More...
 
void pio_disable_output_write (Pio *p_pio, const uint32_t ul_mask)
 Disable PIO output write. More...
 
void pio_disable_pin_interrupt (uint32_t ul_pin)
 Disable interrupt for a GPIO pin. More...
 
void pio_enable_interrupt (Pio *p_pio, const uint32_t ul_mask)
 Enable the given interrupt source. The PIO must be configured as an NVIC interrupt source as well. More...
 
void pio_enable_output_write (Pio *p_pio, const uint32_t ul_mask)
 Enable PIO output write for synchronous data output. More...
 
void pio_enable_pin_interrupt (uint32_t ul_pin)
 Enable interrupt for a GPIO pin. More...
 
uint32_t pio_get (Pio *p_pio, const pio_type_t ul_type, const uint32_t ul_mask)
 Return 1 if one or more PIOs of the given Pin instance currently have a high level; otherwise returns 0. This method returns the actual value that is being read on the pin. To return the supposed output value of a pin, use pio_get_output_data_status() instead. More...
 
uint32_t pio_get_interrupt_mask (const Pio *p_pio)
 Read PIO interrupt mask. More...
 
uint32_t pio_get_interrupt_status (const Pio *p_pio)
 Read and clear PIO interrupt status. More...
 
uint32_t pio_get_multi_driver_status (const Pio *p_pio)
 Get multi-driver status. More...
 
uint32_t pio_get_output_data_status (const Pio *p_pio, const uint32_t ul_mask)
 Return 1 if one or more PIOs of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead. More...
 
uint32_t pio_get_output_write_status (const Pio *p_pio)
 Read PIO output write status. More...
 
Piopio_get_pin_group (uint32_t ul_pin)
 Return GPIO port for a GPIO pin. More...
 
uint32_t pio_get_pin_group_id (uint32_t ul_pin)
 Return GPIO port peripheral ID for a GPIO pin. More...
 
uint32_t pio_get_pin_group_mask (uint32_t ul_pin)
 Return GPIO port pin mask for a GPIO pin. More...
 
uint32_t pio_get_pin_value (uint32_t ul_pin)
 Return the value of a pin. More...
 
uint32_t pio_get_writeprotect_status (const Pio *p_pio)
 Read write protect status. More...
 
void pio_pull_up (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_pull_up_enable)
 Configure PIO internal pull-up. More...
 
void pio_set (Pio *p_pio, const uint32_t ul_mask)
 Set a high output level on all the PIOs defined in ul_mask. This has no immediate effects on PIOs that are not output, but the PIO controller will save the value if they are changed to outputs. More...
 
void pio_set_additional_interrupt_mode (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_attribute)
 Set additional interrupt mode. More...
 
void pio_set_debounce_filter (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_cut_off)
 Configure Glitch or Debouncing filter for the specified input(s). More...
 
void pio_set_input (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_attribute)
 Configure one or more pin(s) or a PIO controller as inputs. Optionally, the corresponding internal pull-up(s) and glitch filter(s) can be enabled. More...
 
void pio_set_multi_driver (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_multi_driver_enable)
 Configure PIO pin multi-driver. More...
 
void pio_set_output (Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_default_level, const uint32_t ul_multidrive_enable, const uint32_t ul_pull_up_enable)
 Configure one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s). More...
 
void pio_set_peripheral (Pio *p_pio, const pio_type_t ul_type, const uint32_t ul_mask)
 Configure IO of a PIO controller as being controlled by a specific peripheral. More...
 
void pio_set_pin_group_high (Pio *p_pio, uint32_t ul_mask)
 Drive a GPIO port to 1. More...
 
void pio_set_pin_group_low (Pio *p_pio, uint32_t ul_mask)
 Drive a GPIO port to 0. More...
 
void pio_set_pin_high (uint32_t ul_pin)
 Drive a GPIO pin to 1. More...
 
void pio_set_pin_low (uint32_t ul_pin)
 Drive a GPIO pin to 0. More...
 
void pio_set_writeprotect (Pio *p_pio, const uint32_t ul_enable)
 Enable or disable write protect of PIO registers. More...
 
void pio_sync_output_write (Pio *p_pio, const uint32_t ul_mask)
 Synchronously write on output pins. More...
 
void pio_toggle_pin (uint32_t ul_pin)
 Toggle a GPIO pin. More...
 
void pio_toggle_pin_group (Pio *p_pio, uint32_t ul_mask)
 Toggle a GPIO group. More...
 

Detailed Description

Purpose

The Parallel Input/Output Controller (PIO) manages up to 32 fully programmable input/output lines. Each I/O line may be dedicated as a general-purpose I/O or be assigned to a function of an embedded peripheral. This assures effective optimization of the pins of a product.

Macro Definition Documentation

◆ FREQ_SLOW_CLOCK_EXT

#define FREQ_SLOW_CLOCK_EXT   32768

Definition at line 58 of file pio.c.

Function Documentation

◆ pio_clear()

void pio_clear ( Pio p_pio,
const uint32_t  ul_mask 
)

Set a low output level on all the PIOs defined in ul_mask. This has no immediate effects on PIOs that are not output, but the PIO controller will save the value if they are changed to outputs.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 130 of file pio.c.

◆ pio_configure()

uint32_t pio_configure ( Pio p_pio,
const pio_type_t  ul_type,
const uint32_t  ul_mask,
const uint32_t  ul_attribute 
)

Perform complete pin(s) configuration; general attributes and PIO init if necessary.

Parameters
p_pioPointer to a PIO instance.
ul_typePIO type.
ul_maskBitmask of one or more pin(s) to configure.
ul_attributePins attributes.
Returns
Whether the pin(s) have been configured properly.

Definition at line 348 of file pio.c.

◆ pio_configure_interrupt()

void pio_configure_interrupt ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_attr 
)

Configure the given interrupt source. Interrupt can be configured to trigger on rising edge, falling edge, high level, low level or simply on level change.

Parameters
p_pioPointer to a PIO instance.
ul_maskInterrupt source bit map.
ul_attrInterrupt source attributes.

Definition at line 538 of file pio.c.

◆ pio_configure_pin()

uint32_t pio_configure_pin ( uint32_t  ul_pin,
const uint32_t  ul_flags 
)

Perform complete pin(s) configuration; general attributes and PIO init if necessary.

Parameters
ul_pinThe pin index.
ul_flagsPins attributes.
Returns
Whether the pin(s) have been configured properly.

Definition at line 763 of file pio.c.

◆ pio_configure_pin_group()

uint32_t pio_configure_pin_group ( Pio p_pio,
uint32_t  ul_mask,
const uint32_t  ul_flags 
)

Perform complete pin(s) configuration; general attributes and PIO init if necessary.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.
ul_flagsPin(s) attributes.
Returns
Whether the pin(s) have been configured properly.

Definition at line 863 of file pio.c.

◆ pio_disable_interrupt()

void pio_disable_interrupt ( Pio p_pio,
const uint32_t  ul_mask 
)

Disable a given interrupt source, with no added side effects.

Parameters
p_pioPointer to a PIO instance.
ul_maskInterrupt sources bit map.

Definition at line 589 of file pio.c.

◆ pio_disable_output_write()

void pio_disable_output_write ( Pio p_pio,
const uint32_t  ul_mask 
)

Disable PIO output write.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 472 of file pio.c.

◆ pio_disable_pin_interrupt()

void pio_disable_pin_interrupt ( uint32_t  ul_pin)

Disable interrupt for a GPIO pin.

Parameters
ul_pinThe pin index.
Note
The function gpio_configure_pin must be called before.

Definition at line 929 of file pio.c.

◆ pio_enable_interrupt()

void pio_enable_interrupt ( Pio p_pio,
const uint32_t  ul_mask 
)

Enable the given interrupt source. The PIO must be configured as an NVIC interrupt source as well.

Parameters
p_pioPointer to a PIO instance.
ul_maskInterrupt sources bit map.

Definition at line 578 of file pio.c.

◆ pio_enable_output_write()

void pio_enable_output_write ( Pio p_pio,
const uint32_t  ul_mask 
)

Enable PIO output write for synchronous data output.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 461 of file pio.c.

◆ pio_enable_pin_interrupt()

void pio_enable_pin_interrupt ( uint32_t  ul_pin)

Enable interrupt for a GPIO pin.

Parameters
ul_pinThe pin index.
Note
The function gpio_configure_pin must be called before.

Definition at line 914 of file pio.c.

◆ pio_get()

uint32_t pio_get ( Pio p_pio,
const pio_type_t  ul_type,
const uint32_t  ul_mask 
)

Return 1 if one or more PIOs of the given Pin instance currently have a high level; otherwise returns 0. This method returns the actual value that is being read on the pin. To return the supposed output value of a pin, use pio_get_output_data_status() instead.

Parameters
p_pioPointer to a PIO instance.
ul_typePIO type.
ul_maskBitmask of one or more pin(s) to configure.
Return values
1at least one PIO currently has a high level.
0all PIOs have a low level.

Definition at line 148 of file pio.c.

◆ pio_get_interrupt_mask()

uint32_t pio_get_interrupt_mask ( const Pio p_pio)

Read PIO interrupt mask.

Parameters
p_pioPointer to a PIO instance.
Returns
The interrupt mask value.

Definition at line 613 of file pio.c.

◆ pio_get_interrupt_status()

uint32_t pio_get_interrupt_status ( const Pio p_pio)

Read and clear PIO interrupt status.

Parameters
p_pioPointer to a PIO instance.
Returns
The interrupt status value.

Definition at line 601 of file pio.c.

◆ pio_get_multi_driver_status()

uint32_t pio_get_multi_driver_status ( const Pio p_pio)

Get multi-driver status.

Parameters
p_pioPointer to a PIO instance.
Returns
The multi-driver mask value.

Definition at line 428 of file pio.c.

◆ pio_get_output_data_status()

uint32_t pio_get_output_data_status ( const Pio p_pio,
const uint32_t  ul_mask 
)

Return 1 if one or more PIOs of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s).
Return values
1At least one PIO is configured to output a high level.
0All PIOs are configured to output a low level.

Definition at line 392 of file pio.c.

◆ pio_get_output_write_status()

uint32_t pio_get_output_write_status ( const Pio p_pio)

Read PIO output write status.

Parameters
p_pioPointer to a PIO instance.
Returns
The output write mask value.

Definition at line 484 of file pio.c.

◆ pio_get_pin_group()

Pio* pio_get_pin_group ( uint32_t  ul_pin)

Return GPIO port for a GPIO pin.

Parameters
ul_pinThe pin index.
Returns
Pointer to Pio struct for GPIO port.

Definition at line 944 of file pio.c.

◆ pio_get_pin_group_id()

uint32_t pio_get_pin_group_id ( uint32_t  ul_pin)

Return GPIO port peripheral ID for a GPIO pin.

Parameters
ul_pinThe pin index.
Returns
GPIO port peripheral ID.

Definition at line 979 of file pio.c.

◆ pio_get_pin_group_mask()

uint32_t pio_get_pin_group_mask ( uint32_t  ul_pin)

Return GPIO port pin mask for a GPIO pin.

Parameters
ul_pinThe pin index.
Returns
GPIO port pin mask.

Definition at line 1025 of file pio.c.

◆ pio_get_pin_value()

uint32_t pio_get_pin_value ( uint32_t  ul_pin)

Return the value of a pin.

Parameters
ul_pinThe pin number.
Returns
The pin value.
Note
If pin is output: a pull-up or pull-down could hide the actual value. The function pio_get can be called to get the actual pin output level.
If pin is input: PIOx must be clocked to sample the signal. See PMC driver.

Definition at line 697 of file pio.c.

◆ pio_get_writeprotect_status()

uint32_t pio_get_writeprotect_status ( const Pio p_pio)

Read write protect status.

Parameters
p_pioPointer to a PIO instance.
Returns
Return write protect status.

Definition at line 679 of file pio.c.

◆ pio_pull_up()

void pio_pull_up ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_pull_up_enable 
)

Configure PIO internal pull-up.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.
ul_pull_up_enableIndicates if the pin(s) internal pull-up shall be configured.

Definition at line 69 of file pio.c.

◆ pio_set()

void pio_set ( Pio p_pio,
const uint32_t  ul_mask 
)

Set a high output level on all the PIOs defined in ul_mask. This has no immediate effects on PIOs that are not output, but the PIO controller will save the value if they are changed to outputs.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 117 of file pio.c.

◆ pio_set_additional_interrupt_mode()

void pio_set_additional_interrupt_mode ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_attribute 
)

Set additional interrupt mode.

Parameters
p_pioPointer to a PIO instance.
ul_maskInterrupt sources bit map.
ul_attributePin(s) attributes.

Definition at line 625 of file pio.c.

◆ pio_set_debounce_filter()

void pio_set_debounce_filter ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_cut_off 
)

Configure Glitch or Debouncing filter for the specified input(s).

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.
ul_cut_offCuts off frequency for debouncing filter.

Definition at line 87 of file pio.c.

◆ pio_set_input()

void pio_set_input ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_attribute 
)

Configure one or more pin(s) or a PIO controller as inputs. Optionally, the corresponding internal pull-up(s) and glitch filter(s) can be enabled.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask indicating which pin(s) to configure as input(s).
ul_attributePIO attribute(s).

Definition at line 257 of file pio.c.

◆ pio_set_multi_driver()

void pio_set_multi_driver ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_multi_driver_enable 
)

Configure PIO pin multi-driver.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.
ul_multi_driver_enableIndicates if the pin(s) multi-driver shall be configured.

Definition at line 410 of file pio.c.

◆ pio_set_output()

void pio_set_output ( Pio p_pio,
const uint32_t  ul_mask,
const uint32_t  ul_default_level,
const uint32_t  ul_multidrive_enable,
const uint32_t  ul_pull_up_enable 
)

Configure one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s).

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask indicating which pin(s) to configure.
ul_default_levelDefault level on the pin(s).
ul_multidrive_enableIndicates if the pin(s) shall be configured as open-drain.
ul_pull_up_enableIndicates if the pin shall have its pull-up activated.

Definition at line 310 of file pio.c.

◆ pio_set_peripheral()

void pio_set_peripheral ( Pio p_pio,
const pio_type_t  ul_type,
const uint32_t  ul_mask 
)

Configure IO of a PIO controller as being controlled by a specific peripheral.

Parameters
p_pioPointer to a PIO instance.
ul_typePIO type.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 174 of file pio.c.

◆ pio_set_pin_group_high()

void pio_set_pin_group_high ( Pio p_pio,
uint32_t  ul_mask 
)

Drive a GPIO port to 1.

Parameters
p_pioBase address of the PIO port.
ul_maskBitmask of one or more pin(s) to toggle.

Definition at line 818 of file pio.c.

◆ pio_set_pin_group_low()

void pio_set_pin_group_low ( Pio p_pio,
uint32_t  ul_mask 
)

Drive a GPIO port to 0.

Parameters
p_pioBase address of the PIO port.
ul_maskBitmask of one or more pin(s) to toggle.

Definition at line 830 of file pio.c.

◆ pio_set_pin_high()

void pio_set_pin_high ( uint32_t  ul_pin)

Drive a GPIO pin to 1.

Parameters
ul_pinThe pin index.
Note
The function pio_configure_pin must be called beforehand.

Definition at line 711 of file pio.c.

◆ pio_set_pin_low()

void pio_set_pin_low ( uint32_t  ul_pin)

Drive a GPIO pin to 0.

Parameters
ul_pinThe pin index.
Note
The function pio_configure_pin must be called before.

Definition at line 726 of file pio.c.

◆ pio_set_writeprotect()

void pio_set_writeprotect ( Pio p_pio,
const uint32_t  ul_enable 
)

Enable or disable write protect of PIO registers.

Parameters
p_pioPointer to a PIO instance.
ul_enable1 to enable, 0 to disable.

Definition at line 667 of file pio.c.

◆ pio_sync_output_write()

void pio_sync_output_write ( Pio p_pio,
const uint32_t  ul_mask 
)

Synchronously write on output pins.

Note
Only bits unmasked by PIO_OWSR (Output Write Status Register) are written.
Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 497 of file pio.c.

◆ pio_toggle_pin()

void pio_toggle_pin ( uint32_t  ul_pin)

Toggle a GPIO pin.

Parameters
ul_pinThe pin index.
Note
The function pio_configure_pin must be called before.

Definition at line 741 of file pio.c.

◆ pio_toggle_pin_group()

void pio_toggle_pin_group ( Pio p_pio,
uint32_t  ul_mask 
)

Toggle a GPIO group.

Parameters
p_pioPointer to a PIO instance.
ul_maskBitmask of one or more pin(s) to configure.

Definition at line 842 of file pio.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:01