RA Flexible Software Package Documentation  Release v4.0.0

 
I/O Port (r_ioport)

Functions

fsp_err_t R_IOPORT_Open (ioport_ctrl_t *const p_ctrl, const ioport_cfg_t *p_cfg)
 
fsp_err_t R_IOPORT_Close (ioport_ctrl_t *const p_ctrl)
 
fsp_err_t R_IOPORT_PinsCfg (ioport_ctrl_t *const p_ctrl, const ioport_cfg_t *p_cfg)
 
fsp_err_t R_IOPORT_PinCfg (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, uint32_t cfg)
 
fsp_err_t R_IOPORT_PinRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t *p_pin_value)
 
fsp_err_t R_IOPORT_PortRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t *p_port_value)
 
fsp_err_t R_IOPORT_PortWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t value, ioport_size_t mask)
 
fsp_err_t R_IOPORT_PinWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t level)
 
fsp_err_t R_IOPORT_PortDirectionSet (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t direction_values, ioport_size_t mask)
 
fsp_err_t R_IOPORT_PortEventInputRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t *p_event_data)
 
fsp_err_t R_IOPORT_PinEventInputRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t *p_pin_event)
 
fsp_err_t R_IOPORT_PortEventOutputWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t event_data, ioport_size_t mask_value)
 
fsp_err_t R_IOPORT_PinEventOutputWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t pin_value)
 

Detailed Description

Driver for the I/O Ports peripheral on RA MCUs. This module implements the I/O Port Interface.

Overview

The I/O port pins operate as general I/O port pins, I/O pins for peripheral modules, interrupt input pins, analog I/O, port group function for the ELC, or bus control pins.

Features

The IOPORT HAL module can configure the following pin settings:

The module also provides the following functionality:

Configuration

The I/O PORT HAL module must be configured by the user for the desired operation. The operating state of an I/O pin can be set via the RA Configuraton tool. When the project is built a pin configuration file is created. The BSP will automatically configure the MCU IO ports accordingly at startup using the same API functions mentioned in this document.

Build Time Configurations for r_ioport

The following build time configurations are defined in fsp_cfg/r_ioport_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.

Configurations for System > I/O Port (r_ioport)

This module can be added to the Stacks tab via New Stack > System > I/O Port (r_ioport).

ConfigurationOptionsDefaultDescription
NameName must be a valid C symbolg_ioport Module name.
Port 1 ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORT1
Port 2 ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORT2
Port 3 ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORT3
Port 4 ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORT4
Port B ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORTB
Port C ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORTC
Port D ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORTD
Port E ELC Trigger SourceMCU Specific OptionsELC source that will trigger PORTE
Pin Configuration NameName must be a valid C symbolg_bsp_pin_cfg Name for pin configuration structure

Clock Configuration

The I/O PORT HAL module does not require a specific clock configuration.

Pin Configuration

The IOPORT module is used for configuring pins.

Usage Notes

Port Group Function for ELC

Depending on pin configuration, the IOPORT module can perform automatic reads and writes on ports 1-4 on receipt of an ELC event.

When an event is received by a port, the state of the input pins on the port is saved in a hardware register. Simultaneously, the state of output pins on the port is set or cleared based on settings configured by the user. The functions R_IOPORT_PinEventInputRead and R_IOPORT_PortEventInputRead allow reading the last event input state of a pin or port, and event-triggered pin output can be configured through R_IOPORT_PinEventOutputWrite and R_IOPORT_PortEventOutputWrite.

In addition, each pin on ports 1-4 can be configured to trigger an ELC event on rising, falling or both edges. This event can be used to activate other modules when the pin changes state.

Note
The number of ELC-aware ports vary across MCUs. Refer to the Hardware User's Manual for your device for more details.

Examples

Basic Example

This is a basic example of minimal use of the IOPORT in an application.

