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

Option Explicit
'*****************************************************************************
' Module:
'        LIN
'-----------------------------------------------------------------------------
' Description:
'        This file contains functions which are create controls for the
'        module 'LIN'.
'        Furthermore it contains functions for the event handling of
'        these controls.
'
'-----------------------------------------------------------------------------
' History:
'
'        Rev.    Author       Date           Description
'        ---------------------------------------------------------------------
'        1.0     Raja         30.05.2005     LIN for Pegasus lite XC164CM
'
'*****************************************************************************


'*****************************************************************************
'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
    UpdateProjectData = False

    Select Case lngUpdateDescriptor
        Case 0
             r.v("LIN_FrameList_EXIST") = 0
             r.v("LIN_SignalList_EXIST") = 0
             r.v("LIST_FRAME_INDEX") = 0
             r.v("LIST_SIGNAL_INDEX") = 0
             r.v("lstData_INDEX") = 0
            
             r.v("LIST_NODE_INDEX") = 0
             r.v("LIN_NCF_FILE") = "LIN_NCF.ncf"
             r.v("LIN_LDF_FILE") = "LIN_LDF.ldf"
             r.v("LIN_CFILE") = "LIN_LDF.c"
             r.v("LIN_HFILE") = "LIN_LDF.h"
             r.v("LIN_Notes") = ""
             r.v("LIN_GEN_NCF") = 0
             r.v("LIN_GEN_LDF") = 0
             r.v("LIN_USE_Init") = 0
             r.v("LIN_NAME_Init") = "LIN_vInit"
             r.v("LIN_Mode") = 0

             r.v("LIN_M_Name") = "Master"
             r.v("LIN_M_TBase") = "5"
             r.v("LIN_M_Jitter") = "0.1"
             r.v("LIN_Language_Version") = "2.0"
             r.v("LIN_Protocol_Version") = "2.0"
             r.v("LIN_Speed") = 19.2
             r.v("LIN_supplier_id") = 28
             r.v("LIN_function_id") = 0
             r.v("LIN_variant_id") = 2#
             
             r.v("LIN_Node_Name") = "Slave1"
             r.v("LIN_Node_NAD") = 127
             r.v("LIN_Node_p2min") = 0
             r.v("LIN_Node_stmin") = 0
             r.v("LIN_Node_ssid") = 0
             r.v("LIN_Node_MaxMsglen") = 4095
             
             r.v("LIN_Signal_Name") = "Signal1"
             r.v("LIN_Signal_InitVal") = 0
             r.v("LIN_Signal_Type") = 0
             r.v("LIN_Signal_Size") = 1
             r.v("LIN_Signal_Pub") = "Master"
             
             r.v("LIN_Frame_Name") = "Frame1"
             r.v("LIN_Frame_ID") = 0
             r.v("LIN_Frame_Type") = "Unconditional"
             r.v("LIN_Frame_MsgID") = 0
             r.v("LIN_Frame_Length") = 2
             r.v("LIN_Frame_MinTime") = 10
             r.v("LIN_Frame_MaxTime") = 100
        Case 1
    End Select

    UpdateProjectData = True
    Exit Function

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

