1 /*
2  * Copyright (c) 2023 deveritec GmbH
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_TMAG5273_H_
7 #define ZEPHYR_INCLUDE_DT_BINDINGS_TMAG5273_H_
8 
9 #include <zephyr/dt-bindings/dt-util.h>
10 
11 /* Operating Mode */
12 #define TMAG5273_DT_OPER_MODE_CONTINUOUS 0
13 #define TMAG5273_DT_OPER_MODE_STANDBY    1
14 
15 /* Axis */
16 #define TMAG5273_DT_AXIS_NONE 0x0
17 #define TMAG5273_DT_AXIS_X    0x1
18 #define TMAG5273_DT_AXIS_Y    0x2
19 #define TMAG5273_DT_AXIS_Z    0x4
20 #define TMAG5273_DT_AXIS_XY   (TMAG5273_DT_AXIS_X | TMAG5273_DT_AXIS_Y)
21 #define TMAG5273_DT_AXIS_XZ   (TMAG5273_DT_AXIS_X | TMAG5273_DT_AXIS_Z)
22 #define TMAG5273_DT_AXIS_YZ   (TMAG5273_DT_AXIS_Y | TMAG5273_DT_AXIS_Z)
23 #define TMAG5273_DT_AXIS_XYZ  (TMAG5273_DT_AXIS_X | TMAG5273_DT_AXIS_Y | TMAG5273_DT_AXIS_Z)
24 #define TMAG5273_DT_AXIS_XYX  0x8
25 #define TMAG5273_DT_AXIS_YXY  0x9
26 #define TMAG5273_DT_AXIS_YZY  0xA
27 #define TMAG5273_DT_AXIS_XZX  0xB
28 
29 /* Range */
30 #define TMAG5273_DT_AXIS_RANGE_LOW     0
31 #define TMAG5273_DT_AXIS_RANGE_HIGH    1
32 #define TMAG5273_DT_AXIS_RANGE_RUNTIME 2
33 
34 /* Interrupt-Mode */
35 #define TMAG5273_DT_INT_THROUGH_INT         0
36 #define TMAG5273_DT_INT_THROUGH_INT_EXC_I2C 1
37 #define TMAG5273_DT_INT_THROUGH_SCL         2
38 #define TMAG5273_DT_INT_THROUGH_SCL_EXC_I2C 3
39 
40 /* Threshold crossings */
41 #define TMAG5273_DT_THRX_COUNT_1 0
42 #define TMAG5273_DT_THRX_COUNT_4 1
43 
44 /* Threshold direction */
45 #define TMAG5273_DT_THRX_ABOVE   0
46 #define TMAG5273_DT_THRX_BELOW   1
47 #define TMAG5273_DT_THRX_OUTSIDE 2
48 #define TMAG5273_DT_THRX_INSIDE  3
49 
50 /* Temperature coefficient */
51 #define TMAG5273_DT_TEMP_COEFF_NONE    0
52 #define TMAG5273_DT_TEMP_COEFF_NDBFE   1
53 #define TMAG5273_DT_TEMP_COEFF_CERAMIC 2
54 
55 /* Angle/Magnitude calculation */
56 #define TMAG5273_DT_ANGLE_MAG_NONE    0
57 #define TMAG5273_DT_ANGLE_MAG_XY      1
58 #define TMAG5273_DT_ANGLE_MAG_YZ      2
59 #define TMAG5273_DT_ANGLE_MAG_XZ      3
60 #define TMAG5273_DT_ANGLE_MAG_RUNTIME 4
61 
62 /* Channel Magnitude Gain Correction */
63 #define TMAG5273_DT_CORRECTION_CH_1 0
64 #define TMAG5273_DT_CORRECTION_CH_2 1
65 
66 /* Averaging */
67 #define TMAG5273_DT_AVERAGING_NONE 0
68 #define TMAG5273_DT_AVERAGING_2X   1
69 #define TMAG5273_DT_AVERAGING_4X   2
70 #define TMAG5273_DT_AVERAGING_8X   3
71 #define TMAG5273_DT_AVERAGING_16X  4
72 #define TMAG5273_DT_AVERAGING_32X  5
73 
74 /* Sleeptime */
75 #define TMAG5273_DT_SLEEPTIME_1MS     0
76 #define TMAG5273_DT_SLEEPTIME_5MS     1
77 #define TMAG5273_DT_SLEEPTIME_10MS    2
78 #define TMAG5273_DT_SLEEPTIME_15MS    3
79 #define TMAG5273_DT_SLEEPTIME_20MS    4
80 #define TMAG5273_DT_SLEEPTIME_30MS    5
81 #define TMAG5273_DT_SLEEPTIME_50MS    6
82 #define TMAG5273_DT_SLEEPTIME_100MS   7
83 #define TMAG5273_DT_SLEEPTIME_500MS   8
84 #define TMAG5273_DT_SLEEPTIME_1000MS  9
85 #define TMAG5273_DT_SLEEPTIME_2000MS  10
86 #define TMAG5273_DT_SLEEPTIME_5000MS  11
87 #define TMAG5273_DT_SLEEPTIME_20000MS 12
88 
89 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_TMAG5273_H_ */
90