void basic_example ()
{
bsp_io_level_t readLevel;
fsp_err_t err;
/* Initialize the IOPORT module and configure the pins
* Note: The default pin configuration name in the RA Configuraton tool is g_bsp_pin_cfg */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Call R_IOPORT_PinsCfg if the configuration was not part of initial configurations made in open */
err = R_IOPORT_PinsCfg(&g_ioport_ctrl, &g_runtime_pin_cfg);
assert(FSP_SUCCESS == err);
/* Set Pin 00 of Port 06 to High */
assert(FSP_SUCCESS == err);
/* Read Pin 00 of Port 06*/
err = R_IOPORT_PinRead(&g_ioport_ctrl, BSP_IO_PORT_06_PIN_00, &readLevel);
assert(FSP_SUCCESS == err);
}

Blinky Example

This example uses IOPORT to configure and toggle a pin to blink an LED.

void blinky_example ()
{
fsp_err_t err;
/* Initialize the IOPORT module and configure the pins */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Configure Pin as output
* Call the R_IOPORT_PinCfg if the configuration was not part of initial configurations made in open */
assert(FSP_SUCCESS == err);
while (1)
{
/* Determine the next state of the LEDs */
if (BSP_IO_LEVEL_LOW == level)
{
}
else
{
}
/* Update LED on RA6M3-PK */
err = R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_06_PIN_00, level);
assert(FSP_SUCCESS == err);
/* Delay */
}
}

ELC Example

This is an example of using IOPORT with ELC events. The ELC event system allows the captured data to be stored when it occurs and then read back at a later time.

