Changeset 5d4a81f5 in rtems


Ignore:
Timestamp:
Jun 12, 2019, 10:51:20 AM (5 days ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ee36616
Parents:
38b29232
git-author:
Sebastian Huber <sebastian.huber@…> (06/12/19 10:51:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/12/19 11:50:19)
Message:

bsp/atsam: Fix RTC_SetTimeAlarm()

Set the alarm time according to the note in the datasheet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/atsam/contrib/libraries/libchip/source/rtc.c

    r38b29232 r5d4a81f5  
    262262{
    263263        uint32_t dwAlarm = 0;
     264        uint32_t dwAlarmEnable = 0;
    264265
    265266        TRACE_DEBUG("RTC_SetTimeAlarm()\n\r");
    266267
    267268        /* Hour */
    268         if (pucHour)
    269                 dwAlarm |= RTC_TIMALR_HOUREN | ((*pucHour / 10) << 20) | ((
    270                                            *pucHour % 10) << 16);
     269        if (pucHour) {
     270                dwAlarm |= ((*pucHour / 10) << 20) | (( *pucHour % 10) << 16);
     271                dwAlarmEnable |= RTC_TIMALR_HOUREN;
     272        }
    271273
    272274        /* Minute */
    273275        if (pucMinute) {
    274                 dwAlarm |= RTC_TIMALR_MINEN | ((*pucMinute / 10) << 12)
    275                                    | ((*pucMinute % 10) << 8);
     276                dwAlarm |= ((*pucMinute / 10) << 12) | ((*pucMinute % 10) << 8);
     277                dwAlarmEnable |= RTC_TIMALR_MINEN;
    276278        }
    277279
    278280        /* Second */
    279         if (pucSecond)
    280                 dwAlarm |= RTC_TIMALR_SECEN | ((*pucSecond / 10) << 4) | (*pucSecond % 10);
    281 
     281        if (pucSecond) {
     282                dwAlarm |= ((*pucSecond / 10) << 4) | (*pucSecond % 10);
     283                dwAlarmEnable |= RTC_TIMALR_SECEN;
     284        }
     285
     286        pRtc->RTC_TIMALR = 0;
    282287        pRtc->RTC_TIMALR = dwAlarm;
     288        pRtc->RTC_TIMALR = dwAlarm | dwAlarmEnable;
    283289
    284290        return (int)(pRtc->RTC_VER & RTC_VER_NVTIMALR);
Note: See TracChangeset for help on using the changeset viewer.