Example #1
0
            /// <summary>
            ///  Gets the date. Only used on Cerb based boards.
            /// </summary>
            public static void RTC_GetDate()
            {
                SafeToProceed(DeviceID.FEZ_CERB);

                Register RTC_DR = new Register(RTC_BASE + 0x04);
                UInt32 tmpreg = (UInt32)(RTC_DR.Read() & RTC_DR_RESERVED_MASK);
                /* Fill the structure fields with the read parameters */
                RTC_Year = (byte)((tmpreg & (RTC_DR_YT | RTC_DR_YU)) >> 16);
                RTC_Month = (byte)((tmpreg & (RTC_DR_MT | RTC_DR_MU)) >> 8);
                RTC_Date = (byte)(tmpreg & (RTC_DR_DT | RTC_DR_DU));
                RTC_WeekDay = (byte)((tmpreg & (RTC_DR_WDU)) >> 13);
                /* Convert the structure parameters to Binary format */
                RTC_Year = (byte)RTC_Bcd2ToByte(RTC_Year);
                RTC_Month = (byte)RTC_Bcd2ToByte(RTC_Month);
                RTC_Date = (byte)RTC_Bcd2ToByte(RTC_Date);
                //RTC_WeekDay = (byte)(RTC_DateStruct->RTC_WeekDay);

            }
Example #2
0
            /// <summary>
            /// Gets the time. Only used on Cerb based boards.
            /// </summary>
            public static void RTC_GetTime()
            {
                SafeToProceed(DeviceID.FEZ_CERB);

                Register RTC_TR = new Register(RTC_BASE + 0x00);
                UInt32 tmpreg;
                tmpreg = (UInt32)(RTC_TR.Read() & RTC_TR_RESERVED_MASK);
                RTC_Hours = (byte)((tmpreg & (RTC_TR_HT | RTC_TR_HU)) >> 16);
                RTC_Minutes = (byte)((tmpreg & (RTC_TR_MNT | RTC_TR_MNU)) >> 8);
                RTC_Seconds = (byte)(tmpreg & (RTC_TR_ST | RTC_TR_SU));
                RTC_H12 = (byte)((tmpreg & (RTC_TR_PM)) >> 22);
                /* Convert the structure parameters to Binary format */
                RTC_Hours = (byte)RTC_Bcd2ToByte(RTC_Hours);
                RTC_Minutes = (byte)RTC_Bcd2ToByte(RTC_Minutes);
                RTC_Seconds = (byte)RTC_Bcd2ToByte(RTC_Seconds);


            }