static elc_instance_ctrl_t g_elc_ctrl;
static elc_cfg_t g_elc_cfg;
void ioport_elc_example ()
{
bsp_io_level_t eventValue;
fsp_err_t err;
/* Initializes the software and sets the links defined in the control structure. */
err = R_ELC_Open(&g_elc_ctrl, &g_elc_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Create or modify a link between a peripheral function and an event source. */
err = R_ELC_LinkSet(&g_elc_ctrl, (elc_peripheral_t) ELC_PERIPHERAL_IOPORT2, ELC_EVENT_ELC_SOFTWARE_EVENT_0);
assert(FSP_SUCCESS == err);
/* Globally enable event linking in the ELC. */
err = R_ELC_Enable(&g_elc_ctrl);
assert(FSP_SUCCESS == err);
/* Initialize the IOPORT module and configure the pins */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
assert(FSP_SUCCESS == err);
/* Call the R_IOPORT_PinCfg if the configuration was not part of initial configurations made in open */
assert(FSP_SUCCESS == err);
/* Generate an event signal through software to the linked peripheral. */
assert(FSP_SUCCESS == err);
/* Read Pin Event Input. The data(BSP_IO_LEVEL_HIGH/ BSP_IO_LEVEL_LOW) from BSP_IO_PORT_02_PIN_00 is read into the
* EIDR bit */
err = R_IOPORT_PinEventInputRead(&g_ioport_ctrl, BSP_IO_PORT_02_PIN_00, &eventValue);
assert(FSP_SUCCESS == err);
}

Data Structures

struct  ioport_instance_ctrl_t
 

Enumerations

enum  ioport_port_pin_t
 

Data Structure Documentation

◆ ioport_instance_ctrl_t

struct ioport_instance_ctrl_t

IOPORT private control block. DO NOT MODIFY. Initialization occurs when R_IOPORT_Open() is called.

Enumeration Type Documentation

◆ ioport_port_pin_t

Superset list of all possible IO port pins.

Enumerator
IOPORT_PORT_00_PIN_00 

IO port 0 pin 0.

IOPORT_PORT_00_PIN_01 

IO port 0 pin 1.

IOPORT_PORT_00_PIN_02 

IO port 0 pin 2.

IOPORT_PORT_00_PIN_03 

IO port 0 pin 3.

IOPORT_PORT_00_PIN_04 

IO port 0 pin 4.

IOPORT_PORT_00_PIN_05 

IO port 0 pin 5.

IOPORT_PORT_00_PIN_06 

IO port 0 pin 6.

IOPORT_PORT_00_PIN_07 

IO port 0 pin 7.

IOPORT_PORT_00_PIN_08 

IO port 0 pin 8.

IOPORT_PORT_00_PIN_09 

IO port 0 pin 9.

IOPORT_PORT_00_PIN_10 

IO port 0 pin 10.

IOPORT_PORT_00_PIN_11 

IO port 0 pin 11.

IOPORT_PORT_00_PIN_12 

IO port 0 pin 12.

IOPORT_PORT_00_PIN_13 

IO port 0 pin 13.

IOPORT_PORT_00_PIN_14 

IO port 0 pin 14.

IOPORT_PORT_00_PIN_15 

IO port 0 pin 15.

IOPORT_PORT_01_PIN_00 

IO port 1 pin 0.

IOPORT_PORT_01_PIN_01 

IO port 1 pin 1.

IOPORT_PORT_01_PIN_02 

IO port 1 pin 2.

IOPORT_PORT_01_PIN_03 

IO port 1 pin 3.

IOPORT_PORT_01_PIN_04 

IO port 1 pin 4.

IOPORT_PORT_01_PIN_05 

IO port 1 pin 5.

IOPORT_PORT_01_PIN_06 

IO port 1 pin 6.

IOPORT_PORT_01_PIN_07 

IO port 1 pin 7.

IOPORT_PORT_01_PIN_08 

IO port 1 pin 8.

IOPORT_PORT_01_PIN_09 

IO port 1 pin 9.

IOPORT_PORT_01_PIN_10 

IO port 1 pin 10.

IOPORT_PORT_01_PIN_11 

IO port 1 pin 11.

IOPORT_PORT_01_PIN_12 

IO port 1 pin 12.

IOPORT_PORT_01_PIN_13 

IO port 1 pin 13.

IOPORT_PORT_01_PIN_14 

IO port 1 pin 14.

IOPORT_PORT_01_PIN_15 

IO port 1 pin 15.

IOPORT_PORT_02_PIN_00 

IO port 2 pin 0.

IOPORT_PORT_02_PIN_01 

IO port 2 pin 1.

IOPORT_PORT_02_PIN_02 

IO port 2 pin 2.

IOPORT_PORT_02_PIN_03 

IO port 2 pin 3.

IOPORT_PORT_02_PIN_04 

IO port 2 pin 4.

IOPORT_PORT_02_PIN_05 

IO port 2 pin 5.

IOPORT_PORT_02_PIN_06 

IO port 2 pin 6.

IOPORT_PORT_02_PIN_07 

IO port 2 pin 7.

IOPORT_PORT_02_PIN_08 

IO port 2 pin 8.

IOPORT_PORT_02_PIN_09 

IO port 2 pin 9.

IOPORT_PORT_02_PIN_10 

IO port 2 pin 10.

IOPORT_PORT_02_PIN_11 

IO port 2 pin 11.

IOPORT_PORT_02_PIN_12 

IO port 2 pin 12.

IOPORT_PORT_02_PIN_13 

IO port 2 pin 13.

IOPORT_PORT_02_PIN_14 

IO port 2 pin 14.

IOPORT_PORT_02_PIN_15 

IO port 2 pin 15.

IOPORT_PORT_03_PIN_00 

IO port 3 pin 0.

IOPORT_PORT_03_PIN_01 

IO port 3 pin 1.

IOPORT_PORT_03_PIN_02 

IO port 3 pin 2.

IOPORT_PORT_03_PIN_03 

IO port 3 pin 3.

IOPORT_PORT_03_PIN_04 

IO port 3 pin 4.

IOPORT_PORT_03_PIN_05 

IO port 3 pin 5.

IOPORT_PORT_03_PIN_06 

IO port 3 pin 6.

IOPORT_PORT_03_PIN_07 

IO port 3 pin 7.

IOPORT_PORT_03_PIN_08 

IO port 3 pin 8.

IOPORT_PORT_03_PIN_09 

IO port 3 pin 9.

IOPORT_PORT_03_PIN_10 

IO port 3 pin 10.

IOPORT_PORT_03_PIN_11 

IO port 3 pin 11.

IOPORT_PORT_03_PIN_12 

IO port 3 pin 12.

IOPORT_PORT_03_PIN_13 

IO port 3 pin 13.

IOPORT_PORT_03_PIN_14 

IO port 3 pin 14.

IOPORT_PORT_03_PIN_15 

IO port 3 pin 15.

IOPORT_PORT_04_PIN_00 

IO port 4 pin 0.

IOPORT_PORT_04_PIN_01 

IO port 4 pin 1.

IOPORT_PORT_04_PIN_02 

IO port 4 pin 2.

IOPORT_PORT_04_PIN_03 

IO port 4 pin 3.

IOPORT_PORT_04_PIN_04 

IO port 4 pin 4.

IOPORT_PORT_04_PIN_05 

IO port 4 pin 5.

IOPORT_PORT_04_PIN_06 

IO port 4 pin 6.

IOPORT_PORT_04_PIN_07 

IO port 4 pin 7.

IOPORT_PORT_04_PIN_08 

IO port 4 pin 8.

IOPORT_PORT_04_PIN_09 

IO port 4 pin 9.

IOPORT_PORT_04_PIN_10 

IO port 4 pin 10.

IOPORT_PORT_04_PIN_11 

IO port 4 pin 11.

IOPORT_PORT_04_PIN_12 

IO port 4 pin 12.

IOPORT_PORT_04_PIN_13 

IO port 4 pin 13.

IOPORT_PORT_04_PIN_14 

IO port 4 pin 14.

IOPORT_PORT_04_PIN_15 

IO port 4 pin 15.

IOPORT_PORT_05_PIN_00 

IO port 5 pin 0.

IOPORT_PORT_05_PIN_01 

IO port 5 pin 1.

IOPORT_PORT_05_PIN_02 

IO port 5 pin 2.

IOPORT_PORT_05_PIN_03 

IO port 5 pin 3.

IOPORT_PORT_05_PIN_04 

IO port 5 pin 4.

IOPORT_PORT_05_PIN_05 

IO port 5 pin 5.

IOPORT_PORT_05_PIN_06 

IO port 5 pin 6.

IOPORT_PORT_05_PIN_07 

IO port 5 pin 7.

IOPORT_PORT_05_PIN_08 

IO port 5 pin 8.

IOPORT_PORT_05_PIN_09 

IO port 5 pin 9.

IOPORT_PORT_05_PIN_10 

IO port 5 pin 10.

IOPORT_PORT_05_PIN_11 

IO port 5 pin 11.

IOPORT_PORT_05_PIN_12 

IO port 5 pin 12.

IOPORT_PORT_05_PIN_13 

IO port 5 pin 13.

IOPORT_PORT_05_PIN_14 

IO port 5 pin 14.

IOPORT_PORT_05_PIN_15 

IO port 5 pin 15.

IOPORT_PORT_06_PIN_00 

IO port 6 pin 0.

IOPORT_PORT_06_PIN_01 

IO port 6 pin 1.

IOPORT_PORT_06_PIN_02 

IO port 6 pin 2.

IOPORT_PORT_06_PIN_03 

IO port 6 pin 3.

IOPORT_PORT_06_PIN_04 

IO port 6 pin 4.

IOPORT_PORT_06_PIN_05 

IO port 6 pin 5.

IOPORT_PORT_06_PIN_06 

IO port 6 pin 6.

IOPORT_PORT_06_PIN_07 

IO port 6 pin 7.

IOPORT_PORT_06_PIN_08 

IO port 6 pin 8.

IOPORT_PORT_06_PIN_09 

IO port 6 pin 9.

IOPORT_PORT_06_PIN_10 

IO port 6 pin 10.

IOPORT_PORT_06_PIN_11 

IO port 6 pin 11.

IOPORT_PORT_06_PIN_12 

IO port 6 pin 12.

IOPORT_PORT_06_PIN_13 

IO port 6 pin 13.

IOPORT_PORT_06_PIN_14 

IO port 6 pin 14.

IOPORT_PORT_06_PIN_15 

IO port 6 pin 15.

IOPORT_PORT_07_PIN_00 

IO port 7 pin 0.

IOPORT_PORT_07_PIN_01 

IO port 7 pin 1.

IOPORT_PORT_07_PIN_02 

IO port 7 pin 2.

IOPORT_PORT_07_PIN_03 

IO port 7 pin 3.

IOPORT_PORT_07_PIN_04 

IO port 7 pin 4.

IOPORT_PORT_07_PIN_05 

IO port 7 pin 5.

IOPORT_PORT_07_PIN_06 

IO port 7 pin 6.

IOPORT_PORT_07_PIN_07 

IO port 7 pin 7.

IOPORT_PORT_07_PIN_08 

IO port 7 pin 8.

IOPORT_PORT_07_PIN_09 

IO port 7 pin 9.

IOPORT_PORT_07_PIN_10 

IO port 7 pin 10.

IOPORT_PORT_07_PIN_11 

IO port 7 pin 11.

IOPORT_PORT_07_PIN_12 

IO port 7 pin 12.

IOPORT_PORT_07_PIN_13 

IO port 7 pin 13.

IOPORT_PORT_07_PIN_14 

IO port 7 pin 14.

IOPORT_PORT_07_PIN_15 

IO port 7 pin 15.

IOPORT_PORT_08_PIN_00 

IO port 8 pin 0.

IOPORT_PORT_08_PIN_01 

IO port 8 pin 1.

IOPORT_PORT_08_PIN_02 

IO port 8 pin 2.

IOPORT_PORT_08_PIN_03 

IO port 8 pin 3.

IOPORT_PORT_08_PIN_04 

IO port 8 pin 4.

IOPORT_PORT_08_PIN_05 

IO port 8 pin 5.

IOPORT_PORT_08_PIN_06 

IO port 8 pin 6.

IOPORT_PORT_08_PIN_07 

IO port 8 pin 7.

IOPORT_PORT_08_PIN_08 

IO port 8 pin 8.

IOPORT_PORT_08_PIN_09 

IO port 8 pin 9.

IOPORT_PORT_08_PIN_10 

IO port 8 pin 10.

IOPORT_PORT_08_PIN_11 

IO port 8 pin 11.

IOPORT_PORT_08_PIN_12 

IO port 8 pin 12.

IOPORT_PORT_08_PIN_13 

IO port 8 pin 13.

IOPORT_PORT_08_PIN_14 

IO port 8 pin 14.

IOPORT_PORT_08_PIN_15 

IO port 8 pin 15.

IOPORT_PORT_09_PIN_00 

IO port 9 pin 0.

IOPORT_PORT_09_PIN_01 

IO port 9 pin 1.

IOPORT_PORT_09_PIN_02 

IO port 9 pin 2.

IOPORT_PORT_09_PIN_03 

IO port 9 pin 3.

IOPORT_PORT_09_PIN_04 

IO port 9 pin 4.

IOPORT_PORT_09_PIN_05 

IO port 9 pin 5.

IOPORT_PORT_09_PIN_06 

IO port 9 pin 6.

IOPORT_PORT_09_PIN_07 

IO port 9 pin 7.

IOPORT_PORT_09_PIN_08 

IO port 9 pin 8.

IOPORT_PORT_09_PIN_09 

IO port 9 pin 9.

IOPORT_PORT_09_PIN_10 

IO port 9 pin 10.

IOPORT_PORT_09_PIN_11 

IO port 9 pin 11.

IOPORT_PORT_09_PIN_12 

IO port 9 pin 12.

IOPORT_PORT_09_PIN_13 

IO port 9 pin 13.

IOPORT_PORT_09_PIN_14 

IO port 9 pin 14.

IOPORT_PORT_09_PIN_15 

IO port 9 pin 15.

IOPORT_PORT_10_PIN_00 

IO port 10 pin 0.

IOPORT_PORT_10_PIN_01 

IO port 10 pin 1.

IOPORT_PORT_10_PIN_02 

IO port 10 pin 2.

IOPORT_PORT_10_PIN_03 

IO port 10 pin 3.

IOPORT_PORT_10_PIN_04 

IO port 10 pin 4.

IOPORT_PORT_10_PIN_05 

IO port 10 pin 5.

IOPORT_PORT_10_PIN_06 

IO port 10 pin 6.

IOPORT_PORT_10_PIN_07 

IO port 10 pin 7.

IOPORT_PORT_10_PIN_08 

IO port 10 pin 8.

IOPORT_PORT_10_PIN_09 

IO port 10 pin 9.

IOPORT_PORT_10_PIN_10 

IO port 10 pin 10.

IOPORT_PORT_10_PIN_11 

IO port 10 pin 11.

IOPORT_PORT_10_PIN_12 

IO port 10 pin 12.

IOPORT_PORT_10_PIN_13 

IO port 10 pin 13.

IOPORT_PORT_10_PIN_14 

IO port 10 pin 14.

IOPORT_PORT_10_PIN_15 

IO port 10 pin 15.

IOPORT_PORT_11_PIN_00 

IO port 11 pin 0.

IOPORT_PORT_11_PIN_01 

IO port 11 pin 1.

IOPORT_PORT_11_PIN_02 

IO port 11 pin 2.

IOPORT_PORT_11_PIN_03 

IO port 11 pin 3.

IOPORT_PORT_11_PIN_04 

IO port 11 pin 4.

IOPORT_PORT_11_PIN_05 

IO port 11 pin 5.

IOPORT_PORT_11_PIN_06 

IO port 11 pin 6.

IOPORT_PORT_11_PIN_07 

IO port 11 pin 7.

IOPORT_PORT_11_PIN_08 

IO port 11 pin 8.

IOPORT_PORT_11_PIN_09 

IO port 11 pin 9.

IOPORT_PORT_11_PIN_10 

IO port 11 pin 10.

IOPORT_PORT_11_PIN_11 

IO port 11 pin 11.

IOPORT_PORT_11_PIN_12 

IO port 11 pin 12.

IOPORT_PORT_11_PIN_13 

IO port 11 pin 13.

IOPORT_PORT_11_PIN_14 

IO port 11 pin 14.

IOPORT_PORT_11_PIN_15 

IO port 11 pin 15.

IOPORT_PORT_12_PIN_00 

IO port 12 pin 0.

IOPORT_PORT_12_PIN_01 

IO port 12 pin 1.

IOPORT_PORT_12_PIN_02 

IO port 12 pin 2.

IOPORT_PORT_12_PIN_03 

IO port 12 pin 3.

IOPORT_PORT_12_PIN_04 

IO port 12 pin 4.

IOPORT_PORT_12_PIN_05 

IO port 12 pin 5.

IOPORT_PORT_12_PIN_06 

IO port 12 pin 6.

IOPORT_PORT_12_PIN_07 

IO port 12 pin 7.

IOPORT_PORT_12_PIN_08 

IO port 12 pin 8.

IOPORT_PORT_12_PIN_09 

IO port 12 pin 9.

IOPORT_PORT_12_PIN_10 

IO port 12 pin 10.

IOPORT_PORT_12_PIN_11 

IO port 12 pin 11.

IOPORT_PORT_12_PIN_12 

IO port 12 pin 12.

IOPORT_PORT_12_PIN_13 

IO port 12 pin 13.

IOPORT_PORT_12_PIN_14 

IO port 12 pin 14.

IOPORT_PORT_12_PIN_15 

IO port 12 pin 15.

IOPORT_PORT_13_PIN_00 

IO port 13 pin 0.

IOPORT_PORT_13_PIN_01 

IO port 13 pin 1.

IOPORT_PORT_13_PIN_02 

IO port 13 pin 2.

IOPORT_PORT_13_PIN_03 

IO port 13 pin 3.

IOPORT_PORT_13_PIN_04 

IO port 13 pin 4.

IOPORT_PORT_13_PIN_05 

IO port 13 pin 5.

IOPORT_PORT_13_PIN_06 

IO port 13 pin 6.

IOPORT_PORT_13_PIN_07 

IO port 13 pin 7.

IOPORT_PORT_13_PIN_08 

IO port 13 pin 8.

IOPORT_PORT_13_PIN_09 

IO port 13 pin 9.

IOPORT_PORT_13_PIN_10 

IO port 13 pin 10.

IOPORT_PORT_13_PIN_11 

IO port 13 pin 11.

IOPORT_PORT_13_PIN_12 

IO port 13 pin 12.

IOPORT_PORT_13_PIN_13 

IO port 13 pin 13.

IOPORT_PORT_13_PIN_14 

IO port 13 pin 14.

IOPORT_PORT_13_PIN_15 

IO port 13 pin 15.

IOPORT_PORT_14_PIN_00 

IO port 14 pin 0.

IOPORT_PORT_14_PIN_01 

IO port 14 pin 1.

IOPORT_PORT_14_PIN_02 

IO port 14 pin 2.

IOPORT_PORT_14_PIN_03 

IO port 14 pin 3.

IOPORT_PORT_14_PIN_04 

IO port 14 pin 4.

IOPORT_PORT_14_PIN_05 

IO port 14 pin 5.

IOPORT_PORT_14_PIN_06 

IO port 14 pin 6.

IOPORT_PORT_14_PIN_07 

IO port 14 pin 7.

IOPORT_PORT_14_PIN_08 

IO port 14 pin 8.

IOPORT_PORT_14_PIN_09 

IO port 14 pin 9.

IOPORT_PORT_14_PIN_10 

IO port 14 pin 10.

IOPORT_PORT_14_PIN_11 

IO port 14 pin 11.

IOPORT_PORT_14_PIN_12 

IO port 14 pin 12.

IOPORT_PORT_14_PIN_13 

IO port 14 pin 13.

IOPORT_PORT_14_PIN_14 

IO port 14 pin 14.

IOPORT_PORT_14_PIN_15 

IO port 14 pin 15.

Function Documentation

◆ R_IOPORT_Open()

fsp_err_t R_IOPORT_Open ( ioport_ctrl_t *const  p_ctrl,
const ioport_cfg_t p_cfg 
)

Initializes internal driver data, then calls pin configuration function to configure pins.

Return values
FSP_SUCCESSPin configuration data written to PFS register(s)
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_ALREADY_OPENModule is already open.

◆ R_IOPORT_Close()

fsp_err_t R_IOPORT_Close ( ioport_ctrl_t *const  p_ctrl)

Resets IOPORT registers. Implements ioport_api_t::close

Return values
FSP_SUCCESSThe IOPORT was successfully uninitialized
FSP_ERR_ASSERTIONp_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_IOPORT_PinsCfg()

fsp_err_t R_IOPORT_PinsCfg ( ioport_ctrl_t *const  p_ctrl,
const ioport_cfg_t p_cfg 
)

Configures the functions of multiple pins by loading configuration data into pin PFS registers. Implements ioport_api_t::pinsCfg.

This function initializes the supplied list of PmnPFS registers with the supplied values. This data can be generated by the Pins tab of the RA Configuration editor or manually by the developer. Different pin configurations can be loaded for different situations such as low power modes and testing.

Return values
FSP_SUCCESSPin configuration data written to PFS register(s)
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer

◆ R_IOPORT_PinCfg()

fsp_err_t R_IOPORT_PinCfg ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
uint32_t  cfg 
)

