em_idac.h

Go to the documentation of this file.
00001 /***************************************************************************/
00034 #ifndef __SILICON_LABS_EM_IDAC_H_
00035 #define __SILICON_LABS_EM_IDAC_H_
00036 
00037 #include "em_device.h"
00038 
00039 #if defined(IDAC_COUNT) && (IDAC_COUNT > 0)
00040 #include <stdbool.h>
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /***************************************************************************/
00051 /***************************************************************************/
00059 #define IDAC_REF_VALID(ref)    ((ref) == IDAC0)
00060 
00063 /*******************************************************************************
00064  ********************************   ENUMS   ************************************
00065  ******************************************************************************/
00066 
00068 typedef enum
00069 {
00070   idacOutputPin     = IDAC_CTRL_OUTMODE_PIN,     
00071   idacOutputADC     = IDAC_CTRL_OUTMODE_ADC      
00072 } IDAC_OutMode_TypeDef;
00073 
00074 
00077 typedef enum
00078 {
00079   idacPRSSELCh0 = IDAC_CTRL_PRSSEL_PRSCH0,      
00080   idacPRSSELCh1 = IDAC_CTRL_PRSSEL_PRSCH1,      
00081   idacPRSSELCh2 = IDAC_CTRL_PRSSEL_PRSCH2,      
00082   idacPRSSELCh3 = IDAC_CTRL_PRSSEL_PRSCH3,      
00083 #if  defined( IDAC_CTRL_PRSSEL_PRSCH4 )
00084   idacPRSSELCh4 = IDAC_CTRL_PRSSEL_PRSCH4,      
00085 #endif
00086 #if  defined( IDAC_CTRL_PRSSEL_PRSCH5 )
00087   idacPRSSELCh5 = IDAC_CTRL_PRSSEL_PRSCH5,      
00088 #endif
00089 #if  defined( IDAC_CTRL_PRSSEL_PRSCH6 )
00090   idacPRSSELCh6 = IDAC_CTRL_PRSSEL_PRSCH6,      
00091 #endif
00092 #if  defined( IDAC_CTRL_PRSSEL_PRSCH7 )
00093   idacPRSSELCh7 = IDAC_CTRL_PRSSEL_PRSCH7,      
00094 #endif
00095 #if  defined( IDAC_CTRL_PRSSEL_PRSCH8 )
00096   idacPRSSELCh8 = IDAC_CTRL_PRSSEL_PRSCH8,      
00097 #endif
00098 #if  defined( IDAC_CTRL_PRSSEL_PRSCH9 )
00099   idacPRSSELCh9 = IDAC_CTRL_PRSSEL_PRSCH9,      
00100 #endif
00101 #if  defined( IDAC_CTRL_PRSSEL_PRSCH10 )
00102   idacPRSSELCh10 = IDAC_CTRL_PRSSEL_PRSCH10,    
00103 #endif
00104 #if  defined( IDAC_CTRL_PRSSEL_PRSCH11 )
00105   idacPRSSELCh11 = IDAC_CTRL_PRSSEL_PRSCH11,    
00106 #endif
00107 } IDAC_PRSSEL_TypeDef;
00108 
00109 
00111 typedef enum
00112 {
00113   idacCurrentRange0 = IDAC_CURPROG_RANGESEL_RANGE0, 
00114   idacCurrentRange1 = IDAC_CURPROG_RANGESEL_RANGE1, 
00115   idacCurrentRange2 = IDAC_CURPROG_RANGESEL_RANGE2, 
00116   idacCurrentRange3 = IDAC_CURPROG_RANGESEL_RANGE3, 
00117 } IDAC_Range_TypeDef;
00118 
00119 /*******************************************************************************
00120  *******************************   STRUCTS   ***********************************
00121  ******************************************************************************/
00122 
00124 typedef struct
00125 {
00127   bool                  enable;
00128 
00130   IDAC_OutMode_TypeDef  outMode;
00131 
00137   bool                  prsEnable;
00138 
00143   IDAC_PRSSEL_TypeDef   prsSel;
00144 
00146   bool                  sinkEnable;
00147 
00148 } IDAC_Init_TypeDef;
00149 
00151 #define IDAC_INIT_DEFAULT                                             \
00152   { false,          /* Leave IDAC disabled when init done. */         \
00153     idacOutputPin,   /* Output to IDAC OUT pin. */                     \
00154     false,          /* Disable PRS triggering. */                     \
00155     idacPRSSELCh0,  /* Select PRS ch0 (if PRS triggering enabled). */ \
00156     false           /* Disable current sink mode. */                  \
00157   }
00158 
00159 
00160 /*******************************************************************************
00161  *****************************   PROTOTYPES   **********************************
00162  ******************************************************************************/
00163 
00164 /***************************************************************************/
00181 void IDAC_Init(IDAC_TypeDef *idac, const IDAC_Init_TypeDef *init);
00182 
00183 
00184 /***************************************************************************/
00194 void IDAC_Enable(IDAC_TypeDef *idac, bool enable);
00195 
00196 
00197 /***************************************************************************/
00204 void IDAC_Reset(IDAC_TypeDef *idac);
00205 
00206 
00207 /***************************************************************************/
00217 void IDAC_MinimalOutputTransitionMode(IDAC_TypeDef *idac, bool enable);
00218 
00219 
00220 /***************************************************************************/
00236 void IDAC_RangeSet(IDAC_TypeDef *idac, const IDAC_Range_TypeDef range);
00237 
00238 
00239 /***************************************************************************/
00249 void IDAC_StepSet(IDAC_TypeDef *idac, const uint32_t step);
00250 
00251 
00252 /***************************************************************************/
00262 void IDAC_OutEnable(IDAC_TypeDef *idac, bool enable);
00263 
00264 
00268 #ifdef __cplusplus
00269 }
00270 #endif
00271 
00272 #endif /* defined(IDAC_COUNT) && (IDAC_COUNT > 0) */
00273 
00274 #endif /* __SILICON_LABS_EM_IDAC_H_ */