XMEGA legacy IOPORT software compatibility driver interface header file.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "../ioport.h"
Macros | |
Initial Output State Flags | |
#define | IOPORT_INIT_LOW (0 << 1) |
#define | IOPORT_INIT_HIGH (1 << 1) |
Input/Sense Configuration Flags | |
#define | IOPORT_BOTHEDGES (0 << 8) |
#define | IOPORT_RISING (1 << 8) |
#define | IOPORT_FALLING (2 << 8) |
#define | IOPORT_LEVEL (3 << 8) |
#define | IOPORT_INPUT_DISABLE (7 << 8) |
Output and Pull Configuration Flags | |
#define | IOPORT_TOTEM (0 << 11) |
#define | IOPORT_BUSKEEPER (1 << 11) |
#define | IOPORT_PULL_DOWN (2 << 11) |
#define | IOPORT_PULL_UP (3 << 11) |
#define | IOPORT_WIRED_OR (4 << 11) |
#define | IOPORT_WIRED_AND (5 << 11) |
#define | IOPORT_WIRED_OR_PULL_DOWN (6 << 11) |
#define | IOPORT_WIRED_AND_PULL_UP (7 << 11) |
Inverted I/O Configuration Flags | |
#define | IOPORT_INV_ENABLED (1 << 14) |
#define | IOPORT_INV_DISABLE (0 << 14) |
Slew Rate Limit Configuration Flags | |
#define | IOPORT_SRL_ENABLED (1 << 15) |
#define | IOPORT_SRL_DISABLED (0 << 15) |
PORT fields structure offset | |
These macros are used to compute the field offset number with the PORT_t structure. | |
#define | PORT_DIR 0x00 |
#define | PORT_DIRSET 0x01 |
#define | PORT_DIRCLR 0x02 |
#define | PORT_DIRTGL 0x03 |
#define | PORT_OUT 0x04 |
#define | PORT_OUTSET 0x05 |
#define | PORT_OUTCLR 0x06 |
#define | PORT_OUTTGL 0x07 |
#define | PORT_IN 0x08 |
#define | PORT_INTCTRL 0x09 |
#define | PORT_INT0MASK 0x0A |
#define | PORT_INT1MASK 0x0B |
#define | PORT_INTFLAGS 0x0C |
#define | PORT_PIN0CTRL 0x10 |
#define | PORT_PIN1CTRL 0x11 |
#define | PORT_PIN2CTRL 0x12 |
#define | PORT_PIN3CTRL 0x13 |
#define | PORT_PIN4CTRL 0x14 |
#define | PORT_PIN5CTRL 0x15 |
#define | PORT_PIN6CTRL 0x16 |
#define | PORT_PIN7CTRL 0x17 |
Typedefs | |
typedef uint8_t | pin_mask_t |
A pin mask. More... | |
typedef uint8_t | port_id_t |
A port id. More... | |
typedef uint16_t | port_pin_flags_t |
Pin configuration flags. More... | |
typedef uint8_t | port_pin_t |
A PORT pin. More... | |
Functions | |
static void | ioport_configure_group (port_id_t port, pin_mask_t pin_mask, port_pin_flags_t flags) |
Configure a group of I/O pins on a specified port number. More... | |
static void | ioport_configure_pin (port_pin_t pin, port_pin_flags_t flags) |
Select the port function for a single pin. More... | |
void | ioport_configure_port_pin (void *port, pin_mask_t pin_mask, port_pin_flags_t flags) |
Configure the IO PORT pin function for a set of pins on a port. More... | |
static bool | ioport_get_value (port_pin_t pin) |
Read the current state of a PORT pin. More... | |
static PORT_t * | ioport_id_pin_to_port (port_id_t port) |
static bool | ioport_pin_is_high (port_pin_t pin) |
Read the current state of a PORT pin and test high level. More... | |
static bool | ioport_pin_is_low (port_pin_t pin) |
Read the current state of a PORT pin and test high level. More... | |
static PORT_t * | ioport_pin_to_port (port_pin_t pin) |
static void | ioport_set_group_high (port_id_t port_id, pin_mask_t port_mask) |
Drives a group of I/O pin of a port to high level. More... | |
static void | ioport_set_group_low (port_id_t port_id, pin_mask_t port_mask) |
Drives a group of I/O pin of a port to low level. More... | |
static void | ioport_set_pin_high (port_pin_t pin) |
Drive a PORT pin to a high level. More... | |
static void | ioport_set_pin_low (port_pin_t pin) |
Drive a PORT pin to a low level. More... | |
static void | ioport_set_value (port_pin_t pin, bool value) |
Drive a PORT pin to a given state. More... | |
static void | ioport_tgl_group (port_id_t port_id, pin_mask_t port_mask) |
Toggles a group of I/O pin of a port. More... | |
static void | ioport_toggle_pin (port_pin_t pin) |
Toggle the current state of a PORT pin. More... | |
#define IOPORT_BOTHEDGES (0 << 8) |
Sense Both Edges
#define IOPORT_BUSKEEPER (1 << 11) |
Bus Keeper
#define IOPORT_FALLING (2 << 8) |
Sense Falling Edge
Referenced by main().
#define IOPORT_INIT_HIGH (1 << 1) |
Initial Output State High
Referenced by ioport_configure_port_pin().
#define IOPORT_INIT_LOW (0 << 1) |
Initial Output State Low
Referenced by main().
#define IOPORT_INPUT_DISABLE (7 << 8) |
Input Buffer Disabled
Referenced by lowpower_init().
#define IOPORT_INV_DISABLE (0 << 14) |
I/O is Not Inverted
#define IOPORT_INV_ENABLED (1 << 14) |
I/O is Inverted
#define IOPORT_LEVEL (3 << 8) |
Sense Low Level
Referenced by main().
#define IOPORT_PULL_DOWN (2 << 11) |
Pull-Down (when input)
#define IOPORT_PULL_UP (3 << 11) |
Pull-Up (when input)
Referenced by lowpower_init(), and main().
#define IOPORT_RISING (1 << 8) |
Sense Rising Edge
#define IOPORT_SRL_DISABLED (0 << 15) |
Slew Rate Limit Disabled
#define IOPORT_SRL_ENABLED (1 << 15) |
Slew Rate Limit Enabled
#define IOPORT_TOTEM (0 << 11) |
Normal push/pull output
#define IOPORT_WIRED_AND (5 << 11) |
Wired AND
#define IOPORT_WIRED_AND_PULL_UP (7 << 11) |
Wired AND and Pull-Up
#define IOPORT_WIRED_OR (4 << 11) |
Wired OR
#define IOPORT_WIRED_OR_PULL_DOWN (6 << 11) |
Wired OR and Pull-Down
#define PORT_DIR 0x00 |
Data Direction
#define PORT_DIRCLR 0x02 |
Data Direction Clear
Referenced by ioport_configure_port_pin().
#define PORT_DIRSET 0x01 |
Data Direction Set
Referenced by ioport_configure_port_pin().
#define PORT_DIRTGL 0x03 |
Data Direction Toggle
#define PORT_IN 0x08 |
Data Input Value
#define PORT_INT0MASK 0x0A |
Interrupt 0 Mask
#define PORT_INT1MASK 0x0B |
Interrupt 1 Mask
#define PORT_INTCTRL 0x09 |
Interrupt Control
#define PORT_INTFLAGS 0x0C |
Interrupt Flags
#define PORT_OUT 0x04 |
Data Output Value
#define PORT_OUTCLR 0x06 |
Data Output Value Clear
Referenced by ioport_configure_port_pin().
#define PORT_OUTSET 0x05 |
Data Output Value Set
Referenced by ioport_configure_port_pin().
#define PORT_OUTTGL 0x07 |
Data Output Value Toggle
#define PORT_PIN0CTRL 0x10 |
Pin 0 Configuration
Referenced by ioport_configure_port_pin().
#define PORT_PIN1CTRL 0x11 |
Pin 1 Configuration
#define PORT_PIN2CTRL 0x12 |
Pin 2 Configuration
#define PORT_PIN3CTRL 0x13 |
Pin 3 Configuration
#define PORT_PIN4CTRL 0x14 |
Pin 4 Configuration
#define PORT_PIN5CTRL 0x15 |
Pin 5 Configuration
#define PORT_PIN6CTRL 0x16 |
Pin 6 Configuration
#define PORT_PIN7CTRL 0x17 |
Pin 7 Configuration
typedef uint8_t pin_mask_t |
A pin mask.
This type is used to describe the port pin mask on the part.
typedef uint8_t port_id_t |
A port id.
This type is used to describe the port id on the part (0 is PORTA).
typedef uint16_t port_pin_flags_t |
Pin configuration flags.
This is a bitmask containing configuration flags for the pins that shall be configured.
typedef uint8_t port_pin_t |
A PORT pin.
This type is used to describe the PORT pins on the part.
|
inlinestatic |
Configure a group of I/O pins on a specified port number.
port | The port number |
pin_mask | The pin mask to configure |
flags | Bitmask of flags specifying additional configuration parameters. |
References arch_ioport_port_to_base(), and ioport_configure_port_pin().
|
inlinestatic |
Select the port function for a single pin.
pin | The pin to configure |
flags | Bitmask of flags specifying additional configuration parameters. |
References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), and ioport_configure_port_pin().
Referenced by lowpower_init(), and main().
void ioport_configure_port_pin | ( | void * | port, |
pin_mask_t | pin_mask, | ||
port_pin_flags_t | flags | ||
) |
Configure the IO PORT pin function for a set of pins on a port.
port | Pointer to the port |
pin_mask | Mask containing the pins that should be configured |
flags | Bitmask of flags specifying additional configuration parameters. |
References IOPORT_DIR_OUTPUT, IOPORT_INIT_HIGH, PORT_DIRCLR, PORT_DIRSET, PORT_OUTCLR, PORT_OUTSET, and PORT_PIN0CTRL.
Referenced by ioport_configure_group(), ioport_configure_pin(), lowpower_init(), and main().
|
inlinestatic |
Read the current state of a PORT pin.
pin | A number identifying the pin to read. |
true | The pin is currently high (close to Vdd) |
false | The pin is currently low (close to Vss) |
References arch_ioport_get_pin_level().
|
inlinestatic |
References arch_ioport_port_to_base().
|
inlinestatic |
Read the current state of a PORT pin and test high level.
pin | A number identifying the pin to read. |
true | The pin is currently high (close to Vdd) |
false | The pin is currently low (close to Vss) |
References arch_ioport_get_pin_level().
Referenced by wait_for_button(), and wait_for_switches().
|
inlinestatic |
Read the current state of a PORT pin and test high level.
pin | A number identifying the pin to read. |
true | The pin is currently high (close to Vdd) |
false | The pin is currently low (close to Vss) |
References arch_ioport_get_pin_level().
Referenced by ISR(), wait_for_button(), and wait_for_switches().
|
inlinestatic |
References arch_ioport_pin_to_base().
Referenced by main().
|
inlinestatic |
Drives a group of I/O pin of a port to high level.
port_id | The port number. |
port_mask | The mask. |
References arch_ioport_set_port_level().
|
inlinestatic |
Drives a group of I/O pin of a port to low level.
port_id | The port number. |
port_mask | The mask. |
References arch_ioport_set_port_level().
|
inlinestatic |
Drive a PORT pin to a high level.
This function will only have an effect if pin is configured as an output.
pin | A number identifying the pin to act on. |
References arch_ioport_set_pin_level().
Referenced by main(), spi_deselect_device(), st7565r_hard_reset(), st7565r_write_data(), and usart_spi_deselect_device().
|
inlinestatic |
Drive a PORT pin to a low level.
This function will only have an effect if pin is configured as an output.
pin | A number identifying the pin to act on. |
References arch_ioport_set_pin_level().
Referenced by main(), spi_select_device(), st7565r_hard_reset(), st7565r_init(), st7565r_write_command(), st7565r_write_data(), and usart_spi_select_device().
|
inlinestatic |
Drive a PORT pin to a given state.
This function will only have an effect if pin is configured as an output.
pin | A number identifying the pin to act on. |
value | The desired state of the pin. true means drive the pin high (towards Vdd), while false means drive the pin low (towards Vss). |
References arch_ioport_set_pin_level().
|
inlinestatic |
Toggles a group of I/O pin of a port.
port_id | The port number. |
port_mask | The mask. |
References arch_ioport_toggle_port_level().
|
inlinestatic |
Toggle the current state of a PORT pin.
pin | A number identifying the pin to act on. |
References arch_ioport_toggle_pin_level().