Low level driver for SPI for F7
[betaflight.git] / src / main / target / NERO / target.h
blobb358377183703ff2b2b056b4b6f4dabd12af1c3e
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight 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.
9 * Cleanflight 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.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
19 #define TARGET_BOARD_IDENTIFIER "NERO"
21 #define USBD_PRODUCT_STRING "NERO"
23 #define HW_PIN PB2
25 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
27 #define LED0_PIN PB6
28 #define LED1_PIN PB5
29 #define LED2_PIN PB4
31 #define BEEPER PC1
32 #define BEEPER_INVERTED
34 // MPU6500 interrupt
35 #define USE_EXTI
36 #define MPU_INT_EXTI PB2
37 #define USE_MPU_DATA_READY_SIGNAL
38 //#define DEBUG_MPU_DATA_READY_INTERRUPT
40 #define MPU6500_CS_PIN PC4
41 #define MPU6500_SPI_INSTANCE SPI1
43 #define ACC
44 #define USE_ACC_MPU6500
45 #define USE_ACC_SPI_MPU6500
46 #define ACC_MPU6500_ALIGN CW0_DEG
48 #define GYRO
49 #define USE_GYRO_MPU6500
50 #define USE_GYRO_SPI_MPU6500
51 #define GYRO_MPU6500_ALIGN CW0_DEG
53 #define USE_SDCARD
55 #define SDCARD_DETECT_INVERTED
56 #define SDCARD_DETECT_PIN PD2
57 #define SDCARD_SPI_INSTANCE SPI3
58 #define SDCARD_SPI_CS_PIN PA15
60 // SPI2 is on the APB1 bus whose clock runs at 84MHz. Divide to under 400kHz for init:
61 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 328kHz
62 // Divide to under 25MHz for normal operation:
63 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 4 // 21MHz
65 //#define SDCARD_DMA_CHANNEL_TX DMA1_Stream5
66 //#define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA_FLAG_TCIF1_5
67 //#define SDCARD_DMA_CLK RCC_AHB1Periph_DMA1
68 //#define SDCARD_DMA_CHANNEL DMA_CHANNEL_0
70 #define USE_I2C
71 #define USE_I2C_DEVICE_1
72 #define I2C_DEVICE (I2CDEV_1)
73 #define I2C1_SCL PB8
74 #define I2C1_SDA PB9
76 #define USE_VCP
77 //#define VBUS_SENSING_PIN PA8
78 //#define VBUS_SENSING_ENABLED
80 #define USE_UART1
81 #define UART1_RX_PIN PA10
82 #define UART1_TX_PIN PA9
84 #define USE_UART3
85 #define UART3_RX_PIN PB11
86 #define UART3_TX_PIN PB10
88 #define USE_UART6
89 #define UART6_RX_PIN PC7
90 #define UART6_TX_PIN PC6
92 #define USE_SOFTSERIAL1
93 #define USE_SOFTSERIAL2
95 #define SERIAL_PORT_COUNT 6
97 #define USE_ESCSERIAL
98 #define ESCSERIAL_TIMER_TX_PIN PC7 // (Hardware=0, PPM)
100 #define USE_SPI
101 #define USE_LOWLEVEL_DRIVER
103 #define USE_SPI_DEVICE_1
104 #define SPI1_NSS_PIN PC4
105 #define SPI1_SCK_PIN PA5
106 #define SPI1_MISO_PIN PA6
107 #define SPI1_MOSI_PIN PA7
109 #define USE_SPI_DEVICE_2
110 #define SPI2_NSS_PIN PB12
111 #define SPI2_SCK_PIN PB13
112 #define SPI2_MISO_PIN PB14
113 #define SPI2_MOSI_PIN PB15
115 #define USE_SPI_DEVICE_3
116 #define SPI3_NSS_PIN PB3
117 #define SPI3_SCK_PIN PC10
118 #define SPI3_MISO_PIN PC11
119 #define SPI3_MOSI_PIN PC12
121 #define USE_ADC
122 #define VBAT_ADC_PIN PC3
124 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
126 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
127 #define SERIALRX_PROVIDER SERIALRX_SBUS
128 #define SERIALRX_UART SERIAL_PORT_USART6
130 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
132 #define TARGET_IO_PORTA 0xffff
133 #define TARGET_IO_PORTB 0xffff
134 #define TARGET_IO_PORTC 0xffff
135 #define TARGET_IO_PORTD (BIT(2))
137 #define USABLE_TIMER_CHANNEL_COUNT 9
138 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(9) )