Hardware Abstraction Layer (HAL)

Power Level Mapping

The following table shows how the HAL-defined power levels map to the hardware-specific power levels when cyhal_dac uses output pin buffered mode (with opamp). Unbuffered mode only supports ON and OFF.

HAL Power Level Opamp Power Level
CYHAL_POWER_LEVEL_HIGH CY_CTB_POWER_HIGH
CYHAL_POWER_LEVEL_MEDIUM CY_CTB_POWER_MEDIUM
CYHAL_POWER_LEVEL_LOW CY_CTB_POWER_LOW
CYHAL_POWER_LEVEL_DEFAULT CY_CTB_POWER_MEDIUM

cyhal_dac automatically choose between buffered and unbuffered mode by selecting pin. Unbuffered mode - dac pin, buffered - opamp pin. Buffered mode take care of reserving and configuring the opamp (OA0). If AREF voltage reference source is selected cyhal_dac takes care of reserving and configuring the opamp (OA1). By default cyhal_dac use VDDA voltage reference source. Use cyhal_dac_set_reference() to change between CYHAL_DAC_REF_VDDA and CYHAL_DAC_REF_VREF voltage reference sources.