update credits
[librepilot.git] / flight / targets / boards / tinyfish / board_hw_defs.c
blob6f1ef546779607fdd23d5750bef8f68e3b11e8f6
1 /**
2 ******************************************************************************
3 * @file board_hw_defs.c
4 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
5 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
8 * @brief Defines board specific static initializers for hardware for the tinyFISH board.
9 *****************************************************************************/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #if defined(PIOS_INCLUDE_LED)
28 #include <pios_led_priv.h>
29 static const struct pios_gpio pios_leds[] = {
30 [PIOS_LED_HEARTBEAT] = {
31 .pin = {
32 .gpio = GPIOC,
33 .init = {
34 .GPIO_Pin = GPIO_Pin_14,
35 .GPIO_Mode = GPIO_Mode_OUT,
36 .GPIO_OType = GPIO_OType_PP,
37 .GPIO_Speed = GPIO_Speed_50MHz,
38 .GPIO_PuPd = GPIO_PuPd_NOPULL,
41 .active_low = false
43 [PIOS_LED_ALARM] = { /* or PC15 ?? */
44 .pin = {
45 .gpio = GPIOA,
46 .init = {
47 .GPIO_Pin = GPIO_Pin_13,
48 .GPIO_Mode = GPIO_Mode_OUT,
49 .GPIO_OType = GPIO_OType_PP,
50 .GPIO_Speed = GPIO_Speed_50MHz,
51 .GPIO_PuPd = GPIO_PuPd_NOPULL,
54 .active_low = false
56 [PIOS_BUZZER_ALARM] = { /* (or PB2 ??) */
57 .pin = {
58 .gpio = GPIOC,
59 .init = {
60 .GPIO_Pin = GPIO_Pin_15,
61 .GPIO_Mode = GPIO_Mode_OUT,
62 .GPIO_OType = GPIO_OType_PP,
63 .GPIO_Speed = GPIO_Speed_50MHz,
64 .GPIO_PuPd = GPIO_PuPd_NOPULL,
67 .active_low = false
71 static const struct pios_gpio_cfg pios_led_cfg = {
72 .gpios = pios_leds,
73 .num_gpios = NELEMENTS(pios_leds),
76 const struct pios_gpio_cfg *PIOS_BOARD_HW_DEFS_GetLedCfg(__attribute__((unused)) uint32_t board_revision)
78 return &pios_led_cfg;
81 #endif /* PIOS_INCLUDE_LED */
83 #if defined(PIOS_INCLUDE_SPI)
85 #include <pios_spi_priv.h>
87 /* SPI Flash interface */
89 static const struct pios_spi_cfg pios_spi2_cfg = {
90 .regs = SPI2,
91 .init = {
92 .SPI_Mode = SPI_Mode_Master,
93 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
94 .SPI_DataSize = SPI_DataSize_8b,
95 .SPI_NSS = SPI_NSS_Soft,
96 .SPI_FirstBit = SPI_FirstBit_MSB,
97 .SPI_CRCPolynomial = 7,
98 .SPI_CPOL = SPI_CPOL_High,
99 .SPI_CPHA = SPI_CPHA_2Edge,
100 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16, /* 10 Mhz */
102 .use_crc = false,
103 .remap = GPIO_AF_5,
104 .sclk = {
105 .gpio = GPIOB,
106 .init = {
107 .GPIO_Pin = GPIO_Pin_13,
108 .GPIO_Speed = GPIO_Speed_50MHz,
109 .GPIO_Mode = GPIO_Mode_AF,
110 .GPIO_OType = GPIO_OType_PP,
111 .GPIO_PuPd = GPIO_PuPd_NOPULL,
114 .miso = {
115 .gpio = GPIOB,
116 .init = {
117 .GPIO_Pin = GPIO_Pin_14,
118 .GPIO_Speed = GPIO_Speed_50MHz,
119 .GPIO_Mode = GPIO_Mode_AF,
120 .GPIO_OType = GPIO_OType_PP,
121 .GPIO_PuPd = GPIO_PuPd_NOPULL,
124 .mosi = {
125 .gpio = GPIOB,
126 .init = {
127 .GPIO_Pin = GPIO_Pin_15,
128 .GPIO_Speed = GPIO_Speed_50MHz,
129 .GPIO_Mode = GPIO_Mode_AF,
130 .GPIO_OType = GPIO_OType_PP,
131 .GPIO_PuPd = GPIO_PuPd_NOPULL,
134 .slave_count = 1,
135 .ssel = {
137 .gpio = GPIOB,
138 .init = {
139 .GPIO_Pin = GPIO_Pin_12,
140 .GPIO_Speed = GPIO_Speed_50MHz,
141 .GPIO_Mode = GPIO_Mode_OUT,
142 .GPIO_OType = GPIO_OType_PP,
143 .GPIO_PuPd = GPIO_PuPd_UP
149 uint32_t pios_spi2_id;
151 static const struct pios_spi_cfg pios_spi1_cfg = {
152 .regs = SPI1,
153 .init = {
154 .SPI_Mode = SPI_Mode_Master,
155 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
156 .SPI_DataSize = SPI_DataSize_8b,
157 .SPI_NSS = SPI_NSS_Soft,
158 .SPI_FirstBit = SPI_FirstBit_MSB,
159 .SPI_CRCPolynomial = 7,
160 .SPI_CPOL = SPI_CPOL_High,
161 .SPI_CPHA = SPI_CPHA_2Edge,
162 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16, /* 10 Mhz */
164 .use_crc = false,
165 .remap = GPIO_AF_5,
166 .sclk = {
167 .gpio = GPIOA,
168 .init = {
169 .GPIO_Pin = GPIO_Pin_5,
170 .GPIO_Speed = GPIO_Speed_50MHz,
171 .GPIO_Mode = GPIO_Mode_AF,
172 .GPIO_OType = GPIO_OType_PP,
173 .GPIO_PuPd = GPIO_PuPd_NOPULL,
176 .miso = {
177 .gpio = GPIOA,
178 .init = {
179 .GPIO_Pin = GPIO_Pin_6,
180 .GPIO_Speed = GPIO_Speed_50MHz,
181 .GPIO_Mode = GPIO_Mode_AF,
182 .GPIO_OType = GPIO_OType_PP,
183 .GPIO_PuPd = GPIO_PuPd_NOPULL,
186 .mosi = {
187 .gpio = GPIOA,
188 .init = {
189 .GPIO_Pin = GPIO_Pin_7,
190 .GPIO_Speed = GPIO_Speed_50MHz,
191 .GPIO_Mode = GPIO_Mode_AF,
192 .GPIO_OType = GPIO_OType_PP,
193 .GPIO_PuPd = GPIO_PuPd_NOPULL,
196 .slave_count = 1,
197 .ssel = {
198 { /* MPU6000 */
199 .gpio = GPIOA,
200 .init = {
201 .GPIO_Pin = GPIO_Pin_4,
202 .GPIO_Speed = GPIO_Speed_50MHz,
203 .GPIO_Mode = GPIO_Mode_OUT,
204 .GPIO_OType = GPIO_OType_PP,
205 .GPIO_PuPd = GPIO_PuPd_UP
211 uint32_t pios_spi1_id;
213 #endif /* PIOS_INCLUDE_SPI */
215 #if defined(PIOS_INCLUDE_FLASH)
216 #include "pios_flashfs_logfs_priv.h"
217 #include "pios_flash_jedec_priv.h"
218 #include "pios_flash_internal_priv.h"
220 static const struct pios_flash_internal_cfg flash_internal_system_cfg = {};
222 static const struct flashfs_logfs_cfg flashfs_internal_cfg = {
223 .fs_magic = 0x99abcfef,
224 .total_fs_size = EE_BANK_SIZE, /* 32K bytes (16x2KB sectors) */
225 .arena_size = 0x00004000, /* 64 * slot size = 16K bytes = 8 sectors */
226 .slot_size = 0x00000100, /* 256 bytes */
228 .start_offset = EE_BANK_BASE, /* start after the bootloader */
229 .sector_size = 0x00000800, /* 2K bytes */
230 .page_size = 0x00000800, /* 2K bytes */
233 #endif /* PIOS_INCLUDE_FLASH */
235 #include "pios_tim_priv.h"
237 static const TIM_TimeBaseInitTypeDef tim_time_base = {
238 .TIM_Prescaler = (PIOS_MASTER_CLOCK / 1000000) - 1,
239 .TIM_ClockDivision = TIM_CKD_DIV1,
240 .TIM_CounterMode = TIM_CounterMode_Up,
241 .TIM_Period = ((1000000 / PIOS_SERVO_UPDATE_HZ) - 1),
242 .TIM_RepetitionCounter = 0x0000,
245 static const struct pios_tim_clock_cfg tim_1_cfg = {
246 .timer = TIM1,
247 .time_base_init = &tim_time_base,
248 .irq = {
249 .init = {
250 .NVIC_IRQChannel = TIM1_CC_IRQn,
251 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
252 .NVIC_IRQChannelSubPriority = 0,
253 .NVIC_IRQChannelCmd = ENABLE,
258 static const struct pios_tim_clock_cfg tim_2_cfg = {
259 .timer = TIM2,
260 .time_base_init = &tim_time_base,
261 .irq = {
262 .init = {
263 .NVIC_IRQChannel = TIM2_IRQn,
264 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
265 .NVIC_IRQChannelSubPriority = 0,
266 .NVIC_IRQChannelCmd = ENABLE,
271 static const struct pios_tim_clock_cfg tim_3_cfg = {
272 .timer = TIM3,
273 .time_base_init = &tim_time_base,
274 .irq = {
275 .init = {
276 .NVIC_IRQChannel = TIM3_IRQn,
277 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
278 .NVIC_IRQChannelSubPriority = 0,
279 .NVIC_IRQChannelCmd = ENABLE,
284 static const struct pios_tim_clock_cfg tim_4_cfg = {
285 .timer = TIM4,
286 .time_base_init = &tim_time_base,
287 .irq = {
288 .init = {
289 .NVIC_IRQChannel = TIM4_IRQn,
290 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
291 .NVIC_IRQChannelSubPriority = 0,
292 .NVIC_IRQChannelCmd = ENABLE,
297 static const struct pios_tim_clock_cfg tim_8_cfg = {
298 .timer = TIM8,
299 .time_base_init = &tim_time_base,
300 .irq = {
301 .init = {
302 .NVIC_IRQChannel = TIM8_CC_IRQn,
303 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
304 .NVIC_IRQChannelSubPriority = 0,
305 .NVIC_IRQChannelCmd = ENABLE,
310 static const struct pios_tim_clock_cfg tim_15_cfg = {
311 .timer = TIM4,
312 .time_base_init = &tim_time_base,
313 .irq = {
314 .init = {
315 .NVIC_IRQChannel = TIM1_BRK_TIM15_IRQn,
316 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
317 .NVIC_IRQChannelSubPriority = 0,
318 .NVIC_IRQChannelCmd = ENABLE,
323 static const struct pios_tim_clock_cfg tim_16_cfg = {
324 .timer = TIM4,
325 .time_base_init = &tim_time_base,
326 .irq = {
327 .init = {
328 .NVIC_IRQChannel = TIM1_UP_TIM16_IRQn,
329 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
330 .NVIC_IRQChannelSubPriority = 0,
331 .NVIC_IRQChannelCmd = ENABLE,
336 static const struct pios_tim_clock_cfg tim_17_cfg = {
337 .timer = TIM4,
338 .time_base_init = &tim_time_base,
339 .irq = {
340 .init = {
341 .NVIC_IRQChannel = TIM1_TRG_COM_TIM17_IRQn,
342 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
343 .NVIC_IRQChannelSubPriority = 0,
344 .NVIC_IRQChannelCmd = ENABLE,
349 #include <pios_servo_config.h>
351 #define GPIO_AF_PA1_TIM2 GPIO_AF_1
352 #define GPIO_AF_PA0_TIM2 GPIO_AF_1
353 #define GPIO_AF_PA8_TIM1 GPIO_AF_6
354 #define GPIO_AF_PA2_TIM2 GPIO_AF_1
355 #define GPIO_AF_PB6_TIM4 GPIO_AF_2
356 #define GPIO_AF_PB5_TIM3 GPIO_AF_2
357 #define GPIO_AF_PB0_TIM3 GPIO_AF_2
358 #define GPIO_AF_PB1_TIM3 GPIO_AF_2
359 #define GPIO_AF_PB9_TIM4 GPIO_AF_2
360 #define GPIO_AF_PB8_TIM4 GPIO_AF_2
361 #define GPIO_AF_PB7_TIM4 GPIO_AF_2
362 #define GPIO_AF_PB4_TIM3 GPIO_AF_2
363 #define GPIO_AF_PB11_TIM2 GPIO_AF_1
364 #define GPIO_AF_PA15_TIM8 GPIO_AF_2
365 #define GPIO_AF_PA3_TIM15 GPIO_AF_9
366 #define GPIO_AF_PA6_TIM3 GPIO_AF_2
367 #define GPIO_AF_PA7_TIM3 GPIO_AF_2
368 #define GPIO_AF_PA10_TIM2 GPIO_AF_10
370 #define GPIO_AF_PA4_TIM3 GPIO_AF_2
371 #define GPIO_AF_PA7_TIM17 GPIO_AF_1
372 #define GPIO_AF_PB8_TIM16 GPIO_AF_1
374 #define GPIO_AF_PB9_TIM8 GPIO_AF_10
375 #define GPIO_AF_PA2_TIM15 GPIO_AF_9
376 #define GPIO_AF_PB10_TIM2 GPIO_AF_1
378 #define TIM1_CH1_DMA_INSTANCE 1
379 #define TIM1_CH1_DMA_CHANNEL 2
381 #define TIM16_CH1_DMA_INSTANCE 2
382 #define TIM16_CH1_DMA_CHANNEL 3
384 static const struct pios_tim_channel pios_tim_servoport_pins[] = {
385 TIM_SERVO_CHANNEL_CONFIG(TIM4, 3, B, 8), // bank 1
386 TIM_SERVO_CHANNEL_CONFIG(TIM8, 3, B, 9), // bank 2
387 TIM_SERVO_CHANNEL_CONFIG(TIM15, 2, A, 3), // bank 3
388 TIM_SERVO_CHANNEL_CONFIG(TIM15, 1, A, 2), // bank 3
390 // following two are here so we can have two additional PWM outputs instead of UART3
391 TIM_SERVO_CHANNEL_CONFIG(TIM2, 4, B, 11), // bank 4 (UART3 RX)
392 TIM_SERVO_CHANNEL_CONFIG(TIM2, 3, B, 10), // bank 4 (UART3 TX)
395 #if defined(PIOS_INCLUDE_USART)
397 #define GPIO_AF_USART1 GPIO_AF_7
398 #define GPIO_AF_USART2 GPIO_AF_7
399 #define GPIO_AF_USART3 GPIO_AF_7
402 #include "pios_usart_priv.h"
403 #include "pios_usart_config.h"
405 static const struct pios_usart_cfg pios_usart_cfg[] = {
406 USART_CONFIG(USART1, B, 7, B, 6), /* RX_DEBUG, TX_??? */
407 USART_CONFIG(USART2, A, 15, A, 14), /* RX_SBUS, TX_FRSKY_TELEMETRY */
408 USART_CONFIG(USART3, B, 11, B, 10),
412 #endif /* PIOS_INCLUDE_USART */
414 #if defined(PIOS_INCLUDE_COM)
416 #include "pios_com_priv.h"
418 #endif /* PIOS_INCLUDE_COM */
420 #if defined(PIOS_INCLUDE_RTC)
422 * Realtime Clock (RTC)
424 #include <pios_rtc_priv.h>
426 void PIOS_RTC_IRQ_Handler(void);
427 void RTC_WKUP_IRQHandler() __attribute__((alias("PIOS_RTC_IRQ_Handler")));
428 static const struct pios_rtc_cfg pios_rtc_main_cfg = {
429 .clksrc = RCC_RTCCLKSource_HSE_Div32,
430 .prescaler = 25 - 1, // 8Mhz / 32 / 16 / 25 => 625Hz
431 .irq = {
432 .init = {
433 .NVIC_IRQChannel = RTC_WKUP_IRQn,
434 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
435 .NVIC_IRQChannelSubPriority = 0,
436 .NVIC_IRQChannelCmd = ENABLE,
441 void PIOS_RTC_IRQ_Handler(void)
443 PIOS_RTC_irq_handler();
446 #endif /* if defined(PIOS_INCLUDE_RTC) */
448 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
450 * Servo outputs
452 #include <pios_servo_priv.h>
454 const struct pios_servo_cfg pios_servo_cfg = {
455 .tim_oc_init = {
456 .TIM_OCMode = TIM_OCMode_PWM1,
457 .TIM_OutputState = TIM_OutputState_Enable,
458 .TIM_OutputNState = TIM_OutputNState_Disable,
459 .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
460 .TIM_OCPolarity = TIM_OCPolarity_High,
461 .TIM_OCNPolarity = TIM_OCPolarity_High,
462 .TIM_OCIdleState = TIM_OCIdleState_Reset,
463 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
465 .channels = pios_tim_servoport_pins,
466 .num_channels = NELEMENTS(pios_tim_servoport_pins) - 2,
469 const struct pios_servo_cfg pios_servo_uart3_cfg = {
470 .tim_oc_init = {
471 .TIM_OCMode = TIM_OCMode_PWM1,
472 .TIM_OutputState = TIM_OutputState_Enable,
473 .TIM_OutputNState = TIM_OutputNState_Disable,
474 .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
475 .TIM_OCPolarity = TIM_OCPolarity_High,
476 .TIM_OCNPolarity = TIM_OCPolarity_High,
477 .TIM_OCIdleState = TIM_OCIdleState_Reset,
478 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
480 .channels = pios_tim_servoport_pins,
481 .num_channels = NELEMENTS(pios_tim_servoport_pins),
485 #endif /* PIOS_INCLUDE_SERVO && PIOS_INCLUDE_TIM */
488 * PPM Inputs
490 #if defined(PIOS_INCLUDE_PPM)
491 #include <pios_ppm_priv.h>
493 static const struct pios_tim_channel pios_tim_ppm = TIM_SERVO_CHANNEL_CONFIG(TIM2, 4, B, 11);
495 const struct pios_ppm_cfg pios_ppm_cfg = {
496 .tim_ic_init = {
497 .TIM_ICPolarity = TIM_ICPolarity_Rising,
498 .TIM_ICSelection = TIM_ICSelection_DirectTI,
499 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
500 .TIM_ICFilter = 0x0,
502 .channels = &pios_tim_ppm,
503 .num_channels = 1,
505 #endif /* PIOS_INCLUDE_PPM */
508 #if defined(PIOS_INCLUDE_RCVR)
509 #include "pios_rcvr_priv.h"
511 #endif /* PIOS_INCLUDE_RCVR */
513 #if defined(PIOS_INCLUDE_USB)
514 #include "pios_usb_priv.h"
516 static const struct pios_usb_cfg pios_usb_main_cfg = {
517 .irq = {
518 .init = {
519 .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
520 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
521 .NVIC_IRQChannelSubPriority = 0,
522 .NVIC_IRQChannelCmd = ENABLE,
527 const struct pios_usb_cfg *PIOS_BOARD_HW_DEFS_GetUsbCfg(__attribute__((unused)) uint32_t board_revision)
529 return &pios_usb_main_cfg;
531 #endif /* PIOS_INCLUDE_USB */
533 #if defined(PIOS_INCLUDE_WS2811)
534 #include "pios_ws2811_cfg.h"
536 static const struct pios_ws2811_cfg pios_ws2811_cfg = PIOS_WS2811_CONFIG(TIM1, 1, A, 8);
538 void DMA1_Channel2_IRQHandler()
540 PIOS_WS2811_DMA_irq_handler();
543 #endif /* PIOS_INCLUDE_WS2811 */
545 #if defined(PIOS_INCLUDE_ADC)
546 #include "pios_adc_priv.h"
547 void PIOS_ADC_DMC_irq_handler(void);
548 void DMA2_Channel5_IRQHandler(void) __attribute__((alias("PIOS_ADC_DMC_irq_handler")));
550 struct pios_adc_cfg pios_adc_cfg = {
551 .adc_dev = ADC3,
552 .dma = {
553 .irq = {
554 .flags = (DMA2_FLAG_TC5 | DMA2_FLAG_TE5 | DMA2_FLAG_HT5),
555 .init = {
556 .NVIC_IRQChannel = DMA2_Channel5_IRQn,
557 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
558 .NVIC_IRQChannelSubPriority = 0,
559 .NVIC_IRQChannelCmd = ENABLE,
562 .rx = {
563 .channel = DMA2_Channel5,
566 .half_flag = DMA2_FLAG_HT5,
567 .full_flag = DMA2_FLAG_TC5,
570 void PIOS_ADC_DMC_irq_handler(void)
572 /* Call into the generic code to handle the IRQ for this specific device */
573 PIOS_ADC_DMA_Handler();
575 const struct pios_adc_cfg *PIOS_BOARD_HW_DEFS_GetAdcCfg(__attribute__((unused)) uint32_t board_revision)
577 return &pios_adc_cfg;
579 #endif /* if defined(PIOS_INCLUDE_ADC) */
582 * Configuration for MPU6000 chip
584 #if defined(PIOS_INCLUDE_MPU6000)
585 #include "pios_mpu6000.h"
586 static const struct pios_exti_cfg pios_exti_mpu6000_cfg __exti_config = {
587 .vector = PIOS_MPU6000_IRQHandler,
588 .line = EXTI_Line13,
589 .pin = {
590 .gpio = GPIOC,
591 .init = {
592 .GPIO_Pin = GPIO_Pin_13,
593 .GPIO_Speed = GPIO_Speed_10MHz,
594 .GPIO_Mode = GPIO_Mode_IN,
595 .GPIO_OType = GPIO_OType_OD,
596 .GPIO_PuPd = GPIO_PuPd_NOPULL,
599 .irq = {
600 .init = {
601 .NVIC_IRQChannel = EXTI15_10_IRQn,
602 .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
603 .NVIC_IRQChannelSubPriority = 0,
604 .NVIC_IRQChannelCmd = ENABLE,
607 .exti = {
608 .init = {
609 .EXTI_Line = EXTI_Line13, // matches above GPIO pin
610 .EXTI_Mode = EXTI_Mode_Interrupt,
611 .EXTI_Trigger = EXTI_Trigger_Rising,
612 .EXTI_LineCmd = ENABLE,
617 static const struct pios_mpu6000_cfg pios_mpu6000_cfg = {
618 .exti_cfg = &pios_exti_mpu6000_cfg,
619 .Fifo_store = PIOS_MPU6000_FIFO_TEMP_OUT | PIOS_MPU6000_FIFO_GYRO_X_OUT | PIOS_MPU6000_FIFO_GYRO_Y_OUT | PIOS_MPU6000_FIFO_GYRO_Z_OUT,
620 // Clock at 8 khz, downsampled by 8 for 1000 Hz
621 .Smpl_rate_div_no_dlp = 7,
622 // Clock at 1 khz, downsampled by 1 for 1000 Hz
623 .Smpl_rate_div_dlp = 0,
624 .interrupt_cfg = PIOS_MPU6000_INT_CLR_ANYRD,
625 .interrupt_en = PIOS_MPU6000_INTEN_DATA_RDY,
626 .User_ctl = PIOS_MPU6000_USERCTL_DIS_I2C,
627 .Pwr_mgmt_clk = PIOS_MPU6000_PWRMGMT_PLL_X_CLK,
628 .accel_range = PIOS_MPU6000_ACCEL_8G,
629 .gyro_range = PIOS_MPU6000_SCALE_2000_DEG,
630 .filter = PIOS_MPU6000_LOWPASS_256_HZ,
631 .orientation = PIOS_MPU6000_BOTTOM_90DEG,
632 #ifdef PIOS_INCLUDE_SPI
633 .fast_prescaler = PIOS_SPI_PRESCALER_4,
634 .std_prescaler = PIOS_SPI_PRESCALER_64,
635 #endif /* PIOS_INCLUDE_SPI */
636 .max_downsample = 2
639 const struct pios_mpu6000_cfg *PIOS_BOARD_HW_DEFS_GetMPU6000Cfg(__attribute__((unused)) uint32_t board_revision)
641 return &pios_mpu6000_cfg;
643 #endif /* PIOS_INCLUDE_MPU6000 */