lpcware

rtc_15xx.h Chip_RTC_ClearStatus Bug?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by frh on Thu Jun 11 17:17:45 MST 2015
[color=#f00]Update 6/12/15: Looks like I posted to the wrong forum: rookie mistake. Found more on this will repost on LPC Open forum. Moderator, (if there is one), please remove this.[/color]

I'm following the lpc_open v2.08c example code for the RTC and it's not working. In my copy of rtc_15xx.h I find the following definitioins with identical implementations and I think it's incorrect in the case of the "Clear" function.

Shouldn't something like

pRTC->CTRL &= ~stsMask;  // corrected from original post


precede the return?

/**
* @briefClears latched RTC statuses
* @parampRTC: The base address of RTC block
* @paramstsMask: OR'ed status bits to clear
* @returnNothing
* @noteUse and OR'ed stsMask value of RTC_CTRL_OFD, RTC_CTRL_ALARM1HZ,
*and RTC_CTRL_WAKE1KHZ to clear specific RTC states.
*/
STATIC INLINE uint32_t Chip_RTC_ClearStatus(LPC_RTC_T *pRTC, uint32_t stsMask)
{
return pRTC->CTRL;
}

/**
* @briefReturn RTC control/status register
* @parampRTC: The base address of RTC block
* @returnThe current RTC control/status register
* @noteMask the return value with a RTC_CTRL_* definitions to determine
*which bits are set. For example, mask the return value with
*RTC_CTRL_ALARM1HZ to determine if the alarm interrupt is pending.
*/
STATIC INLINE uint32_t Chip_RTC_GetStatus(LPC_RTC_T *pRTC)
{
return pRTC->CTRL;
}

Outcomes