UUtzinger_DRV8704 0.1.0 Arduino library for the DRV8704 dual H-bridge gate driver

drv8704_defs.h
Go to the documentation of this file.
1
6 #ifndef DRV8704_DEFS_H
7 #define DRV8704_DEFS_H
8
9 #include <stdint.h>
10 #include <SPI.h>
11
12 #define DRV8704_SPI_SPEED 1000000U
13 #define DRV8704_SPI_MODE SPI_MODE0
14 #define DRV8704_SPI_ORDER MSBFIRST
15
16 #define DRV8704_WAKE_DELAY_US 1000U
17 #define DRV8704_RESET_PULSE_WIDTH_US 10U
18 #define DRV8704_RESET_RECOVERY_US 10U
19
20 #define DRV8704_MIN_INPUT_PWM_HZ 100U
21 #define DRV8704_MAX_INPUT_PWM_HZ 500000U
22 #define DRV8704_DEFAULT_INPUT_PWM_HZ 20000U
23 #define DRV8704_DEFAULT_PWM_RES_BITS 8U
24 #define DRV8704_MAX_PWM_RES_BITS 16U
25
26 #define DRV8704_REG_CTRL 0x00U
27 #define DRV8704_REG_TORQUE 0x01U
28 #define DRV8704_REG_OFF 0x02U
29 #define DRV8704_REG_BLANK 0x03U
30 #define DRV8704_REG_DECAY 0x04U
31 #define DRV8704_REG_RESERVED 0x05U
32 #define DRV8704_REG_DRIVE 0x06U
33 #define DRV8704_REG_STATUS 0x07U
34
35 #define DRV8704_REGISTER_COUNT 8U
36 #define DRV8704_REGISTER_MASK 0x0FFFU
37 #define DRV8704_ADDRESS_MASK 0x0007U
38 #define DRV8704_ADDRESS_SHIFT 12U
39 #define DRV8704_READ_BIT 0x8000U
40 #define DRV8704_WRITE_BIT 0x0000U
41
42 #define DRV8704_CTRL_DEFAULT 0x0C01U
43 #define DRV8704_TORQUE_DEFAULT 0x00FFU
44 #define DRV8704_OFF_DEFAULT 0x0130U
45 #define DRV8704_BLANK_DEFAULT 0x0080U
46 #define DRV8704_DECAY_DEFAULT 0x0010U
47 #define DRV8704_DRIVE_DEFAULT 0x0FA5U
48 #define DRV8704_STATUS_DEFAULT 0x0000U
49
50 #define DRV8704_CTRL_ENBL_SHIFT 0U
51 #define DRV8704_CTRL_ENBL_MASK 0x0001U
52 #define DRV8704_CTRL_ISGAIN_SHIFT 8U
53 #define DRV8704_CTRL_ISGAIN_MASK 0x0300U
54 #define DRV8704_CTRL_DTIME_SHIFT 10U
55 #define DRV8704_CTRL_DTIME_MASK 0x0C00U
56
57 #define DRV8704_TORQUE_SHIFT 0U
58 #define DRV8704_TORQUE_MASK 0x00FFU
59
60 #define DRV8704_OFF_TOFF_SHIFT 0U
61 #define DRV8704_OFF_TOFF_MASK 0x00FFU
62 #define DRV8704_OFF_PWMMODE_SHIFT 8U
63 #define DRV8704_OFF_PWMMODE_MASK 0x0100U
64 #define DRV8704_OFF_PWMMODE_PWM 0x0100U
65
66 #define DRV8704_BLANK_TBLANK_SHIFT 0U
67 #define DRV8704_BLANK_TBLANK_MASK 0x00FFU
68
69 #define DRV8704_DECAY_TDECAY_SHIFT 0U
70 #define DRV8704_DECAY_TDECAY_MASK 0x00FFU
71 #define DRV8704_DECAY_DECMOD_SHIFT 8U
72 #define DRV8704_DECAY_DECMOD_MASK 0x0700U
73
74 #define DRV8704_DRIVE_OCPTH_SHIFT 0U
75 #define DRV8704_DRIVE_OCPTH_MASK 0x0003U
76 #define DRV8704_DRIVE_OCPDEG_SHIFT 2U
77 #define DRV8704_DRIVE_OCPDEG_MASK 0x000CU
78 #define DRV8704_DRIVE_TDRIVEN_SHIFT 4U
79 #define DRV8704_DRIVE_TDRIVEN_MASK 0x0030U
80 #define DRV8704_DRIVE_TDRIVEP_SHIFT 6U
81 #define DRV8704_DRIVE_TDRIVEP_MASK 0x00C0U
82 #define DRV8704_DRIVE_IDRIVEN_SHIFT 8U
83 #define DRV8704_DRIVE_IDRIVEN_MASK 0x0300U
84 #define DRV8704_DRIVE_IDRIVEP_SHIFT 10U
85 #define DRV8704_DRIVE_IDRIVEP_MASK 0x0C00U
86
87 #define DRV8704_STATUS_OTS_MASK 0x0001U
88 #define DRV8704_STATUS_AOCP_MASK 0x0002U
89 #define DRV8704_STATUS_BOCP_MASK 0x0004U
90 #define DRV8704_STATUS_APDF_MASK 0x0008U
91 #define DRV8704_STATUS_BPDF_MASK 0x0010U
92 #define DRV8704_STATUS_UVLO_MASK 0x0020U
93 #define DRV8704_STATUS_FAULT_MASK 0x003FU
94
95 #define DRV8704_STATUS_OTS_SHIFT 0U
96 #define DRV8704_STATUS_AOCP_SHIFT 1U
97 #define DRV8704_STATUS_BOCP_SHIFT 2U
98 #define DRV8704_STATUS_APDF_SHIFT 3U
99 #define DRV8704_STATUS_BPDF_SHIFT 4U
100 #define DRV8704_STATUS_UVLO_SHIFT 5U
101
102 #endif // DRV8704_DEFS_H