Microchip® Advanced Software Framework

mega/ioport.h File Reference

MEGA and MEGA_RF architecture specific IOPORT service implementation header file.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

Data Structures

struct  PORT_struct
 

Macros

#define IOPORT_BASE_ADDRESS   0x20
 
#define IOPORT_CREATE_PIN(port, pin)   ((IOPORT_ ## port) * 8 + (pin))
 Create IOPORT pin number. More...
 
#define IOPORT_PORT_OFFSET   0x03
 
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)
 

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_tarch_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_tarch_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_tioport_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_tioport_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...
 

#define IOPORT_BASE_ADDRESS   0x20
#define IOPORT_PORT_OFFSET   0x03