34 #if defined( RTCC_COUNT ) && ( RTCC_COUNT == 1 )
81 void RTCC_ChannelInit(
int ch, RTCC_CCChConf_TypeDef
const *confPtr )
83 EFM_ASSERT( RTCC_CH_VALID( ch ) );
84 EFM_ASSERT( (uint32_t)confPtr->compMask
85 < ( _RTCC_CC_CTRL_COMPMASK_MASK >> _RTCC_CC_CTRL_COMPMASK_SHIFT )
89 RTCC->CC[ch].CTRL = ( (uint32_t)confPtr->chMode << _RTCC_CC_CTRL_MODE_SHIFT )
90 | ( (uint32_t)confPtr->compMatchOutAction << _RTCC_CC_CTRL_CMOA_SHIFT )
91 | ( (uint32_t)confPtr->prsSel << _RTCC_CC_CTRL_PRSSEL_SHIFT )
92 | ( (uint32_t)confPtr->inputEdgeSel << _RTCC_CC_CTRL_ICEDGE_SHIFT )
93 | ( (uint32_t)confPtr->compBase << _RTCC_CC_CTRL_COMPBASE_SHIFT )
94 | ( (uint32_t)confPtr->compMask << _RTCC_CC_CTRL_COMPMASK_SHIFT )
95 | ( (uint32_t)confPtr->dayCompMode << _RTCC_CC_CTRL_DAYCC_SHIFT );
105 void RTCC_Enable(
bool enable )
123 void RTCC_Init(
const RTCC_Init_TypeDef *init )
125 RTCC->CTRL = ( (uint32_t)init->enable << _RTCC_CTRL_ENABLE_SHIFT )
126 | ( (uint32_t)init->debugRun << _RTCC_CTRL_DEBUGRUN_SHIFT )
127 | ( (uint32_t)init->precntWrapOnCCV0 << _RTCC_CTRL_PRECCV0TOP_SHIFT )
128 | ( (uint32_t)init->cntWrapOnCCV1 << _RTCC_CTRL_CCV1TOP_SHIFT )
129 | ( (uint32_t)init->presc << _RTCC_CTRL_CNTPRESC_SHIFT )
130 | ( (uint32_t)init->prescMode << _RTCC_CTRL_CNTTICK_SHIFT )
131 #if defined(_RTCC_CTRL_BUMODETSEN_MASK)
132 | ( (uint32_t)init->enaBackupModeSet << _RTCC_CTRL_BUMODETSEN_SHIFT )
134 | ( (uint32_t)init->enaOSCFailDetect << _RTCC_CTRL_OSCFDETEN_SHIFT )
135 | ( (uint32_t)init->cntMode << _RTCC_CTRL_CNTMODE_SHIFT )
136 | ( (uint32_t)init->disLeapYearCorr << _RTCC_CTRL_LYEARCORRDIS_SHIFT );
143 void RTCC_Reset(
void )
149 RTCC->CTRL = _RTCC_CTRL_RESETVALUE;
150 RTCC->PRECNT = _RTCC_PRECNT_RESETVALUE;
151 RTCC->CNT = _RTCC_CNT_RESETVALUE;
152 RTCC->TIME = _RTCC_TIME_RESETVALUE;
153 RTCC->DATE = _RTCC_DATE_RESETVALUE;
154 RTCC->IEN = _RTCC_IEN_RESETVALUE;
155 RTCC->IFC = _RTCC_IFC_MASK;
157 RTCC->EM4WUEN = _RTCC_EM4WUEN_RESETVALUE;
159 for (i = 0; i < 3; i++)
161 RTCC->CC[i].CTRL = _RTCC_CC_CTRL_RESETVALUE;
162 RTCC->CC[i].CCV = _RTCC_CC_CCV_RESETVALUE;
163 RTCC->CC[i].TIME = _RTCC_CC_TIME_RESETVALUE;
164 RTCC->CC[i].DATE = _RTCC_CC_DATE_RESETVALUE;
172 void RTCC_StatusClear(
void )
174 while ( RTCC->SYNCBUSY & RTCC_SYNCBUSY_CMD )
178 RTCC->CMD = RTCC_CMD_CLRSTATUS;
RAM and peripheral bit-field set and clear API.
Real Time Counter (RTCC) peripheral API.
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.