2 **************************************************************************
3 * @file at32f435_437_acc.h
6 * @brief at32f435_437 acc header file
7 **************************************************************************
8 * Copyright notice & Disclaimer
10 * The software Board Support Package (BSP) that is made available to
11 * download from Artery official website is the copyrighted work of Artery.
12 * Artery authorizes customers to use, copy, and distribute the BSP
13 * software and its related documentation for the purpose of design and
14 * development in conjunction with Artery microcontrollers. Use of the
15 * software is governed by this copyright notice and the following disclaimer.
17 * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
18 * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
19 * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
20 * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
21 * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24 **************************************************************************
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef __AT32F435_437_ACC_H
29 #define __AT32F435_437_ACC_H
36 /* Includes ------------------------------------------------------------------*/
37 #include "at32f435_437.h"
39 /** @addtogroup AT32F435_437_periph_driver
47 /** @defgroup ACC_exported_constants
51 #define ACC_CAL_HICKCAL ((uint16_t)0x0000) /*!< acc hick calibration */
52 #define ACC_CAL_HICKTRIM ((uint16_t)0x0002) /*!< acc hick trim */
54 #define ACC_RSLOST_FLAG ((uint16_t)0x0002) /*!< acc reference signal lost error flag */
55 #define ACC_CALRDY_FLAG ((uint16_t)0x0001) /*!< acc internal high-speed clock calibration ready error flag */
57 #define ACC_CALRDYIEN_INT ((uint16_t)0x0020) /*!< acc internal high-speed clock calibration ready interrupt enable */
58 #define ACC_EIEN_INT ((uint16_t)0x0010) /*!< acc reference signal lost interrupt enable */
60 #define ACC_SOF_OTG1 ((uint16_t)0x0000) /*!< acc sof signal select: otg1 */
61 #define ACC_SOF_OTG2 ((uint16_t)0x0004) /*!< acc sof signal select: otg2 */
67 /** @defgroup ACC_exported_types
72 * @brief type define acc register all
78 * @brief acc sts register, offset:0x00
85 __IO
uint32_t calrdy
: 1; /* [0] */
86 __IO
uint32_t rslost
: 1; /* [1] */
87 __IO
uint32_t reserved1
: 30;/* [31:2] */
92 * @brief acc ctrl1 register, offset:0x04
99 __IO
uint32_t calon
: 1; /* [0] */
100 __IO
uint32_t entrim
: 1; /* [1] */
101 __IO
uint32_t reserved1
: 2; /* [3:2] */
102 __IO
uint32_t eien
: 1; /* [4] */
103 __IO
uint32_t calrdyien
: 1; /* [5] */
104 __IO
uint32_t reserved2
: 2; /* [7:6] */
105 __IO
uint32_t step
: 4; /* [11:8] */
106 __IO
uint32_t reserved3
: 20;/* [31:12] */
111 * @brief acc ctrl2 register, offset:0x08
118 __IO
uint32_t hickcal
: 8; /* [7:0] */
119 __IO
uint32_t hicktrim
: 6; /* [13:8] */
120 __IO
uint32_t reserved1
: 18;/* [31:14] */
125 * @brief acc acc_c1 register, offset:0x0C
132 __IO
uint32_t c1
: 16;/* [15:0] */
133 __IO
uint32_t reserved1
: 16;/* [31:16] */
138 * @brief acc acc_c2 register, offset:0x10
145 __IO
uint32_t c2
: 16;/* [15:0] */
146 __IO
uint32_t reserved1
: 16;/* [31:16] */
151 * @brief acc acc_c3 register, offset:0x14
158 __IO
uint32_t c3
: 16;/* [15:0] */
159 __IO
uint32_t reserved1
: 16;/* [31:16] */
168 #define ACC ((acc_type *) ACC_BASE)
170 /** @defgroup ACC_exported_functions
174 void acc_calibration_mode_enable(uint16_t acc_trim
, confirm_state new_state
);
175 void acc_step_set(uint8_t step_value
);
176 void acc_sof_select(uint16_t sof_sel
);
177 void acc_interrupt_enable(uint16_t acc_int
, confirm_state new_state
);
178 uint8_t acc_hicktrim_get(void);
179 uint8_t acc_hickcal_get(void);
180 void acc_write_c1(uint16_t acc_c1_value
);
181 void acc_write_c2(uint16_t acc_c2_value
);
182 void acc_write_c3(uint16_t acc_c3_value
);
183 uint16_t acc_read_c1(void);
184 uint16_t acc_read_c2(void);
185 uint16_t acc_read_c3(void);
186 flag_status
acc_flag_get(uint16_t acc_flag
);
187 void acc_flag_clear(uint16_t acc_flag
);