This set of functions are for configuring basic usage of the CTDAC.
|
__STATIC_INLINE void | Cy_CTDAC_SetValue (CTDAC_Type *base, int32_t value) |
| Set the CTDAC_VAL register (DAC hardware is updated on the next PeriClk cycle). More...
|
|
__STATIC_INLINE void | Cy_CTDAC_SetValueBuffered (CTDAC_Type *base, int32_t value) |
| Set the CTDAC_VAL_NEXT register. More...
|
|
void | Cy_CTDAC_SetSignMode (CTDAC_Type *base, cy_en_ctdac_format_t formatMode) |
| Set whether to interpret the DAC value as signed or unsigned. More...
|
|
void | Cy_CTDAC_SetDeepSleepMode (CTDAC_Type *base, cy_en_ctdac_deep_sleep_t deepSleep) |
| Enable or disable the DAC hardware operation in Deep Sleep mode. More...
|
|
void | Cy_CTDAC_SetOutputMode (CTDAC_Type *base, cy_en_ctdac_output_mode_t outputMode) |
| Set the output mode of the CTDAC: More...
|
|
void | Cy_CTDAC_SetDeglitchMode (CTDAC_Type *base, cy_en_ctdac_deglitch_t deglitchMode) |
| Enable deglitching on the unbuffered path, buffered path, both, or disable deglitching. More...
|
|
void | Cy_CTDAC_SetDeglitchCycles (CTDAC_Type *base, uint32_t deglitchCycles) |
| Set the number of deglitch cycles (0 to 63) that will be used. More...
|
|
void | Cy_CTDAC_SetRef (CTDAC_Type *base, cy_en_ctdac_ref_source_t refSource) |
| Set the CTDAC reference source to Vdda or an external reference. More...
|
|
◆ Cy_CTDAC_SetValue()
__STATIC_INLINE void Cy_CTDAC_SetValue |
( |
CTDAC_Type * |
base, |
|
|
int32_t |
value |
|
) |
| |
Set the CTDAC_VAL register (DAC hardware is updated on the next PeriClk cycle).
Only the least significant 12 bits have an effect. Sign extension of negative values is unnecessary and is ignored by the hardware. The way in which the CTDAC interprets the 12-bit data is controlled by Cy_CTDAC_SetSignMode.
- Note
- Call this function only when the update mode is set to Direct write. Calling this function for any other update mode will not have the intended effect.
- Parameters
-
base | Pointer to structure describing registers |
value | Value to write into the CTDAC_VAL register |
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetValueBuffered()
__STATIC_INLINE void Cy_CTDAC_SetValueBuffered |
( |
CTDAC_Type * |
base, |
|
|
int32_t |
value |
|
) |
| |
Set the CTDAC_VAL_NEXT register.
The value is transferred to the CTDAC_VAL register on the next edge of the CTDAC clock. Only the least significant 12 bits have an effect. Sign extension of negative values is unnecessary and is ignored by the hardware. The way in which the CTDAC interprets the 12-bit data is controlled by Cy_CTDAC_SetSignMode.
- Note
- Calling this function in Direct write mode will not update the DAC output. Call this function for all modes that use buffered values (i.e. uses a clock).
- Parameters
-
base | Pointer to structure describing registers |
value | Value to write into the CTDAC_VAL_NEXT register |
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetSignMode()
Set whether to interpret the DAC value as signed or unsigned.
In unsigned mode, the DAC value register is used without any decoding. In signed mode, the MSB is inverted by adding 0x800 to the DAC value. This converts the lowest signed number, 0x800, to the lowest unsigned number, 0x000.
- Parameters
-
base | Pointer to structure describing registers |
formatMode | Mode can be signed or unsigned. See cy_en_ctdac_format_t for values. |
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetDeepSleepMode()
Enable or disable the DAC hardware operation in Deep Sleep mode.
- Parameters
-
base | Pointer to structure describing registers |
deepSleep | Enable or disable Deep Sleep operation. Select value from cy_en_ctdac_deep_sleep_t. |
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetOutputMode()
Set the output mode of the CTDAC:
- Parameters
-
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetDeglitchMode()
Enable deglitching on the unbuffered path, buffered path, both, or disable deglitching.
The deglitch mode should match the configured output path.
- Parameters
-
base | Pointer to structure describing registers |
deglitchMode | Deglitching mode selection. See cy_en_ctdac_deglitch_t for values. |
- Returns
- None
- Function Usage
◆ Cy_CTDAC_SetDeglitchCycles()
void Cy_CTDAC_SetDeglitchCycles |
( |
CTDAC_Type * |
base, |
|
|
uint32_t |
deglitchCycles |
|
) |
| |
Set the number of deglitch cycles (0 to 63) that will be used.
To calculate the deglitch time:
(DEGLITCH_CNT + 1) / PERI_CLOCK_FREQ
The optimal deglitch time is 700 ns.
- Parameters
-
base | Pointer to structure describing registers |
deglitchCycles | Number of cycles to deglitch |
- Returns
- None
- Function Usage
#define PERICLK_FREQ_MHZ (50)
#define DEGLITCH_TARGET_TIME_NS (700uL)
#define FACTOR_NANO_TO_MICRO (1000uL)
uint32_t deglitchCycles = ((PERICLK_FREQ_MHZ * DEGLITCH_TARGET_TIME_NS) / FACTOR_NANO_TO_MICRO) - 1uL;
◆ Cy_CTDAC_SetRef()
Set the CTDAC reference source to Vdda or an external reference.
The external reference must come from Opamp1 of the CTB.
- Parameters
-
base | Pointer to structure describing registers |
refSource | The reference source. Select a value from cy_en_ctdac_ref_source_t. |
- Returns
- None
- Function Usage