⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtccsetalarmrpt.c

📁 Mplab C30编译器
💻 C
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "Rtcc.h"


#ifdef _TMR_RTCC_V1

/*********************************************************************
  Function:        void RtccSetAlarmRpt(rtccRepeat rpt, BOOL dsblAlrm)

  PreCondition:    rpt has to be a proper rtccRepeat enumeration value 
 
  Input:           rpt - value of the desired alarm repeat rate 
                   dsblAlrm - if TRUE, the API can temporarily disable
                              the alarm when changing the RPT value 
  Output:          None
  
  Side Effects:    None
  
  Overview:        The function sets the RTCC alarm repeat count.
  
  Note:            If alarm is enabled, changing the repeat count can be safely made
                   only when the sync pulse is unasserted. To avoid waiting for the sync
                   pulse, the user can choose to temporarily disable the alarm and then
                   re-enable it. This means that the user has the knowledge that an alarm
                   event is not imminent.
 ********************************************************************/
void RtccSetAlarmRpt(rtccRepeat rpt, BOOL dsblAlrm)
{
   BOOL    isAlrm=mRtccIsAlrmEnabled();

   if(isAlrm)
   {
       if(dsblAlrm)
       {
           mRtccAlrmDisable();
       }
       else
       {
           mRtccWaitSync();
       }
   }

   // update the repeat rate
   ALCFGRPTbits.AMASK=rpt;
       
   // restore previous status
   if(isAlrm && dsblAlrm)
   {
       mRtccAlrmEnable();
   }
}

#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -