Attribute VB_Name = "Module1"
'#Uses "Include.inc"
'#Uses "..\include\Global.inc"
Option Explicit
'*****************************************************************************
' Module:
'        IR
'-----------------------------------------------------------------------------
' Description:
'        This file contains the 'Update' functions for the module.
'
'-----------------------------------------------------------------------------
' History:
'
'        Rev. Author         Date        Description
'        ----------------------------------------------------------------------
'        0.1  Radhish        27-10-04     version for XC866
'
'
'*****************************************************************************


'*****************************************************************************
'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 iInt As Integer

    UpdateProjectData = False

    If (lngUpdateDescriptor = 0) Then
        r.v("IR_CFile") = "INT.C"
        r.v("IR_HFile") = "INT.H"
        r.v("IR_NAME_EnableAll") = "INT_vEnableAll"
        r.v("IR_NAME_EnableInterrupt") = "INT_vEnableInterrupt"
        r.v("IR_NAME_DisableAll") = "INT_vDisableAll"
        r.v("IR_NAME_DisableInterrupt") = "INT_vDisableInterrupt"
        r.v("IR_NAME_Init") = "INT_vInit"
        r.v("IR_Notes") = ""
        r.v("IR_NAME_IsrNMI") = "INT_viNmiIsr"
        For iInt = 0 To NUMBER_OF_EXT_INTERRUPTS - 1
'            r.v("IR_PARA_" & ExtIntId(iInt)) = ExtIntId(iInt)
             r.v("IR_PARA_" & ExtIntId(iInt, r)) = ExtIntId(iInt, r)
            'r.v("IR_NAME_IsrExt" & iInt) = "INT_viExt" & iInt
           If ((iInt = 3) And (IsCpuTypeOK(r))) Then
               r.v("IR_NAME_IsrExt" & iInt) = "SHINT_viXINTR9Isr"
           ElseIf (iInt = 2) Then
               r.v("IR_NAME_IsrExt" & iInt) = "SHINT_viXINTR8Isr"
           Else
               r.v("IR_NAME_IsrExt" & iInt) = "INT_viExt" & iInt
           End If
           r.v("IR_USE_IsrExt" & iInt) = 0
        Next iInt

        For iInt = 0 To NUMBER_OF_PERI_INTERRUPTS - 1
            'r.v("IR_PARA_" & PeriIntId(iInt)) = PeriIntId(iInt)
             r.v("IR_PARA_" & PeriIntId(iInt, r)) = PeriIntId(iInt, r)
        Next iInt

        r.v("IR_USE_DisableAll") = 0
        r.v("IR_USE_DisableInterrupt") = 0
        r.v("IR_USE_EnableAll") = 0
        r.v("IR_USE_EnableInterrupt") = 0
        r.v("IR_USE_Init") = 0
         r.v("IR_USE_IsrNMI") = 0
        '************************** Added by jag on 31/01/06 ****************************
         r.v("EXINT0_Pin_P0.5_Used") = 0
         r.v("EXINT0_Pin_P1.4_Used") = 0
        '************************** Added by jag on 31/01/06 ****************************
    End If

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

    UpdateProjectData = True
    Exit Function

UpdateProjectDataError:
    Exit Function
End Function

