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... | |
Pio * | pio_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... | |
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.
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask of one or more pin(s) to 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.
p_pio | Pointer to a PIO instance. |
ul_type | PIO type. |
ul_mask | Bitmask of one or more pin(s) to configure. |
ul_attribute | Pins attributes. |
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Interrupt source bit map. |
ul_attr | Interrupt source attributes. |
uint32_t pio_configure_pin | ( | uint32_t | ul_pin, |
const uint32_t | ul_flags | ||
) |
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask of one or more pin(s) to configure. |
ul_flags | Pin(s) attributes. |
void pio_disable_interrupt | ( | Pio * | p_pio, |
const uint32_t | ul_mask | ||
) |
void pio_disable_output_write | ( | Pio * | p_pio, |
const uint32_t | ul_mask | ||
) |
void pio_disable_pin_interrupt | ( | uint32_t | ul_pin | ) |
Disable interrupt for a GPIO pin.
ul_pin | The pin index. |
void pio_enable_interrupt | ( | Pio * | p_pio, |
const uint32_t | ul_mask | ||
) |
void pio_enable_output_write | ( | Pio * | p_pio, |
const uint32_t | ul_mask | ||
) |
void pio_enable_pin_interrupt | ( | uint32_t | ul_pin | ) |
Enable interrupt for a GPIO pin.
ul_pin | The pin index. |
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.
p_pio | Pointer to a PIO instance. |
ul_type | PIO type. |
ul_mask | Bitmask of one or more pin(s) to configure. |
1 | at least one PIO currently has a high level. |
0 | all PIOs have a low level. |
uint32_t pio_get_interrupt_mask | ( | const Pio * | p_pio | ) |
uint32_t pio_get_interrupt_status | ( | const Pio * | p_pio | ) |
uint32_t pio_get_multi_driver_status | ( | const Pio * | p_pio | ) |
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask of one or more pin(s). |
1 | At least one PIO is configured to output a high level. |
0 | All PIOs are configured to output a low level. |
uint32_t pio_get_output_write_status | ( | const Pio * | p_pio | ) |
Pio* pio_get_pin_group | ( | uint32_t | ul_pin | ) |
uint32_t pio_get_pin_group_id | ( | uint32_t | ul_pin | ) |
uint32_t pio_get_pin_group_mask | ( | uint32_t | ul_pin | ) |
uint32_t pio_get_pin_value | ( | uint32_t | ul_pin | ) |
Return the value of a pin.
ul_pin | The pin number. |
uint32_t pio_get_writeprotect_status | ( | const Pio * | p_pio | ) |
void pio_pull_up | ( | Pio * | p_pio, |
const uint32_t | ul_mask, | ||
const uint32_t | ul_pull_up_enable | ||
) |
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask of one or more pin(s) to configure. |
void pio_set_additional_interrupt_mode | ( | Pio * | p_pio, |
const uint32_t | ul_mask, | ||
const uint32_t | ul_attribute | ||
) |
void pio_set_debounce_filter | ( | Pio * | p_pio, |
const uint32_t | ul_mask, | ||
const uint32_t | ul_cut_off | ||
) |
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.
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask indicating which pin(s) to configure as input(s). |
ul_attribute | PIO attribute(s). |
void pio_set_multi_driver | ( | Pio * | p_pio, |
const uint32_t | ul_mask, | ||
const uint32_t | ul_multi_driver_enable | ||
) |
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).
p_pio | Pointer to a PIO instance. |
ul_mask | Bitmask indicating which pin(s) to configure. |
ul_default_level | Default level on the pin(s). |
ul_multidrive_enable | Indicates if the pin(s) shall be configured as open-drain. |
ul_pull_up_enable | Indicates if the pin shall have its pull-up activated. |
void pio_set_peripheral | ( | Pio * | p_pio, |
const pio_type_t | ul_type, | ||
const uint32_t | ul_mask | ||
) |
void pio_set_pin_group_high | ( | Pio * | p_pio, |
uint32_t | ul_mask | ||
) |
void pio_set_pin_group_low | ( | Pio * | p_pio, |
uint32_t | ul_mask | ||
) |
void pio_set_pin_high | ( | uint32_t | ul_pin | ) |
Drive a GPIO pin to 1.
ul_pin | The pin index. |
void pio_set_pin_low | ( | uint32_t | ul_pin | ) |
Drive a GPIO pin to 0.
ul_pin | The pin index. |
void pio_set_writeprotect | ( | Pio * | p_pio, |
const uint32_t | ul_enable | ||
) |
void pio_sync_output_write | ( | Pio * | p_pio, |
const uint32_t | ul_mask | ||
) |
void pio_toggle_pin | ( | uint32_t | ul_pin | ) |
Toggle a GPIO pin.
ul_pin | The pin index. |