Attribute VB_Name = "Module1"
'#Uses "Include.inc"

Option Explicit
'*****************************************************************************
' Module:
'        SSC
'-----------------------------------------------------------------------------
' Description:
'        This file contains the 'Update' functions for the module.
'
'-----------------------------------------------------------------------------
' History:
'
'        Rev.  Author       Date        Description
'        ----------------------------------------------------------------------
'        1.0    ahe       17.02.00     final version for
'                                         C165UTAH
'                                         C165H
'                                         C161U
'
'        ----------------------------------------------------------------------
'        2.0    ahe       05.09.00     final version for
'                                         C167CS
'                                         C161PI
'                                         C161CS/JC/JI
'
'
'        ----------------------------------------------------------------------
'        3.0    ahe       25.10.00     final version for
'                                         C167CS
'                                         C161PI
'                                         C161CS/JC/JI
'                                         C167CR/SR r2
'
'        ----------------------------------------------------------------------
'        4.0    ahe       20.04.01     final version for Pegasus
'
'        4.1    ahe       08.08.02     - neu interrupt pages
'        4.2    ste       16.12.02     no changes
'        ----------------------------------------------------------------------
'        5.0    raj         14.08.04    final version for XC164CM Pegasus light
'                                      - Pin Selection Page added
'*****************************************************************************


'*****************************************************************************
'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

    Dim sVarPre As String
    Dim sRegPre As String

    UpdateProjectData = False
    sVarPre = "SSC" & vIndex
    sRegPre = sVarPre & "_"

    Select Case lngUpdateDescriptor
        Case 0

            r.v(sRegPre & "CON_BM_BC") = 7         'SSCBM Reg = 1 => 8 bit Data
            r.v(sVarPre & "_Baudrate") = 100000    'Baud rate Variable
            Call UpdateSSCBaudrate(r, vIndex)
            
            r.v(sRegPre & "NAME_Init") = sRegPre & "vInit"
            r.v(sRegPre & "NAME_SendData") = sRegPre & "vSendData"
            r.v(sRegPre & "NAME_GetData") = sRegPre & "uwGetData"
            r.v(sRegPre & "NAME_Tx") = sRegPre & "viTx"
            r.v(sRegPre & "NAME_Rx") = sRegPre & "viRx"
            r.v(sRegPre & "NAME_Error") = sRegPre & "viError"
            r.v(sRegPre & "NAME_TransData") = sRegPre & "vTransData"
            r.v(sRegPre & "NAME_EnTransmitter") = sRegPre & "vEnTransmitter"
            r.v(sRegPre & "NAME_DisTransmitter") = sRegPre & "vDisTransmitter"
            r.v(sRegPre & "NAME_TxBufFree") = sRegPre & "ubTxBufFree"
            r.v(sRegPre & "NAME_RxDataReady") = sRegPre & "ubRxDataReady"
            r.v(sRegPre & "NAME_Busy") = sRegPre & "ubBusy"
            r.v(sRegPre & "NAME_ErrorCheck") = sRegPre & "ubErrorCheck"
            r.v(sRegPre & "NAME_SetLoopBackMode") = sRegPre & "vSetLoopBackMode"
            r.v(sRegPre & "NAME_ResetLoopBackMode") = sRegPre & "vResetLoopBackMode"

            r.v(sRegPre & "CFile") = sVarPre & ".C"
            r.v(sRegPre & "HFile") = sVarPre & ".H"
            r.v(sRegPre & "Notes") = ""

        Case 1
            '...
            Call UpdateSSCBaudrate(r, vIndex)
       'Case...
    End Select

    UpdateProjectData = True
    Exit Function

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

