conf_general.h
Go to the documentation of this file.
1 /*
2  Copyright 2012-2014 Benjamin Vedder benjamin@vedder.se
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19  * conf_general.h
20  *
21  * Created on: 14 apr 2014
22  * Author: benjamin
23  */
24 
25 #ifndef CONF_GENERAL_H_
26 #define CONF_GENERAL_H_
27 
28 // Firmware version
29 #define FW_VERSION_MAJOR 1
30 #define FW_VERSION_MINOR 12
31 
32 #include "datatypes.h"
33 
34 /*
35  * Settings
36  */
37 #define AUTO_PRINT_FAULTS 0
38 #define SYSTEM_CORE_CLOCK 168000000
39 
40 // Component parameters to override
41 //#define VIN_R1 33000.0
42 //#define VIN_R2 2200.0
43 //#define CURRENT_AMP_GAIN 10.0
44 //#define CURRENT_SHUNT_RES 0.0005
45 //#define WS2811_ENABLE 1
46 //#define CURR1_DOUBLE_SAMPLE 0
47 //#define CURR2_DOUBLE_SAMPLE 0
48 
49 /*
50  * Select only one hardware version
51  */
52 //#define HW_VERSION_40
53 //#define HW_VERSION_45
54 #define HW_VERSION_46 // Also for 4.7
55 //#define HW_VERSION_R2
56 //#define HW_VERSION_VICTOR_R1A
57 
58 /*
59  * Select only one (default) motor configuration
60  */
61 //#define MCCONF_OUTRUNNER1
62 #define MCCONF_OUTRUNNER2
63 //#define MCCONF_STEN
64 
65 /*
66  * Select which custom application to use. To configure the default applications and
67  * their settings, go to conf_general_read_app_configuration and enter the default init
68  * values.
69  */
70 //#define USE_APP_STEN
71 //#define USE_APP_GURGALOF
72 
73 /*
74  * Use encoder
75  */
76 #define ENCODER_ENABLE 0
77 #define ENCODER_COUNTS 14400
78 //#define ENCODER_COUNTS 10000
79 
80 /*
81  * Enable CAN-bus
82  */
83 #define CAN_ENABLE 1
84 
85 /*
86  * Settings for the external LEDs (hardcoded for now)
87  */
88 #define LED_EXT_BATT_LOW 28.0
89 #define LED_EXT_BATT_HIGH 33.0
90 
91 /*
92  * Output WS2811 signal on the HALL1 pin. Notice that hall sensors can't be used
93  * at the same time.
94  */
95 #ifndef WS2811_ENABLE
96 #define WS2811_ENABLE 0
97 #endif
98 #define WS2811_CLK_HZ 800000
99 #define WS2811_LED_NUM 14
100 #define WS2811_USE_CH2 1 // 0: CH1 (PB6) 1: CH2 (PB7)
101 
102 /*
103  * Servo output driver
104  */
105 #ifndef SERVO_OUT_ENABLE
106 #define SERVO_OUT_ENABLE 0 // Enable servo output
107 #endif
108 #define SERVO_OUT_SIMPLE 1 // Use simple HW-based driver (recommended)
109 #define SERVO_OUT_PULSE_MIN_US 1000 // Minimum pulse length in microseconds
110 #define SERVO_OUT_PULSE_MAX_US 2000 // Maximum pulse length in microseconds
111 #define SERVO_OUT_RATE_HZ 50 // Update rate in Hz
112 
113 // Correction factor for computations that depend on the old resistor division factor
114 #define VDIV_CORR ((VIN_R2 / (VIN_R2 + VIN_R1)) / (2.2 / (2.2 + 33.0)))
115 
116 // Actual voltage on 3.3V net based on internal reference
117 //#define V_REG (1.21 / ((float)ADC_Value[ADC_IND_VREFINT] / 4095.0))
118 #define V_REG 3.3
119 
120 // Functions
121 void conf_general_init(void);
126 bool conf_general_detect_motor_param(float current, float min_rpm, float low_duty,
127  float *int_limit, float *bemf_coupling_k, int8_t *hall_table, int *hall_res);
128 
129 #endif /* CONF_GENERAL_H_ */
void conf_general_init(void)
Definition: conf_general.c:144
void conf_general_read_mc_configuration(mc_configuration *conf)
Definition: conf_general.c:282
Definition: datatypes.h:246
bool conf_general_store_mc_configuration(mc_configuration *conf)
Definition: conf_general.c:375
void conf_general_read_app_configuration(app_configuration *conf)
Definition: conf_general.c:169
bool conf_general_detect_motor_param(float current, float min_rpm, float low_duty, float *int_limit, float *bemf_coupling_k, int8_t *hall_table, int *hall_res)
Definition: conf_general.c:405
bool conf_general_store_app_configuration(app_configuration *conf)
Definition: conf_general.c:246
Definition: datatypes.h:91