2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
27 #include "build/build_config.h"
29 #include "drivers/time.h"
30 #include "drivers/bus_spi.h"
31 #include "drivers/sensor.h"
32 #include "drivers/io.h"
33 #include "drivers/exti.h"
34 #include "drivers/accgyro/accgyro.h"
35 #include "drivers/accgyro/accgyro_mpu.h"
36 #include "drivers/accgyro/accgyro_mpu6500.h"
38 #include "hardware_revision.h"
40 uint8_t hardwareRevision
= 1;
42 void detectHardwareRevision(void)
44 GPIO_InitTypeDef GPIO_InitStructure
= {
45 .GPIO_Mode
= GPIO_Mode_OUT
,
46 .GPIO_OType
= GPIO_OType_PP
,
47 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
48 .GPIO_Speed
= GPIO_Speed_2MHz
52 GPIO_InitStructure
.GPIO_Pin
= (GPIO_Pin_5
| GPIO_Pin_12
);
53 GPIO_Init(GPIOB
, &GPIO_InitStructure
);
54 GPIO_SetBits(GPIOB
, GPIO_InitStructure
.GPIO_Pin
);
56 GPIO_InitStructure
.GPIO_Pin
= GPIO_Pin_7
;
57 GPIO_Init(GPIOA
, &GPIO_InitStructure
);
58 GPIO_SetBits(GPIOA
, GPIO_InitStructure
.GPIO_Pin
);
61 void updateHardwareRevision(void)