|
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) |
|
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:
- Pin direction
- Default output state
- Pull-up
- NMOS/PMOS
- Drive strength
- Event edge trigger (falling, rising or both)
- Whether the pin is to be used as an IRQ pin
- Whether the pin is to be used as an analog pin
- Peripheral connection
The module also provides the following functionality:
- Read/write GPIO pins/ports
- Sets event output data
- Reads event input data
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 Configuration 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:
Configuration | Options | Default | Description |
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).
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_ioport | Module name. |
1st Port ELC Trigger Source | MCU Specific Options | | ELC source that will trigger the 1st port |
2nd Port ELC Trigger Source | MCU Specific Options | | ELC source that will trigger the 2nd port |
3rd Port ELC Trigger Source | MCU Specific Options | | ELC source that will trigger the 3rd port |
4th Port ELC Trigger Source | MCU Specific Options | | ELC source that will trigger the 4th port |
Pin Configuration Name | Name must be a valid C symbol | g_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 4 ports (RA2 and RA0 series support 2 ports only, see the table of ELC triggers below) on receipt of an ELC event.
ELC triggers | RA6T2 | RA2XX, RA0XX | All others |
1st Port | Port B | Port 1 | Port 1 |
2nd Port | Port C | Port 2 | Port 2 |
3rd Port | Port D | NA | Port 3 |
4th Port | Port E | NA | Port 4 |
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 these ports 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 ()
{
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
}
Blinky Example
This example uses IOPORT to configure and toggle a pin to blink an LED.
void blinky_example ()
{
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
while (1)
{
{
}
else
{
}
assert(FSP_SUCCESS == err);
}
}
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.
void ioport_elc_example ()
{
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
}
◆ ioport_instance_ctrl_t
struct ioport_instance_ctrl_t |
IOPORT private control block. DO NOT MODIFY. Initialization occurs when R_IOPORT_Open() is called.
◆ 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.
|
◆ ioport_peripheral_t
Superset of all peripheral functions.
Enumerator |
---|
IOPORT_PERIPHERAL_IO | Pin will functions as an IO pin
|
IOPORT_PERIPHERAL_DEBUG | Pin will function as a DEBUG pin
|
IOPORT_PERIPHERAL_AGT | Pin will function as an AGT peripheral pin
|
IOPORT_PERIPHERAL_AGTW | Pin will function as an AGT peripheral pin
|
IOPORT_PERIPHERAL_AGT1 | Pin will function as an AGT peripheral pin
|
IOPORT_PERIPHERAL_GPT0 | Pin will function as a GPT peripheral pin
|
IOPORT_PERIPHERAL_GPT1 | Pin will function as a GPT peripheral pin
|
IOPORT_PERIPHERAL_SCI0_2_4_6_8 | Pin will function as an SCI peripheral pin
|
IOPORT_PERIPHERAL_SCI1_3_5_7_9 | Pin will function as an SCI peripheral pin
|
IOPORT_PERIPHERAL_SPI | Pin will function as a SPI peripheral pin
|
IOPORT_PERIPHERAL_IIC | Pin will function as a IIC peripheral pin
|
IOPORT_PERIPHERAL_KEY | Pin will function as a KEY peripheral pin
|
IOPORT_PERIPHERAL_CLKOUT_COMP_RTC | Pin will function as a clock/comparator/RTC peripheral pin
|
IOPORT_PERIPHERAL_CAC_AD | Pin will function as a CAC/ADC peripheral pin
|
IOPORT_PERIPHERAL_BUS | Pin will function as a BUS peripheral pin
|
IOPORT_PERIPHERAL_CTSU | Pin will function as a CTSU peripheral pin
|
IOPORT_PERIPHERAL_ACMPHS | Pin will function as a CMPHS peripheral pin
|
IOPORT_PERIPHERAL_LCDC | Pin will function as a segment LCD peripheral pin
|
IOPORT_PERIPHERAL_DE_SCI0_2_4_6_8 | Pin will function as an SCI peripheral DEn pin
|
IOPORT_PERIPHERAL_DE_SCI1_3_5_7_9 | Pin will function as an SCI DEn peripheral pin
|
IOPORT_PERIPHERAL_DALI | Pin will function as a DALI peripheral pin
|
IOPORT_PERIPHERAL_CEU | Pin will function as a CEU peripheral pin
|
IOPORT_PERIPHERAL_CAN | Pin will function as a CAN peripheral pin
|
IOPORT_PERIPHERAL_QSPI | Pin will function as a QSPI peripheral pin
|
IOPORT_PERIPHERAL_SSI | Pin will function as an SSI peripheral pin
|
IOPORT_PERIPHERAL_USB_FS | Pin will function as a USB full speed peripheral pin
|
IOPORT_PERIPHERAL_USB_HS | Pin will function as a USB high speed peripheral pin
|
IOPORT_PERIPHERAL_GPT2 | Pin will function as a GPT peripheral pin
|
IOPORT_PERIPHERAL_SDHI_MMC | Pin will function as an SD/MMC peripheral pin
|
IOPORT_PERIPHERAL_GPT3 | Pin will function as a GPT peripheral pin
|
IOPORT_PERIPHERAL_ETHER_MII | Pin will function as an Ethernet MMI peripheral pin
|
IOPORT_PERIPHERAL_GPT4 | Pin will function as a GPT peripheral pin
|
IOPORT_PERIPHERAL_ETHER_RMII | Pin will function as an Ethernet RMMI peripheral pin
|
IOPORT_PERIPHERAL_PDC | Pin will function as a PDC peripheral pin
|
IOPORT_PERIPHERAL_LCD_GRAPHICS | Pin will function as a graphics LCD peripheral pin
|
IOPORT_PERIPHERAL_CAC | Pin will function as a CAC peripheral pin
|
IOPORT_PERIPHERAL_TRACE | Pin will function as a debug trace peripheral pin
|
IOPORT_PERIPHERAL_OSPI | Pin will function as a OSPI peripheral pin
|
IOPORT_PERIPHERAL_CEC | Pin will function as a CEC peripheral pin
|
IOPORT_PERIPHERAL_PGAOUT0 | Pin will function as a PGAOUT peripheral pin
|
IOPORT_PERIPHERAL_PGAOUT1 | Pin will function as a PGAOUT peripheral pin
|
IOPORT_PERIPHERAL_ULPT | Pin will function as a ULPT peripheral pin
|
IOPORT_PERIPHERAL_MIPI | Pin will function as a MIPI DSI peripheral pin
|
IOPORT_PERIPHERAL_UARTA | Pin will function as an UARTA peripheral pin
|
◆ ioport_cfg_options_t
enum ioport_cfg_options_t |
Options to configure pin functions
Enumerator |
---|
IOPORT_CFG_PORT_DIRECTION_INPUT | Sets the pin direction to input (default)
|
IOPORT_CFG_PORT_DIRECTION_OUTPUT | Sets the pin direction to output.
|
IOPORT_CFG_PORT_OUTPUT_LOW | Sets the pin level to low.
|
IOPORT_CFG_PORT_OUTPUT_HIGH | Sets the pin level to high.
|
IOPORT_CFG_PULLUP_ENABLE | Enables the pin's internal pull-up.
|
IOPORT_CFG_PIM_TTL | Enables the pin's input mode.
|
IOPORT_CFG_NMOS_ENABLE | Enables the pin's NMOS open-drain output.
|
IOPORT_CFG_IRQ_ENABLE | Sets pin as an IRQ pin.
|
IOPORT_CFG_ANALOG_ENABLE | Enables pin to operate as an analog pin.
|
IOPORT_CFG_PERIPHERAL_PIN | Enables pin to operate as a peripheral pin.
|
IOPORT_CFG_PORT_DIRECTION_INPUT | Sets the pin direction to input (default)
|
IOPORT_CFG_PORT_DIRECTION_OUTPUT | Sets the pin direction to output.
|
IOPORT_CFG_PORT_OUTPUT_LOW | Sets the pin level to low.
|
IOPORT_CFG_PORT_OUTPUT_HIGH | Sets the pin level to high.
|
IOPORT_CFG_PULLUP_ENABLE | Enables the pin's internal pull-up.
|
IOPORT_CFG_PIM_TTL | Enables the pin's input mode.
|
IOPORT_CFG_NMOS_ENABLE | Enables the pin's NMOS open-drain output.
|
IOPORT_CFG_PMOS_ENABLE | Enables the pin's PMOS open-drain ouput.
|
IOPORT_CFG_DRIVE_MID | Sets pin drive output to medium.
|
IOPORT_CFG_DRIVE_HS_HIGH | Sets pin drive output to high along with supporting high speed.
|
IOPORT_CFG_DRIVE_MID_IIC | Sets pin to drive output needed for IIC on a 20mA port.
|
IOPORT_CFG_DRIVE_HIGH | Sets pin drive output to high.
|
IOPORT_CFG_EVENT_RISING_EDGE | Sets pin event trigger to rising edge.
|
IOPORT_CFG_EVENT_FALLING_EDGE | Sets pin event trigger to falling edge.
|
IOPORT_CFG_EVENT_BOTH_EDGES | Sets pin event trigger to both edges.
|
IOPORT_CFG_IRQ_ENABLE | Sets pin as an IRQ pin.
|
IOPORT_CFG_ANALOG_ENABLE | Enables pin to operate as an analog pin.
|
IOPORT_CFG_PERIPHERAL_PIN | Enables pin to operate as a peripheral pin.
|
◆ R_IOPORT_Open()
Initializes internal driver data, then calls pin configuration function to configure pins.
- Return values
-
FSP_SUCCESS | Pin configuration data written to PFS register(s) |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_ALREADY_OPEN | Module is already open. |
◆ R_IOPORT_Close()
Resets IOPORT registers. Implements ioport_api_t::close
- Return values
-
FSP_SUCCESS | The IOPORT was successfully uninitialized |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
◆ R_IOPORT_PinsCfg()
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_SUCCESS | Pin configuration data written to PFS register(s) |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
◆ R_IOPORT_PinCfg()
Configures the settings of a pin. Implements ioport_api_t::pinCfg.
- Return values
-
FSP_SUCCESS | Pin configured |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL 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()
Reads the level on a pin. Implements ioport_api_t::pinRead.
- Return values
-
FSP_SUCCESS | Pin read |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
- Note
- This function is re-entrant for different pins.
◆ R_IOPORT_PortRead()
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_SUCCESS | Port read |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PortWrite()
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_SUCCESS | Port written to |
FSP_ERR_INVALID_ARGUMENT | The port and/or mask not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- 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()
Sets a pin's output either high or low. Implements ioport_api_t::pinWrite.
- Return values
-
FSP_SUCCESS | Pin written to |
FSP_ERR_INVALID_ARGUMENT | The pin and/or level not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- 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()
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_SUCCESS | Port direction updated |
FSP_ERR_INVALID_ARGUMENT | The port and/or mask not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PortEventInputRead()
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_SUCCESS | Port read |
FSP_ERR_INVALID_ARGUMENT | Port not a valid ELC port |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_UNSUPPORTED | Function not supported. |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PinEventInputRead()
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_SUCCESS | Pin read |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_INVALID_ARGUMENT | Port is not valid ELC PORT. |
FSP_ERR_UNSUPPORTED | Function not supported. |
- Note
- This function is re-entrant.
◆ R_IOPORT_PortEventOutputWrite()
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_SUCCESS | Port event data written |
FSP_ERR_INVALID_ARGUMENT | Port or Mask not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PinEventOutputWrite()
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_SUCCESS | Pin event data written |
FSP_ERR_INVALID_ARGUMENT | Port or Pin or value not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is re-entrant for different ports.