예제 #1
0
/*******************************************************************************
* Function Name: WaveDAC8_1_Init
********************************************************************************
*
* Summary:
*  Initializes component with parameters set in the customizer.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void WaveDAC8_1_Init(void)
{
    WaveDAC8_1_VDAC8_Init();
    WaveDAC8_1_VDAC8_SetSpeed(WaveDAC8_1_HIGHSPEED);
    WaveDAC8_1_VDAC8_SetRange(WaveDAC8_1_DAC_RANGE);

#if(WaveDAC8_1_DAC_MODE == WaveDAC8_1_CURRENT_MODE)
    WaveDAC8_1_IDAC8_SetPolarity(WaveDAC8_1_DAC_POL);
#endif /* WaveDAC8_1_DAC_MODE == WaveDAC8_1_CURRENT_MODE */

#if(WaveDAC8_1_OUT_MODE == WaveDAC8_1_BUFFER_MODE)
    WaveDAC8_1_BuffAmp_Init();
#endif /* WaveDAC8_1_OUT_MODE == WaveDAC8_1_BUFFER_MODE */

    /* Get the TD Number for the DMA channel 1 and 2   */
    WaveDAC8_1_Wave1TD = CyDmaTdAllocate();
    WaveDAC8_1_Wave2TD = CyDmaTdAllocate();

    /* Initialize waveform pointers  */
    WaveDAC8_1_Wave1Setup(WaveDAC8_1_wave1, WaveDAC8_1_WAVE1_LENGTH) ;
    WaveDAC8_1_Wave2Setup(WaveDAC8_1_wave2, WaveDAC8_1_WAVE2_LENGTH) ;

    /* Initialize the internal clock if one present  */
#if defined(WaveDAC8_1_DacClk_PHASE)
    WaveDAC8_1_DacClk_SetPhase(WaveDAC8_1_CLK_PHASE_0nS);
#endif /* defined(WaveDAC8_1_DacClk_PHASE) */
}
/*******************************************************************************
* Function Name: WaveDAC8_1_VDAC8_Init
********************************************************************************
* Summary:
*  Initialize to the schematic state.
* 
* Parameters:
*  void:
*
* Return:
*  void
*
* Theory:
*
* Side Effects:
*
*******************************************************************************/
void WaveDAC8_1_VDAC8_Init(void) 
{
    WaveDAC8_1_VDAC8_CR0 = (WaveDAC8_1_VDAC8_MODE_V );

    /* Set default data source */
    #if(WaveDAC8_1_VDAC8_DEFAULT_DATA_SRC != 0 )
        WaveDAC8_1_VDAC8_CR1 = (WaveDAC8_1_VDAC8_DEFAULT_CNTL | WaveDAC8_1_VDAC8_DACBUS_ENABLE) ;
    #else
        WaveDAC8_1_VDAC8_CR1 = (WaveDAC8_1_VDAC8_DEFAULT_CNTL | WaveDAC8_1_VDAC8_DACBUS_DISABLE) ;
    #endif /* (WaveDAC8_1_VDAC8_DEFAULT_DATA_SRC != 0 ) */

    /* Set default strobe mode */
    #if(WaveDAC8_1_VDAC8_DEFAULT_STRB != 0)
        WaveDAC8_1_VDAC8_Strobe |= WaveDAC8_1_VDAC8_STRB_EN ;
    #endif/* (WaveDAC8_1_VDAC8_DEFAULT_STRB != 0) */

    /* Set default range */
    WaveDAC8_1_VDAC8_SetRange(WaveDAC8_1_VDAC8_DEFAULT_RANGE); 

    /* Set default speed */
    WaveDAC8_1_VDAC8_SetSpeed(WaveDAC8_1_VDAC8_DEFAULT_SPEED);
}