EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
em_dac.h File Reference

Detailed Description

Digital to Analog Converter (DAC) peripheral API.

Version
5.1.2

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file em_dac.h.

#include "em_device.h"
#include "em_assert.h"
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  DAC_Init_TypeDef
 
struct  DAC_InitChannel_TypeDef
 

Macros

#define DAC_INIT_DEFAULT
 
#define DAC_INITCHANNEL_DEFAULT
 

Enumerations

enum  DAC_ConvMode_TypeDef {
  dacConvModeContinuous = _DAC_CTRL_CONVMODE_CONTINUOUS,
  dacConvModeSampleHold = _DAC_CTRL_CONVMODE_SAMPLEHOLD,
  dacConvModeSampleOff = _DAC_CTRL_CONVMODE_SAMPLEOFF
}
 
enum  DAC_Output_TypeDef {
  dacOutputDisable = _DAC_CTRL_OUTMODE_DISABLE,
  dacOutputPin = _DAC_CTRL_OUTMODE_PIN,
  dacOutputADC = _DAC_CTRL_OUTMODE_ADC,
  dacOutputPinADC = _DAC_CTRL_OUTMODE_PINADC
}
 
enum  DAC_PRSSEL_TypeDef {
  dacPRSSELCh0 = _DAC_CH0CTRL_PRSSEL_PRSCH0,
  dacPRSSELCh1 = _DAC_CH0CTRL_PRSSEL_PRSCH1,
  dacPRSSELCh2 = _DAC_CH0CTRL_PRSSEL_PRSCH2,
  dacPRSSELCh3 = _DAC_CH0CTRL_PRSSEL_PRSCH3,
  dacPRSSELCh4 = _DAC_CH0CTRL_PRSSEL_PRSCH4,
  dacPRSSELCh5 = _DAC_CH0CTRL_PRSSEL_PRSCH5,
  dacPRSSELCh6 = _DAC_CH0CTRL_PRSSEL_PRSCH6,
  dacPRSSELCh7 = _DAC_CH0CTRL_PRSSEL_PRSCH7
}
 
enum  DAC_Ref_TypeDef {
  dacRef1V25 = _DAC_CTRL_REFSEL_1V25,
  dacRef2V5 = _DAC_CTRL_REFSEL_2V5,
  dacRefVDD = _DAC_CTRL_REFSEL_VDD
}
 
enum  DAC_Refresh_TypeDef {
  dacRefresh8 = _DAC_CTRL_REFRSEL_8CYCLES,
  dacRefresh16 = _DAC_CTRL_REFRSEL_16CYCLES,
  dacRefresh32 = _DAC_CTRL_REFRSEL_32CYCLES,
  dacRefresh64 = _DAC_CTRL_REFRSEL_64CYCLES
}
 

Functions

__STATIC_INLINE void DAC_Channel0OutputSet (DAC_TypeDef *dac, uint32_t value)
 Set the output signal of DAC channel 0 to a given value. More...
 
__STATIC_INLINE void DAC_Channel1OutputSet (DAC_TypeDef *dac, uint32_t value)
 Set the output signal of DAC channel 1 to a given value. More...
 
void DAC_ChannelOutputSet (DAC_TypeDef *dac, unsigned int channel, uint32_t value)
 Set the output signal of a DAC channel to a given value. More...
 
void DAC_Enable (DAC_TypeDef *dac, unsigned int ch, bool enable)
 Enable/disable DAC channel. More...
 
void DAC_Init (DAC_TypeDef *dac, const DAC_Init_TypeDef *init)
 Initialize DAC. More...
 
void DAC_InitChannel (DAC_TypeDef *dac, const DAC_InitChannel_TypeDef *init, unsigned int ch)
 Initialize DAC channel. More...
 
__STATIC_INLINE void DAC_IntClear (DAC_TypeDef *dac, uint32_t flags)
 Clear one or more pending DAC interrupts. More...
 
__STATIC_INLINE void DAC_IntDisable (DAC_TypeDef *dac, uint32_t flags)
 Disable one or more DAC interrupts. More...
 
__STATIC_INLINE void DAC_IntEnable (DAC_TypeDef *dac, uint32_t flags)
 Enable one or more DAC interrupts. More...
 
__STATIC_INLINE uint32_t DAC_IntGet (DAC_TypeDef *dac)
 Get pending DAC interrupt flags. More...
 
__STATIC_INLINE uint32_t DAC_IntGetEnabled (DAC_TypeDef *dac)
 Get enabled and pending DAC interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More...
 
__STATIC_INLINE void DAC_IntSet (DAC_TypeDef *dac, uint32_t flags)
 Set one or more pending DAC interrupts from SW. More...
 
uint8_t DAC_PrescaleCalc (uint32_t dacFreq, uint32_t hfperFreq)
 Calculate prescaler value used to determine DAC clock. More...
 
void DAC_Reset (DAC_TypeDef *dac)
 Reset DAC to same state as after a HW reset. More...