Configures the settings of a pin. Implements ioport_api_t::pinCfg.

Return values
FSP_SUCCESSPin configured
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different pins. This function will change the configuration of the pin with the new configuration. For example it is not possible with this function to change the drive strength of a pin while leaving all the other pin settings unchanged. To achieve this the original settings with the required change will need to be written using this function.

◆ R_IOPORT_PinRead()

fsp_err_t R_IOPORT_PinRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t p_pin_value 
)

Reads the level on a pin. Implements ioport_api_t::pinRead.

Return values
FSP_SUCCESSPin read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
Note
This function is re-entrant for different pins.

◆ R_IOPORT_PortRead()

fsp_err_t R_IOPORT_PortRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t p_port_value 
)

Reads the value on an IO port. Implements ioport_api_t::portRead.

The specified port will be read, and the levels for all the pins will be returned. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on.

Return values
FSP_SUCCESSPort read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortWrite()

fsp_err_t R_IOPORT_PortWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  value,
ioport_size_t  mask 
)

Writes to multiple pins on a port. Implements ioport_api_t::portWrite.

The input value will be written to the specified port. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Only the bits with the corresponding bit in the mask value set will be updated. For example, value = 0xFFFF, mask = 0x0003 results in only bits 0 and 1 being updated.

Return values
FSP_SUCCESSPort written to
FSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointerd
Note
This function is re-entrant for different ports. This function makes use of the PCNTR3 register to atomically modify the levels on the specified pins on a port.

