Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

DAC channels configuration

DAC channels configuration
[DAC_Private_Functions]

DAC channels configuration: trigger, output buffer, data format. More...

Functions

void DAC_DeInit (DAC_TypeDef *DACx)
 Deinitializes the DAC peripheral registers to their default reset values.
void DAC_Init (DAC_TypeDef *DACx, uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
 Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.
void DAC_StructInit (DAC_InitTypeDef *DAC_InitStruct)
 Fills each DAC_InitStruct member with its default value.
void DAC_Cmd (DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState)
 Enables or disables the specified DAC channel.
void DAC_SoftwareTriggerCmd (DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState)
 Enables or disables the selected DAC channel software trigger.
void DAC_DualSoftwareTriggerCmd (DAC_TypeDef *DACx, FunctionalState NewState)
 Enables or disables simultaneously the two DAC channels software triggers.
void DAC_WaveGenerationCmd (DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
 Enables or disables the selected DAC channel wave generation.
void DAC_SetChannel1Data (DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
 Set the specified data holding register value for DAC channel1.
void DAC_SetChannel2Data (DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
 Set the specified data holding register value for DAC channel2.
void DAC_SetDualChannelData (DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
 Set the specified data holding register value for dual channel DAC.
uint16_t DAC_GetDataOutputValue (DAC_TypeDef *DACx, uint32_t DAC_Channel)
 Returns the last data output value of the selected DAC channel.

Detailed Description

DAC channels configuration: trigger, output buffer, data format.

 ===============================================================================
    ##### DAC channels configuration: trigger, output buffer, data format #####
 ===============================================================================  


Function Documentation

void DAC_Cmd ( DAC_TypeDef *  DACx,
uint32_t  DAC_Channel,
FunctionalState  NewState 
)

Enables or disables the specified DAC channel.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
DAC_Channel,:The selected DAC channel. This parameter can be one of the following values:

  • DAC_Channel_1: DAC Channel1 selected
  • DAC_Channel_2: DAC Channel2 selected
NewState,:new state of the DAC channel. This parameter can be: ENABLE or DISABLE.
Note:
When the DAC channel is enabled the trigger source can no more be modified.
Return values:
None

Definition at line 273 of file stm32f30x_dac.c.

void DAC_DeInit ( DAC_TypeDef *  DACx )

Deinitializes the DAC peripheral registers to their default reset values.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
Return values:
None

Definition at line 176 of file stm32f30x_dac.c.

void DAC_DualSoftwareTriggerCmd ( DAC_TypeDef *  DACx,
FunctionalState  NewState 
)

Enables or disables simultaneously the two DAC channels software triggers.

Parameters:
DACx,:where x can be 1 to select the DAC1 peripheral.
Note:
Dual trigger is not applicable for DAC2 (DAC2 integrates one channel).
Parameters:
NewState,:new state of the DAC channels software triggers. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 331 of file stm32f30x_dac.c.

uint16_t DAC_GetDataOutputValue ( DAC_TypeDef *  DACx,
uint32_t  DAC_Channel 
)

Returns the last data output value of the selected DAC channel.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
DAC_Channel,:the selected DAC channel. This parameter can be one of the following values:

  • DAC_Channel_1: DAC Channel1 selected
  • DAC_Channel_2: DAC Channel2 selected
Return values:
Theselected DAC channel data output value.

Definition at line 494 of file stm32f30x_dac.c.

void DAC_Init ( DAC_TypeDef *  DACx,
uint32_t  DAC_Channel,
DAC_InitTypeDef *  DAC_InitStruct 
)

Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
DAC_Channel,:the selected DAC channel. This parameter can be one of the following values:

  • DAC_Channel_1: DAC Channel1 selected
  • DAC_Channel_2: DAC Channel2 selected
DAC_InitStruct,:pointer to a DAC_InitTypeDef structure that contains the configuration information for the specified DAC channel.
Return values:
None

Definition at line 209 of file stm32f30x_dac.c.

void DAC_SetChannel1Data ( DAC_TypeDef *  DACx,
uint32_t  DAC_Align,
uint16_t  Data 
)

Set the specified data holding register value for DAC channel1.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
DAC_Align,:Specifies the data alignment for DAC channel1. This parameter can be one of the following values:

  • DAC_Align_8b_R: 8bit right data alignment selected
  • DAC_Align_12b_L: 12bit left data alignment selected
  • DAC_Align_12b_R: 12bit right data alignment selected
Data,:Data to be loaded in the selected data holding register.
Return values:
None

Definition at line 397 of file stm32f30x_dac.c.

void DAC_SetChannel2Data ( DAC_TypeDef *  DACx,
uint32_t  DAC_Align,
uint16_t  Data 
)

Set the specified data holding register value for DAC channel2.

Parameters:
DACx,:where x can be 1 to select the DAC peripheral.
Note:
This function is available only for DAC1.
Parameters:
DAC_Align,:Specifies the data alignment for DAC channel2. This parameter can be one of the following values:

  • DAC_Align_8b_R: 8bit right data alignment selected
  • DAC_Align_12b_L: 12bit left data alignment selected
  • DAC_Align_12b_R: 12bit right data alignment selected
Data: Data to be loaded in the selected data holding register.
Return values:
None

Definition at line 425 of file stm32f30x_dac.c.

void DAC_SetDualChannelData ( DAC_TypeDef *  DACx,
uint32_t  DAC_Align,
uint16_t  Data2,
uint16_t  Data1 
)

Set the specified data holding register value for dual channel DAC.

Parameters:
DACx,:where x can be 1 to select the DAC peripheral.
Note:
This function isn't applicable for DAC2.
Parameters:
DAC_Align,:Specifies the data alignment for dual channel DAC. This parameter can be one of the following values:

  • DAC_Align_8b_R: 8bit right data alignment selected
  • DAC_Align_12b_L: 12bit left data alignment selected
  • DAC_Align_12b_R: 12bit right data alignment selected
Data2,:Data for DAC Channel2 to be loaded in the selected data holding register.
Data1,:Data for DAC Channel1 to be loaded in the selected data holding register.
Note:
In dual mode, a unique register access is required to write in both DAC channels at the same time.
Return values:
None

Definition at line 458 of file stm32f30x_dac.c.

void DAC_SoftwareTriggerCmd ( DAC_TypeDef *  DACx,
uint32_t  DAC_Channel,
FunctionalState  NewState 
)

Enables or disables the selected DAC channel software trigger.

Parameters:
DACx,:where x can be 1 or 2 to select the DAC peripheral.
DAC_Channel,:the selected DAC channel. This parameter can be one of the following values:

  • DAC_Channel_1: DAC Channel1 selected
  • DAC_Channel_2: DAC Channel2 selected
NewState,:new state of the selected DAC channel software trigger. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 303 of file stm32f30x_dac.c.

void DAC_StructInit ( DAC_InitTypeDef *  DAC_InitStruct )

Fills each DAC_InitStruct member with its default value.

Parameters:
DAC_InitStruct,:pointer to a DAC_InitTypeDef structure which will be initialized.
Return values:
None

Definition at line 247 of file stm32f30x_dac.c.

void DAC_WaveGenerationCmd ( DAC_TypeDef *  DACx,
uint32_t  DAC_Channel,
uint32_t  DAC_Wave,
FunctionalState  NewState 
)

Enables or disables the selected DAC channel wave generation.

Parameters:
DACx,:where x can be 1 to select the DAC1 peripheral.
Note:
Wave generation is not available in DAC2.
Parameters:
DAC_Channel,:the selected DAC channel. This parameter can be one of the following values:

  • DAC_Channel_1: DAC Channel1 selected
  • DAC_Channel_2: DAC Channel2 selected
DAC_Wave,:Specifies the wave type to enable or disable. This parameter can be one of the following values:

  • DAC_Wave_Noise: noise wave generation
  • DAC_Wave_Triangle: triangle wave generation
NewState,:new state of the selected DAC channel wave generation. This parameter can be: ENABLE or DISABLE.
Note:
Return values:
None

Definition at line 366 of file stm32f30x_dac.c.