www.renesas.com User’s Manual All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by Renesas Electronics Corp. without notice. Please review the latest information published by Renesas Electronics Corp. through various means, including the Renesas Electronics Corp. website (http://www.renesas.com). e 2 studio Code Generator Integrated Development Environment User's Manual: RL78 API Reference Target Device RL78 Family Rev.1.05 Feb 2018
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
www.renesas.com
User’s M
anual
All information contained in these materials, including products and product specifications,represents information on the product at the time of publication and is subject to change byRenesas Electronics Corp. without notice. Please review the latest information published byRenesas Electronics Corp. through various means, including the Renesas Electronics Corp.website (http://www.renesas.com).
e2 studio Code GeneratorIntegrated Development Environment
User's Manual: RL78 API Reference
Target Device
RL78 Family
Rev.1.05 Feb 2018
Notice 1. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation or any other use of the circuits, software, and information in the design of your product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use of these circuits, software, or information.
2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other claims involving patents, copyrights, or other intellectual property rights of third parties, by or arising from the use of Renesas Electronics products or technical information described in this document, including but not limited to, the product data, drawings, charts, programs, algorithms, and application examples.
3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others.
4. You shall not alter, modify, copy, or reverse engineer any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copying or reverse engineering.
5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The intended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below. “Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment;
home electronic appliances; machine tools; personal electronic equipment; industrial robots; etc. “High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication
equipment; key financial terminal systems; safety control equipment; etc. Unless expressly designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not intended or authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems; surgical implantations; etc.), or may cause serious property damage (space system; undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics disclaims any and all liability for any damages or losses incurred by you or any third parties arising from the use of any Renesas Electronics product that is inconsistent with any Renesas Electronics data sheet, user’s manual or other Renesas Electronics document.
6. When using Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, “General Notes for Handling and Using Semiconductor Devices” in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat dissipation characteristics, installation, etc. Renesas Electronics disclaims any and all liability for any malfunctions, failure or accident arising out of the use of Renesas Electronics products outside of such specified ranges.
7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific characteristics, such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Unless designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products are not subject to radiation resistance design. You are responsible for implementing safety measures to guard against the possibility of bodily injury, injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, such as safety design for hardware and software, including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult and impractical, you are responsible for evaluating the safety of the final products or systems manufactured by you.
8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. You are responsible for carefully and sufficiently investigating applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive, and using Renesas Electronics products in compliance with all these applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.
9. Renesas Electronics products and technologies shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You shall comply with any applicable export control laws and regulations promulgated and administered by the governments of any countries asserting jurisdiction over the parties or transactions.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, or any other party who distributes, disposes of, or otherwise sells or transfers the product to a third party, to notify such third party in advance of the contents and conditions set forth in this document.
11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its directly or indirectly controlled subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
(Rev.4.0-1 November 2017)
How to Use This Manual
Readers The target readers of this manual are the application system engineers who use the Code Generator and need to understand its function.
Purpose The purpose of this manual is to explain the user for understanding and using the Code Generator functions.
We aim to help their system development including their hardware and software.
Organization This manual can be broadly divided into the following units.
1.GENERAL2.OUTPUT FILES3.API FUNCTIONS
How to Read This Manual It is assumed that the readers of this manual have general knowledge of electricity, logic circuits, and microcontrollers.
Conventions Data significance: Higher digits on the left and lower digits on the right
Active low representation: XXX (overscore over pin or signal name)
Note: Footnote for item marked with Note in the text
Caution: Information requiring particular attention
R20UT3127EJ0105 Rev.1.05 Page 6 of 642Feb 01, 2018
e2 studio Code Generator Tool 1. GENERAL
1. GENERAL
Code Generator Tool is a software tool that automatically generates device drivers.This manual explains about .This manual gives Output files and API functions.
1.1 Overview
Code Generator tool enables you to output the pin assignment of the microcontroller (device pin list and device top view), and the source code (device driver programs, C source files and header files) necessary to control the peripheral functions (clock generator, port functions, etc.) provided by the microcontroller by configuring various information using the GUI.
1.2 Features
Code Generator tool has the following features.
- Code generating functionThe Code Generator can output not only device driver programs in accordance with the information configured using the GUI, but also a build environment such as sample programs containing main functions and link directive files.
- Reporting functionYou can output configured information using the Pin Configurator/Code Generator as files in various formats for use as design documents.
- Renaming functionThe user can change default names assigned to the files output by the Code Generator and the API functions con-tained in the source code.
- User code protective functionThe user can add user's original source code to each API function.When user generated the device driver programs again by the Code Generator, user's source code within this comment is protected.
[Comment for user source code descriptions]/* Start user code. Do not edit comment generated here *//* End user code. Do not edit comment generated here */
e2 studio Code Generator Tool 2. OUTPUT FILES
R20UT3127EJ0105 Rev.1.05 Page 7 of 642Feb 01, 2018
2. OUTPUT FILES
This appendix describes the files output by the Code Generator.
2.1 Description
Below is a list of output file files by the Code Generator.
Table 2.1 Output File List
Peripheral Function File Name API Function Name Out-put(*1)
Voltage detector r_cg_lvd.c R_LVD_CreateR_LVD_InterruptMode_StartR_LVD_Start_VDDR_LVD_Start_VBATR_LVD_Start_VRTCR_LVD_Start_EXLVDR_LVD_Stop_VDDR_LVD_Stop_VBATR_LVD_Start_VRTCR_LVD_Stop_EXLVDR_LVI_CreateR_LVI_InterruptMode_Start
Peripheral Function File Name API Function Name Out-put(*1)
e2 studio Code Generator Tool 2. OUTPUT FILES
R20UT3127EJ0105 Rev.1.05 Page 21 of 642Feb 01, 2018
*1 In case of [API output control] setting are default ([Output all API functions according to the setting]). A:Output by settings on each peripheral functions panel automatically. M:Output by the file used setting in API property.
(5) [Return value]API function return value is explained in the following format.
(a) MacroMacro of return value
(b) DescriptionDescription of return value
I/O Argument Description
(a) (b) (c)
Macro Description
(a) (b)
R20UT3127EJ0105 Rev.1.05 Page 24 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.1 Common
Below is a list of API functions output by the Code Generator for common use.
Table 3.1 API Functions: [Common]
API Function Name Function
hdwinit Performs initialization necessary to control the various hardwares.This API is automatically called from the startup routine of Renesas-made compiler.
R_Systeminit Performs initialization necessary to control the various peripheral functions.
I clock_mode_t mode; Clock generator typeHIOCLK: High-speed onchip oscillatorSYSX1CLK: X1 clockSYSEXTCLK: External main system clockSUBXT1CLK: XT1 clockSUBEXTCLK: External subsystem clock
Macro Description
MD_OK Normal completion
MD_ERROR1 Exit with error (abend)
MD_ERROR2 Exit with error (abend)
MD_ERROR3 Exit with error (abend)
MD_ERROR4 Exit with error (abend)
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 37 of 642Feb 01, 2018
Starts the RAM-ECC function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_RAMECC_Start
void R_CGC_RAMECC_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 38 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the RAM-ECC function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_RAMECC_Stop
void R_CGC_RAMECC_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 39 of 642Feb 01, 2018
Starts the CPU stack pointer function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_StackPointer_Start
void R_CGC_StackPointer_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 40 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the CPU stack pointer function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_StackPointer_Stop
void R_CGC_StackPointer_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 41 of 642Feb 01, 2018
Starts the clock monitor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_ClockMonitor_Start
void R_CGC_ClockMonitor_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 42 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the clock monitor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CGC_ClockMonitor_Stop
void R_CGC_ClockMonitor_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 43 of 642Feb 01, 2018
3.2.3 Port functions
Below is a list of API functions output by the Code Generator for port functions use.
Table 3.3 API Functions: [Port Functions]
API Function Name Function
R_PORT_Create Performs initialization necessary to control the port functions.
R_PORT_Create_UserInit Performs user-defined initialization relating to the port functions.
R20UT3127EJ0105 Rev.1.05 Page 44 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the port functions.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PORT_Create
void R_PORT_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 45 of 642Feb 01, 2018
Performs user-defined initialization relating to the port functions.
Remark This API function is called as the R_PORT_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PORT_Create_UserInit
void R_PORT_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 46 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.4 High-speed on-chip Oscillator clock Frequency Correction function
Below is a list of API functions output by the Code Generator for the High-speed on-chip Oscillator clock Frequency Cor-rection function use.
Table 3.4 API Functions: [High-speed on-chip Oscillator clock Frequency Correction function]/
API Function Name Function
R_HOFC_Create Performs initialization necessary to control the High-speed on-chip Oscillator clock Frequency Correction function.
R_HOFC_Create_UserInit Performs user-defined initialization relating to the High-speed on-chip Oscillator clock Frequency Correction function.
r_hofc_interrupt Performs processing in response to the timer interrupt.
R_HOFC_Start Starts the count for the High-speed on-chip Oscillator clock Frequency Correction function.
R_HOFC_Stop Ends the count for the High-speed on-chip Oscillator clock Frequency Correction function.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 47 of 642Feb 01, 2018
Performs initialization necessary to control the High-speed on-chip Oscillator clock Frequency Correction function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_HOFC_Create
void R_HOFC_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 48 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the High-speed on-chip Oscillator clock Frequency Correction function.
Remark This API function is called as the R_HOFC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_HOFC_Create_UserInit
void R_HOFC_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 49 of 642Feb 01, 2018
Performs processing in response to the timer interrupt.
Remark This API function is called as the interrupt process corresponding to the High-speed on-chip Oscillator clock Frequency Correction function interrupt INTCR.
R20UT3127EJ0105 Rev.1.05 Page 57 of 642Feb 01, 2018
Starts the count for channel n.
Remark The time from the call to this API function to the start of counting depends on the type of the function in question (e.g. interval timer, square-wave output, or external event counter).
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Start
void R_TAUm_Channeln_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 58 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count (higher 8-bit) for channel n.
Remark This API function can only be called when the timer array unit is used as a 8-bit timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Higher8bits_Start
void R_TAUm_Channeln_Higher8bits_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 59 of 642Feb 01, 2018
Starts the count (lower 8-bit) for channel n.
Remarks 1. This API function can only be called when the timer array unit is used as a 8-bit timer.
Remarks 2. The time from the call to this API function to the start of counting depends on the type of the function in question (e.g. interval timer, external event counter, or delay counter).
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Lower8bits_Start
void R_TAUm_Channeln_Lower8bits_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 60 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count for channel n.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Stop
void R_TAUm_Channeln_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 61 of 642Feb 01, 2018
Ends the count (higher 8-bit) for channel n.
Remark This API function can only be called when the timer array unit is used as a 8-bit timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Higher8bits_Stop
void R_TAUm_Channeln_Higher8bits_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 62 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count (lower 8-bit) for channel n.
Remark This API function can only be called when the timer array unit is used as a 8-bit timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Channeln_Lower8bits_Stop
void R_TAUm_Channeln_Lower8bits_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 63 of 642Feb 01, 2018
Reset the timer array unit.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Reset
void R_TAUm_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 64 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the timer array unit.
Remark Calling this API function changes the timer array unit to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TAUm_Set_PowerOff
void R_TAUm_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 65 of 642Feb 01, 2018
Captures the high/low-level width measured between pulses of the signal (pulses) input to the TImn pin.
[Syntax]
Remark m is the unit number, and n is the channel number.
R20UT3127EJ0105 Rev.1.05 Page 71 of 642Feb 01, 2018
Starts the count for 16-bit timer RJn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RJn_Start
void R_TMR_RJn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 72 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count for 16-bit timer RJn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RJn_Stop
void R_TMR_RJn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 73 of 642Feb 01, 2018
Halts the clock supplied to the 16-bit timer RJn.
Remark Calling this API function changes the 16-bit timer RJn to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RJn_Set_PowerOff
void R_TMR_RJn_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 74 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reads the pulse width of the 16-bit timer RJn.
Remarks 1. This API function can only be called when the 16-bit timer RJn is being used for pulse width measurement mode / pulse period measurement mode.
Remarks 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
R20UT3127EJ0105 Rev.1.05 Page 78 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count for 16-bit timer RJn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRJn_Start
void R_TMRJn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 79 of 642Feb 01, 2018
Ends the count for 16-bit timer RJn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRJn_Stop
void R_TMRJn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 80 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 16-bit timer RJn.
Remark Calling this API function changes the 16-bit timer RJn to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRJn_Set_PowerOff
void R_TMRJn_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 81 of 642Feb 01, 2018
Reads the pulse width of the 16-bit timer RJn.
Remarks 1. This API function can only be called when the 16-bit timer RJn is being used for pulse width measurement mode / pulse period measurement mode.
Remarks 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
R20UT3127EJ0105 Rev.1.05 Page 86 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RDn_Start
void R_TMR_RDn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 87 of 642Feb 01, 2018
Ends the count for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RDn_Stop
void R_TMR_RDn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 88 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 16-bit timer RDn.
Remark Calling this API function changes the 16-bit timer RDn to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RDn_Set_PowerOff
void R_TMR_RDn_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 89 of 642Feb 01, 2018
Starts the pulse output forced cutoff for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RDn_ForcedOutput_Start
void R_TMR_RDn_ForcedOutput_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 90 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the pulse output forced cutoff for 16-bit timer RDn.
Remark This API function can only be called when the 16-bit timer RDn is the count to stopped (the TSTART bit in the timer RD start register (TRDSTR) is 0).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_RDn_ForcedOutput_Stop
void R_TMR_RDn_ForcedOutput_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 91 of 642Feb 01, 2018
Reads the pulse width of the 16-bit timer RDn.
Remarks 1. This API function can only be called when the 16-bit timer RDn is being used for input capture function.
Remarks 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
R20UT3127EJ0105 Rev.1.05 Page 95 of 642Feb 01, 2018
Starts the count for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRDn_Start
void R_TMRDn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 96 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRDn_Stop
void R_TMRDn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 97 of 642Feb 01, 2018
Halts the clock supplied to the 16-bit timer RDn.
Remark Calling this API function changes the 16-bit timer RDn to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRDn_Set_PowerOff
void R_TMRDn_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 98 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the pulse output forced cutoff for 16-bit timer RDn.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRDn_ForcedOutput_Start
void R_TMRDn_ForcedOutput_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 99 of 642Feb 01, 2018
Ends the pulse output forced cutoff for 16-bit timer RDn.
Remark This API function can only be called when the 16-bit timer RDn is the count to stopped (the TSTART bit in the timer RD start register (TRDSTR) is 0).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMRDn_ForcedOutput_Stop
void R_TMRDn_ForcedOutput_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 100 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reads the pulse width of the 16-bit timer RDn.
Remarks 1. This API function can only be called when the 16-bit timer RDn is being used for input capture function.
Remarks 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
Pointer to an area storing the active level width that was read
O uint32_t * const inactive_width;
Pointer to an area storing the inactive level width that was read
I timer_channel_t channel; Pin to readTMCHANNELA: TRDIOAn pinTMCHANNELB: TRDIOBn pinTMCHANNELC: TRDIOCn pinTMCHANNELD: TRDIODn pin
Macro Description
MD_OK Normal completion
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 101 of 642Feb 01, 2018
Halts the clock supplied to the 16-bit timer RD.
Remark Calling this API function changes the 16-bit timer RDn to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMRD_Set_PowerOff
void R_TMRD_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 102 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.8 Timer RG
Below is a list of API functions output by the Code Generator for timer RG use.
Table 3.8 API Functions: [Timer RG]
API Function Name Function
R_TMR_RG0_Create Performs initialization necessary to control the 16-bit timer RG0.
R_TMR_RG0_Create_UserInit Performs user-defined initialization relating to the 16-bit timer RG0.
r_tmr_rg0_interrupt Performs processing in response to the timer interrupt.
R_TMR_RG0_Start Starts the count for 16-bit timer RG0.
R_TMR_RG0_Stop Ends the count for 16-bit timer RG0.
R_TMR_RG0_Set_PowerOff Halts the clock supplied to the 16-bit timer RG0.
R_TMR_RG0_Get_PulseWidth Reads the pulse width of the 16-bit timer RG0.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 103 of 642Feb 01, 2018
Performs initialization necessary to control the 16-bit timer RG0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_RG0_Create
void R_TMR_RG0_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 104 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the 16-bit timer RG0.
Remark This API function is called as the R_TMR_RG0_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_RG0_Create_UserInit
void R_TMR_RG0_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 105 of 642Feb 01, 2018
Performs processing in response to the timer interrupt.
Remark This API function is called as the interrupt process corresponding to the timer interrupt.
R20UT3127EJ0105 Rev.1.05 Page 106 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count for 16-bit timer RG0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_RG0_Start
void R_TMR_RG0_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 107 of 642Feb 01, 2018
Ends the count for 16-bit timer RG0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_RG0_Stop
void R_TMR_RG0_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 108 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 16-bit timer RG0.
Remark Calling this API function changes the 16-bit timer RG0 to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_RG0_Set_PowerOff
void R_TMR_RG0_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 109 of 642Feb 01, 2018
Reads the pulse width of the 16-bit timer RG0.
Remarks 1. This API function can only be called when the 16-bit timer RG0 is being used for input capture function.
Remarks 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
R20UT3127EJ0105 Rev.1.05 Page 114 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count for 16-bit timer RX.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMRX_Start
void R_TMRX_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 115 of 642Feb 01, 2018
Ends the count for 16-bit timer RX.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMRX_Stop
void R_TMRX_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 116 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 16-bit timer RX.
Remark Calling this API function changes the 16-bit timer RX to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMRX_Set_PowerOff
void R_TMRX_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 117 of 642Feb 01, 2018
Reads the buffer value of TRX register (16-bit timer RX).
[Syntax]
[Argument(s)]
[Return value]
なし
R_TMRX_Get_BufferValue
#include "r_cg_macrodriver.h"void R_TMRX_Get_BufferValue ( uint32_t * const value );
I/O Argument Description
O uint32_t * const value;
Pointer to an area storing the buffer resister value of TRX resister
R20UT3127EJ0105 Rev.1.05 Page 118 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.10 16-bit timer KB
Below is a list of API functions output by the Code Generator for 16-bit timer KB use.
Table 3.10 API Functions: [16-bit Timers KB]
API Function Name Function
R_TMR_KB_Create Performs initialization necessary to control the 16-bit timer KB.
R_TMR_KBm_Create_UserInit Performs user-defined initialization relating to the 16-bit timer KB.
r_tmr_kbm_interrupt Performs processing in response to the timer interrupt.
R_TMR_KBm_Start Starts the count for 16-bit timer KB.
R_TMR_KBm_Stop Ends the count for 16-bit timer KB.
R_TMR_KBm_Set_PowerOff Halts the clock supplied to the 16-bit timer KB.
R_TMR_KBmn_ForcedOutput_Start Enables input of the trigger signal used for the forced output stop func-tion.
R_TMR_KBmn_ForcedOutput_Stop Disables input of the trigger signal used for the forced output stop func-tion.
R_TMR_KBm_BatchOverwriteRequestOn
Enables batch overwriting of the compare register.
R_TMR_KBm_ForcedOutput_mn_Start Enables input of the trigger signal used for the forced output stop func-tion.
R_TMR_KBm_ForcedOutput_mn_Stop Disables input of the trigger signal used for the forced output stop func-tion.
R_TMR_KBm_Reset Reset the 16-bit timer KB.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 119 of 642Feb 01, 2018
Performs initialization necessary to control the 16-bit timers KB.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KB_Create
void R_TMR_KB_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 120 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the 16-bit timer KB.
Remark This API function is called as the R_TMR_KB_Create callback routine.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_Create_UserInit
void R_TMR_KBm_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 121 of 642Feb 01, 2018
Performs processing in response to the timer interrupt.
Remark This API function is called as the interrupt process corresponding to the timer interrupt.
R20UT3127EJ0105 Rev.1.05 Page 122 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the count for 16-bit timer KB.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_Start
void R_TMR_KBm_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 123 of 642Feb 01, 2018
Ends the count for 16-bit timer KB.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_Stop
void R_TMR_KBm_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 124 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 16-bit timer KB.
Remark Calling this API function changes the 16-bit timer KB to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_Set_PowerOff
void R_TMR_KBm_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 125 of 642Feb 01, 2018
Enables input of the trigger signal used for the forced output stop function.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBmn_ForcedOutput_Start
void R_TMR_KBmn_ForcedOutput_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 126 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables input of the trigger signal used for the forced output stop function.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBmn_ForcedOutput_Stop
void R_TMR_KBmn_ForcedOutput_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 127 of 642Feb 01, 2018
Enables batch overwriting of the compare register.
Remark The timing for batch-overwriting the content of the compare register is when a count value and a value set in the compare register are matched or an external trigger is generated after calling this API function.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_BatchOverwriteRequestOn
void R_TMR_KBm_BatchOverwriteRequestOn ( void );
R20UT3127EJ0105 Rev.1.05 Page 128 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables input of the trigger signal used for the forced output stop function.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_ForcedOutput_mn_Start
void R_TMR_KBm_ForcedOutput_mn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 129 of 642Feb 01, 2018
Disables input of the trigger signal used for the forced output stop function.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_ForcedOutput_mn_Stop
void R_TMR_KBm_ForcedOutput_mn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 130 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset the 16-bit timers KB.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_TMR_KBm_Reset
void R_TMR_KBm_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 131 of 642Feb 01, 2018
3.2.11 16-bit timer KC0
Below is a list of API functions output by the Code Generator for 16-bit timer KC0 use.
Table 3.11 API Functions: [16-bit Timer KC0]
API Function Name Function
R_TMR_KC0_Create Performs initialization necessary to control the 16-bit timer KC0.
R_TMR_KC0_Create_UserInit Performs user-defined initialization relating to the 16-bit timer KC0.
r_tmr_kc0_interrupt Performs processing in response to the timer interrupt.
R_TMR_KC0_Start Starts the count for 16-bit timer KC0.
R_TMR_KC0_Stop Ends the count for 16-bit timer KC0.
R_TMR_KC0_Set_PowerOff Halts the clock supplied to the 16-bit timer KC0.
R20UT3127EJ0105 Rev.1.05 Page 132 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the the 16-bit timer KC0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KC0_Create
void R_TMR_KC0_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 133 of 642Feb 01, 2018
Performs user-defined initialization relating to the 16-bit timer KC0.
Remark This API function is called as the R_TMR_KC0_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KC0_Create_UserInit
void R_TMR_KC0_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 134 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the timer interrupt.
Remark This API function is called as the interrupt process corresponding to the timer interrupt.
R20UT3127EJ0105 Rev.1.05 Page 135 of 642Feb 01, 2018
Starts the count for 16-bit timer KC0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KC0_Start
void R_TMR_KC0_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 136 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count for 16-bit timer KC0.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KC0_Stop
void R_TMR_KC0_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 137 of 642Feb 01, 2018
Halts the clock supplied to the 16-bit timer KC0.
Remark Calling this API function changes the 16-bit timer KC0 to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMR_KC0_Set_PowerOff
void R_TMR_KC0_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 138 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.12 16-bit timer KB2
Below is a list of API functions output by the Code Generator for 16-bit timer KB2 use.
Table 3.12 API Functions: [16-bit Timer KB2]
API Function Name Function
R_KB2m_Create Performs initialization necessary to control the 16-bit timer KB2.
R_KB2m_Create_UserInit Performs user-defined initialization relating to the 16-bit timer KB2.
r_kb2m_interrupt Performs processing in response to the timer interrupt INTTKB2m.
R_KB2m_Start Starts the count for 16-bit timer KB2.
R_KB2m_Stop Ends the count for 16-bit timer KB2.
R_KB2m_Set_PowerOff Halts the clock supplied to the 16-bit timer KB2.
R_KB2m_Simultaneous_Start Starts the simultaneous start/stop mode.
R_KB2m_Simultaneous_Stop Ends the simultaneous start/stop mode.
R_KB2m_Synchronous_Start Starts the timer start/clear mode.
R_KB2m_Synchronous_Stop Ends the timer start/clear mode.
R_KB2m_TKBOn0_Forced_Output_Stop_Function1_Start
Starts forced output stop function 1 for timer output TKBOn0.
R_KB2m_TKBOn0_Forced_Output_Stop_Function1_Stop
Ends forced output stop function 1 for timer output TKBOn0.
R_KB2m_TKBOn1_Forced_Output_Stop_Function1_Start
Starts forced output stop function 2 for timer output TKBOn1.
R_KB2m_TKBOn1_Forced_Output_Stop_Function1_Stop
Starts forced output stop function 2 for timer output TKBOn1.
R_KB2m_TKBOn0_DitheringFunction_Start
Starts dithering function for timer output TKBOn0.
R_KB2m_TKBOn0_DitheringFunction_Stop
Ends dithering function for timer output TKBOn0.
R_KB2m_TKBOn1_DitheringFunction_Start
Starts dithering function for timer output TKBOn1.
R_KB2m_TKBOn1_DitheringFunction_Stop
Ends dithering function for timer output TKBOn1.
R_KB2m_TKBOn0_SmoothStartFunction_Start
Starts smooth start function for timer output TKBOn0.
R_KB2m_TKBOn0_SmoothStartFunction_Stop
Ends smooth start function for timer output TKBOn0.
R_KB2m_TKBOn1_SmoothStartFunction_Start
Starts smooth start function for timer output TKBOn1.
R_KB2m_TKBOn1_SmoothStartFunction_Stop
Ends smooth start function for timer output TKBOn1.
R_KB2m_Set_BatchOverwriteRequestOn Enables batch overwriting of the compare register.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 139 of 642Feb 01, 2018
Performs initialization necessary to control the 16-bit timer KB2.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_KB2m_Create
void R_KB2m_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 140 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the 16-bit timer KB2.
Remark This API function is called as the R_KB2m_Create callback routine.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_KB2m_Create_UserInit
void R_KB2m_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 141 of 642Feb 01, 2018
Performs processing in response to the timer interrupt INTTKB2m.
Remark This API function is called as the interrupt process corresponding to the timer interrupt INTTKB2m.
R20UT3127EJ0105 Rev.1.05 Page 161 of 642Feb 01, 2018
Enables batch overwriting of the compare register.
Remark The timing for batch-overwriting the content of the compare register is when a count value and a value set in the compare register are matched or an external trigger is generated after calling this API function.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_KB2m_Set_BatchOverwriteRequestOn
void R_KB2m_Set_BatchOverwriteRequestOn ( void );
R20UT3127EJ0105 Rev.1.05 Page 162 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.13 Real-time clock
Below is a list of API functions output by the Code Generator for real-time clock use.
Table 3.13 API Functions: [Real-time Clock]
API Function Name Function
R_RTC_Create Performs initialization necessary to control the real-time clock.
R_RTC_Create_UserInit Performs user-defined initialization relating to the real-time clock.
r_rtc_interrupt Performs processing in response to the real-time clock interrupt INTRTC.
R_RTC_Start Starts the count of the real-time clock (year, month, weekday, day, hour, minute, second).
R_RTC_Stop Ends the count of the real-time clock (year, month, weekday, day, hour, minute, second).
R_RTC_Set_PowerOff Halts the clock supplied to the real-time clock.
R_RTC_Set_HourSystem Sets the clock type (12-hour or 24-hour clock) of the real-time clock.
R_RTC_Set_CounterValue Sets the counter value of the real-time clock.
R_RTC_Set_CalendarCounterValue Sets the counter value of the real-time clock.(in the case of the calendar mode setting)
R_RTC_Set_BinaryCounterValue Sets the counter value of the real-time clock.(in the case of the binary mode setting)
R_RTC_Get_CounterValue Reads the counter value of the real-time clock.
R_RTC_Get_CalendarCounterValue Reads the counter value of the real-time clock.(in the case of the calen-dar mode setting)
R_RTC_Get_BinaryCounterValue Reads the counter value of the real-time clock.(in the case of the binary mode setting)
R_RTC_Set_ConstPeriodInterruptOn Sets the cycle of the interrupts INTRTC, then starts the cyclic interrupt function.
R_RTC_Set_ConstPeriodInterruptOff Ends the cyclic interrupt function.
r_rtc_callback_constperiod Performs processing in response to the cyclic interrupt INTRTC.
R_RTC_Set_AlarmOn Starts the alarm interrupt function.
R_RTC_Set_CalendarAlarmOn Starts the alarm interrupt function.(in the case of the calendar mode set-ting)
R_RTC_Set_BinaryAlarmOn Starts the alarm interrupt function.(in the case of the binary mode set-ting)
R_RTC_Set_AlarmOff Ends the alarm interrupt function.
R_RTC_Set_AlarmValue Sets the alarm conditions (weekday, hour, minute).
R_RTC_Set_CalendarAlarmValue Sets the alarm conditions (year, month, weekday, day, hour, minute, sec-ond).(in the case of the calendar mode setting)
R_RTC_Set_BinaryAlarmValue Sets the alarm conditions.(in the case of the binary mode setting)
R_RTC_Get_AlarmValue Reads the alarm conditions (weekday, hour, minute).
R_RTC_Get_CalendarAlarmValue Reads the alarm conditions (year, month, weekday, day, hour, minute, second).(in the case of the calendar mode setting)
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 163 of 642Feb 01, 2018
R_RTC_Get_BinaryAlarmValue Reads the alarm conditions.(in the case of the binary mode setting)
r_rtc_callback_alarm Performs processing in response to the alarm interrupt INTRTC.
R_RTC_Set_RTC1HZOn Enables output of the correction clock (1 Hz) to the RTC1HZ pin.
R_RTC_Set_RTC1HZOff Disables output of the correction clock (1 Hz) to the RTC1HZ pin.
R_RTC_Set_RTCOUTOn Enables output of the RTCOUT.
R_RTC_Set_RTCOUTOff Disables output of the RTCOUT.
r_rtc_alarminterrupt Performs processing in response to the alarm interrupt INTRTCALM.
r_rtc_periodicinterrupt Performs processing in response to the periodic interrupt INTRTCPRD.
r_rtc_callback_periodic Performs processing in response to the cyclic interrupt INTRTC.
API Function Name Function
R20UT3127EJ0105 Rev.1.05 Page 164 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the real-time clock.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_RTC_Create
void R_RTC_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 165 of 642Feb 01, 2018
Performs user-defined initialization relating to the real-time clock.
Remark This API function is called as the R_RTC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_RTC_Create_UserInit
void R_RTC_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 166 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the real-time clock interrupt INTRTC.
Remark This API function is called as the interrupt process corresponding to the real-time clock interrupt INTRTC.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_rtc_interrupt
__interrupt static void r_rtc_interrupt ( void );
static void __near r_rtc_interrupt ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 167 of 642Feb 01, 2018
Starts the count of the real-time clock (year, month, weekday, day, hour, minute, second).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_RTC_Start
void R_RTC_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 168 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count of the real-time clock (year, month, weekday, day, hour, minute, second).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_RTC_Stop
void R_RTC_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 169 of 642Feb 01, 2018
Halts the clock supplied to the real-time clock.
Remarks 1. Calling this API function changes the real-time clock to reset status.For this reason, writes to the control registers after this API function is called are ignored.
Remarks 2. This API function stops the clock supply to the real-time clock, by operating the RTCEN bit of peripheral enable register n.For this reason, this API function also stops the clock supply to other peripheral devices sharing the RTCEN bit (e.g. interval timer).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_RTC_Set_PowerOff
void R_RTC_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 170 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets the clock type (12-hour or 24-hour clock) of the real-time clock.
[Syntax]
[Argument(s)]
[Return value]
Remark If MD_BUSY1 or MD_BUSY2 is returned, it may be because the counter-operation is stopped, or the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.
I rtc_hour_system_t hour_system; Clock typeHOUR12: 12-hour clockHOUR24: 24-hour clock
Macro Description
MD_OK Normal completion
MD_BUSY1 Executing count process (before change to setting)
MD_BUSY2 Stopping count process (after change to setting)
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 171 of 642Feb 01, 2018
Sets the counter value (year, month, weekday, day, hour, minute, second) of the real-time clock.
[Syntax]
[Argument(s)]
Remark Below is an example of the structure rtc_counter_value_t (counter value) for the real-time clock.
[Return value]
Remark If MD_BUSY1 or MD_BUSY2 is returned, it may be because the counter-operation is stopped, or the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.
MD_BUSY1 Executing count process (before change to setting)
MD_BUSY2 Stopping count process (after change to setting)
R20UT3127EJ0105 Rev.1.05 Page 172 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets the counter value of the real-time clock.(in the case of the calendar mode setting)
[Syntax]
[Argument(s)]
Remark See R_RTC_Set_CounterValue for details about the rtc_counter_value_t counter value.
[Return value]
Remark If MD_BUSY1 is returned, it may be because the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.
MD_BUSY1 Executing count process (before change to setting)
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 173 of 642Feb 01, 2018
Sets the counter value of the real-time clock.(in the case of the binary mode setting)
[Syntax]
[Argument(s)]
Remark See R_RTC_Set_CounterValue for details about the rtc_counter_value_t counter value.
[Return value]
Remark If MD_BUSY1 is returned, it may be because the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.
MD_BUSY1 Executing count process (before change to setting)
R20UT3127EJ0105 Rev.1.05 Page 174 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reads the counter value (year, month, weekday, day, hour, minute, second) of the real-time clock.
[Syntax]
[Argument(s)]
Remark See R_RTC_Set_CounterValue for details about the rtc_counter_value_t counter value.
[Return value]
Remark If MD_BUSY1 or MD_BUSY2 is returned, it may be because the counter-operation is stopped, or the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.
R20UT3127EJ0105 Rev.1.05 Page 185 of 642Feb 01, 2018
- alarmwh (Hour)Below are shown the meanings of each bit of the structure member alarmwh.If the real-time clock is set to the 12-hour clock, then bit 5 has the following meaning.
0: AM1: PM
- alarmww (Weekday)Below are shown the meanings of each bit of the structure member alarmww.
- alarmwd (Day)Below are shown the meanings of each bit of the structure member alarmwd.
- alarmwmn (Month)Below are shown the meanings of each bit of the structure member alarmwmn.
BCD code (hour: digit 10)BCD code (hour: digit 1)
567 034
00: Fixed
3567 04 2 1
1: Sunday
1: Tuesday
1: Friday1: Saturday
0: Fixed
1: Monday
1: Wednesday1: Thursday
BCD code (day: digit 10)BCD code (day: digit 1)
567 034
00: Fixed
7 6 0
BCD code (month: digit 1)
4 3
0: FixedBCD code (month: digit 10))
5
R20UT3127EJ0105 Rev.1.05 Page 186 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
- alarmwy (Year)Below are shown the meanings of each bit of the structure member alarmwmn.
[Return value]
None.
0
BCD code (year: digit 1)
4 37
BCD code (year: digit 10)
815
0: Fixed
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 187 of 642Feb 01, 2018
Sets the alarm conditions (year, month, weekday, day, hour, minute, second).(in the case of the calendar mode setting)
[Syntax]
Remark See R_RTC_Set_AlarmValue for details about rtc_alarm_value_t (alarm conditions).
R20UT3127EJ0105 Rev.1.05 Page 199 of 642Feb 01, 2018
Performs processing in response to the cyclic interrupt INTRTC.
Remark This API function is called as the callback routine of interrupt process r_rtc_interrupt corresponding to the cyclic interrupt INTRTC.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
r_rtc_callback_periodic
static void r_rtc_callback_periodic ( void );
R20UT3127EJ0105 Rev.1.05 Page 200 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.14 Subsystem clock frequency measurement circuit
Below is a list of API functions output by the Code Generator for subsystem clock frequency measurement circuit use.
Table 3.14 API Functions: [Subsystem Clock Frequency Measurement Circuit]
API Function Name Function
R_FMC_Create Performs initialization necessary to control the subsystem clock frequency measurement circuit.
R_FMC_Create_UserInit Performs user-defined initialization relating to the subsystem clock frequency measurement circuit.
r_fmc_interrupt Performs processing in response to the end of frequency measurement interrupt INTFM.
R_FMC_Start Starts measurement of the frequency that uses the subsystem clock fre-quency measurement circuit.
R_FMC_Stop Ends measurement of the frequency that uses the subsystem clock fre-quency measurement circuit.
R_FMC_Set_PowerOff Halts the clock supplied to the subsystem clock frequency measurement circuit.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 201 of 642Feb 01, 2018
Performs initialization necessary to control the subsystem clock frequency measurement circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_FMC_Create
void R_FMC_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 202 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the subsystem clock frequency measurement circuit.
Remark This API function is called as the R_FMC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_FMC_Create_UserInit
void R_FMC_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 203 of 642Feb 01, 2018
Performs processing in response to the end of frequency measurement interrupt INTFM.
Remark This API function is called as the interrupt process corresponding to the end of frequency measurement interrupt INTFM.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_fmc_interrupt
__interrupt static void r_fmc_interrupt ( void );
static void __near r_fmc_interrupt ( void );
R20UT3127EJ0105 Rev.1.05 Page 204 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts measurement of the frequency that uses the subsystem clock frequency measurement circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_FMC_Start
void R_FMC_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 205 of 642Feb 01, 2018
Ends measurement of the frequency that uses the subsystem clock frequency measurement circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_FMC_Stop
void R_FMC_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 206 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the subsystem clock frequency measurement circuit.
Remark Calling this API function changes the subsystem clock frequency measurement circuit to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_FMC_Set_PowerOff
void R_FMC_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 207 of 642Feb 01, 2018
3.2.15 12-bit interval timer
Below is a list of API functions output by the Code Generator for 12-bit interval timer use.
Table 3.15 API Functions: [12-Bit Interval Timer]
API Function Name Function
R_IT_Create Performs initialization necessary to control the 12-bit interval timer.
R_IT_Create_UserInit Performs user-defined initialization relating to the 12-bit interval timer.
r_it_interrupt Performs processing in response to the 12-bit interval timer interrupt INTIT.
R_IT_Start Starts the count of the 12-bit interval timer.
R_IT_Stop Ends the count of the 12-bit interval timer.
R_IT_Reset Reset the 12-bit interval timer.
R_IT_Set_PowerOff Halts the clock supplied to the 12-bit interval timer.
R20UT3127EJ0105 Rev.1.05 Page 208 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 12-bit interval timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Create
void R_IT_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 209 of 642Feb 01, 2018
Performs user-defined initialization relating to the 12-bit interval timer.
Remark This API function is called as the R_IT_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Create_UserInit
void R_IT_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 210 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the 12-bit interval timer interrupt INTIT.
Remark This API function is called as the interrupt process corresponding to the 12-bit interval timer interrupt INTIT.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_it_interrupt
__interrupt static void r_it_interrupt ( void );
static void __near r_it_interrupt ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 211 of 642Feb 01, 2018
Starts the count of the 12-bit interval timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Start
void R_IT_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 212 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count of the 12-bit interval timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Stop
void R_IT_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 213 of 642Feb 01, 2018
Reset the 12-bit interval timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Reset
void R_IT_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 214 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 12-bit interval timer.
Remarks 1. Calling this API function changes the 12-bit interval timer to reset status.For this reason, writes to the control registers after this API function is called are ignored.
Remarks 2. This API function stops the clock supply to the 12-bit interval timer, by operating the RTCEN bit of periph-eral enable register n.For this reason, this API function also stops the clock supply to other peripheral devices sharing the RTCEN bit (e.g. real-timer clock).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IT_Set_PowerOff
void R_IT_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 215 of 642Feb 01, 2018
3.2.16 8-bit interval timer
Below is a list of API functions output by the Code Generator for 8-bit interval timer use.
Table 3.16 API Functions: [8-Bit Interval Timer]
API Function Name Function
R_IT8bitm_Channeln_Create Performs initialization necessary to control the 8-bit interval timer.
R_IT8bitm_Channeln_Create_UserInit Performs user-defined initialization relating to the 8-bit interval timer.
r_it8bitm_channeln_interrupt Performs processing in response to the 8-bit interval timer interrupt
INTITn0 or INTITn1.
R_IT8bitm_Channeln_Start Starts the count of the 8-bit interval timer.
R_IT8bitm_Channeln_Stop Ends the count of the 8-bit interval timer.
R_IT8bitm_Channeln_Set_PowerOff Halts the clock supplied to the 8-bit interval timer.
R_IT8bitm_Set_PowerOff Halts the clock supplied to the 8-bit interval timer.
R20UT3127EJ0105 Rev.1.05 Page 216 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 8-bit interval timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Channeln_Create
void R_IT8bitm_Channeln_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 217 of 642Feb 01, 2018
Performs user-defined initialization relating to the 8-bit interval timer.
Remark This API function is called as the R_IT8bitm_Channeln_Create callback routine.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Channeln_Create_UserInit
void R_IT8bitm_Channeln_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 218 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the 8-bit interval timer interrupt INTITn0 or INTITn1.
Remark This API function is called as the interrupt process corresponding to the 8-bit interval timer interrupt INTITn0 or INTITn1.
R20UT3127EJ0105 Rev.1.05 Page 219 of 642Feb 01, 2018
Starts the count of the 8-bit interval timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Channeln_Start
void R_IT8bitm_Channeln_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 220 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count of the 8-bit interval timer.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Channeln_Stop
void R_IT8bitm_Channeln_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 221 of 642Feb 01, 2018
Halts the clock supplied to the 8-bit interval timer.
Remark Calling this API function changes the 8-bit interval timer to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Channeln_Set_PowerOff
void R_IT8bitm_Channeln_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 222 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 8-bit interval timer.
Remark Calling this API function changes the 8-bit interval timer to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_IT8bitm_Set_PowerOff
void R_IT8bitm_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 223 of 642Feb 01, 2018
3.2.17 16-bit wakeup timer
Below is a list of API functions output by the Code Generator for 16-bit wakeup timer (WUTM) use.
Table 3.17 API Functions: [16-bit Wakeup Timer]
API Function Name Function
R_WUTM_Create Performs initialization necessary to control the 16-bit wakeup timer.
R_WUTM_Create_UserInit Performs user-defined initialization relating to the 16-bit wakeup timer.
r_wutm_interrupt Performs processing in response to the timer interrupt.
R_WUTM_Start Starts the count for 16-bit wakeup timer.
R_WUTM_Stop Ends the count for 16-bit wakeup timer.
R_WUTM_Set_PowerOff Halts the clock supplied to the 16-bit wakeup timer.
R20UT3127EJ0105 Rev.1.05 Page 224 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 16-bit wakeup timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WUTM_Create
void R_WUTM_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 225 of 642Feb 01, 2018
Performs user-defined initialization relating to the 16-bit wakeup timer.
Remark This API function is called as the R_WUTM_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WUTM_Create_UserInit
void R_WUTM_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 226 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the timer interrupt.
Remark This API function is called as the interrupt process corresponding to the timer interrupt.
R20UT3127EJ0105 Rev.1.05 Page 227 of 642Feb 01, 2018
Starts the count for 16-bit wakeup timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WUTM_Start
void R_WUTM_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 228 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the count for 16-bit wakeup timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WUTM_Stop
void R_WUTM_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 229 of 642Feb 01, 2018
Halts the clock supplied to the 16-bit wakeup timer.
Remark Calling this API function changes the 16-bit wakeup timer to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WUTM_Set_PowerOff
void R_WUTM_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 230 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.18 Clock output/buzzer output controller
Below is a list of API functions output by the Code Generator for clock output/buzzer output controller use.
Table 3.18 API Functions: [Clock Output/Buzzer Output Controller]
API Function Name Function
R_PCLBUZn_Create Performs initialization necessary to control the clock/buzzer output controller.
R_PCLBUZn_Create_UserInit Performs user-defined initialization relating to the clock/buzzer output controller.
R_PCLBUZn_Start Starts clock/buzzer output.
R_PCLBUZn_Stop Ends clock/buzzer output.
R_PCLBUZ_Set_PowerOff Halts the clock supplied to the clock/buzzer output controller.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 231 of 642Feb 01, 2018
Performs initialization necessary to control the clock/buzzer output controller.
[Syntax]
Remark n is the output pin.
[Argument(s)]
None.
[Return value]
None.
R_PCLBUZn_Create
void R_PCLBUZn_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 232 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the clock/buzzer output controller.
Remark This API function is called as the R_PCLBUZn_Create callback routine.
[Syntax]
Remark n is the output pin.
[Argument(s)]
None.
[Return value]
None.
R_PCLBUZn_Create_UserInit
void R_PCLBUZn_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 233 of 642Feb 01, 2018
Starts clock/buzzer output.
[Syntax]
Remark n is the output pin.
[Argument(s)]
None.
[Return value]
None.
R_PCLBUZn_Start
void R_PCLBUZn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 234 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends clock/buzzer output.
[Syntax]
Remark n is the output pin.
[Argument(s)]
None.
[Return value]
None.
R_PCLBUZn_Stop
void R_PCLBUZn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 235 of 642Feb 01, 2018
Halts the clock supplied to the clock/buzzer output controller.
Remarks 1. Calling this API function changes the clock/buzzer output controller to reset status.For this reason, writes to the control registers after this API function is called are ignored.
Remarks 2. This API function stops the clock supply to the clock/buzzer output controller, by operating the RTCEN bit of peripheral enable register n.For this reason, this API function also stops the clock supply to other peripheral devices sharing the RTCEN bit (e.g. real-time clock).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PCLBUZ_Set_PowerOff
void R_PCLBUZ_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 236 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.19 Watchdog timer
Below is a list of API functions output by the Code Generator for watchdog timer use.
Table 3.19 API Functions: [Watchdog Timer]
API Function Name Function
R_WDT_Create Performs initialization necessary to control the watchdog timer.
R_WDT_Create_UserInit Performs user-defined initialization relating to the watchdog timer.
r_wdt_interrupt Performs processing in response to the interval interrupt INTWDTI.
R_WDT_Restart Clears the watchdog timer counter and resumes counting.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 237 of 642Feb 01, 2018
Performs initialization necessary to control the watchdog timer.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WDT_Create
void R_WDT_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 238 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the watchdog timer.
Remark This API function is called as the R_WDT_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WDT_Create_UserInit
void R_WDT_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 239 of 642Feb 01, 2018
Performs processing in response to the interval interrupt INTWDTI.
Remark This API function is called as the interrupt process corresponding to the interval interrupt INTWDTI.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_wdt_interrupt
__interrupt static void r_wdt_interrupt ( void );
static void __near r_wdt_interrupt ( void );
R20UT3127EJ0105 Rev.1.05 Page 240 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Clears the watchdog timer counter and resumes counting.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_WDT_Restart
void R_WDT_Restart ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 241 of 642Feb 01, 2018
3.2.20 24-bit DS A/D converter with programmable gain instrumentation amplifier
Below is a list of API functions output by the Code Generator for 24-bit ΔΣ A/D converter with programmable gain instru-mentation amplifier use.
Table 3.20 API Functions: [24-bit ΔΣ A/D converter with programmable gain instrumentation amplifier]
API Function Name Function
R_PGA_DSAD_Create Performs initialization necessary to control the 24-bit ΔΣ A/D converter with programmable gain instrumentation amplifier.
R_PGA_DSAD_Create_UserInit Performs user-defined initialization relating to the 24-bit ΔΣ A/D con-verter with programmable gain instrumentation amplifier.
r_pga_dsad_interrupt_conversion Performs processing in response to the 24-bit ΔΣ A/D conversion end interrupt INTDSAD.
r_pga_dsad_interrupt_scan Performs processing in response to the 24-bit ΔΣ A/D scan end interrupt INTDSADS.
R_PGA_DSAD_Start Starts A/D conversion.
R_PGA_DSAD_Stop Ends A/D conversion.
R_PGA_DSAD_Set_PowerOff Halts the clock supplied to the 24-bit ΔΣ A/D converter with programma-ble gain instrumentation amplifier.
R_PGA_DSAD_Get_AverageResult Reads the results of A/D conversion.(mean value)
R_PGA_DSAD_Get_Result Reads the results of A/D conversion.
R_PGA_DSAD_CAMP_OffsetTrimming Connects the configurable amplifier to the 24-bit ΔΣ A/D converter and trims the offset.
r_pga_dsad_conversion_interrupt Performs processing in response to the 24-bit ΔΣ A/D conversion end interrupt INTDSAD.
r_pga_dsad_scan_interrupt Performs processing in response to the 24-bit ΔΣ A/D scan end interrupt INTDSADS.
R20UT3127EJ0105 Rev.1.05 Page 242 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 24-bit ΔΣ A/D converter with programmable gain instrumentation amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_DSAD_Create
void R_PGA_DSAD_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 243 of 642Feb 01, 2018
Performs user-defined initialization relating to the 24-bit ΔΣ A/D converter with programmable gain instrumentation amplifier.
Remark This API function is called as the R_PGA_DSAD_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_DSAD_Create_UserInit
void R_PGA_DSAD_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 244 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the 24-bit ΔΣ A/D conversion end interrupt INTDSAD.
Remark This API function is called as the interrupt process corresponding to the 24-bit ΔΣ A/D conversion end interrupt INTDSAD.
R20UT3127EJ0105 Rev.1.05 Page 254 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.21 A/D converter
Below is a list of API functions output by the Code Generator for A/D converter use.
Table 3.21 API Functions: [A/D Converter]
API Function Name Function
R_ADC_Create Performs initialization necessary to control the A/D converter.
R_ADC_Create_UserInit Performs user-defined initialization relating to the A/D converter.
r_adc_interrupt Performs processing in response to the A/D conversion end interrupt INTAD.
R_ADC_Set_OperationOn Enables operation of voltage converter.
R_ADC_Set_OperationOff Disables operation of voltage converter.
R_ADC_Start Starts A/D conversion.
R_ADC_Stop Ends A/D conversion.
R_ADC_Reset Reset A/D conversion.
R_ADC_Set_PowerOff Halts the clock supplied to the A/D converter.
R_ADC_Set_ADChannel Configures the analog voltage input pin for A/D conversion.
R_ADC_Set_SnoozeOn Enables the switch from STOP mode to SNOOZE mode.
R_ADC_Set_SnoozeOff Disables the switch from STOP mode to SNOOZE mode.
R_ADC_Set_TestChannel Sets the operation mode of A/D converter.
R_ADC_Get_Result Reads the results of A/D conversion (10 bits).
R_ADC_Get_Result_8bit Reads the results of A/D conversion (8 bits; most significant 8 bits of 10-bit resolution).
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 255 of 642Feb 01, 2018
Performs initialization necessary to control the A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Create
void R_ADC_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 256 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the A/D converter.
Remark This API function is called as the R_ADC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Create_UserInit
void R_ADC_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 257 of 642Feb 01, 2018
Performs processing in response to the A/D conversion end interrupt INTAD.
Remark This API function is called as the interrupt process corresponding to the A/D conversion end interrupt INTAD.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_adc_interrupt
__interrupt static void r_adc_interrupt ( void );
static void __near r_adc_interrupt ( void );
R20UT3127EJ0105 Rev.1.05 Page 258 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of voltage converter.
Remarks 1. About 1 microsecond of stabilization time is required when changing the voltage converter from operation stopped to operation enabled status.Consequently, about 1 micro second must be left free between the call to this API function and the call to R_ADC_Start.
Remarks 2. On the [A/D Converter], in the [Comparator operation setting] area, if "Operation" is selected, then the voltage converter will be switched to "always on".There is thus no need to call this API function in this case.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Set_OperationOn
void R_ADC_Set_OperationOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 259 of 642Feb 01, 2018
Disables operation of voltage converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Set_OperationOff
void R_ADC_Set_OperationOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 260 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts A/D conversion.
Remark About 1 micro second of stabilization time is required when changing the voltage converter from opera-tion stopped to operation enabled status.Consequently, about 1 micro second must be left free between the call to R_ADC_Set_OperationOn and the call to this API function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Start
void R_ADC_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 261 of 642Feb 01, 2018
Ends A/D conversion.
Remark The voltage converter continues to operate after the process of this API function completes.Consequently, to stop the operation of the voltage converter, you must call R_ADC_Set_OperationOff after the process of this API function completes.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Stop
void R_ADC_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 262 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset A/D conversion.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Reset
void R_ADC_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 263 of 642Feb 01, 2018
Halts the clock supplied to the A/D converter.
Remark Calling this API function changes the A/D converter to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ADC_Set_PowerOff
void R_ADC_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 264 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Configures the analog voltage input pin for A/D conversion.
Remark The value specified in argument channel is set to analog input channel specification register (ADS).
[Syntax]
[Argument(s)]
Remark See the header file r_cg_adc.h for details about the analog voltage input pin ADCHANNELn.
I test_channel_t channel; Operation mode of A/D converterADNORMALINPUT: Normal mode (Normal A/D conver-sion)ADAVREFM: Test mode (AVREFM input)ADAVREFP: Test mode (AVREFP input)
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 268 of 642Feb 01, 2018
O uint8_t * const buffer; Pointer to area in which to store the results of A/D conversion
15 8 7 0B1B2B3B4B5B6B7B8B10 B9
Results of A/D conversion to be stored in buffer
R20UT3127EJ0105 Rev.1.05 Page 270 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.22 Configurable amplifier
Below is a list of API functions output by the Code Generator for configurable amplifier use.
Table 3.22 API Functions: [Configurable amplifier]
API Function Name Function
R_CAMP_Create Performs initialization necessary to control the configurable amplifier.
R_CAMP_Create_UserInit Performs user-defined initialization relating to the configurableamplifier.
R_CAMPn_Start Turns on the power of the configurable amplifier(AMPn).
R_CAMPn_Stop Turns off the power of the configurable amplifier(AMPn).
R_CAMP_Set_PowerOff Halts the clock supplied to the configurable amplifier.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 271 of 642Feb 01, 2018
Performs initialization necessary to control the configurable amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CAMP_Create
void R_CAMP_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 272 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the configurable amplifier.
Remark This API function is called as the R_CAMP_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CAMP_Create_UserInit
void R_CAMP_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 273 of 642Feb 01, 2018
Turns on the power of the configurable amplifier(AMPn).
[Syntax]
Remark n is the channel number.ye
[Argument(s)]
None.
[Return value]
None.
R_CAMPn_Start
void R_CAMPn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 274 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Turns off the power of the configurable amplifier(AMPn).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_CAMPn_Stop
void R_CAMPn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 275 of 642Feb 01, 2018
Halts the clock supplied to the configurable amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_CAMP_Set_PowerOff
void R_CAMP_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 276 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.23 Temperature sensor
Below is a list of API functions output by the Code Generator for temperature sensor use.
Table 3.23 API Functions: [Temperature Sensor]
API Function Name Function
R_TMPS_Create Performs initialization necessary to control the temperature sensor.
R_TMPS_Create_UserInit Performs user-defined initialization relating to the temperature sensor.
R_TMPS_Start Starts measurement of the temperature that uses the temperature sen-sor.
R_TMPS_Stop Ends measurement of the temperature that uses the temperature sen-sor.
R_TMPS_Reset Reset the temperature sensor.
R_TMPS_Set_PowerOff Halts the clock supplied to the temperature sensor.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 277 of 642Feb 01, 2018
Performs initialization necessary to control the temperature sensor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Create
void R_TMPS_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 278 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the temperature sensor.
Remark This API function is called as the R_TMPS_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Create_UserInit
void R_TMPS_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 279 of 642Feb 01, 2018
Starts measurement of the temperature that uses the temperature sensor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Start
void R_TMPS_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 280 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends measurement of the temperature that uses the temperature sensor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Stop
void R_TMPS_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 281 of 642Feb 01, 2018
Reset the temperature sensor.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Reset
void R_TMPS_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 282 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the temperature sensor.
Remark Calling this API function changes the temperature sensor to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_TMPS_Set_PowerOff
void R_TMPS_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 283 of 642Feb 01, 2018
3.2.24 24-bitDS A/D converter
Below is a list of API functions output by the Code Generator for 24-bit A/D converter use.
Table 3.24 API Functions: [24-bit A/D Converter]
API Function Name Function
R_DSADC_Create Performs initialization necessary to control the 24-bit A/D converter.
R_DSADC_Create_UserInit Performs user-defined initialization relating to the 24-bit A/D con-verter.
r_dsadc_interrupt Performs processing in response to the A/D conversion end interrupt INTDSAD.
r_dsadzcn_interrupt Performs processing in response to the zero-cross detection interrupt INTDSADZCn.
R_DSADC_Set_OperationOn Enables operation of 24-bit A/D converter.
R_DSADC_Set_OperationOff Disables operation of 24-bit A/D converter.
R_DSADC_Start Starts A/D conversion.
R_DSADC_Stop Ends A/D conversion.
R_DSADC_Reset Reset the 24-bit A/D converter.
R_DSADC_Set_PowerOff Performs electric charge reset for the 24-bit A/D converter.
R_DSADC_Channeln_Get_Result Reads the results of A/D conversion (24 bits).
R_DSADC_Channeln_Get_Result_16bit Reads the results of A/D conversion (16 bits; most significant 16 bits of 24-bit resolution).
R20UT3127EJ0105 Rev.1.05 Page 284 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 24-bit A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Create
void R_DSADC_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 285 of 642Feb 01, 2018
Performs user-defined initialization relating to the 24-bit A/D converter.
Remark This API function is called as the R_DSADC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Create_UserInit
void R_DSADC_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 286 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the A/D conversion end interrupt INTDSAD.
Remark This API function is called as the interrupt process corresponding to the A/D conversion end interrupt INTDSAD.
R20UT3127EJ0105 Rev.1.05 Page 288 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of 24-bit A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Set_OperationOn
void R_DSADC_Set_OperationOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 289 of 642Feb 01, 2018
Disables operation of 24-bit A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Set_OperationOff
void R_DSADC_Set_OperationOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 290 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts A/D conversion.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Start
void R_DSADC_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 291 of 642Feb 01, 2018
Ends A/D conversion.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Stop
void R_DSADC_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 292 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset the 24-bit A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Reset
void R_DSADC_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 293 of 642Feb 01, 2018
Performs electric charge reset for the 24-bit A/D converter.
Remark About 1.4 microseconds of stabilization time is required when electric charge reset is performed for the 24-bit A/D converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DSADC_Set_PowerOff
void R_DSADC_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 294 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reads the results of A/D conversion (24 bits).
Remark The result of A/D conversion (24 bits) by this API function must be read within the maximum pending time of the A/D conversion result register n after A/D conversion end interrupt INTDSAD is generated.
O uint32_t * const buffer; Pointer to area in which to store read results of A/D conversion
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 295 of 642Feb 01, 2018
Reads the results of A/D conversion (16 bits; most significant 16 bits of 24-bit resolution).
Remark The result of A/D conversion by this API function must be read within the maximum pending time of the A/D conversion result register n after A/D conversion end interrupt INTDSAD is generated.
O uint16_t * const buffer; Pointer to area in which to store the results of A/D conversion
R20UT3127EJ0105 Rev.1.05 Page 296 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.25 D/A converter
Below is a list of API functions output by the Code Generator for D/A converter use.
Table 3.25 API Functions: [D/A Converter]
API Function Name Function
R_DAC_Create Performs initialization necessary to control the D/A converter.
R_DAC_Create_UserInit Performs user-defined initialization relating to the D/A converter.
R_DACn_Start Starts D/A conversion.
R_DACn_Stop Ends D/A conversion.
R_DAC_Set_PowerOff Halts the clock supplied to the D/A converter.
R_DACn_Set_ConversionValue Sets the analog voltage output to the ANOn pin.
R_DAC_Change_OutputVoltage_8bit
Changes the output voltage of D/A converter.(8bit mode)
R_DAC_Change_OutputVoltage Changes the output voltage of D/A converter.(12bit mode)
R_DACn_Create Performs initialization necessary to control the D/A converter.
R_DAC_Reset Reset the D/A converter.
R_DACn_Create_UserInit Performs user-defined initialization relating to the D/A converter.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 297 of 642Feb 01, 2018
Performs initialization necessary to control the D/A converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DAC_Create
void R_DAC_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 298 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the D/A converter.
Remark This API function is called as the R_DAC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DAC_Create_UserInit
void R_DAC_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 299 of 642Feb 01, 2018
Starts D/A conversion.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DACn_Start
void R_DACn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 300 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends D/A conversion.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DACn_Stop
void R_DACn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 301 of 642Feb 01, 2018
Halts the clock supplied to the D/A converter.
Remark Calling this API function changes the D/A converter to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DAC_Set_PowerOff
void R_DAC_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 302 of 642Feb 01, 2018
R20UT3127EJ0105 Rev.1.05 Page 306 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset the D/A converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DAC_Reset
void R_DAC_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 307 of 642Feb 01, 2018
Performs user-defined initialization relating to the D/A converter.
Remark This API function is called as the R_DACn_Create callback routine.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DACn_Create_UserInit
void R_DACn_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 308 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.26 Programmable gain amplifier
Below is a list of API functions output by the Code Generator for programmable gain amplifier use.
Table 3.26 API Functions: [Programmable Gain Amplifier]
API Function Name Function
R_PGA_Create Performs initialization necessary to control the programmable gain amplifier.
R_PGA_Create_UserInit Performs user-defined initialization relating to the programmable gain amplifier.
R_PGA_Start Starts the operation of programmable gain amplifier.
R_PGA_Stop Ends the operation of programmable gain amplifier.
R_PGA_Reset Reset the programmable gain amplifier.
R_PGA_Set_PowerOff Halts the clock supplied to the programmable gain amplifier.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 309 of 642Feb 01, 2018
Performs initialization necessary to control the programmable gain amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Create
void R_PGA_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 310 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the programmable gain amplifier.
Remark This API function is called as the R_PGA_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Create_UserInit
void R_PGA_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 311 of 642Feb 01, 2018
Starts the operation of programmable gain amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Start
void R_PGA_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 312 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends the operation of programmable gain amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Stop
void R_PGA_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 313 of 642Feb 01, 2018
Reset the operation of programmable gain amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Reset
void R_PGA_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 314 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the programmable gain amplifier.
Remark Calling this API function changes the comparator to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_PGA_Set_PowerOff
void R_PGA_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 315 of 642Feb 01, 2018
3.2.27 Comparator
Below is a list of API functions output by the Code Generator for comparator use.
Table 3.27 API Functions: [Comparator]
API Function Name Function
R_COMP_Create Performs initialization necessary to control the comparator.
R_COMP_Create_UserInit Performs user-defined initialization relating to the comparator.
r_compn_interrupt Performs processing in response to the comparator interrupt INTCMPn.
R_COMPn_Start Begins comparison of reference input voltage and analog input volt-age.
R_COMPn_Stop Stops comparison of reference input voltage and analog input voltage.
R_COMP_Reset Reset the comparator.
R_COMP_Set_PowerOff Halts the clock supplied to the comparator.
R20UT3127EJ0105 Rev.1.05 Page 316 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the comparator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMP_Create
void R_COMP_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 317 of 642Feb 01, 2018
Performs user-defined initialization relating to the comparator.
Remark This API function is called as the R_COMP_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMP_Create_UserInit
void R_COMP_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 318 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the comparator interrupt INTCMPn.
Remark This API function is called as the interrupt process corresponding to the comparator interrupt INTCMPn.
R20UT3127EJ0105 Rev.1.05 Page 319 of 642Feb 01, 2018
Begins comparison of reference input voltage and analog input voltage.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_COMPn_Start
void R_COMPn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 320 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Stops comparison of reference input voltage and analog input voltage.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_COMPn_Stop
void R_COMPn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 321 of 642Feb 01, 2018
Reset the comparator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMP_Reset
void R_COMP_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 322 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the comparator.
Remark Calling this API function changes the comparator to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMP_Set_PowerOff
void R_COMP_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 323 of 642Feb 01, 2018
3.2.28 Comparator/ProgrammableGainAmplifier
Below is a list of API functions output by the Code Generator for comparator/programmable gain amplifier use.
Table 3.28 API Functions: [Comparator/ProgrammableGainAmplifier]
API Function Name Function
R_COMPPGA_Create Performs initialization necessary to control the comparator/program-mable gain amplifier.
R_COMPPGA_Set_PowerOff Halts the clock supplied to the comparator/programmable gain ampli-fier.
R_COMPPGA_Create_UserInit Performs user-defined initialization relating to the comparator/pro-grammable gain amplifier.
r_compn_interrupt Performs processing in response to the comparator interrupt INTCMPn.
R_COMPn_Start Begins comparison of reference input voltage and analog input volt-age.
R_COMPn_Stop Stops comparison of reference input voltage and analog input voltage.
R_PGA_Start Starts the operation of programmable gain amplifier.
R_PGA_Stop Ends the operation of programmable gain amplifier.
R_PWMOPT_Start Supplies the clock to the 6-phase PWM option.In addition, sets the operation mode of the 6-phase PWM option.
R_PWMOPT_Stop Halts the clock supplied to the 6-phase PWM option.
R20UT3127EJ0105 Rev.1.05 Page 324 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the comparator/programmable gain amplifier.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMPPGA_Create
void R_COMPPGA_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 325 of 642Feb 01, 2018
Halts the clock supplied to the comparator/programmable gain amplifier.
Remark Calling this API function changes the comparator/programmable gain amplifier to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMPPGA_Set_PowerOff
void R_COMPPGA_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 326 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the comparator/programmable gain amplifier.
Remark This API function is called as the R_COMPPGA_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_COMPPGA_Create_UserInit
void R_COMPPGA_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 327 of 642Feb 01, 2018
Performs processing in response to the comparator interrupt INTCMPn.
Remark This API function is called as the interrupt process corresponding to the comparator interrupt INTCMPn.
r_iicmn_callback_master_sendend Performs processing in response to the simple IICmn master transmission end interrupt INTIICmn.
r_iicmn_callback_master_receiveend Performs processing in response to the simple IICmn master reception end interrupt INTIICmn.
r_iicmn_callback_master_error Performs processing in response to detection of parity error (ACK error).
API Function Name Function
R20UT3127EJ0105 Rev.1.05 Page 336 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the serial array unit.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Create
void R_SAUm_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 337 of 642Feb 01, 2018
Performs user-defined initialization related to the serial array unit.
Remark This API function is called as the R_SAUm_Create callback routine.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Create_UserInit
void R_SAUm_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 338 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset the serial array unit.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Reset
void R_SAUm_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 339 of 642Feb 01, 2018
Halts the clock supplied to the serial array unit.
Remark Calling this API function changes the serial array unit to reset status.For this reason, writes to the control registers (e.g. serial clock select register n: SPSn) after this API function is called are ignored.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Set_PowerOff
void R_SAUm_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 340 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables the switch from STOP mode to SNOOZE mode.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Set_SnoozeOn
void R_SAUm_Set_SnoozeOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 341 of 642Feb 01, 2018
Disables the switch from STOP mode to SNOOZE mode.
[Syntax]
Remark m is the unit number.
[Argument(s)]
None.
[Return value]
None.
R_SAUm_Set_SnoozeOff
void R_SAUm_Set_SnoozeOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 342 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to perform the UART communication.
Remark This API function is used as an internal function of R_SAUm_Create.For this reason, there is normally no need to call it from a user program.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTn_Create
void R_UARTn_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 343 of 642Feb 01, 2018
Performs processing in response to the UART transmission end interrupt INTSTn.
Remark This API function is called as the interrupt process corresponding to the UART transmission end interrupt INTSTn.
R20UT3127EJ0105 Rev.1.05 Page 346 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets UART communication to standby mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTn_Start
void R_UARTn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 347 of 642Feb 01, 2018
Ends UART communication.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTn_Stop
void R_UARTn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 348 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts UART data transmission.
Remarks 1. This API function repeats the byte-level UART transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. When performing a UART transmission, R_UARTn_Start must be called before this API function is called.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 349 of 642Feb 01, 2018
Starts UART data reception.
Remarks 1. This API function performs byte-level UART reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2. Actual UART reception starts after this API function is called, and R_UARTn_Start is then called.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 350 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the UART transmission end interrupt INTSTn.
Remark This API function is called as the callback routine of interrupt process r_uartn_interrupt_send corre-sponding to the UART transmission end interrupt INTSTn (performed when number of transmission data specified by R_UARTn_Send argument tx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_uartn_callback_sendend
static void r_uartn_callback_sendend ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 351 of 642Feb 01, 2018
Performs processing in response to the UART reception end interrupt INTSRn.
Remark This API function is called as the callback routine of interrupt process r_uartn_interrupt_receive corre-sponding to the UART reception end interrupt INTSRn (performed when number of received data speci-fied by R_UARTn_Receive argument rx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_uartn_callback_receiveend
static void r_uartn_callback_receiveend ( void );
R20UT3127EJ0105 Rev.1.05 Page 352 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the UART reception error interrupt INTSREn.
Remark This API function is called as the callback routine of interrupt process r_uartn_interrupt_error correspond-ing to the UART reception error interrupt INTSREn.
O uint8_t err_type; Trigger for UART reception error interrupt00000xx1B: Overrun error00000x1xB: Parity error000001xxB: Framing error
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 353 of 642Feb 01, 2018
Performs processing in response to detection of overrun error.
Remark This API function is called as the callback routine of interrupt process r_uartn_interrupt_receive corre-sponding to the UART reception end interrupt INTSRn (process performed when the amount of data received is greater than the argument rx_num specified for R_UARTn_Receive).
R20UT3127EJ0105 Rev.1.05 Page 356 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets 3-wire serial I/O communication to standby mode.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_CSImn_Start
void R_CSImn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 357 of 642Feb 01, 2018
Ends 3-wire serial I/O communication.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_CSImn_Stop
void R_CSImn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 358 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts CSI data transmission.
Remarks 1. This API function repeats the byte-level CSI transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. When performing a CSI transmission, R_CSImn_Start must be called before this API function is called.
[Syntax]
Remark m is the unit number, and n is the channel number.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 359 of 642Feb 01, 2018
Starts CSI data reception.
Remarks 1. This API function performs byte-level CSI reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2. When performing a CSI reception, R_CSImn_Start must be called before this API function is called.
[Syntax]
Remark m is the unit number, and n is the channel number.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 360 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts CSI data transmission/reception.
Remarks 1. This API function repeats the byte-level CSI transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. This API function performs byte-level CSI reception the number of times specified by the argument tx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 3. When performing a CSI reception, R_CSImn_Start must be called before this API function is called.
[Syntax]
Remark m is the unit number, and n is the channel number.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send/receive
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 361 of 642Feb 01, 2018
Performs processing in response to the CSI transmission end interrupt INTCSImn.
Remark This API function is called as the callback routine of interrupt process r_csimn_interrupt corresponding to the CSI transmission end interrupt INTCSImn (performed when number of transmission data specified by R_CSImn_Send or R_CSImn_Send_Receive argument tx_num has been completed).
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_csimn_callback_sendend
static void r_csimn_callback_sendend ( void );
R20UT3127EJ0105 Rev.1.05 Page 362 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the CSI reception end interrupt INTCSImn.
Remark This API function is called as the callback routine of interrupt process r_csimn_interrupt corresponding to the CSI reception end interrupt INTCSImn (performed when number of received data specified by R_CSImn_Receive or R_CSImn_Send_Receive argument rx_num has been completed).
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_csimn_callback_receiveend
static void r_csimn_callback_receiveend ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 363 of 642Feb 01, 2018
Performs processing in response to the CSI reception error interrupt INTSREn.
Remark This API function is called as the callback routine of interrupt process r_uartn_interrupt_error correspond-ing to the CSI reception error interrupt INTSREn.
[Syntax]
Remark m is the unit number, and n is the channel number.
R20UT3127EJ0105 Rev.1.05 Page 366 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Generates start conditions.
Remark This API function is used as an internal function of R_IICmn_Master_Send and R_IICmn_Master_Receive.For this reason, there is normally no need to call it from a user program.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICmn_StartCondition
void R_IICmn_StartCondition ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 367 of 642Feb 01, 2018
Generates stop conditions.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICmn_StopCondition
void R_IICmn_StopCondition ( void );
R20UT3127EJ0105 Rev.1.05 Page 368 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends simple IIC communication.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICmn_Stop
void R_IICmn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 369 of 642Feb 01, 2018
Starts simple IIC master transmission.
Remark This API function repeats the byte-level simple IIC master transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
Remark Below is shown the format for specifying device address adr.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
7
Device address
Device typeSlave address
B0B1B2B3B4B5B6B70
R20UT3127EJ0105 Rev.1.05 Page 370 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts simple IIC master reception.
Remark This API function performs byte-level simple IIC master reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
[Syntax]
Remark m is the unit number, and n is the channel number.
[Argument(s)]
Remark Below is shown the format for specifying device address adr.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
7
Device address
Device typeSlave address
B0B1B2B3B4B5B6B70
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 371 of 642Feb 01, 2018
Performs processing in response to the simple IICmn master transmission end interrupt INTIICmn.
Remark This API function is called as the callback routine of interrupt process r_iicmn_interrupt corresponding to the simple IICmn master transmission end interrupt INTIICmn (performed when number of transmission data specified by R_IICmn_Master_Send argument tx_num has been completed).
[Syntax]
Remark m is the unit number, and n is the channel number.
R20UT3127EJ0105 Rev.1.05 Page 372 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the simple IICmn master reception end interrupt INTIICmn.
Remark This API function is called as the callback routine of interrupt process r_iicmn_interrupt corresponding to the simple IICmn master reception end interrupt INTIICmn (performed when number of received data specified by R_IICmn_Master_Receive argument rx_num has been completed).
[Syntax]
Remark m is the unit number, and n is the channel number.
R20UT3127EJ0105 Rev.1.05 Page 379 of 642Feb 01, 2018
Sets DALI communication to standby mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DALIn_Start
void R_DALIn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 380 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends DALI communication.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DALIn_Stop
void R_DALIn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 381 of 642Feb 01, 2018
Starts DALI data transmission.
Remarks 1. This API function repeats the byte-level DALI transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. When performing a DALI transmission, R_DALIn_Start must be called before this API function is called.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 382 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts DALI data reception.
Remarks 1. This API function performs byte-level DALI reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2. Actual DALI reception starts after this API function is called, and R_DALIn_Start is then called.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 383 of 642Feb 01, 2018
Performs processing in response to the DALI transmission end interrupt INTSTDLn.
Remark This API function is called as the callback routine of interrupt process r_dalin_interrupt_send correspond-ing to the DALI transmission end interrupt INTSTDLn (performed when number of transmission data specified by R_DALIn_Send argument tx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_dalin_callback_sendend
static void r_dalin_callback_sendend ( void );
R20UT3127EJ0105 Rev.1.05 Page 384 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the DALI reception end interrupt INTSRDLn.
Remark This API function is called as the callback routine of interrupt process r_dalin_interrupt_receive corre-sponding to the DALI reception end interrupt INTSRDLn (performed when number of received data spec-ified by R_DALIn_Receive argument rx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_dalin_callback_receiveend
static void r_dalin_callback_receiveend ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 385 of 642Feb 01, 2018
Performs processing in response to the DALI reception error interrupt INTSREDLn.
Remark This API function is called as the callback routine of interrupt process r_dalin_interrupt_error correspond-ing to the DALI reception error interrupt INTSREDLn.
O uint8_t err_type; Trigger for DALI reception error interrupt00000xx1B: Overrun error00000x1xB: Parity error000001xxB: Framing error
R20UT3127EJ0105 Rev.1.05 Page 386 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to detection of overrun error.
Remark This API function is called as the callback routine of interrupt process r_dalin_interrupt_receive corre-sponding to the DALI reception end interrupt INTSRDLn (process performed when the amount of data received is greater than the argument rx_num specified for R_DALIn_Receive).
R20UT3127EJ0105 Rev.1.05 Page 393 of 642Feb 01, 2018
Sets LIN communication to standby mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTFn_Start
void R_UARTFn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 394 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends LIN communication.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTFn_Stop
void R_UARTFn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 395 of 642Feb 01, 2018
Halts the clock supplied to the asynchronous serial interface LIN-UART (UARTF).
Remark Calling this API function changes the asynchronous serial interface LIN-UART (UARTF) to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTFn_Set_PowerOff
void R_UARTFn_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 396 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts UARTF data transmission.
Remarks 1. This API function repeats the byte-level UARTF transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. When performing a UARTF transmission, R_UARTFn_Start must be called before this API function is called.
Remarks 3. If the asynchronous serial interface LIN-UART (UARTF) is used in expansion bit mode, then store the data to send in the buffer specified by argument tx_buf, in the following format."8-bit data", "Expansion bit", "8-bit data", "Expansion bit", ...
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
MD_DATAEXISTS Executing transmission process
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 397 of 642Feb 01, 2018
Starts UARTF data reception.
Remarks 1. This API function performs byte-level UARTF reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2. Actual UARTF reception starts after this API function is called, and R_UARTFn_Start is then called.
Remarks 3. If the asynchronous serial interface LIN-UART (UARTF) is used in expansion bit mode, then the received data is stored in the buffer specified by argument rx_buf, in the following format."8-bit data", "Expansion bit", "8-bit data", "Expansion bit", ...
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 398 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts the data comparison.
Remark Calling this API function switches the asynchronous serial interface LIN-UART (UARTF) to expansion bit mode (with data comparison).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTFn_Set_DataComparisonOn
void R_UARTFn_Set_DataComparisonOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 399 of 642Feb 01, 2018
Ends the data comparison.
Remark Calling this API function switches the asynchronous serial interface LIN-UART (UARTF) to expansion bit mode (with no data comparison).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTFn_Set_DataComparisonOff
void R_UARTFn_Set_DataComparisonOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 400 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the LIN-UART transmission end interrupt INTLT.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_send corre-sponding to the LIN-UART transmission end interrupt INTLT (performed when number of transmission data specified by R_UARTFn_Send argument tx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_uartfn_callback_sendend
static void r_uartfn_callback_sendend ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 401 of 642Feb 01, 2018
Performs processing in response to the LIN-UART reception end interrupt INTLR.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_receive corre-sponding to the LIN-UART reception end interrupt INTLR (performed when number of received data specified by R_UARTFn_Receive argument rx_num has been completed).
R20UT3127EJ0105 Rev.1.05 Page 402 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the LIN-UART reception status interrupt INTLS.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_error corre-sponding to the LIN-UART reception status interrupt INTLS.
O uint8_t err_type; Trigger for LIN-UART reception status interrupt00000xx1B: Overrun error00000x1xB: Parity error000001xxB: Framing error
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 403 of 642Feb 01, 2018
Performs processing in response to detection of overrun error.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_receive corre-sponding to the LIN-UART reception end interrupt INTLR (performed when number of received data specified by R_UARTFn_Receive argument rx_num has been completed).
R20UT3127EJ0105 Rev.1.05 Page 404 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to detection of expansion bit.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_error corre-sponding to the LIN-UART reception status interrupt INTLS (performed when expansion bit has been detected).
R20UT3127EJ0105 Rev.1.05 Page 405 of 642Feb 01, 2018
Performs processing in response to match ID parity.
Remark This API function is called as the callback routine of interrupt process r_uartfn_interrupt_error corre-sponding to the LIN-UART reception status interrupt INTLS (performed when ID parity has been matched).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_uartfn_callback_idmatch
static void r_uartfn_callback_idmatch ( void );
R20UT3127EJ0105 Rev.1.05 Page 406 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.32 Serial interface IICA
Below is a list of API functions output by the Code Generator for serial interface IICA use.
Table 3.32 API Functions: [Serial Interface IICA]
API Function Name Function
R_IICAn_Create Performs initialization necessary to control the serial interface IICA.
R_IICAn_Create_UserInit Performs user-defined initialization related to the serial interface IICA.
r_iican_interrupt Performs processing in response to the IICA communication end inter-rupt INTIICAn.
R_IICAn_StopCondition Generates stop conditions.
R_IICAn_Stop Ends IICA communication.
R_IICAn_Reset Reset the serial interface IICA.
R_IICAn_Set_PowerOff Halts the clock supplied to the serial interface IICA.
R20UT3127EJ0105 Rev.1.05 Page 410 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Generates stop conditions.
Remark After calling this API function, please confirm a detection of stop condition by SPD0 bit before stopping IICA.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_StopCondition
void R_IICAn_StopCondition ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 411 of 642Feb 01, 2018
Ends IICA communication.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Stop
void R_IICAn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 412 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Reset the serial interface IICA.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Reset
void R_IICAn_Reset ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 413 of 642Feb 01, 2018
Halts the clock supplied to the serial interface IICA.
Remark Calling this API function changes the serial interface IICA to reset status.For this reason, writes to the control registers (e.g. IICA control register n: IICCTLn) after this API func-tion is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Set_PowerOff
void R_IICAn_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 414 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts IICA master transmission.
Remark This API function repeats the byte-level IICA master transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
I uint8_t wait; Setup time of start conditions
Macro Description
MD_OK Normal completion
MD_ERROR1 Bus communication status
MD_ERROR2 Bus not released status
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 415 of 642Feb 01, 2018
Starts IICA master reception.
Remark This API function performs byte-level IICA master reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
I uint8_t wait; Setup time of start conditions
Macro Description
MD_OK Normal completion
MD_ERROR1 Bus communication status
MD_ERROR2 Bus not released status
R20UT3127EJ0105 Rev.1.05 Page 416 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the IICA master transmission end interrupt INTIICAn.
Remark This API function is called as the callback routine of interrupt process r_iican_interrupt corresponding to the IICA master transmission end interrupt INTIICAn.
R20UT3127EJ0105 Rev.1.05 Page 417 of 642Feb 01, 2018
Performs processing in response to the IICA master reception end interrupt INTIICAn.
Remark This API function is called as the callback routine of interrupt process r_iican_interrupt corresponding to the IICA master reception end interrupt INTIICAn.
R20UT3127EJ0105 Rev.1.05 Page 418 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to detection of IICA master communication error.
[Syntax]
Remark n is the channel number.
[Argument(s)]
[Return value]
None.
r_iican_callback_master_error
#include "r_cg_macrodriver.h"static void r_iican_callback_master_error ( MD_STATUS flag );
I/O Argument Description
I MD_STATUS flag; Cause of communication errorMD_SPT: Stop condition detectedMD_NACK: Acknowledge not detected(No slave that matches the address/A slave can receive no more data or does not require the next data)
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 419 of 642Feb 01, 2018
Starts IICA slave transmission.
Remark This API function repeats the byte-level IICA slave transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
R20UT3127EJ0105 Rev.1.05 Page 420 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts IICA slave reception.
Remark This API function performs byte-level IICA slave reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 421 of 642Feb 01, 2018
Performs processing in response to the IICA slave transmission end interrupt INTIICAn.
Remark This API function is called as the callback routine of interrupt process r_iican_interrupt corresponding to the IICA slave transmission end interrupt INTIICAn.
R20UT3127EJ0105 Rev.1.05 Page 422 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the IICA slave reception end interrupt INTIICAn.
Remark This API function is called as the callback routine of interrupt process r_iican_interrupt corresponding to the IICA slave reception end interrupt INTIICAn.
R20UT3127EJ0105 Rev.1.05 Page 425 of 642Feb 01, 2018
Enables operation of the address match wakeup function in STOP mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Set_SnoozeOn
void R_IICAn_Set_SnoozeOn ( void );
R20UT3127EJ0105 Rev.1.05 Page 426 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables operation of the address match wakeup function in STOP mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Set_SnoozeOff
void R_IICAn_Set_SnoozeOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 427 of 642Feb 01, 2018
Enables operation of the address match wakeup function in STOP mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Set_WakeupOn
void R_IICAn_Set_WakeupOn ( void );
R20UT3127EJ0105 Rev.1.05 Page 428 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables operation of the address match wakeup function in STOP mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_IICAn_Set_WakeupOff
void R_IICAn_Set_WakeupOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 429 of 642Feb 01, 2018
3.2.33 LCD controller/driver
Below is a list of API functions output by the Code Generator for LCD controller/driver use.
Table 3.33 API Functions: [LCD Controller/Driver]
API Function Name Function
R_LCD_Create Performs initialization necessary to control the LCD controller/driver.
R_LCD_Create_UserInit Performs user-defined initialization relating to the LCD controller/driver.
r_lcd_interrupt Performs processing in response to the LCD frame interrupt INTLCD.
R_LCD_Start Sets the LCD controller/driver to display on status.
R_LCD_Stop Sets the LCD controller/driver to display off status.
R_LCD_Set_VoltageOn Enables operation of internal voltage boost circuit and capacitor split cir-cuit.
R_LCD_Set_VoltageOff Disables operation of internal voltage boost circuit and capacitor split cir-cuit.
R_LCD_Set_PowerOff Halts the clock supplied to the LCD controller/driver.
R_LCD_VoltageOn Enables operation of internal voltage boost circuit and capacitor split cir-cuit.
R_LCD_VoltageOff Disables operation of internal voltage boost circuit and capacitor split cir-cuit.
R20UT3127EJ0105 Rev.1.05 Page 430 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the LCD controller/driver.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Create
void R_LCD_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 431 of 642Feb 01, 2018
Performs user-defined initialization relating to the LCD controller/driver.
Remark This API function is called as the R_LCD_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Create_UserInit
void R_LCD_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 432 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the LCD frame interrupt INTLCD.
Remark This API function is called as the interrupt process corresponding to the LCD frame interrupt INTLCD.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_lcd_interrupt
__interrupt static void r_lcd_interrupt ( void );
static void __near r_lcd_interrupt ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 433 of 642Feb 01, 2018
Sets the LCD controller/driver to display on status.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Start
void R_LCD_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 434 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets the LCD controller/driver to display off status.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Stop
void R_LCD_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 435 of 642Feb 01, 2018
Enables operation of internal voltage boost circuit and capacitor split circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Set_VoltageOn
void R_LCD_Set_VoltageOn ( void );
R20UT3127EJ0105 Rev.1.05 Page 436 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables operation of internal voltage boost circuit and capacitor split circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Set_VoltageOff
void R_LCD_Set_VoltageOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 437 of 642Feb 01, 2018
Halts the clock supplied to the LCD controller/driver.
Remarks 1. Calling this API function changes the LCD controller/driver to reset status.For this reason, writes to the control registers after this API function is called are ignored.
Remarks 2. This API function stops the clock supply to the LCD controller/driver, by operating the RTCEN bit of peripheral enable register n.For this reason, this API function also stops the clock supply to other peripheral devices sharing the RTCEN bit (e.g. real-time clock).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_Set_PowerOff
void R_LCD_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 438 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of internal voltage boost circuit and capacitor split circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_VoltageOn
void R_LCD_VoltageOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 439 of 642Feb 01, 2018
Disables operation of internal voltage boost circuit and capacitor split circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_LCD_VoltageOff
void R_LCD_VoltageOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 440 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.34 Sound generator
Below is a list of API functions output by the Code Generator for sound generator use.
Table 3.34 API Functions: [Sound Generator]
API Function Name Function
R_SG_Create Performs initialization necessary to control the sound generator.
R_SG_Create_UserInit Performs user-defined initialization relating to the sound generator.
r_sg_interrupt Performs processing in response to the threshold value detection of the logarithmic decrement interrupt INTSG.
R_SG_Start Enables operation of sound generator.
R_SG_Stop Disables operation of sound generator.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 441 of 642Feb 01, 2018
Performs initialization necessary to control the sound generator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SG_Create
void R_SG_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 442 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the sound generator.
Remark This API function is called as the R_SG_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SG_Create_UserInit
void R_SG_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 443 of 642Feb 01, 2018
Performs processing in response to the threshold value detection of the logarithmic decrement interrupt INTSG.
Remark This API function is called as the interrupt process corresponding to the threshold value detection of the logarithmic decrement interrupt INTSG.
[Syntax]
CA78K0R Compiler
CC-RL Compiler
[Argument(s)]
None.
[Return value]
None.
r_sg_interrupt
__interrupt static void r_sg_interrupt ( void );
static void __near r_sg_interrupt ( void );
R20UT3127EJ0105 Rev.1.05 Page 444 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of sound generator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SG_Start
void R_SG_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 445 of 642Feb 01, 2018
Disables operation of sound generator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SG_Stop
void R_SG_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 446 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.35 DMA controller
Below is a list of API functions output by the Code Generator for DMA controller use.
Table 3.35 API Functions: [DMA Controller]
API Function Name Function
R_DMACn_Create Performs initialization necessary to control the DMA controller.
R_DMACn_Create_UserInit Performs user-defined initialization relating to the DMA controller.
R_DMAC_Create Performs initialization necessary to control the DMA controller.
R_DMAC_Create_UserInit Performs user-defined initialization relating to the DMA controller.
r_dmacn_interrupt Performs processing in response to the DMA transfer end interrupt INTDMAn.
R20UT3127EJ0105 Rev.1.05 Page 452 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of channel n.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DMACn_Start
void R_DMACn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 453 of 642Feb 01, 2018
Disables operation of channel n.
Remarks 1. This API function does not forcibly terminate DMA transfer.
Remarks 2. Before using this API function, you must confirm that transmission has ended.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DMACn_Stop
void R_DMACn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 454 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts DMA transfer.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DMACn_Set_SoftwareTriggerOn
void R_DMACn_Set_SoftwareTriggerOn ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 455 of 642Feb 01, 2018
3.2.36 Data transfer controller
Below is a list of API functions output by the Code Generator for Data transfer controller use.
Table 3.36 API Functions: [Data transfer controller]
API Function Name Function
R_DTC_Create Performs initialization necessary to control the Data transfer controller.
R_DTC_Create_UserInit Performs user-defined initialization relating to the Data transfer controller.
R_DTCn_Start Enables operation of the Data transfer controller.
R_DTCn_Stop Disables operation of the Data transfer controller.
R_DTC_Set_PowerOff Halts the clock supplied to the Data transfer controller.
R_DTCDn_Start Enables operation of the Data transfer controller.
R_DTCDn_Stop Disables operation of the Data transfer controller.
R20UT3127EJ0105 Rev.1.05 Page 456 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the DTC.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DTC_Create
void R_DTC_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 457 of 642Feb 01, 2018
Performs user-defined initialization relating to the DTC.
Remark This API function is called as the R_DTC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DTC_Create_UserInit
void R_DTC_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 458 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of the DTC.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DTCn_Start
void R_DTCn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 459 of 642Feb 01, 2018
Disables operation of the DTC.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DTCn_Stop
void R_DTCn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 460 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the DTC.
Remark Calling this API function changes the DTC to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DTC_Set_PowerOff
void R_DTC_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 461 of 642Feb 01, 2018
Enables operation of the DTC.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DTCDn_Start
void R_DTCDn_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 462 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables operation of the DTC.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_DTCDn_Stop
void R_DTCDn_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 463 of 642Feb 01, 2018
3.2.37 Event link controller
Below is a list of API functions output by the Code Generator for event link controller (ELC) use.
Table 3.37 API Functions: [Event Link Controller]
API Function Name Function
R_ELC_Create Performs initialization necessary to control the event link controller (ELC).
R_ELC_Create_UserInit Performs user-defined initialization relating to the event link controller (ELC).
R_ELC_Stop Disables operation of the event link controller (ELC).
R20UT3127EJ0105 Rev.1.05 Page 464 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the event link controller (ELC).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ELC_Create
void R_ELC_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 465 of 642Feb 01, 2018
Performs user-defined initialization relating to the event link controller (ELC).
Remark This API function is called as the R_ELC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_ELC_Create_UserInit
void R_ELC_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 466 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Disables operation of the event link controller (ELC).
[Syntax]
[Argument(s)]
Remark Below is shown the format for specifying disabled event source event.In case of setting the event to 0x01010101, the event link operations of event source 00, 08, 16, 24 are prohibited.
[Return value]
None.
R_ELC_Stop
void R_ELC_Stop ( uint32_t event );
I/O Argument Description
I uint32_t event; Disabled event source
031B0B24B31
Event source 00
... ...
B25
Event source 24
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 467 of 642Feb 01, 2018
3.2.38 Interrupt functions
Below is a list of API functions output by the Code Generator for interrupt functions use.
Table 3.38 API Functions: [Interrupt Functions]
API Function Name Function
R_INTC_Create Performs initialization necessary to control the interrupt functions.
R_INTC_Create_UserInit Performs user-defined initialization relating to the interrupt functions.
r_intcn_interrupt Performs processing in response to the external maskable interrupt INTPn.
R_INTCn_Start Enables the acceptance of the external maskable interrupts INTPn.
R_INTCn_Stop Disables the acceptance of the external maskable interrupts INTPn.
r_intclrn_interrupt Performs processing in response to the external maskable interrupt INTPLRn.
R_INTCLRn_Start Enables the acceptance of the external maskable interrupts INTPLRn.
R_INTCLRn_Stop Disables the acceptance of the external maskable interrupts INTPLRn.
r_intrtcicn_interrupt Performs processing in response to the external maskable interrupt INTRTCICn.
R_INTRTCICn_Start Enables the acceptance of the external maskable interrupts INTRTCICn.
R_INTRTCICn_Stop Disables the acceptance of the external maskable interrupts INTRTCICn.
R_INTFO_Start Enables the acceptance of the external maskable interrupts INTFO.
R_INTFO_Stop Disables the acceptance of the external maskable interrupts INTFO.
R_INTFO_ClearFlag Clears INTFCLR flag of Interrupt flag output control register 1 (INTFOCTL1).
r_intfo_interrupt Performs processing in response to the external maskable interrupt INTFO.
R20UT3127EJ0105 Rev.1.05 Page 468 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the interrupt functions.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_INTC_Create
void R_INTC_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 469 of 642Feb 01, 2018
Performs user-defined initialization relating to the interrupt functions.
Remark This API function is called as the R_INTC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_INTC_Create_UserInit
void R_INTC_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 470 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the external maskable interrupt INTPn.
Remark This API function is called as the interrupt process corresponding to the external maskable interrupt INTPn.
R20UT3127EJ0105 Rev.1.05 Page 520 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables operation of oscillation stop detector.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_OSDC_Start
void R_OSDC_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 521 of 642Feb 01, 2018
Disables operation of oscillation stop detector.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_OSDC_Stop
void R_OSDC_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 522 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the oscillation stop detector.
Remark Calling this API function changes the oscillation stop detector to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_OSDC_Set_PowerOff
void R_OSDC_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 523 of 642Feb 01, 2018
Reset the oscillation stop detector.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_OSDC_Reset
void R_OSDC_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 524 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.43 SPI interface
Below is a list of API functions output by the Code Generator for SPI interface use.
Table 3.43 API Functions: [SPI Interface]
API Function Name Function
R_SAIC_Create Performs initialization necessary to control the SPI interface.
R_SAIC_Create_UserInit Performs user-defined initialization relating to the SPI interface.
R_SAIC_Write Starts SPI data transmission.
R_SAIC_Read Starts SPI data reception.
R_SPI_Create Performs initialization necessary to control the SPI interface.
R_SPI_Create_UserInit Performs user-defined initialization relating to the SPI interface.
R_SPI_Write Starts SPI data transmission.
R_SPI_Read Starts SPI data reception.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 525 of 642Feb 01, 2018
Performs initialization necessary to control the SPI interface.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SAIC_Create
void R_SAIC_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 526 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the SPI interface.
Remark This API function is called as the R_SAIC_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_SAIC_Create_UserInit
void R_SAIC_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 527 of 642Feb 01, 2018
I doc_mode_t mode; Operation mode of data operation circuitADDTION: Data addition modeSUBTRACTION: Data subtraction modeCOMPARE_MATCH: Data comparison mode (Detection Condition: Data match is detected)COMPARE_MISMATCH: Data subtraction mode (Detection Condition: Data mismatch is detected)
I uint16_t value; Data addition and data subtraction : Results of operationsData comparison : 16-bit data for use as a reference
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 547 of 642Feb 01, 2018
Writes new data to compare, add or subtract.
Remark Write data to DODIR register.
[Syntax]
[Argument(s)]
[Return value]
None.
R_DOC_WriteData
#include “r_cg_macrodriver.h”void R_DOC_WriteData ( uint16_t data );
I/O Argument Description
O uint16_t data; data to compare, add or subtract
R20UT3127EJ0105 Rev.1.05 Page 548 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Gets result of addition or subtraction.
[Syntax]
[Argument(s)]
[Return value]
None.
R_DOC_GetResult
#include “r_cg_macrodriver.h”void R_DOC_GetResult ( uint16_t *const data );
I/O Argument Description
O uint16_t *const data pointer to where result will be stored
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 549 of 642Feb 01, 2018
Clears DOPCF flag of DOC control register (DOCR).
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DOC_ClearFlag
void R_DOC_ClearFlag ( void );
R20UT3127EJ0105 Rev.1.05 Page 550 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Stops the clock supplied for data operation circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DOC_Set_PowerOff
void R_DOC_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 551 of 642Feb 01, 2018
Resets Data operation circuit module.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_DOC_Reset
void R_DOC_Reset ( void );
R20UT3127EJ0105 Rev.1.05 Page 552 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.46 32-bit Multiply-accumulator
Below is a list of API functions output by the Code Generator for 32-bit Multiply-accumulator use.
Table 3.46 API Functions: [32-bit Multiply-accumulator]
API Function Name Function
R_MAC32Bit_Create Performs initialization necessary to control the data operation circuit.
R_MAC32Bit_Create_UserInit Performs user-defined initialization related to the data operation circuit.
r_mac32bit_interrupt_flow Performs processing in response to the DOC operation result detection interrupt INTDOC.
R_MAC32Bit_Reset Gets result of addition or subtraction.
R_MAC32Bit_Set_PowerOff Clears DOPCF flag of DOC control register (DOCR).
R_MAC32bit_MULUnsigned Operates the unsigned multiply.
R_MAC32Bit_MULSigned Operates the signed multiply.
R_MAC32Bit_MACUnsigned Operates the unsigned multiply-accumulate.
R_MAC32Bit_MACSigned Operates the signed multiply-accumulate.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 553 of 642Feb 01, 2018
Performs initialization necessary to control the 32-bit Multiply-accumulator.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_MAC32Bit_Create
void R_MAC32Bit_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 554 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization relating to the 32-bit Multiply-accumulator.
Remark This API function is called as the R_MAC32Bit_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_MAC32Bit_Create_UserInit
void R_MAC32Bit_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 555 of 642Feb 01, 2018
Performs processing in response to the 32-bit Multiply-accumulator interrupt INTMACLOF.
Remark This API function is called as the interrupt process corresponding to the 32-bit Multiply-accumulator inter-rupt INTMACLOF.
R20UT3127EJ0105 Rev.1.05 Page 566 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts A/D conversion.
Remark About 1 micro second of stabilization time is required when changing the voltage converter from opera-tion stopped to operation enabled status.Consequently, about 1 micro second must be left free between the call to R_12ADC_Create and the call to this API function.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12ADC_Start
void R_12ADC_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 567 of 642Feb 01, 2018
Ends A/D conversion.
Remark The voltage converter continues to operate after the process of this API function completes.Consequently, to stop the operation of the voltage converter, you must call R_12ADC_Set_PowerOff after the process of this API function completes.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12ADC_Stop
void R_12ADC_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 568 of 642Feb 01, 2018
O uint16_t * const buffer; Pointer to area in which to store read results of A/D conversion
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 569 of 642Feb 01, 2018
Configures the analog voltage input pin for A/D conversion.
Remark The value specified in argument channel is set to A/D channel select register A0 (ADANSA0) or A/D con-version extended input control register (ADEXICR).
[Syntax]
[Argument(s)]
Remark See the header file r_cg_12adc.h for details about the analog voltage input pin ADCHANNELn.
[Return value]
R_12ADC_Set_ADChannel
#include "r_cg_macrodriver.h"#include "r_cg_12adc.h"MD_STATUS R_12ADC_Set_ADChannel ( ad_sel_register_t register, uint16_t data );
I/O Argument Description
I ad_sel_register_t register; Set to selected registerSEL_ADANSA0: A/D channel select register A0 (ADANSA0)SEL_ADEXICR: A/D conversion extended input con-trol register (ADEXICR)
I uint16_t data; Set to selected register value
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 570 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Enables 12-bit A/D converter temperature sensor output circuit.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12ADC_TemperatureSensorOutput_On
void R_12ADC_TemperatureSensorOutput_On ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 571 of 642Feb 01, 2018
Disables 12-bit A/D converter temperature sensor output circuit.
R20UT3127EJ0105 Rev.1.05 Page 574 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 12-bit A/D converter.
Remark Calling this API function changes the A/D converter to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12ADC_Set_PowerOff
void R_12ADC_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 575 of 642Feb 01, 2018
3.2.48 12-bit D/A converter
Below is a list of API functions output by the Code Generator for 12-bit D/A converter use.
Table 3.48 API Functions: [12-bit D/A Converter]
API Function Name Function
R_12DA_Create Performs initialization necessary to control the 12-bit D/A converter.
R_12DA_Create_UserInit Performs user-defined initialization relating to the 12-bit D/A converter.
R_12DAn_Start Starts D/A conversion.
R_12DAn_Stop Ends D/A conversion.
R_12DA_Set_PowerOff Halts the clock supplied to the 12-bit D/A converter.
R_12DAn_Set_ConversionValue Sets the analog voltage output to the ANOn pin.
R20UT3127EJ0105 Rev.1.05 Page 576 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs initialization necessary to control the 12-bit D/A converter.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12DA_Create
void R_12DA_Create ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 577 of 642Feb 01, 2018
Performs user-defined initialization relating to the 12-bit D/A converter.
Remark This API function is called as the R_12DA_Create callback routine.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12DA_Create_UserInit
void R_12DA_Create_UserInit ( void );
R20UT3127EJ0105 Rev.1.05 Page 578 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts D/A conversion.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_12DAn_Start
void R_12DAn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 579 of 642Feb 01, 2018
Ends D/A conversion.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_12DAn_Stop
void R_12DAn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 580 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the 12-bit D/A converter.
Remark Calling this API function changes the 12-bit D/A converter to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_12DA_Set_PowerOff
void R_12DA_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 581 of 642Feb 01, 2018
R20UT3127EJ0105 Rev.1.05 Page 609 of 642Feb 01, 2018
Starts A/D External signal sanpling.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_EXSD_Start
void R_EXSD_Start ( void );
R20UT3127EJ0105 Rev.1.05 Page 610 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Ends External signal sampling.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_EXSD_Stop
void R_EXSD_Stop ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 611 of 642Feb 01, 2018
Halts the clock supplied to the External signal sampler.
Remark Calling this API function changes the External signal sampler to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
[Argument(s)]
None.
[Return value]
None.
R_EXSD_Set_PowerOff
void R_EXSD_Set_PowerOff ( void );
R20UT3127EJ0105 Rev.1.05 Page 612 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
3.2.53 Serial interface UARTMG
Below is a list of API functions output by the Code Generator for serial interface UARTMG use.
Table 3.53 API Functions: [Serial interface UARTMG]
API Function Name Function
R_UARTMGn_Create Performs initialization necessary to control the serial interface UARTMG.
R_UARTMGn_Create_UserInit Performs user-defined initialization related to the serial interface UARTMG.
r_uartmgn_interrupt_send Performs processing in response to the UARTMG transmissioncompletion interrupt INTSTMGn.
r_uartmgn_interrupt_receive Performs processing in response to the UARTMG reception completion interrupt INTSRMGn.
r_uartmgn_interrupt_error Perfomrs processing in response to the UARTMG reception errorinterrupt INTSREMGn.
R_UARTMGn_Start Sets UARTMG communication to standby mode..
R_UARTMGn_Stop Ends UARTMG communication.
R_UARTMGn_Set_PowerOff Halts the clock supplied to the serial interface UARTMG.
R_UARTMGn_Send Starts UARTMG data transmission.
R_UARTMGn_Receive Starts UARTMG data reception.
r_uartmgn_callback_sendend Performs processing in response to the UARTMG transmission comple-tion interrupt INTSTMGn.
r_uartn_callback_receiveend Performs processing in response to the UARTMG reception completion interrupt INTSRMGn.
r_uartmgn_callback_error Performs processing in response to the UARTMG reception error inter-rupt INTSREMGn.
r_uartmgn_callback_softwareoverrun Performs processing in response to detection of overrun error.
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 613 of 642Feb 01, 2018
Performs initialization necessary to control the serial interface UARTMG.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTMGn_Create
void R_UARTMGn_Create ( void );
R20UT3127EJ0105 Rev.1.05 Page 614 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs user-defined initialization related to the serial interface UARTMG.
Remark This API function is called as the R_UARTMGn_Create callback routine.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTMGn_Create_UserInit
void R_UARTMGn_Create_UserInit ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 615 of 642Feb 01, 2018
Performs processing in response to the UARTMG transmission completion interrupt INTSTMGn.
Remark This API function is called as the interrupt process corresponding to the UARTMG transmissioncompletion interrupt INTSTMGn.
R20UT3127EJ0105 Rev.1.05 Page 618 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Sets UARTMG communication to standby mode.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTMGn_Start
void R_UARTMGn_Start ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 619 of 642Feb 01, 2018
Ends UARTMG communication.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTMGn_Stop
void R_UARTMGn_Stop ( void );
R20UT3127EJ0105 Rev.1.05 Page 620 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Halts the clock supplied to the serial interface UARTMG.
Remark Calling this API function changes the serial interface UARTMG to reset status.For this reason, writes to the control registers after this API function is called are ignored.
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
R_UARTMGn_Set_PowerOff
void R_UARTMGn_Set_PowerOff ( void );
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 621 of 642Feb 01, 2018
Starts UARTMG data transmission.
Remarks 1. This API function repeats the byte-level UART transmission from the buffer specified in argument tx_buf the number of times specified in argument tx_num.
Remarks 2. When performing a UART transmission, R_UARTMGn_Start must be called before this API function is called.
I uint8_t * const tx_buf; Pointer to a buffer storing the transmission data
I uint16_t tx_num; Total amount of data to send
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
R20UT3127EJ0105 Rev.1.05 Page 622 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Starts UARTMG data reception.
Remarks 1. This API function performs byte-level UART reception the number of times specified by the argument rx_num, and stores the data in the buffer specified by the argument rx_buf.
Remarks 2. Actual UART reception starts after this API function is called, and R_UARTMGn_Start is then called.
O uint8_t * const rx_buf; Pointer to a buffer to store the received data
I uint16_t rx_num; Total amount of data to receive
Macro Description
MD_OK Normal completion
MD_ARGERROR Invalid argument specification
e2 studio Code Generator Tool 3. API FUNCTIONS
R20UT3127EJ0105 Rev.1.05 Page 623 of 642Feb 01, 2018
Performs processing in response to the UARTMG transmission complition interrupt INTSTMGn.
Remark This API function is called as the callback routine of interrupt process r_uartmgn_interrupt_send corre-sponding to the UARTMG transmission completion interrupt INTSTMGn (performed when number of transmission data specified by R_UARTMGn_Send argument tx_num has been completed).
[Syntax]
Remark n is the channel number.
[Argument(s)]
None.
[Return value]
None.
r_uartmgn_callback_sendend
static void r_uartmgn_callback_sendend ( void );
R20UT3127EJ0105 Rev.1.05 Page 624 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to the UARTMG reception completion interrupt INTSRMGn.
Remark This API function is called as the callback routine of interrupt process r_uartmgn_interrupt_receive corre-sponding to the UARTMG reception completion interrupt INTSRMGn (performed when number of received data specified by R_UARTMGn_Receive argument rx_num has been completed).
R20UT3127EJ0105 Rev.1.05 Page 625 of 642Feb 01, 2018
Performs processing in response to the UARTMG reception error interrupt INTSREMGn.
Remark This API function is called as the callback routine of interrupt process r_uartmgn_interrupt_error corre-sponding to the UARTMG reception error interrupt INTSREMGn.
O uint8_t err_type; Trigger for UART reception error interrupt00000xx1B: Overrun error00000x1xB: Parity error000001xxB: Framing error
R20UT3127EJ0105 Rev.1.05 Page 626 of 642Feb 01, 2018
e2 studio Code Generator Tool 3. API FUNCTIONS
Performs processing in response to detection of overrun error.
Remark This API function is called as the callback routine of interrupt process r_uartmgn_interrupt_receive corre-sponding to the UARTMG reception end interrupt INTSRMGn (process performed when the amount of data received is greater than the argument rx_num specified for R_UARTMGn_Receive).
3.2.49.Operational amplifier and Analog switchchapter additionAPI addition・R_AMPANSW_Create・R_AMPANSW_Create_UserInit・R_OPAMPm_Set_ReferenceCircuitOn・R_OPAMPm_Set_ReferenceCircuitOff・R_OPAMPm_Start・R_OPAMPm_Stop・R_ANSW_ChargePumpm_On・R_ANSW_ChargePumpm_Off