/** ************************************************************************** * @file at32f435_437_dac.h * @version v2.1.0 * @date 2022-08-16 * @brief at32f435_437 dac header file ************************************************************************** * Copyright notice & Disclaimer * * The software Board Support Package (BSP) that is made available to * download from Artery official website is the copyrighted work of Artery. * Artery authorizes customers to use, copy, and distribute the BSP * software and its related documentation for the purpose of design and * development in conjunction with Artery microcontrollers. Use of the * software is governed by this copyright notice and the following disclaimer. * * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES, * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS, * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS, * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * ************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __AT32F435_437_DAC_H #define __AT32F435_437_DAC_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "at32f435_437.h" /** @addtogroup AT32F435_437_periph_driver * @{ */ /** @addtogroup DAC * @{ */ #define DAC1_D1DMAUDRF ((uint32_t)(0x00002000)) #define DAC2_D2DMAUDRF ((uint32_t)(0x20000000)) /** @defgroup DAC_exported_types * @{ */ /** * @brief dac select type */ typedef enum { DAC1_SELECT = 0x01, /*!< dac1 select */ DAC2_SELECT = 0x02 /*!< dac2 select */ } dac_select_type; /** * @brief dac trigger type */ typedef enum { DAC_TMR6_TRGOUT_EVENT = 0x00, /*!< dac trigger selection:timer6 trgout event */ DAC_TMR8_TRGOUT_EVENT = 0x01, /*!< dac trigger selection:timer8 trgout event */ DAC_TMR7_TRGOUT_EVENT = 0x02, /*!< dac trigger selection:timer7 trgout event */ DAC_TMR5_TRGOUT_EVENT = 0x03, /*!< dac trigger selection:timer5 trgout event */ DAC_TMR2_TRGOUT_EVENT = 0x04, /*!< dac trigger selection:timer2 trgout event */ DAC_TMR4_TRGOUT_EVENT = 0x05, /*!< dac trigger selection:timer4 trgout event */ DAC_EXTERNAL_INTERRUPT_LINE_9 = 0x06, /*!< dac trigger selection:external line9 */ DAC_SOFTWARE_TRIGGER = 0x07 /*!< dac trigger selection:software trigger */ } dac_trigger_type; /** * @brief dac wave type */ typedef enum { DAC_WAVE_GENERATE_NONE = 0x00, /*!< dac wave generation disabled */ DAC_WAVE_GENERATE_NOISE = 0x01, /*!< dac noise wave generation enabled */ DAC_WAVE_GENERATE_TRIANGLE = 0x02 /*!< dac triangle wave generation enabled */ } dac_wave_type; /** * @brief dac mask amplitude type */ typedef enum { DAC_LSFR_BIT0_AMPLITUDE_1 = 0x00, /*!< unmask bit0/ triangle amplitude equal to 1 */ DAC_LSFR_BIT10_AMPLITUDE_3 = 0x01, /*!< unmask bit[1:0]/ triangle amplitude equal to 3 */ DAC_LSFR_BIT20_AMPLITUDE_7 = 0x02, /*!< unmask bit[2:0]/ triangle amplitude equal to 7 */ DAC_LSFR_BIT30_AMPLITUDE_15 = 0x03, /*!< unmask bit[3:0]/ triangle amplitude equal to 15 */ DAC_LSFR_BIT40_AMPLITUDE_31 = 0x04, /*!< unmask bit[4:0]/ triangle amplitude equal to 31 */ DAC_LSFR_BIT50_AMPLITUDE_63 = 0x05, /*!< unmask bit[5:0]/ triangle amplitude equal to 63 */ DAC_LSFR_BIT60_AMPLITUDE_127 = 0x06, /*!< unmask bit[6:0]/ triangle amplitude equal to 127 */ DAC_LSFR_BIT70_AMPLITUDE_255 = 0x07, /*!< unmask bit[7:0]/ triangle amplitude equal to 255 */ DAC_LSFR_BIT80_AMPLITUDE_511 = 0x08, /*!< unmask bit[8:0]/ triangle amplitude equal to 511 */ DAC_LSFR_BIT90_AMPLITUDE_1023 = 0x09, /*!< unmask bit[9:0]/ triangle amplitude equal to 1023 */ DAC_LSFR_BITA0_AMPLITUDE_2047 = 0x0A, /*!< unmask bit[10:0]/ triangle amplitude equal to 2047 */ DAC_LSFR_BITB0_AMPLITUDE_4095 = 0x0B /*!< unmask bit[11:0]/ triangle amplitude equal to 4095 */ } dac_mask_amplitude_type; /** * @brief dac1 aligned data type */ typedef enum { DAC1_12BIT_RIGHT = 0x40007408, /*!< dac1 12-bit data right-aligned */ DAC1_12BIT_LEFT = 0x4000740C, /*!< dac1 12-bit data left-aligned */ DAC1_8BIT_RIGHT = 0x40007410 /*!< dac1 8-bit data right-aligned */ } dac1_aligned_data_type; /** * @brief dac2 aligned data type */ typedef enum { DAC2_12BIT_RIGHT = 0x40007414, /*!< dac2 12-bit data right-aligned */ DAC2_12BIT_LEFT = 0x40007418, /*!< dac2 12-bit data left-aligned */ DAC2_8BIT_RIGHT = 0x4000741C /*!< dac2 8-bit data right-aligned */ } dac2_aligned_data_type; /** * @brief dac dual data type */ typedef enum { DAC_DUAL_12BIT_RIGHT = 0x40007420, /*!