User`s manual
RX62N Group, RX621 Group 4. Library Reference
6) R_IO_PORT_Compare
Synopsis
Check the pin states on an I/O port.
Prototype
bool R_IO_PORT_Compare(
uint16_t data1,
// Input port or port pin selection
uint8_t data2,
// Comparison value
void * func
// Function pointer
);
Description
Read the input state of an I/O port or I/O port pin and call a function if a match occurs.
[data1]
Use either one of the following definition values (from §4.2.3):
•
One port definition or
•
One port pin definition.
[data2]
The value to be compared with; Between 0x00 and 0xFF for a port, 0 or 1 for a pin.
[func]
The function to be called if a match occurs.
Return value
True if the parameters are valid; otherwise false.
Category
I/O port
References
R_IO_PORT_Set
Remarks
•
If an invalid port or pin is specified, the operation of the function cannot be guaranteed.
•
The input buffer for the specified port or pin must be switched on (see R_IO_PORT_Set).
Program example
/* RPDL definitions */
#include "r_pdl_io_port.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void IoHandler1{}
void IoHandler2{}
void func( void )
{
/* Call function IoHandler1 if port pin P05 is high */
R_IO_PORT_Compare(
PDL_IO_PORT_0_5,
1,
IoHandler1
);
/* Call function IoHandler2 if port 6 reads as 0x55 */
R_IO_PORT_Compare(
PDL_IO_PORT_6,
0x55,
IoHandler2
);
}
R20UT0084EE0112 Rev.1.12 Page 4-35
July. 16, 2014