Everything

Usage example

Set the flag to notify switching to battery backup mode.

 

[GUI setting example]

Battery backup function

Used

KEYBATTERYBACKUP

Used

Power switching operation setting

Used

Generate an interrupt when power is switched  (INTVBAT)

Used

Power switching interrupt selection

Interrupt generated when VDD is switched to VBAT

Priority

Low

 

 

[API setting example]

r_cg_main.c

void main(void)

{

       R_MAIN_UserInit();

       /* Start user code. Do not edit comment generated here */

       /* Start battery backup module operation */

       R_BUP_Start();

 

       while (1U)

       {

              ;

       }

       /* End user code. Do not edit comment generated here */

}

 

r_cg_bup_user.c

/* Start user code for global. Do not edit comment generated here */

volatile uint8_t g_bup_f = 0U;

/* End user code. Do not edit comment generated here */

 

static void __near r_bup_interrupt(void)

{

       /* Start user code. Do not edit comment generated here */

       /* When entering the battery backup mode, a flag is set */

       if (VBATCMPM == 0U) {

              g_bup_f = 0U;

       }

       else

       {

              g_bup_f = 1U;

       }

       /* End user code. Do not edit comment generated here */

}