-
Notifications
You must be signed in to change notification settings - Fork 12
/
hw_conf_v4.0.h
executable file
·165 lines (145 loc) · 3.55 KB
/
hw_conf_v4.0.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#ifndef _HW_CONF_V4_0_H_
#define _HW_CONF_V4_0_H_
#include "ch.h"
#include "hal.h"
// PWM
#define PWM_A_HIGH_GPIO GPIOA
#define PWM_A_HIGH_PIN 10
#define PWM_B_HIGH_GPIO GPIOA
#define PWM_B_HIGH_PIN 9
#define PWM_C_HIGH_GPIO GPIOA
#define PWM_C_HIGH_PIN 8
#define PWM_A_LOW_GPIO GPIOB
#define PWM_A_LOW_PIN 15
#define PWM_B_LOW_GPIO GPIOB
#define PWM_B_LOW_PIN 14
#define PWM_C_LOW_GPIO GPIOB
#define PWM_C_LOW_PIN 13
// Gate Power
#define EN_GATE_GPIO GPIOA
#define EN_GATE_PIN 3
// ADC
#define CURR_A_GPIO GPIOC
#define CURR_B_GPIO GPIOC
#define CURR_C_GPIO GPIOA
#define CURR_A_PIN 1
#define CURR_B_PIN 3
#define CURR_C_PIN 1
#define VSENSE_A_GPIO GPIOC
#define VSENSE_B_GPIO GPIOA
#define VSENSE_C_GPIO GPIOA
#define VSENSE_A_PIN 2
#define VSENSE_B_PIN 0
#define VSENSE_C_PIN 2
#define VBUS_GPIO GPIOB
#define VBUS_PIN 1
#define NTC_GPIO GPIOC
#define NTC_PIN 0
#define CURR_A_CHANNEL ADC_Channel_11
#define CURR_B_CHANNEL ADC_Channel_13
#define CURR_C_CHANNEL ADC_Channel_1
#define VSENSE_A_CHANNEL ADC_Channel_12
#define VSENSE_B_CHANNEL ADC_Channel_0
#define VSENSE_C_CHANNEL ADC_Channel_2
#define VBUS_CHANNEL ADC_Channel_9
#define NTC_CHANNEL ADC_Channel_10
// Encoder
#define ENCODER_SCK_GPIO GPIOA
#define ENCODER_MISO_GPIO GPIOA
#define ENCODER_MOSI_GPIO GPIOA
#define ENCODER_NSS_GPIO GPIOA
#define ENCODER_SCK_PIN 5
#define ENCODER_MISO_PIN 6
#define ENCODER_MOSI_PIN 7
#define ENCODER_NSS_PIN GPIOA_LRCK
// WS2812B
#define WS2812B_GPIO GPIOC
#define WS2812B_PIN 9
#define CURRENT_SENSE_RES 0.001
#define CURRENT_AMP_GAIN 20
#define V_REG 3.3
#define VBUS_R1 200000.0
#define VBUS_R2 10000.0
// I2C
#define I2C_DEV I2CD1
#define I2C_GPIO GPIOB
#define I2C_SCL_PIN 6
#define I2C_SDA_PIN 7
// CAN
#define CAN_RX_GPIO GPIOB
#define CAN_RX_PIN 8
#define CAN_TX_GPIO GPIOB
#define CAN_TX_PIN 9
#endif
#define _HW_CONF_H_
#include "ch.h"
#include "hal.h"
// PWM
#define PWM_A_HIGH_GPIO GPIOA
#define PWM_A_HIGH_PIN 10
#define PWM_B_HIGH_GPIO GPIOA
#define PWM_B_HIGH_PIN 9
#define PWM_C_HIGH_GPIO GPIOA
#define PWM_C_HIGH_PIN 8
#define PWM_A_LOW_GPIO GPIOB
#define PWM_A_LOW_PIN 15
#define PWM_B_LOW_GPIO GPIOB
#define PWM_B_LOW_PIN 14
#define PWM_C_LOW_GPIO GPIOB
#define PWM_C_LOW_PIN 13
// Gate Power
#define EN_GATE_GPIO GPIOA
#define EN_GATE_PIN 3
// ADC
#define CURR_A_GPIO GPIOC
#define CURR_B_GPIO GPIOC
#define CURR_C_GPIO GPIOA
#define CURR_A_PIN 1
#define CURR_B_PIN 3
#define CURR_C_PIN 1
#define VSENSE_A_GPIO GPIOC
#define VSENSE_B_GPIO GPIOA
#define VSENSE_C_GPIO GPIOA
#define VSENSE_A_PIN 2
#define VSENSE_B_PIN 0
#define VSENSE_C_PIN 2
#define VBUS_GPIO GPIOB
#define VBUS_PIN 1
#define NTC_GPIO GPIOC
#define NTC_PIN 0
#define CURR_A_CHANNEL ADC_Channel_11
#define CURR_B_CHANNEL ADC_Channel_13
#define CURR_C_CHANNEL ADC_Channel_1
#define VSENSE_A_CHANNEL ADC_Channel_12
#define VSENSE_B_CHANNEL ADC_Channel_0
#define VSENSE_C_CHANNEL ADC_Channel_2
#define VBUS_CHANNEL ADC_Channel_9
#define NTC_CHANNEL ADC_Channel_10
// Encoder
#define ENCODER_SCK_GPIO GPIOA
#define ENCODER_MISO_GPIO GPIOA
#define ENCODER_MOSI_GPIO GPIOA
#define ENCODER_NSS_GPIO GPIOA
#define ENCODER_SCK_PIN 5
#define ENCODER_MISO_PIN 6
#define ENCODER_MOSI_PIN 7
#define ENCODER_NSS_PIN GPIOA_LRCK
// WS2812B
#define WS2812B_GPIO GPIOC
#define WS2812B_PIN 9
#define CURRENT_SENSE_RES 0.001
#define CURRENT_AMP_GAIN 20
#define V_REG 3.3
#define VBUS_R1 200000.0
#define VBUS_R2 10000.0
// I2C
#define I2C_DEV I2CD1
#define I2C_GPIO GPIOB
#define I2C_SCL_PIN 6
#define I2C_SDA_PIN 7
// CAN
#define CAN_RX_GPIO GPIOB
#define CAN_RX_PIN 8
#define CAN_TX_GPIO GPIOB
#define CAN_TX_PIN 9
#endif /* _HW_CONF_V4_0_H_ */