/*******************************************************************************
* Function Name: WaveDAC8_1_VDAC8_Start
********************************************************************************
*
* Summary:
*  The start function initializes the voltage DAC with the default values, 
*  and sets the power to the given level.  A power level of 0, is the same as
*  executing the stop function.
*
* Parameters:
*  Power: Sets power level between off (0) and (3) high power
*
* Return:
*  void 
*
* Global variables:
*  WaveDAC8_1_VDAC8_initVar: Is modified when this function is called for the 
*  first time. Is used to ensure that initialization happens only once.
*
*******************************************************************************/
void WaveDAC8_1_VDAC8_Start(void)  
{
    /* Hardware initiazation only needs to occure the first time */
    if(WaveDAC8_1_VDAC8_initVar == 0u)
    { 
        WaveDAC8_1_VDAC8_Init();
        WaveDAC8_1_VDAC8_initVar = 1u;
    }

    /* Enable power to DAC */
    WaveDAC8_1_VDAC8_Enable();

    /* Set default value */
    WaveDAC8_1_VDAC8_SetValue(WaveDAC8_1_VDAC8_DEFAULT_DATA); 
}
Esempio n. 2
0
/*******************************************************************************
* Function Name: WaveDAC8_1_Enable
********************************************************************************
*
* Summary:
*  Enables the DAC block and DMA operation.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void WaveDAC8_1_Enable(void)
{
    WaveDAC8_1_VDAC8_Enable();

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

    /*
    * Enable the channel. It is configured to remember the TD value so that
    * it can be restored from the place where it has been stopped.
    */
    (void)CyDmaChEnable(WaveDAC8_1_Wave1Chan, 1u);
    (void)CyDmaChEnable(WaveDAC8_1_Wave2Chan, 1u);

    /* set the initial value */
    WaveDAC8_1_SetValue(0u);

#if(WaveDAC8_1_CLOCK_SRC == WaveDAC8_1_CLOCK_INT)
    WaveDAC8_1_DacClk_Start();
#endif /* WaveDAC8_1_CLOCK_SRC == WaveDAC8_1_CLOCK_INT */
}