Ejemplo n.º 1
0
        //---------------------------------------------------------------------
        // Static members

        /// <summary>
        /// Examines the current hardware and operation system configuration to
        /// determine whether a watchdog timer is available that can be operated
        /// by this class.  This method returns a watchdog timer instance if
        /// this is the case, null otherwise.
        /// </summary>
        /// <returns>An IWatchDogTimer instance or null.</returns>
        internal static IWatchDogTimer Create()
        {
            try
            {
                SBC1625IO        board;
                SBC1625IO.Config config;

                if (!SBC1625IO.Present)
                {
                    return(null);
                }

                config          = new SBC1625IO.Config();
                config.EnableIO = false;

                board = new SBC1625IO();
                board.Open(config);

                return(new SBC1625WatchDogTimer(board));
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="board">The board driver.</param>
 private SBC1625WatchDogTimer(SBC1625IO board)
 {
     this.board        = board;
     this.enabled      = false;
     this.expired      = board.WatchDogExpired();
     this.rate         = board.WatchDogCountRate();
     this.timeToReset  = TimeSpan.FromSeconds(0xFFFFFFFF / rate);
     this.countToReset = 0xFFFFFFFF;
 }