APM:Libraries
board.h
Go to the documentation of this file.
1 #ifndef _BOARD_STM32V1F4_H_
2 #define _BOARD_STM32V1F4_H_
3 
4 
5 
9 #define __CM4_REV 0x0001
10 #define __MPU_PRESENT 1
11 #define __NVIC_PRIO_BITS 4
12 #define __Vendor_SysTickConfig 0
13 #define __FPU_PRESENT 1
15 #define HSE_VALUE (8000000)
16 
17 #define CYCLES_PER_MICROSECOND (SystemCoreClock / 1000000)
18 #define SYSTICK_RELOAD_VAL (CYCLES_PER_MICROSECOND*1000-1)
19 
20 #undef STM32_PCLK1
21 #undef STM32_PCLK2
22 #define STM32_PCLK1 (CYCLES_PER_MICROSECOND*1000000/4)
23 #define STM32_PCLK2 (CYCLES_PER_MICROSECOND*1000000/2)
24 
25 #define BOARD_BUTTON_PIN 254
26 
27 #ifndef LOW
28 # define LOW 0
29 #endif
30 #ifndef HIGH
31 # define HIGH 1
32 #endif
33 
34 //#define BOARD_BUZZER_PIN 5 // PB15, PWM2 - used as PPM2
35 
36 
37 #define BOARD_NR_USARTS 5
38 #define BOARD_USART1_TX_PIN 23
39 #define BOARD_USART1_RX_PIN 24
40 #define BOARD_USART3_TX_PIN 0
41 #define BOARD_USART3_RX_PIN 100
42 #define BOARD_USART6_TX_PIN 12
43 #define BOARD_USART6_RX_PIN 13
44 
45 #define BOARD_DSM_USART (_USART1)
46 
47 #define BOARD_NR_SPI 3
48 #define BOARD_SPI1_SCK_PIN 52
49 #define BOARD_SPI1_MISO_PIN 53
50 #define BOARD_SPI1_MOSI_PIN 54
51 #define BOARD_SPI2_SCK_PIN 3 // PB13
52 #define BOARD_SPI2_MISO_PIN 4 // PB14
53 #define BOARD_SPI2_MOSI_PIN 5 // PB15
54 #define BOARD_SPI3_MOSI_PIN 18
55 #define BOARD_SPI3_MISO_PIN 17
56 #define BOARD_SPI3_SCK_PIN 16
57 
58 
59 
60 #define BOARD_MPU6000_CS_PIN 51
61 #define BOARD_MPU6000_DRDY_PIN 10 // PC4
62 
63 
64 #define BOARD_USB_SENSE 11 // PC5
65 
66 
67 # define BOARD_BLUE_LED_PIN 36 // BLUE
68 # define BOARD_GREEN_LED_PIN 9 // frequency select - resistor to VCC or ground
69 
70 # define HAL_GPIO_A_LED_PIN BOARD_BLUE_LED_PIN
71 # define HAL_GPIO_B_LED_PIN BOARD_GREEN_LED_PIN
72 
73 # define HAL_LED_ON LOW
74 # define HAL_LED_OFF HIGH
75 
76 
77 #define BOARD_NR_GPIO_PINS 109
78 
79 #define I2C1_SDA PB9
80 #define I2C1_SCL PB8
81 
82 #define I2C2_SDA PB11
83 #define I2C2_SCL PB10
84 
85 #define BOARD_I2C_BUS_INT 1 // hardware internal I2C
86 
87 #define BOARD_I2C_BUS_EXT 2 // external soft I2C
88 #define BOARD_I2C_BUS_SLOW 2 // slow down this bus
89 
90 // bus 2 (soft) pins
91 #define BOARD_SOFT_SCL 105
92 #define BOARD_SOFT_SDA 26
93 
94 //#define BOARD_BARO_DEFAULT HAL_BARO_BMP085_I2C
95 //#define HAL_BARO_BMP085_BUS BOARD_I2C_BUS_EXT
96 
97 #define BOARD_COMPASS_DEFAULT HAL_COMPASS_HMC5843
98 
99 #define HAL_COMPASS_HMC5843_I2C_BUS BOARD_I2C_BUS_EXT
100 #define HAL_COMPASS_HMC5843_I2C_ADDR (0x1E)
101 #define HAL_COMPASS_HMC5843_ROTATION ROTATION_NONE
102 
103 
104 #define BOARD_INS_DEFAULT HAL_INS_MPU60XX_SPI
105 #define BOARD_INS_ROTATION ROTATION_YAW_180
106 #define BOARD_INS_MPU60x0_NAME "mpu6000"
107 
108 
109 #define BOARD_STORAGE_SIZE 8192 //4096 // EEPROM size
110 
111 #define BOARD_DATAFLASH_NAME "dataflash"
112 #define BOARD_DATAFLASH_PAGES 0x2000 // in 256-bytes pages
113 #define BOARD_DATAFLASH_ERASE_SIZE (4096)// in bytes
114 
115 #if 1// if board's dataflash supports 4k erases then we can use it as FAT and share it via USB
116 #define BOARD_DATAFLASH_FATFS
117 #define BOARD_HAS_SDIO
118 #define USB_MASSSTORAGE
119 #define HAL_BOARD_LOG_DIRECTORY "0:"
120 #define HAL_BOARD_TERRAIN_DIRECTORY "0:/TERRAIN"
121 //#define HAL_PARAM_DEFAULTS_PATH "0:/APM/defaults.parm"
122 #else
123 // old dataflash logs
124 #endif
125 
126 #define BOARD_OSD_NAME "osd"
127 #define BOARD_OSD_CS_PIN 103
128 #define BOARD_OSD_VSYNC_PIN 9 // PC3, Frequency input (pin 11)
129 
130 #define BOARD_OWN_NAME "MiniF4_OSD"
131 
132 # define BOARD_PUSHBUTTON_PIN 254
133 # define BOARD_USB_MUX_PIN -1
134 # define BOARD_BATTERY_VOLT_PIN 8 // Battery voltage on A0 (PC2) D8
135 # define BOARD_BATTERY_CURR_PIN 7 // Battery current on A1 (PC1) D7
136 # define BOARD_SONAR_SOURCE_ANALOG_PIN 254
137 
138 #define BOARD_USB_DMINUS 108
139 
140 
141 #define BOARD_SBUS_UART 1 // can use some UART as hardware inverted input
142 
143 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
144 
145 // use soft I2C driver instead hardware
146 //#define BOARD_SOFT_I2C
147 
148 // motor layouts
149 #define SERVO_PIN_1 46 // PB0
150 #define SERVO_PIN_2 45 // PB1
151 #define SERVO_PIN_3 50 // PA3
152 #define SERVO_PIN_4 49 // PA2
153 #define SERVO_PIN_5 48 // PA1
154 #define SERVO_PIN_6 22 // PA8
155 
156 #define MOTOR_LAYOUT_DEFAULT 0
157 
158 //#define HAL_CONSOLE uart1Driver // console on radio
159 #define HAL_CONSOLE USB_Driver // console on USB
160 #define HAL_CONSOLE_PORT 0 // console on USB
161 
162 
163 
164 /*
165 
166  // @Param: USB_STORAGE
167  // @DisplayName: allows access to SD card at next reboot
168  // @Description: Allows to read/write internal SD card via USB mass-storage protocol. Auto-reset.
169  // @Values: 0:normal, 1:work as USB flash drive
170  // @User: Advanced
171  AP_GROUPINFO("USB_STORAGE", 8, AP_Param_Helper, _usb_storage, 0), \
172 
173 */
174 #define BOARD_HAL_VARINFO \
175  AP_GROUPINFO("USB_STORAGE", 30, AP_Param_Helper, _usb_storage, 0),
176 
177 
178 // parameters
179 #define BOARD_HAL_PARAMS \
180  AP_Int8 _usb_storage;
181 
182 #define USB_MASSSTORAGE
183 
184 #endif