Parallel Input/Output (PIO) Controller driver for SAM. More...
#include "compiler.h"
Go to the source code of this file.
Macros | |
#define | PIO_DEBOUNCE (1u << 3) |
#define | PIO_DEFAULT (0u << 0) |
#define | PIO_DEGLITCH (1u << 1) |
#define | PIO_DELTA ((uint32_t) PIOB - (uint32_t) PIOA) |
#define | PIO_IT_AIME (1u << 4) |
#define | PIO_IT_EDGE (1u << 6) |
#define | PIO_IT_FALL_EDGE (0 | PIO_IT_EDGE | PIO_IT_AIME) |
#define | PIO_IT_HIGH_LEVEL (PIO_IT_RE_OR_HL | 0 | PIO_IT_AIME) |
#define | PIO_IT_LOW_LEVEL (0 | 0 | PIO_IT_AIME) |
#define | PIO_IT_RE_OR_HL (1u << 5) |
#define | PIO_IT_RISE_EDGE (PIO_IT_RE_OR_HL | PIO_IT_EDGE | PIO_IT_AIME) |
#define | PIO_OPENDRAIN (1u << 2) |
#define | PIO_PULLUP (1u << 0) |
#define | PIO_TYPE_Msk (0xFu << PIO_TYPE_Pos) |
#define | PIO_TYPE_NOT_A_PIN (0x0u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_INPUT (0x5u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_OUTPUT_0 (0x6u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_OUTPUT_1 (0x7u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_PERIPH_A (0x1u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_PERIPH_B (0x2u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_PERIPH_C (0x3u << PIO_TYPE_Pos) |
#define | PIO_TYPE_PIO_PERIPH_D (0x4u << PIO_TYPE_Pos) |
#define | PIO_TYPE_Pos 27 |
Typedefs | |
typedef enum _pio_type | pio_type_t |
Enumerations | |
enum | _pio_type { PIO_NOT_A_PIN = PIO_TYPE_NOT_A_PIN, PIO_PERIPH_A = PIO_TYPE_PIO_PERIPH_A, PIO_PERIPH_B = PIO_TYPE_PIO_PERIPH_B, PIO_INPUT = PIO_TYPE_PIO_INPUT, PIO_OUTPUT_0 = PIO_TYPE_PIO_OUTPUT_0, PIO_OUTPUT_1 = PIO_TYPE_PIO_OUTPUT_1 } |
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 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 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 pin) |
Return GPIO port for a GPIO pin. More... | |
uint32_t | pio_get_pin_group_id (uint32_t pin) |
Return GPIO port peripheral ID for a GPIO pin. More... | |
uint32_t | pio_get_pin_group_mask (uint32_t pin) |
Return GPIO port pin mask for a GPIO pin. More... | |
uint32_t | pio_get_pin_value (uint32_t 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 pin) |
Drive a GPIO pin to 1. More... | |
void | pio_set_pin_low (uint32_t 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 pin) |
Toggle a GPIO pin. More... | |
void | pio_toggle_pin_group (Pio *p_pio, uint32_t ul_mask) |
Toggle a GPIO group. More... | |
Parallel Input/Output (PIO) Controller driver for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Definition in file drivers/pio/pio.h.
#define PIO_DEBOUNCE (1u << 3) |
Definition at line 93 of file drivers/pio/pio.h.
#define PIO_DEFAULT (0u << 0) |
Definition at line 84 of file drivers/pio/pio.h.
#define PIO_DEGLITCH (1u << 1) |
Definition at line 88 of file drivers/pio/pio.h.
Definition at line 47 of file drivers/pio/pio.h.
#define PIO_IT_AIME (1u << 4) |
Definition at line 96 of file drivers/pio/pio.h.
#define PIO_IT_EDGE (1u << 6) |
Definition at line 101 of file drivers/pio/pio.h.
#define PIO_IT_FALL_EDGE (0 | PIO_IT_EDGE | PIO_IT_AIME) |
Definition at line 108 of file drivers/pio/pio.h.
#define PIO_IT_HIGH_LEVEL (PIO_IT_RE_OR_HL | 0 | PIO_IT_AIME) |
Definition at line 106 of file drivers/pio/pio.h.
#define PIO_IT_LOW_LEVEL (0 | 0 | PIO_IT_AIME) |
Definition at line 104 of file drivers/pio/pio.h.
#define PIO_IT_RE_OR_HL (1u << 5) |
Definition at line 99 of file drivers/pio/pio.h.
#define PIO_IT_RISE_EDGE (PIO_IT_RE_OR_HL | PIO_IT_EDGE | PIO_IT_AIME) |
Definition at line 110 of file drivers/pio/pio.h.
#define PIO_OPENDRAIN (1u << 2) |
Definition at line 90 of file drivers/pio/pio.h.
#define PIO_PULLUP (1u << 0) |
Definition at line 86 of file drivers/pio/pio.h.
#define PIO_TYPE_Msk (0xFu << PIO_TYPE_Pos) |
Definition at line 52 of file drivers/pio/pio.h.
#define PIO_TYPE_NOT_A_PIN (0x0u << PIO_TYPE_Pos) |
Definition at line 54 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_INPUT (0x5u << PIO_TYPE_Pos) |
Definition at line 64 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_OUTPUT_0 (0x6u << PIO_TYPE_Pos) |
Definition at line 66 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_OUTPUT_1 (0x7u << PIO_TYPE_Pos) |
Definition at line 68 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_PERIPH_A (0x1u << PIO_TYPE_Pos) |
Definition at line 56 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_PERIPH_B (0x2u << PIO_TYPE_Pos) |
Definition at line 58 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_PERIPH_C (0x3u << PIO_TYPE_Pos) |
Definition at line 60 of file drivers/pio/pio.h.
#define PIO_TYPE_PIO_PERIPH_D (0x4u << PIO_TYPE_Pos) |
Definition at line 62 of file drivers/pio/pio.h.
#define PIO_TYPE_Pos 27 |
Definition at line 50 of file drivers/pio/pio.h.
typedef enum _pio_type pio_type_t |
enum _pio_type |
Enumerator | |
---|---|
PIO_NOT_A_PIN | |
PIO_PERIPH_A | |
PIO_PERIPH_B | |
PIO_INPUT | |
PIO_OUTPUT_0 | |
PIO_OUTPUT_1 |
Definition at line 70 of file drivers/pio/pio.h.