◆ R_IOPORT_PinWrite()

fsp_err_t R_IOPORT_PinWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t  level 
)

Sets a pin's output either high or low. Implements ioport_api_t::pinWrite.

Return values
FSP_SUCCESSPin written to
FSP_ERR_INVALID_ARGUMENTThe pin and/or level not valid
FSP_ERR_NOT_OPENThe module has not been opene
FSP_ERR_ASSERTIONNULL pointerd
Note
This function is re-entrant for different pins. This function makes use of the PCNTR3 register to atomically modify the level on the specified pin on a port.

◆ R_IOPORT_PortDirectionSet()

fsp_err_t R_IOPORT_PortDirectionSet ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  direction_values,
ioport_size_t  mask 
)

Sets the direction of individual pins on a port. Implements ioport_api_t::portDirectionSet().

Multiple pins on a port can be set to inputs or outputs at once. Each bit in the mask parameter corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. If a bit is set to 1 then the corresponding pin will be changed to an input or an output as specified by the direction values. If a mask bit is set to 0 then the direction of the pin will not be changed.

Return values
FSP_SUCCESSPort direction updated
FSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortEventInputRead()

fsp_err_t R_IOPORT_PortEventInputRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t p_event_data 
)

Reads the value of the event input data. Implements ioport_api_t::portEventInputRead().

