Newer
Older
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/**
* || ____ _ __
* +------+ / __ )(_) /_______________ _____ ___
* | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
* +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
* || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
*
* Crazyflie control firmware
*
* Copyright (C) 2011-2012 Bitcraze AB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, in version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* config.h - Main configuration file
*
* This file define the default configuration of the copter
* It contains two types of parameters:
* - The global parameters are globally defined and independent of any
* compilation profile. An example of such define could be some pinout.
* - The profiled defines, they are parameter that can be specific to each
* dev build. The vanilla build is intended to be a "customer" build without
* fancy spinning debugging stuff. The developers build are anything the
* developer could need to debug and run his code/crazy stuff.
*
* The golden rule for the profile is NEVER BREAK ANOTHER PROFILE. When adding a
* new parameter, one shall take care to modified everything necessary to
* preserve the behavior of the other profiles.
*
* For the flag. T_ means task. H_ means HAL module. U_ would means utils.
*/
#ifndef CONFIG_H_
#define CONFIG_H_
#include "nrf24l01.h"
#include "trace.h"
#define PROTOCOL_VERSION 2
#ifdef STM32F4XX
#define P_NAME "Crazyflie 2.0"
#define QUAD_FORMATION_X
#define CONFIG_BLOCK_ADDRESS (2048 * (64-1))
#define MCU_ID_ADDRESS 0x1FFF7A10
#define MCU_FLASH_SIZE_ADDRESS 0x1FFF7A22
#define FREERTOS_HEAP_SIZE 30000
#define FREERTOS_MIN_STACK_SIZE 150 // M4-FPU register setup is bigger so stack needs to be bigger
#define FREERTOS_MCU_CLOCK_HZ 168000000
#else
#define P_NAME "Crazyflie 1.0"
#define CONFIG_BLOCK_ADDRESS (1024 * (128-1))
#define MCU_ID_ADDRESS 0x1FFFF7E8
#define MCU_FLASH_SIZE_ADDRESS 0x1FFFF7E0
#define FREERTOS_HEAP_SIZE 14000
#define FREERTOS_MIN_STACK_SIZE 100
#define FREERTOS_MCU_CLOCK_HZ 72000000
#endif
// Task priorities. Higher number higher priority
#define STABILIZER_TASK_PRI 4
#define SENSORS_TASK_PRI 4
#define ADC_TASK_PRI 3
#define SYSTEM_TASK_PRI 2
#define CRTP_TX_TASK_PRI 2
#define CRTP_RX_TASK_PRI 2
#define EXTRX_TASK_PRI 2
#define LOG_TASK_PRI 1
#define MEM_TASK_PRI 1
#define PARAM_TASK_PRI 1
#define PROXIMITY_TASK_PRI 0
#define PM_TASK_PRI 0
#ifdef PLATFORM_CF2
#define SYSLINK_TASK_PRI 5
#define USBLINK_TASK_PRI 3
#endif
#ifdef PLATFORM_CF1
#define NRF24LINK_TASK_PRI 2
#define ESKYLINK_TASK_PRI 1
#define UART_RX_TASK_PRI 2
#endif
// Not compiled
#if 0
#define INFO_TASK_PRI 2
#define PID_CTRL_TASK_PRI 2
#endif
// Task names
#define SYSTEM_TASK_NAME "SYSTEM"
#define ADC_TASK_NAME "ADC"
#define PM_TASK_NAME "PWRMGNT"
#define CRTP_TX_TASK_NAME "CRTP-TX"
#define CRTP_RX_TASK_NAME "CRTP-RX"
#define CRTP_RXTX_TASK_NAME "CRTP-RXTX"
#define LOG_TASK_NAME "LOG"
#define MEM_TASK_NAME "MEM"
#define PARAM_TASK_NAME "PARAM"
#define SENSORS_TASK_NAME "SENSORS"
#define STABILIZER_TASK_NAME "STABILIZER"
#define NRF24LINK_TASK_NAME "NRF24LINK"
#define ESKYLINK_TASK_NAME "ESKYLINK"
#define SYSLINK_TASK_NAME "SYSLINK"
#define USBLINK_TASK_NAME "USBLINK"
#define PROXIMITY_TASK_NAME "PROXIMITY"
#define EXTRX_TASK_NAME "EXTRX"
#define UART_RX_TASK_NAME "UART"
//Task stack sizes
#define SYSTEM_TASK_STACKSIZE (2* configMINIMAL_STACK_SIZE)
#define ADC_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PM_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define CRTP_TX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define CRTP_RX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define CRTP_RXTX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define LOG_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define MEM_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PARAM_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define SENSORS_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define STABILIZER_TASK_STACKSIZE (3 * configMINIMAL_STACK_SIZE)
#define NRF24LINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define ESKYLINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define SYSLINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define USBLINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PROXIMITY_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define EXTRX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define UART_RX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
//The radio channel. From 0 to 125
#define RADIO_CHANNEL 80
#define RADIO_DATARATE RADIO_RATE_250K
#define RADIO_ADDRESS 0xE7E7E7E7E7ULL
/**
* \def ACTIVATE_AUTO_SHUTDOWN
* Will automatically shot of system if no radio activity
*/
//#define ACTIVATE_AUTO_SHUTDOWN
/**
* \def ACTIVATE_STARTUP_SOUND
* Playes a startup melody using the motors and PWM modulation
*/
#define ACTIVATE_STARTUP_SOUND
// Define to force initialization of expansion board drivers. For test-rig and programming.
//#define FORCE_EXP_DETECT
/**
* \def PRINT_OS_DEBUG_INFO
* Print with an interval information about freertos mem/stack usage to console.
*/
//#define PRINT_OS_DEBUG_INFO
//Debug defines
//#define BRUSHLESS_MOTORCONTROLLER
//#define ADC_OUTPUT_RAW_DATA
//#define UART_OUTPUT_TRACE_DATA
//#define UART_OUTPUT_RAW_DATA_ONLY
//#define IMU_OUTPUT_RAW_DATA_ON_UART
//#define T_LAUCH_MOTORS
//#define T_LAUCH_MOTOR_TEST
//#define MOTOR_RAMPUP_TEST
/**
* \def ADC_OUTPUT_RAW_DATA
* When defined the gyro data will be written to the UART channel.
* The UART must be configured to run really fast, e.g. in 2Mb/s.
*/
//#define ADC_OUTPUT_RAW_DATA
#if defined(UART_OUTPUT_TRACE_DATA) && defined(ADC_OUTPUT_RAW_DATA)
# error "Can't define UART_OUTPUT_TRACE_DATA and ADC_OUTPUT_RAW_DATA at the same time"
#endif
#if defined(UART_OUTPUT_TRACE_DATA) || defined(ADC_OUTPUT_RAW_DATA) || defined(IMU_OUTPUT_RAW_DATA_ON_UART)
#define UART_OUTPUT_RAW_DATA_ONLY
#endif
#if defined(UART_OUTPUT_TRACE_DATA) && defined(T_LAUNCH_ACC)
# error "UART_OUTPUT_TRACE_DATA and T_LAUNCH_ACC doesn't work at the same time yet due to dma sharing..."
#endif
#endif /* CONFIG_H_ */