For details on these please see the megaRF Manual.
Data Structures | |
struct | PORT_struct |
Typedefs | |
typedef uint8_t | ioport_mode_t |
typedef uint16_t | ioport_pin_t |
typedef uint8_t | ioport_port_mask_t |
typedef uint8_t | ioport_port_t |
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... | |
typedef struct PORT_struct | PORT_t |
Functions | |
static __always_inline void | arch_ioport_disable_pin (ioport_pin_t pin) |
static __always_inline void | arch_ioport_disable_port (ioport_port_t port, ioport_port_mask_t mask) |
static __always_inline void | arch_ioport_enable_pin (ioport_pin_t pin) |
static __always_inline void | arch_ioport_enable_port (ioport_port_t port, ioport_port_mask_t mask) |
static __always_inline bool | arch_ioport_get_pin_level (ioport_pin_t pin) |
: Get pin level of pin. More... | |
static __always_inline ioport_port_mask_t | arch_ioport_get_port_level (ioport_port_t port, ioport_port_mask_t mask) |
: Get multiple pins level of single port. More... | |
static __always_inline void | arch_ioport_init (void) |
static __always_inline PORT_t * | arch_ioport_pin_to_base (ioport_pin_t pin) |
: To get the base address of port number from defined pin More... | |
static __always_inline ioport_port_mask_t | arch_ioport_pin_to_mask (ioport_pin_t pin) |
: To get the 8-bit pin mask for pin More... | |
static __always_inline ioport_port_t | arch_ioport_pin_to_port_id (uint8_t pin) |
: To get the port number from pin nuber More... | |
static __always_inline PORT_t * | arch_ioport_port_to_base (uint8_t port) |
: To get the base address of port number More... | |
static __always_inline void | arch_ioport_set_pin_dir (ioport_pin_t pin, enum ioport_direction dir) |
: Set pin direction as input or output. More... | |
static __always_inline void | arch_ioport_set_pin_level (ioport_pin_t pin, bool level) |
: Set pin level to high or low. More... | |
static __always_inline void | arch_ioport_set_pin_mode (ioport_pin_t pin, ioport_mode_t mode) |
Set multiple pin modes in a single GPIO port, such as pull-up, pull-down, etc. More... | |
static __always_inline void | arch_ioport_set_pin_sense_mode (ioport_pin_t pin, enum ioport_sense pin_sense) |
: To configure a single GPIO pin for trigger modes: sense the edge/level/both trigger. More... | |
static __always_inline void | arch_ioport_set_port_dir (ioport_port_t port, ioport_port_mask_t mask, enum ioport_direction dir) |
: Set port direction as input or output. More... | |
static __always_inline void | arch_ioport_set_port_level (ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level) |
: Set port multiple pins level to high or low. More... | |
static __always_inline void | arch_ioport_set_port_mode (ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode) |
Set multiple pin modes in a single GPIO port, such as pull-up, pull-down, etc. More... | |
static __always_inline void | arch_ioport_set_port_sense_mode (ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense) |
: To configure a multiple pins for trigger modes: sense the edge/ level/both trigger. More... | |
static __always_inline void | arch_ioport_toggle_pin_level (ioport_pin_t pin) |
: To toggle the pin More... | |
static __always_inline void | arch_ioport_toggle_port_level (ioport_port_t port, ioport_port_mask_t mask) |
: To toggle the multiple pins on a single port. More... | |
static __always_inline 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 __always_inline void | ioport_configure_pin (port_pin_t pin, port_pin_flags_t flags) |
Select the port function for a single pin. More... | |
static __always_inline 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 __always_inline bool | ioport_get_value (port_pin_t pin) |
Read the current state of a PORT pin. More... | |
static __always_inline PORT_t * | ioport_id_pin_to_port (port_id_t port) |
: To get the port address pointer from port number More... | |
static __always_inline bool | ioport_pin_is_high (port_pin_t pin) |
Read the current state of a PORT pin and test high level. More... | |
static __always_inline bool | ioport_pin_is_low (port_pin_t pin) |
Read the current state of a PORT pin and test high level. More... | |
static __always_inline PORT_t * | ioport_pin_to_port (port_pin_t pin) |
: To get the port address pointer from pin More... | |
static __always_inline 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 __always_inline 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 __always_inline void | ioport_set_pin_high (port_pin_t pin) |
Drive a PORT pin to a high level. More... | |
static __always_inline void | ioport_set_pin_low (port_pin_t pin) |
Drive a PORT pin to a low level. More... | |
static __always_inline void | ioport_set_value (port_pin_t pin, bool value) |
Drive a PORT pin to a given state. More... | |
static __always_inline 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 __always_inline void | ioport_toggle_pin (port_pin_t pin) |
Toggle the current state of a PORT pin. More... | |
Variables | |
volatile uint8_t | PORT_struct::DIR |
volatile uint8_t | PORT_struct::PINCRL |
volatile uint8_t | PORT_struct::PORTDATA |
IOPORT Mode bit definitions | |
#define | IOPORT_MODE_PULLDOWN (0x01) |
#define | IOPORT_MODE_PULLUP (0x00) |
Initial Output State Flags | |
#define | IOPORT_INIT_LOW 0 << 1 |
#define | IOPORT_INIT_HIGH 1 << 1 |
Output and Pull Configuration Flags | |
#define | IOPORT_PULL_DOWN (0 << 2) |
#define | IOPORT_PULL_UP (1 << 2) |
#define IOPORT_INIT_HIGH 1 << 1 |
Initial Output State High
Referenced by board_init(), epd_spi_init(), ioport_configure_port_pin(), run_loopback_syncmode_test(), spi_slave_init(), and usart_init_spi().
#define IOPORT_INIT_LOW 0 << 1 |
Initial Output State Low
Referenced by main().
#define IOPORT_MODE_PULLDOWN (0x01) |
Pull-down
Referenced by arch_ioport_set_pin_mode(), and arch_ioport_set_port_mode().
#define IOPORT_MODE_PULLUP (0x00) |
Pull-up
Referenced by arch_ioport_set_pin_mode(), arch_ioport_set_port_mode(), main(), run_ioport_pin_test(), and run_ioport_port_test().
#define IOPORT_PULL_DOWN (0 << 2) |
Pull-Down (when input)
#define IOPORT_PULL_UP (1 << 2) |
Pull-Up (when input)
Referenced by ext_int_init(), ext_int_pcint_init(), and ioport_configure_port_pin().
typedef uint8_t ioport_mode_t |
typedef uint16_t ioport_pin_t |
typedef uint8_t ioport_port_mask_t |
typedef uint8_t ioport_port_t |
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.
typedef struct PORT_struct PORT_t |
|
static |
Referenced by ioport_disable_pin().
|
static |
Referenced by ioport_disable_port().
|
static |
Referenced by ioport_enable_pin().
|
static |
Referenced by ioport_enable_port().
|
static |
: Get pin level of pin.
pin. the pin number defined by IOPORT_CREATE_PIN |
References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), and PORT_struct::PINCRL.
Referenced by ioport_get_pin_level(), ioport_get_value(), ioport_pin_is_high(), and ioport_pin_is_low().
|
static |
: Get multiple pins level of single port.
port | GPIO port to configure e.g. IOPORT_PORTB |
mask | Pin mask of pins to read data. |
References arch_ioport_port_to_base(), and PORT_struct::PINCRL.
Referenced by ioport_get_port_level().
|
static |
Referenced by ioport_init().
|
static |
: To get the base address of port number from defined pin
pin. the pin number defined by IOPORT_CREATE_PIN |
References arch_ioport_port_to_base().
Referenced by arch_ioport_get_pin_level(), arch_ioport_set_pin_dir(), arch_ioport_set_pin_mode(), arch_ioport_toggle_pin_level(), ioport_configure_pin(), and ioport_pin_to_port().
|
static |
: To get the 8-bit pin mask for pin
pin. the pin number defined by IOPORT_CREATE_PIN |
Referenced by arch_ioport_get_pin_level(), arch_ioport_set_pin_dir(), arch_ioport_set_pin_level(), arch_ioport_set_pin_mode(), arch_ioport_toggle_pin_level(), ioport_configure_pin(), and ioport_pin_to_mask().
|
inlinestatic |
: To get the port number from pin nuber
pin. the pin number defined by IOPORT_CREATE_PIN |
Referenced by arch_ioport_set_pin_sense_mode(), and ioport_pin_to_port_id().
|
static |
: To get the base address of port number
port number e.g. IOPORT_PORTB |
References IOPORT_BASE_ADDRESS, and IOPORT_PORT_OFFSET.
Referenced by arch_ioport_get_port_level(), arch_ioport_pin_to_base(), arch_ioport_set_pin_level(), arch_ioport_set_port_dir(), arch_ioport_set_port_level(), arch_ioport_set_port_mode(), arch_ioport_toggle_port_level(), ioport_configure_group(), and ioport_id_pin_to_port().
|
static |
: Set pin direction as input or output.
pin. the pin number defined by IOPORT_CREATE_PIN | |
mask | Pin mask of pins to configure |
mode | dir, ioport_direction |
References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), PORT_struct::DIR, IOPORT_DIR_INPUT, and IOPORT_DIR_OUTPUT.
Referenced by ioport_set_pin_dir().
|
static |
: Set pin level to high or low.
pin. the pin number defined by IOPORT_CREATE_PIN | |
level high/low |
References arch_ioport_pin_to_mask(), arch_ioport_port_to_base(), and PORT_struct::PORTDATA.
Referenced by ioport_set_pin_high(), ioport_set_pin_level(), ioport_set_pin_low(), and ioport_set_value().
|
static |
Set multiple pin modes in a single GPIO port, such as pull-up, pull-down, etc.
configuration.
pin. the pin number defined by IOPORT_CREATE_PIN | |
mask | Pin mask of pins to configure |
mode | Mode masks to configure for the specified pins (IOPORT Modes) |
References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), IOPORT_MODE_PULLDOWN, IOPORT_MODE_PULLUP, and PORT_struct::PORTDATA.
Referenced by ioport_reset_pin_mode(), and ioport_set_pin_mode().
|
static |
: To configure a single GPIO pin for trigger modes: sense the edge/level/both trigger.
pin. the pin number defined by IOPORT_CREATE_PIN | |
pin_sense,refer | to . |
References arch_ioport_pin_to_port_id(), cpu_irq_restore(), and cpu_irq_save().
Referenced by ioport_set_pin_sense_mode().
|
static |
: Set port direction as input or output.
port | GPIO port to configure e.g. IOPORT_PORTB |
mask | Pin mask of pins to configure |
mode | dir, ioport_direction |
References arch_ioport_port_to_base(), PORT_struct::DIR, IOPORT_DIR_INPUT, and IOPORT_DIR_OUTPUT.
Referenced by ioport_set_port_dir().
|
static |
: Set port multiple pins level to high or low.
port | GPIO port to configure e.g. IOPORT_PORTB |
mask Pin mask of pins to configure. | |
level high/low |
References arch_ioport_port_to_base(), and PORT_struct::PORTDATA.
Referenced by ioport_set_group_high(), ioport_set_group_low(), and ioport_set_port_level().
|
static |
Set multiple pin modes in a single GPIO port, such as pull-up, pull-down, etc.
configuration.
port | GPIO port to configure e.g. IOPORT_PORTB |
mask | Pin mask of pins to configure |
mode | Mode masks to configure for the specified pins (IOPORT Modes) |
References arch_ioport_port_to_base(), IOPORT_MODE_PULLDOWN, IOPORT_MODE_PULLUP, and PORT_struct::PORTDATA.
Referenced by ioport_reset_port_mode(), and ioport_set_port_mode().
|
static |
: To configure a multiple pins for trigger modes: sense the edge/ level/both trigger.
pin. the pin number defined by IOPORT_CREATE_PIN | |
pin_sense,refer | to . |
References cpu_irq_restore(), and cpu_irq_save().
Referenced by ioport_set_port_sense_mode().
|
static |
: To toggle the pin
pin. the pin number defined by IOPORT_CREATE_PIN |
References arch_ioport_pin_to_base(), arch_ioport_pin_to_mask(), and PORT_struct::PINCRL.
Referenced by ioport_toggle_pin(), and ioport_toggle_pin_level().
|
static |
: To toggle the multiple pins on a single port.
port | GPIO port to toggle e.g. IOPORT_PORTB |
mask | Pin mask of pins to read data. |
References arch_ioport_port_to_base(), and PORT_struct::PINCRL.
Referenced by ioport_tgl_group(), and ioport_toggle_port_level().
|
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 number defined by IOPORT_CREATE_PIN | |
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 board_init(), ext_int_init(), ext_int_pcint_init(), main(), and run_interrupt_trigger_test().
|
inlinestatic |
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, and IOPORT_PULL_UP.
Referenced by ioport_configure_group(), ioport_configure_pin(), run_loopback_syncmode_test(), and usart_init_spi().
|
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 |
: To get the port address pointer from port number
port | GPIO port to toggle e.g. IOPORT_PORTB |
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().
|
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().
|
inlinestatic |
: To get the port address pointer from pin
pin. the pin number defined by IOPORT_CREATE_PIN |
References arch_ioport_pin_to_base().
Referenced by run_loopback_syncmode_test(), and usart_init_spi().
|
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 spi_deselect_device(), 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. the pin number defined by IOPORT_CREATE_PIN |
References arch_ioport_set_pin_level().
Referenced by spi_select_device(), 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().
Referenced by example_cmp1_int_cb(), and example_cmp3_int_cb().
|
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().
Referenced by example_backoff_slot_cntr_int_cb(), example_cmp1_int_cb(), example_cmp2_int_cb(), example_cmp3_int_cb(), and example_ovf_int_cb().
volatile uint8_t PORT_struct::DIR |
Referenced by arch_ioport_set_pin_dir(), and arch_ioport_set_port_dir().
volatile uint8_t PORT_struct::PINCRL |
volatile uint8_t PORT_struct::PORTDATA |