before merging master
[inav.git] / lib / main / AT32F43x / Drivers / AT32F43x_StdPeriph_Driver / inc / at32f435_437_acc.h
blobaa3c70d76872e526881c6ef469db560ced068656
1 /**
2 **************************************************************************
3 * @file at32f435_437_acc.h
4 * @version v2.1.0
5 * @date 2022-08-16
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
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
36 /* Includes ------------------------------------------------------------------*/
37 #include "at32f435_437.h"
39 /** @addtogroup AT32F435_437_periph_driver
40 * @{
43 /** @addtogroup ACC
44 * @{
47 /** @defgroup ACC_exported_constants
48 * @{
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 */
63 /**
64 * @}
67 /** @defgroup ACC_exported_types
68 * @{
71 /**
72 * @brief type define acc register all
74 typedef struct
77 /**
78 * @brief acc sts register, offset:0x00
80 union
82 __IO uint32_t sts;
83 struct
85 __IO uint32_t calrdy : 1; /* [0] */
86 __IO uint32_t rslost : 1; /* [1] */
87 __IO uint32_t reserved1 : 30;/* [31:2] */
88 } sts_bit;
91 /**
92 * @brief acc ctrl1 register, offset:0x04
94 union
96 __IO uint32_t ctrl1;
97 struct
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] */
107 } ctrl1_bit;
111 * @brief acc ctrl2 register, offset:0x08
113 union
115 __IO uint32_t ctrl2;
116 struct
118 __IO uint32_t hickcal : 8; /* [7:0] */
119 __IO uint32_t hicktrim : 6; /* [13:8] */
120 __IO uint32_t reserved1 : 18;/* [31:14] */
121 } ctrl2_bit;
125 * @brief acc acc_c1 register, offset:0x0C
127 union
129 __IO uint32_t c1;
130 struct
132 __IO uint32_t c1 : 16;/* [15:0] */
133 __IO uint32_t reserved1 : 16;/* [31:16] */
134 } c1_bit;
138 * @brief acc acc_c2 register, offset:0x10
140 union
142 __IO uint32_t c2;
143 struct
145 __IO uint32_t c2 : 16;/* [15:0] */
146 __IO uint32_t reserved1 : 16;/* [31:16] */
147 } c2_bit;
151 * @brief acc acc_c3 register, offset:0x14
153 union
155 __IO uint32_t c3;
156 struct
158 __IO uint32_t c3 : 16;/* [15:0] */
159 __IO uint32_t reserved1 : 16;/* [31:16] */
160 } c3_bit;
162 } acc_type;
165 * @}
168 #define ACC ((acc_type *) ACC_BASE)
170 /** @defgroup ACC_exported_functions
171 * @{
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);
190 * @}
194 * @}
198 * @}
201 #ifdef __cplusplus
203 #endif
205 #endif