Attribute VB_Name = "Module1"
'#Uses "Include.inc"
'#Uses "..\include\Const.inc"
Option Explicit
'*****************************************************************************
' Module:
'        WDT
'-----------------------------------------------------------------------------
' Description:
'        This file contains the 'Update' functions for the module.
'
'-----------------------------------------------------------------------------
' History:
'
'        Rev. Author         Date        Description
'        ----------------------------------------------------------------------
'        0.1  radhish        25-10-04    initial version
'        0.2  Ashish         05.12.06    WDT_vENABLE/Disable variable initialised
'
'*****************************************************************************


'*****************************************************************************
'Description:
'        This function is called by the main module in order to reset or update
'        the project variables and register contents of this peripheral
'-----------------------------------------------------------------------------
'Parameters:
'        r                      reference to the project data variables
'        vIndex                 a parameter
'        lngUpdateDescriptor    identification of the update context
'                  0          = initialization for a new project
'                  1, 2, 3... = value that identifies which project settings have
'                               been changed (e.g. CPU-Type, CPU-Clock etc.)
'-----------------------------------------------------------------------------
'Returns:
'        True            on successful operation
'        False           else
'*****************************************************************************
Function UpdateProjectData(r As ProjectData, vIndex As Variant, lngUpdateDescriptor As Long) As Boolean
    On Error GoTo UpdateProjectDataError

    Dim iPar As Integer

    UpdateProjectData = False

    If (lngUpdateDescriptor = 0) Then
        r.v("WDT_CFile") = "WDT.C"
        r.v("WDT_HFile") = "WDT.H"
        r.v("WDT_NAME_Init") = "WDT_vInit"
        r.v("WDT_NAME_Refresh") = "WDT_vRefresh"
        r.v("WDT_NAME_Windowb") = "WDT_Windowb"
        r.v("WDT_NAME_Reset") = "WDT_bWDTReset"
        r.v("WDT_WinEna") = "WDT_vEnable"
        r.v("GEN_UserDef0") = "WDT_vDisable"
        
        r.v("WDT_Notes") = ""
        r.v("WDT_USE_Init") = 0
        r.v("WDT_USE_Windowb") = 0
        r.v("WDT_USE_Refresh") = 0
        r.v("WDT_PARA_CLR_BIT") = 0
        r.v("WDT_PARA_NO_CLR_BIT") = 0
        
        r.v("WDT_USE_Reset") = 0
        r.v("WDT_WDTUsed") = 1
        'r.v("WDTREL_WDTREL") = 0
        r.d("WDT_WDTPeriod") = Format(WdtTimeoutPeriod(r, r.l(WDT_PREFIX & "WDTREL_WDTREL")), "0.0000")

        
    End If

    ' Some "project settings" may be changed independently from the settings
    ' of the peripheral modules. Therefore the FSM module has to solve any
    ' possible conflicts with the project settings...

    'r.d("WDT_WDTPeriod") = WdtTimeoutPeriod(r, r.sfr("WDTREL")) 'adjust the timeout period'

       

    UpdateProjectData = True
    Exit Function

UpdateProjectDataError:
    Exit Function
End Function

