Macros | |
#define | IOPORT_CREATE_PIN(port, pin) ((IOPORT_ ## port) * 32 + (pin)) |
Create IOPORT pin number. More... | |
Enumerations | |
enum | ioport_direction { IOPORT_DIR_INPUT, IOPORT_DIR_OUTPUT } |
IOPORT pin directions. More... | |
enum | ioport_sense { IOPORT_SENSE_BOTHEDGES, IOPORT_SENSE_RISING, IOPORT_SENSE_FALLING } |
enum | ioport_value { IOPORT_PIN_LEVEL_LOW, IOPORT_PIN_LEVEL_HIGH } |
IOPORT levels. More... | |
Functions | |
static void | ioport_disable_pin (ioport_pin_t pin) |
Disable IOPORT pin, based on a pin created with IOPORT_CREATE_PIN(). More... | |
static void | ioport_disable_port (ioport_port_t port, ioport_port_mask_t mask) |
Disable multiple pins in a single IOPORT port. More... | |
static void | ioport_enable_pin (ioport_pin_t pin) |
Enable an IOPORT pin, based on a pin created with IOPORT_CREATE_PIN(). More... | |
static void | ioport_enable_port (ioport_port_t port, ioport_port_mask_t mask) |
Enable multiple pins in a single IOPORT port. More... | |
static bool | ioport_get_pin_level (ioport_pin_t pin) |
Get current value of an IOPORT pin, which has been configured as an input. More... | |
static ioport_port_mask_t | ioport_get_port_level (ioport_pin_t port, ioport_port_mask_t mask) |
Get current value of several IOPORT pins in a single port, which have been configured as an inputs. More... | |
static void | ioport_init (void) |
Initializes the IOPORT service, ready for use. More... | |
static ioport_port_mask_t | ioport_pin_to_mask (ioport_pin_t pin) |
Convert a pin ID into a bitmask mask for the given pin on its port. More... | |
static ioport_port_t | ioport_pin_to_port_id (ioport_pin_t pin) |
Convert a pin ID into a its port ID. More... | |
static void | ioport_reset_pin_mode (ioport_pin_t pin) |
Reset pin mode configuration for a single IOPORT pin. More... | |
static void | ioport_reset_port_mode (ioport_port_t port, ioport_port_mask_t mask) |
Reset multiple pin modes in a specified IOPORT port to defaults. More... | |
static void | ioport_set_pin_dir (ioport_pin_t pin, enum ioport_direction dir) |
Set direction for a single IOPORT pin. More... | |
static void | ioport_set_pin_level (ioport_pin_t pin, bool level) |
Set an IOPORT pin to a specified logical value. More... | |
static void | ioport_set_pin_mode (ioport_pin_t pin, ioport_mode_t mode) |
Set pin mode for one single IOPORT pin. More... | |
static void | ioport_set_pin_sense_mode (ioport_pin_t pin, enum ioport_sense pin_sense) |
Set the pin sense mode of a single IOPORT pin. More... | |
static void | ioport_set_port_dir (ioport_port_t port, ioport_port_mask_t mask, enum ioport_direction dir) |
Set I/O direction for a group of pins in a single IOPORT. More... | |
static void | ioport_set_port_level (ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level) |
Set a group of IOPORT pins in a single port to a specified logical value. More... | |
static void | ioport_set_port_mode (ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode) |
Set multiple pin modes in a single IOPORT port, such as pull-up, pull-down, etc. configuration. More... | |
static void | ioport_set_port_sense_mode (ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense) |
Set the pin sense mode of a multiple IOPORT pins on a single port. More... | |
static void | ioport_toggle_pin_level (ioport_pin_t pin) |
Toggle the value of an IOPORT pin, which has previously configured as an output. More... | |
static void | ioport_toggle_port_level (ioport_port_t port, ioport_port_mask_t mask) |
Toggle the values of several IOPORT pins located in a single port. More... | |
IOPORT Mode bit definitions | |
#define | IOPORT_MODE_MUX_MASK (0x7 << 0) |
#define | IOPORT_MODE_MUX_BIT0 ( 1 << 0) |
#define | IOPORT_MODE_MUX_A ( 0 << 0) |
#define | IOPORT_MODE_MUX_B ( 1 << 0) |
#define | IOPORT_MODE_PULLUP ( 1 << 3) |
#define | IOPORT_MODE_OPEN_DRAIN ( 1 << 5) |
#define | IOPORT_MODE_GLITCH_FILTER ( 1 << 6) |
#define | IOPORT_MODE_DEBOUNCE ( 1 << 7) |
See Quick start guide for the common IOPORT service.
This is common IOPORT service for GPIO pin configuration and control in a standardized manner across the MEGA, MEGA_RF, XMEGA, UC3 and ARM devices.
Port pin control code is optimized for each platform, and should produce both compact and fast execution times when used with constant values.
This driver depends on the following modules:
For details on these please see the SAM Manual.
#define IOPORT_CREATE_PIN | ( | port, | |
pin | |||
) | ((IOPORT_ ## port) * 32 + (pin)) |
Create IOPORT pin number.
Create a IOPORT pin number for use with the IOPORT functions.
port | IOPORT port (e.g. PORTA, PA or PIOA depending on chosen architecture) |
pin | IOPORT zero-based index of the I/O pin |
Definition at line 41 of file ioport_pio.h.
#define IOPORT_MODE_DEBOUNCE ( 1 << 7) |
Input debounce
Definition at line 87 of file ioport_pio.h.
#define IOPORT_MODE_GLITCH_FILTER ( 1 << 6) |
Glitch filter
Definition at line 86 of file ioport_pio.h.
#define IOPORT_MODE_MUX_A ( 0 << 0) |
MUX function A
Definition at line 70 of file ioport_pio.h.
#define IOPORT_MODE_MUX_B ( 1 << 0) |
MUX function B
Definition at line 71 of file ioport_pio.h.
#define IOPORT_MODE_MUX_BIT0 ( 1 << 0) |
MUX BIT0 mask
Definition at line 64 of file ioport_pio.h.
#define IOPORT_MODE_MUX_MASK (0x7 << 0) |
MUX bits mask
Definition at line 63 of file ioport_pio.h.
#define IOPORT_MODE_OPEN_DRAIN ( 1 << 5) |
Open drain
Definition at line 84 of file ioport_pio.h.
#define IOPORT_MODE_PULLUP ( 1 << 3) |
Pull-up
Definition at line 78 of file ioport_pio.h.
enum ioport_direction |
enum ioport_sense |
enum ioport_value |
|
inlinestatic |
Disable IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
pin | IOPORT pin to disable |
|
inlinestatic |
|
inlinestatic |
Enable an IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
pin | IOPORT pin to enable |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Set direction for a single IOPORT pin.
pin | IOPORT pin to configure |
dir | Direction to set for the specified pin (ioport_direction) |
|
inlinestatic |
|
inlinestatic |
Set pin mode for one single IOPORT pin.
pin | IOPORT pin to configure |
mode | Mode masks to configure for the specified pin (IOPORT Modes) |
|
inlinestatic |
Set the pin sense mode of a single IOPORT pin.
pin | IOPORT pin to configure |
pin_sense | Edge to sense for the pin (ioport_sense) |
|
inlinestatic |
Set I/O direction for a group of pins in a single IOPORT.
port | IOPORT port to configure |
mask | Pin mask of pins to configure |
dir | Direction to set for the specified pins (ioport_direction) |
|
inlinestatic |
|
inlinestatic |
Set multiple pin modes in a single IOPORT port, such as pull-up, pull-down, etc. configuration.
port | IOPORT port to configure |
mask | Pin mask of pins to configure |
mode | Mode masks to configure for the specified pins (IOPORT Modes) |
|
inlinestatic |
Set the pin sense mode of a multiple IOPORT pins on a single port.
port | IOPORT port to configure |
mask | Bitmask if pins whose edge sense is to be configured |
pin_sense | Edge to sense for the pins (ioport_sense) |
|
inlinestatic |
|
inlinestatic |