'#Uses "Include.inc"

Option Explicit
'*****************************************************************************
' Module:
'        GPT2
'-----------------------------------------------------------------------------
' Description:
'        This file contains the 'Update' functions for the module.
'
'-----------------------------------------------------------------------------
' History:
'                 
'        Rev. Author         Date        Description
'        ----------------------------------------------------------------------
'        2.0   ahe         13.06.00     final version for C167CS
'
'        ----------------------------------------------------------------------
'        2.1   ahe         02.08.00     final version for C167CS and C161CS/JC/JI
'                                       - no changes
'
'        ---------------------------------------------------------------------
'              ahe         25.10.00    final version for 
'                                      - C167CS
'                                      - C161CS/JC/JI
'                                      - C167CR/SR r2
'
'        ----------------------------------------------------------------------
'        5.0   ahe         19.04.01     final version for Pegasus
'
'        5.1   ahe         08.08.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 = "GPT2"

    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_ReadCAPREL")   = sVarPre & "_uwReadCAPREL"
            r.v(sVarPre & "_NAME_LoadCAPREL")   = sVarPre & "_vLoadCAPREL"
            r.v(sVarPre & "_NAME_Tmr5")         = sVarPre & "_viTmr5"
            r.v(sVarPre & "_NAME_Tmr6")         = sVarPre & "_viTmr6"
            r.v(sVarPre & "_NAME_CAPREL")       = sVarPre & "_viCAPREL"
            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_SetTmrRemoteControl")    = sVarPre & "_vSetTmrRemoteControl"

            r.v(sVarPre & "_CFile")             = sVarPre & ".C"
            r.v(sVarPre & "_HFile")             = sVarPre & ".H"
            r.v(sVarPre & "_Notes")             = "" 
            
            r.v(sVarPre & "_PARA_TIMER_5") = sVarPre & "_TIMER_5"
            r.v(sVarPre & "_PARA_TIMER_6") = sVarPre & "_TIMER_6"
   
            '...
        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

