'#Uses "Include.inc"

Option Explicit
'*****************************************************************************
' Module:
'        GPT1
'-----------------------------------------------------------------------------
' Description:
'        This file contains the 'Update' functions for the module.
'
'-----------------------------------------------------------------------------
' History:
'                 
'        Rev. Author         Date        Description
'        ----------------------------------------------------------------------
'        1.0  ahe            27.04.00     final version for C165UTAH, C165H
'
'        ----------------------------------------------------------------------
'        1.1  ahe            28.09.00     final version for C165UTAH, C165H
'                                         - no changes
'
'        ----------------------------------------------------------------------
'        4.0  ahe            19.04.01     final version for Pegasus
'
'        4.1  ahe            08.08.02     no changes
'        4.2  ste            16.12.02     no changes
'
'*****************************************************************************


'*****************************************************************************
'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 successfull operation
'        False           else
'*****************************************************************************
Function UpdateProjectData(r As ProjectData, vIndex As Variant, lngUpdateDescriptor As Long) As Boolean
    On Error GoTo UpdateProjectDataError

    UpdateProjectData = False
    Dim sVarPre As String
    sVarPre = "GPT1"

    Select Case lngUpdateDescriptor
 
        Case 0 
            r.v(sVarPre & "_NAME_Init")         = sVarPre & "_vInit"
            r.v(sVarPre & "_NAME_StartTmr")     = sVarPre & "_vStartTmr"
            r.v(sVarPre & "_NAME_StopTmr")      = sVarPre & "_vStopTmr"
            r.v(sVarPre & "_NAME_ClearTmr")     = sVarPre & "_vClearTmr"
            r.v(sVarPre & "_NAME_ReadTmr")      = sVarPre & "_uwReadTmr"
            r.v(sVarPre & "_NAME_LoadTmr")      = sVarPre & "_vLoadTmr"
            r.v(sVarPre & "_NAME_Tmr2")         = sVarPre & "_viTmr2"
            r.v(sVarPre & "_NAME_Tmr3")         = sVarPre & "_viTmr3"
            r.v(sVarPre & "_NAME_Tmr4")         = sVarPre & "_viTmr4"
            r.v(sVarPre & "_NAME_SetToggLatch") = sVarPre & "_vSetToggLatch"
            r.v(sVarPre & "_NAME_ClrToggLatch") = sVarPre & "_vClrToggLatch"
            r.v(sVarPre & "_NAME_CountUp")      = sVarPre & "_vCountUp"
            r.v(sVarPre & "_NAME_CountDown")    = sVarPre & "_vCountDown"

            r.v(sVarPre & "_NAME_CheckRotation")     = sVarPre & "_ubCheckRotation"
            r.v(sVarPre & "_NAME_CheckEdge")         = sVarPre & "_ubCheckEdge"
            r.v(sVarPre & "_NAME_GetCountDirection") = sVarPre & "_ubGetCountDirection"
            
            r.v(sVarPre & "_NAME_SetTmrRemoteControl")    = sVarPre & "_vSetTmrRemoteControl"

            r.v(sVarPre & "_CFile")             = sVarPre & ".C"
            r.v(sVarPre & "_HFile")             = sVarPre & ".H"
            r.v(sVarPre & "_Notes")             = "" 

            r.v(sVarPre & "_PARA_TIMER_2") = "GPT1_TIMER_2"
            r.v(sVarPre & "_PARA_TIMER_3") = "GPT1_TIMER_3"
            r.v(sVarPre & "_PARA_TIMER_4") = "GPT1_TIMER_4"
            '...
        Case 1
            '...

        Case 3
            Call SetModuleToDefault(r)

       'Case...
    End Select

    UpdateProjectData = True
    Exit Function

UpdateProjectDataError:
    ErrorBox "Error in function UpdateProjectData", Err.Description
    Exit Function
End Function