The event input data for the port will be read. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on.

The port event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
FSP_SUCCESSPort read
FSP_ERR_INVALID_ARGUMENTPort not a valid ELC port
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PinEventInputRead()

fsp_err_t R_IOPORT_PinEventInputRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t p_pin_event 
)

Reads the value of the event input data of a specific pin. Implements ioport_api_t::pinEventInputRead.

The pin event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
FSP_SUCCESSPin read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_INVALID_ARGUMENTPort is not valid ELC PORT.
Note
This function is re-entrant.

◆ R_IOPORT_PortEventOutputWrite()

fsp_err_t R_IOPORT_PortEventOutputWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  event_data,
ioport_size_t  mask_value 
)

This function writes the set and reset event output data for a port. Implements ioport_api_t::portEventOutputWrite.

Using the event system enables a port state to be stored by this function in advance of being output on the port. The output to the port will occur when the ELC event occurs.

The input value will be written to the specified port when an ELC event configured for that port occurs. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Return values
FSP_SUCCESSPort event data written
FSP_ERR_INVALID_ARGUMENTPort or Mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PinEventOutputWrite()

fsp_err_t R_IOPORT_PinEventOutputWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t  pin_value 
)

This function writes the event output data value to a pin. Implements ioport_api_t::pinEventOutputWrite.

Using the event system enables a pin state to be stored by this function in advance of being output on the pin. The output to the pin will occur when the ELC event occurs.

Return values
FSP_SUCCESSPin event data written
FSP_ERR_INVALID_ARGUMENTPort or Pin or value not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.