2 ******************************************************************************
3 * @file board_hw_defs.c
4 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
5 * @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
6 * @addtogroup OpenPilotSystem OpenPilot System
8 * @addtogroup OpenPilotCore OpenPilot Core
10 * @brief Defines board specific static initializers for hardware for the Revolution board.
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #if defined(PIOS_INCLUDE_LED)
30 #include <pios_led_priv.h>
31 static const struct pios_gpio pios_leds
[] = {
32 [PIOS_LED_HEARTBEAT
] = {
36 .GPIO_Pin
= GPIO_Pin_2
,
37 .GPIO_Speed
= GPIO_Speed_50MHz
,
38 .GPIO_Mode
= GPIO_Mode_OUT
,
39 .GPIO_OType
= GPIO_OType_PP
,
40 .GPIO_PuPd
= GPIO_PuPd_UP
49 .GPIO_Pin
= GPIO_Pin_3
,
50 .GPIO_Speed
= GPIO_Speed_50MHz
,
51 .GPIO_Mode
= GPIO_Mode_OUT
,
52 .GPIO_OType
= GPIO_OType_PP
,
53 .GPIO_PuPd
= GPIO_PuPd_UP
60 static const struct pios_gpio_cfg pios_led_cfg
= {
62 .num_gpios
= NELEMENTS(pios_leds
),
65 const struct pios_gpio_cfg
*PIOS_BOARD_HW_DEFS_GetLedCfg(__attribute__((unused
)) uint32_t board_revision
)
70 #endif /* PIOS_INCLUDE_LED */
72 #if defined(PIOS_INCLUDE_SPI)
73 #include <pios_spi_priv.h>
75 * - Used for BMA180 accelerometer
77 void PIOS_SPI_accel_irq_handler(void);
78 void DMA2_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
79 void DMA2_Stream3_IRQHandler(void) __attribute__((alias("PIOS_SPI_accel_irq_handler")));
80 static const struct pios_spi_cfg pios_spi_accel_cfg
= {
82 .remap
= GPIO_AF_SPI1
,
84 .SPI_Mode
= SPI_Mode_Master
,
85 .SPI_Direction
= SPI_Direction_2Lines_FullDuplex
,
86 .SPI_DataSize
= SPI_DataSize_8b
,
87 .SPI_NSS
= SPI_NSS_Soft
,
88 .SPI_FirstBit
= SPI_FirstBit_MSB
,
89 .SPI_CRCPolynomial
= 7,
90 .SPI_CPOL
= SPI_CPOL_High
,
91 .SPI_CPHA
= SPI_CPHA_2Edge
,
92 .SPI_BaudRatePrescaler
= SPI_BaudRatePrescaler_16
,
97 .flags
= (DMA_IT_TCIF0
| DMA_IT_TEIF0
| DMA_IT_HTIF0
),
99 .NVIC_IRQChannel
= DMA2_Stream0_IRQn
,
100 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
101 .NVIC_IRQChannelSubPriority
= 0,
102 .NVIC_IRQChannelCmd
= ENABLE
,
107 .channel
= DMA2_Stream0
,
109 .DMA_Channel
= DMA_Channel_3
,
110 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI1
->DR
),
111 .DMA_DIR
= DMA_DIR_PeripheralToMemory
,
112 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
113 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
114 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
115 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
116 .DMA_Mode
= DMA_Mode_Normal
,
117 .DMA_Priority
= DMA_Priority_Medium
,
118 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
119 /* .DMA_FIFOThreshold */
120 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
121 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
125 .channel
= DMA2_Stream3
,
127 .DMA_Channel
= DMA_Channel_3
,
128 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI1
->DR
),
129 .DMA_DIR
= DMA_DIR_MemoryToPeripheral
,
130 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
131 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
132 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
133 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
134 .DMA_Mode
= DMA_Mode_Normal
,
135 .DMA_Priority
= DMA_Priority_High
,
136 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
137 /* .DMA_FIFOThreshold */
138 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
139 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
146 .GPIO_Pin
= GPIO_Pin_5
,
147 .GPIO_Speed
= GPIO_Speed_100MHz
,
148 .GPIO_Mode
= GPIO_Mode_AF
,
149 .GPIO_OType
= GPIO_OType_PP
,
150 .GPIO_PuPd
= GPIO_PuPd_UP
156 .GPIO_Pin
= GPIO_Pin_6
,
157 .GPIO_Speed
= GPIO_Speed_50MHz
,
158 .GPIO_Mode
= GPIO_Mode_AF
,
159 .GPIO_OType
= GPIO_OType_PP
,
160 .GPIO_PuPd
= GPIO_PuPd_UP
166 .GPIO_Pin
= GPIO_Pin_7
,
167 .GPIO_Speed
= GPIO_Speed_50MHz
,
168 .GPIO_Mode
= GPIO_Mode_AF
,
169 .GPIO_OType
= GPIO_OType_PP
,
170 .GPIO_PuPd
= GPIO_PuPd_UP
178 .GPIO_Pin
= GPIO_Pin_4
,
179 .GPIO_Speed
= GPIO_Speed_50MHz
,
180 .GPIO_Mode
= GPIO_Mode_OUT
,
181 .GPIO_OType
= GPIO_OType_PP
,
182 .GPIO_PuPd
= GPIO_PuPd_UP
188 .GPIO_Pin
= GPIO_Pin_5
,
189 .GPIO_Speed
= GPIO_Speed_50MHz
,
190 .GPIO_Mode
= GPIO_Mode_OUT
,
191 .GPIO_OType
= GPIO_OType_PP
,
192 .GPIO_PuPd
= GPIO_PuPd_UP
198 uint32_t pios_spi_accel_id
;
199 void PIOS_SPI_accel_irq_handler(void)
201 /* Call into the generic code to handle the IRQ for this specific device */
202 PIOS_SPI_IRQ_Handler(pios_spi_accel_id
);
207 * - Used for gyro communications
209 void PIOS_SPI_GYRO_irq_handler(void);
210 void DMA1_Stream3_IRQHandler(void) __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
211 void DMA1_Stream4_IRQHandler(void) __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
212 static const struct pios_spi_cfg pios_spi_gyro_cfg
= {
214 .remap
= GPIO_AF_SPI2
,
216 .SPI_Mode
= SPI_Mode_Master
,
217 .SPI_Direction
= SPI_Direction_2Lines_FullDuplex
,
218 .SPI_DataSize
= SPI_DataSize_8b
,
219 .SPI_NSS
= SPI_NSS_Soft
,
220 .SPI_FirstBit
= SPI_FirstBit_MSB
,
221 .SPI_CRCPolynomial
= 7,
222 .SPI_CPOL
= SPI_CPOL_High
,
223 .SPI_CPHA
= SPI_CPHA_2Edge
,
224 .SPI_BaudRatePrescaler
= SPI_BaudRatePrescaler_8
,
229 // Note this is the stream ID that triggers interrupts (in this case RX)
230 .flags
= (DMA_IT_TCIF3
| DMA_IT_TEIF3
| DMA_IT_HTIF3
),
232 .NVIC_IRQChannel
= DMA1_Stream3_IRQn
,
233 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
234 .NVIC_IRQChannelSubPriority
= 0,
235 .NVIC_IRQChannelCmd
= ENABLE
,
240 .channel
= DMA1_Stream3
,
242 .DMA_Channel
= DMA_Channel_0
,
243 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI2
->DR
),
244 .DMA_DIR
= DMA_DIR_PeripheralToMemory
,
245 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
246 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
247 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
248 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
249 .DMA_Mode
= DMA_Mode_Normal
,
250 .DMA_Priority
= DMA_Priority_Medium
,
252 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
253 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
254 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
255 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
259 .channel
= DMA1_Stream4
,
261 .DMA_Channel
= DMA_Channel_0
,
262 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI2
->DR
),
263 .DMA_DIR
= DMA_DIR_MemoryToPeripheral
,
264 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
265 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
266 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
267 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
268 .DMA_Mode
= DMA_Mode_Normal
,
269 .DMA_Priority
= DMA_Priority_Medium
,
270 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
271 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
272 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
273 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
280 .GPIO_Pin
= GPIO_Pin_13
,
281 .GPIO_Speed
= GPIO_Speed_100MHz
,
282 .GPIO_Mode
= GPIO_Mode_AF
,
283 .GPIO_OType
= GPIO_OType_PP
,
284 .GPIO_PuPd
= GPIO_PuPd_NOPULL
290 .GPIO_Pin
= GPIO_Pin_14
,
291 .GPIO_Speed
= GPIO_Speed_50MHz
,
292 .GPIO_Mode
= GPIO_Mode_AF
,
293 .GPIO_OType
= GPIO_OType_PP
,
294 .GPIO_PuPd
= GPIO_PuPd_NOPULL
300 .GPIO_Pin
= GPIO_Pin_15
,
301 .GPIO_Speed
= GPIO_Speed_50MHz
,
302 .GPIO_Mode
= GPIO_Mode_AF
,
303 .GPIO_OType
= GPIO_OType_PP
,
304 .GPIO_PuPd
= GPIO_PuPd_NOPULL
312 .GPIO_Pin
= GPIO_Pin_12
,
313 .GPIO_Speed
= GPIO_Speed_50MHz
,
314 .GPIO_Mode
= GPIO_Mode_OUT
,
315 .GPIO_OType
= GPIO_OType_PP
,
316 .GPIO_PuPd
= GPIO_PuPd_UP
322 uint32_t pios_spi_gyro_id
;
323 void PIOS_SPI_gyro_irq_handler(void)
325 /* Call into the generic code to handle the IRQ for this specific device */
326 PIOS_SPI_IRQ_Handler(pios_spi_gyro_id
);
330 #if !defined(PIOS_FLASH_ON_ACCEL)
332 * - Used for flash communications
334 void PIOS_SPI_flash_irq_handler(void);
335 void DMA1_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_flash_irq_handler")));
336 void DMA1_Stream5_IRQHandler(void) __attribute__((alias("PIOS_SPI_flash_irq_handler")));
337 static const struct pios_spi_cfg pios_spi_flash_cfg
= {
339 .remap
= GPIO_AF_SPI3
,
341 .SPI_Mode
= SPI_Mode_Master
,
342 .SPI_Direction
= SPI_Direction_2Lines_FullDuplex
,
343 .SPI_DataSize
= SPI_DataSize_8b
,
344 .SPI_NSS
= SPI_NSS_Soft
,
345 .SPI_FirstBit
= SPI_FirstBit_MSB
,
346 .SPI_CRCPolynomial
= 7,
347 .SPI_CPOL
= SPI_CPOL_High
,
348 .SPI_CPHA
= SPI_CPHA_2Edge
,
349 .SPI_BaudRatePrescaler
= SPI_BaudRatePrescaler_2
,
354 // Note this is the stream ID that triggers interrupts (in this case RX)
355 .flags
= (DMA_IT_TCIF0
| DMA_IT_TEIF0
| DMA_IT_HTIF0
),
357 .NVIC_IRQChannel
= DMA1_Stream0_IRQn
,
358 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
359 .NVIC_IRQChannelSubPriority
= 0,
360 .NVIC_IRQChannelCmd
= ENABLE
,
365 .channel
= DMA1_Stream0
,
367 .DMA_Channel
= DMA_Channel_0
,
368 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI3
->DR
),
369 .DMA_DIR
= DMA_DIR_PeripheralToMemory
,
370 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
371 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
372 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
373 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
374 .DMA_Mode
= DMA_Mode_Normal
,
375 .DMA_Priority
= DMA_Priority_Medium
,
377 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
378 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
379 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
380 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
384 .channel
= DMA1_Stream5
,
386 .DMA_Channel
= DMA_Channel_0
,
387 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI3
->DR
),
388 .DMA_DIR
= DMA_DIR_MemoryToPeripheral
,
389 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
390 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
391 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
392 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
393 .DMA_Mode
= DMA_Mode_Normal
,
394 .DMA_Priority
= DMA_Priority_Medium
,
395 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
396 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
397 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
398 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
405 .GPIO_Pin
= GPIO_Pin_10
,
406 .GPIO_Speed
= GPIO_Speed_100MHz
,
407 .GPIO_Mode
= GPIO_Mode_AF
,
408 .GPIO_OType
= GPIO_OType_PP
,
409 .GPIO_PuPd
= GPIO_PuPd_NOPULL
415 .GPIO_Pin
= GPIO_Pin_11
,
416 .GPIO_Speed
= GPIO_Speed_50MHz
,
417 .GPIO_Mode
= GPIO_Mode_AF
,
418 .GPIO_OType
= GPIO_OType_PP
,
419 .GPIO_PuPd
= GPIO_PuPd_NOPULL
425 .GPIO_Pin
= GPIO_Pin_12
,
426 .GPIO_Speed
= GPIO_Speed_50MHz
,
427 .GPIO_Mode
= GPIO_Mode_AF
,
428 .GPIO_OType
= GPIO_OType_PP
,
429 .GPIO_PuPd
= GPIO_PuPd_NOPULL
437 .GPIO_Pin
= GPIO_Pin_2
,
438 .GPIO_Speed
= GPIO_Speed_50MHz
,
439 .GPIO_Mode
= GPIO_Mode_OUT
,
440 .GPIO_OType
= GPIO_OType_PP
,
441 .GPIO_PuPd
= GPIO_PuPd_UP
447 uint32_t pios_spi_flash_id
;
448 void PIOS_SPI_flash_irq_handler(void)
450 /* Call into the generic code to handle the IRQ for this specific device */
451 PIOS_SPI_IRQ_Handler(pios_spi_flash_id
);
453 #endif /* PIOS_FLASH_ON_ACCEL */
455 #endif /* PIOS_INCLUDE_SPI */
457 #if defined(PIOS_INCLUDE_FLASH)
458 #include "pios_flashfs_logfs_priv.h"
459 #include "pios_flash_jedec_priv.h"
460 #include "pios_flash_internal_priv.h"
462 static const struct flashfs_logfs_cfg flashfs_external_cfg
= {
463 .fs_magic
= 0x99abceef,
464 .total_fs_size
= 0x00200000, /* 2M bytes (32 sectors = entire chip) */
465 .arena_size
= 0x00010000, /* 256 * slot size */
466 .slot_size
= 0x00000100, /* 256 bytes */
468 .start_offset
= 0, /* start at the beginning of the chip */
469 .sector_size
= 0x00010000, /* 64K bytes */
470 .page_size
= 0x00000100, /* 256 bytes */
474 static const struct pios_flash_internal_cfg flash_internal_cfg
= {};
476 static const struct flashfs_logfs_cfg flashfs_internal_cfg
= {
477 .fs_magic
= 0x99abcfef,
478 .total_fs_size
= EE_BANK_SIZE
, /* 32K bytes (2x16KB sectors) */
479 .arena_size
= 0x00004000, /* 64 * slot size = 16K bytes = 1 sector */
480 .slot_size
= 0x00000100, /* 256 bytes */
482 .start_offset
= EE_BANK_BASE
, /* start after the bootloader */
483 .sector_size
= 0x00004000, /* 16K bytes */
484 .page_size
= 0x00004000, /* 16K bytes */
487 #endif /* PIOS_INCLUDE_FLASH */
489 #if defined(PIOS_OVERO_SPI)
491 * - Used for flash communications
493 #include <pios_overo_priv.h>
494 void PIOS_OVERO_irq_handler(void);
495 void DMA1_Stream7_IRQHandler(void) __attribute__((alias("PIOS_OVERO_irq_handler")));
496 static const struct pios_overo_cfg pios_overo_cfg
= {
498 .remap
= GPIO_AF_SPI3
,
500 .SPI_Mode
= SPI_Mode_Slave
,
501 .SPI_Direction
= SPI_Direction_2Lines_FullDuplex
,
502 .SPI_DataSize
= SPI_DataSize_8b
,
503 .SPI_NSS
= SPI_NSS_Hard
,
504 .SPI_FirstBit
= SPI_FirstBit_MSB
,
505 .SPI_CRCPolynomial
= 7,
506 .SPI_CPOL
= SPI_CPOL_High
,
507 .SPI_CPHA
= SPI_CPHA_2Edge
,
508 .SPI_BaudRatePrescaler
= SPI_BaudRatePrescaler_2
,
513 // Note this is the stream ID that triggers interrupts (in this case TX)
514 .flags
= (DMA_IT_TCIF7
),
516 .NVIC_IRQChannel
= DMA1_Stream7_IRQn
,
517 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
518 .NVIC_IRQChannelSubPriority
= 0,
519 .NVIC_IRQChannelCmd
= ENABLE
,
524 .channel
= DMA1_Stream0
,
526 .DMA_Channel
= DMA_Channel_0
,
527 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI3
->DR
),
528 .DMA_DIR
= DMA_DIR_PeripheralToMemory
,
529 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
530 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
531 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
532 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
533 .DMA_Mode
= DMA_Mode_Circular
,
534 .DMA_Priority
= DMA_Priority_Medium
,
536 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
537 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
538 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
539 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
543 .channel
= DMA1_Stream7
,
545 .DMA_Channel
= DMA_Channel_0
,
546 .DMA_PeripheralBaseAddr
= (uint32_t)&(SPI3
->DR
),
547 .DMA_DIR
= DMA_DIR_MemoryToPeripheral
,
548 .DMA_PeripheralInc
= DMA_PeripheralInc_Disable
,
549 .DMA_MemoryInc
= DMA_MemoryInc_Enable
,
550 .DMA_PeripheralDataSize
= DMA_PeripheralDataSize_Byte
,
551 .DMA_MemoryDataSize
= DMA_MemoryDataSize_Byte
,
552 .DMA_Mode
= DMA_Mode_Circular
,
553 .DMA_Priority
= DMA_Priority_Medium
,
554 .DMA_FIFOMode
= DMA_FIFOMode_Disable
,
555 .DMA_FIFOThreshold
= DMA_FIFOThreshold_Full
,
556 .DMA_MemoryBurst
= DMA_MemoryBurst_Single
,
557 .DMA_PeripheralBurst
= DMA_PeripheralBurst_Single
,
564 .GPIO_Pin
= GPIO_Pin_10
,
565 .GPIO_Speed
= GPIO_Speed_100MHz
,
566 .GPIO_Mode
= GPIO_Mode_AF
,
567 .GPIO_OType
= GPIO_OType_PP
,
568 .GPIO_PuPd
= GPIO_PuPd_NOPULL
574 .GPIO_Pin
= GPIO_Pin_11
,
575 .GPIO_Speed
= GPIO_Speed_50MHz
,
576 .GPIO_Mode
= GPIO_Mode_AF
,
577 .GPIO_OType
= GPIO_OType_PP
,
578 .GPIO_PuPd
= GPIO_PuPd_NOPULL
584 .GPIO_Pin
= GPIO_Pin_12
,
585 .GPIO_Speed
= GPIO_Speed_50MHz
,
586 .GPIO_Mode
= GPIO_Mode_AF
,
587 .GPIO_OType
= GPIO_OType_PP
,
588 .GPIO_PuPd
= GPIO_PuPd_NOPULL
596 .GPIO_Pin
= GPIO_Pin_15
,
597 .GPIO_Speed
= GPIO_Speed_50MHz
,
598 .GPIO_Mode
= GPIO_Mode_OUT
,
599 .GPIO_OType
= GPIO_OType_PP
,
600 .GPIO_PuPd
= GPIO_PuPd_UP
605 uint32_t pios_overo_id
= 0;
606 void PIOS_OVERO_irq_handler(void)
608 /* Call into the generic code to handle the IRQ for this specific device */
609 PIOS_OVERO_DMA_irq_handler(pios_overo_id
);
611 #else /* if defined(PIOS_OVERO_SPI) */
613 #endif /* PIOS_OVERO_SPI */
615 #include <pios_usart_priv.h>
617 #ifdef PIOS_INCLUDE_COM_TELEM
619 * Telemetry on main USART
621 static const struct pios_usart_cfg pios_usart_telem_cfg
= {
623 .remap
= GPIO_AF_USART2
,
627 .GPIO_Pin
= GPIO_Pin_6
,
628 .GPIO_Speed
= GPIO_Speed_2MHz
,
629 .GPIO_Mode
= GPIO_Mode_AF
,
630 .GPIO_OType
= GPIO_OType_PP
,
631 .GPIO_PuPd
= GPIO_PuPd_UP
637 .GPIO_Pin
= GPIO_Pin_5
,
638 .GPIO_Speed
= GPIO_Speed_2MHz
,
639 .GPIO_Mode
= GPIO_Mode_AF
,
640 .GPIO_OType
= GPIO_OType_PP
,
641 .GPIO_PuPd
= GPIO_PuPd_UP
646 #endif /* PIOS_COM_TELEM */
648 #ifdef PIOS_INCLUDE_GPS
652 static const struct pios_usart_cfg pios_usart_gps_cfg
= {
654 .remap
= GPIO_AF_USART1
,
658 .GPIO_Pin
= GPIO_Pin_10
,
659 .GPIO_Speed
= GPIO_Speed_2MHz
,
660 .GPIO_Mode
= GPIO_Mode_AF
,
661 .GPIO_OType
= GPIO_OType_PP
,
662 .GPIO_PuPd
= GPIO_PuPd_UP
668 .GPIO_Pin
= GPIO_Pin_9
,
669 .GPIO_Speed
= GPIO_Speed_2MHz
,
670 .GPIO_Mode
= GPIO_Mode_AF
,
671 .GPIO_OType
= GPIO_OType_PP
,
672 .GPIO_PuPd
= GPIO_PuPd_UP
677 #endif /* PIOS_INCLUDE_GPS */
679 #ifdef PIOS_INCLUDE_COM_AUX
681 * AUX USART (UART label on rev2)
683 static const struct pios_usart_cfg pios_usart_aux_cfg
= {
685 .remap
= GPIO_AF_USART6
,
689 .GPIO_Pin
= GPIO_Pin_7
,
690 .GPIO_Speed
= GPIO_Speed_2MHz
,
691 .GPIO_Mode
= GPIO_Mode_AF
,
692 .GPIO_OType
= GPIO_OType_PP
,
693 .GPIO_PuPd
= GPIO_PuPd_UP
699 .GPIO_Pin
= GPIO_Pin_6
,
700 .GPIO_Speed
= GPIO_Speed_2MHz
,
701 .GPIO_Mode
= GPIO_Mode_AF
,
702 .GPIO_OType
= GPIO_OType_PP
,
703 .GPIO_PuPd
= GPIO_PuPd_UP
708 #endif /* PIOS_COM_AUX */
710 #ifdef PIOS_INCLUDE_COM_AUXSBUS
712 * AUX USART SBUS ( UART/ S Bus label on rev2)
715 static const struct pios_usart_cfg pios_usart_auxsbus_cfg
= {
717 .remap
= GPIO_AF_UART4
,
721 .GPIO_Pin
= GPIO_Pin_1
,
722 .GPIO_Speed
= GPIO_Speed_2MHz
,
723 .GPIO_Mode
= GPIO_Mode_AF
,
724 .GPIO_OType
= GPIO_OType_PP
,
725 .GPIO_PuPd
= GPIO_PuPd_UP
731 .GPIO_Pin
= GPIO_Pin_0
,
732 .GPIO_Speed
= GPIO_Speed_2MHz
,
733 .GPIO_Mode
= GPIO_Mode_AF
,
734 .GPIO_OType
= GPIO_OType_PP
,
735 .GPIO_PuPd
= GPIO_PuPd_UP
740 #endif /* PIOS_INCLUDE_COM_AUXSBUS */
742 #ifdef PIOS_INCLUDE_COM_FLEXI
746 static const struct pios_usart_cfg pios_usart_flexi_cfg
= {
748 .remap
= GPIO_AF_USART3
,
752 .GPIO_Pin
= GPIO_Pin_10
,
753 .GPIO_Speed
= GPIO_Speed_2MHz
,
754 .GPIO_Mode
= GPIO_Mode_AF
,
755 .GPIO_OType
= GPIO_OType_PP
,
756 .GPIO_PuPd
= GPIO_PuPd_UP
762 .GPIO_Pin
= GPIO_Pin_11
,
763 .GPIO_Speed
= GPIO_Speed_2MHz
,
764 .GPIO_Mode
= GPIO_Mode_AF
,
765 .GPIO_OType
= GPIO_OType_PP
,
766 .GPIO_PuPd
= GPIO_PuPd_UP
771 #endif /* PIOS_INCLUDE_COM_FLEXI */
773 #if defined(PIOS_INCLUDE_COM)
775 #include <pios_com_priv.h>
777 #endif /* PIOS_INCLUDE_COM */
779 #if defined(PIOS_INCLUDE_I2C)
781 #include <pios_i2c_priv.h>
786 void PIOS_I2C_mag_adapter_ev_irq_handler(void);
787 void PIOS_I2C_mag_adapter_er_irq_handler(void);
788 void I2C1_EV_IRQHandler()
789 __attribute__((alias("PIOS_I2C_mag_adapter_ev_irq_handler")));
790 void I2C1_ER_IRQHandler()
791 __attribute__((alias("PIOS_I2C_mag_adapter_er_irq_handler")));
793 static const struct pios_i2c_adapter_cfg pios_i2c_mag_adapter_cfg
= {
795 .remapSCL
= GPIO_AF_I2C1
,
796 .remapSDA
= GPIO_AF_I2C1
,
798 .I2C_Mode
= I2C_Mode_I2C
,
799 .I2C_OwnAddress1
= 0,
800 .I2C_Ack
= I2C_Ack_Enable
,
801 .I2C_AcknowledgedAddress
= I2C_AcknowledgedAddress_7bit
,
802 .I2C_DutyCycle
= I2C_DutyCycle_2
,
803 .I2C_ClockSpeed
= 400000, /* bits/s */
805 .transfer_timeout_ms
= 50,
809 .GPIO_Pin
= GPIO_Pin_6
,
810 .GPIO_Mode
= GPIO_Mode_AF
,
811 .GPIO_Speed
= GPIO_Speed_50MHz
,
812 .GPIO_OType
= GPIO_OType_OD
,
813 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
819 .GPIO_Pin
= GPIO_Pin_7
,
820 .GPIO_Mode
= GPIO_Mode_AF
,
821 .GPIO_Speed
= GPIO_Speed_50MHz
,
822 .GPIO_OType
= GPIO_OType_OD
,
823 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
827 .flags
= 0, /* FIXME: check this */
829 .NVIC_IRQChannel
= I2C1_EV_IRQn
,
830 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
831 .NVIC_IRQChannelSubPriority
= 0,
832 .NVIC_IRQChannelCmd
= ENABLE
,
836 .flags
= 0, /* FIXME: check this */
838 .NVIC_IRQChannel
= I2C1_ER_IRQn
,
839 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
840 .NVIC_IRQChannelSubPriority
= 0,
841 .NVIC_IRQChannelCmd
= ENABLE
,
846 uint32_t pios_i2c_mag_adapter_id
;
847 void PIOS_I2C_mag_adapter_ev_irq_handler(void)
849 /* Call into the generic code to handle the IRQ for this specific device */
850 PIOS_I2C_EV_IRQ_Handler(pios_i2c_mag_adapter_id
);
853 void PIOS_I2C_mag_adapter_er_irq_handler(void)
855 /* Call into the generic code to handle the IRQ for this specific device */
856 PIOS_I2C_ER_IRQ_Handler(pios_i2c_mag_adapter_id
);
860 void PIOS_I2C_flexiport_adapter_ev_irq_handler(void);
861 void PIOS_I2C_flexiport_adapter_er_irq_handler(void);
862 void I2C2_EV_IRQHandler() __attribute__((alias("PIOS_I2C_flexiport_adapter_ev_irq_handler")));
863 void I2C2_ER_IRQHandler() __attribute__((alias("PIOS_I2C_flexiport_adapter_er_irq_handler")));
865 static const struct pios_i2c_adapter_cfg pios_i2c_flexiport_adapter_cfg
= {
867 .remapSCL
= GPIO_AF_I2C2
,
868 .remapSDA
= GPIO_AF_I2C2
,
870 .I2C_Mode
= I2C_Mode_I2C
,
871 .I2C_OwnAddress1
= 0,
872 .I2C_Ack
= I2C_Ack_Enable
,
873 .I2C_AcknowledgedAddress
= I2C_AcknowledgedAddress_7bit
,
874 .I2C_DutyCycle
= I2C_DutyCycle_2
,
875 .I2C_ClockSpeed
= 400000, /* bits/s */
877 .transfer_timeout_ms
= 50,
881 .GPIO_Pin
= GPIO_Pin_10
,
882 .GPIO_Mode
= GPIO_Mode_AF
,
883 .GPIO_Speed
= GPIO_Speed_50MHz
,
884 .GPIO_OType
= GPIO_OType_OD
,
885 .GPIO_PuPd
= GPIO_PuPd_UP
,
891 .GPIO_Pin
= GPIO_Pin_11
,
892 .GPIO_Mode
= GPIO_Mode_AF
,
893 .GPIO_Speed
= GPIO_Speed_50MHz
,
894 .GPIO_OType
= GPIO_OType_OD
,
895 .GPIO_PuPd
= GPIO_PuPd_UP
,
899 .flags
= 0, /* FIXME: check this */
901 .NVIC_IRQChannel
= I2C2_EV_IRQn
,
902 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
903 .NVIC_IRQChannelSubPriority
= 0,
904 .NVIC_IRQChannelCmd
= ENABLE
,
908 .flags
= 0, /* FIXME: check this */
910 .NVIC_IRQChannel
= I2C2_ER_IRQn
,
911 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
912 .NVIC_IRQChannelSubPriority
= 0,
913 .NVIC_IRQChannelCmd
= ENABLE
,
918 uint32_t pios_i2c_flexiport_adapter_id
;
919 void PIOS_I2C_flexiport_adapter_ev_irq_handler(void)
921 /* Call into the generic code to handle the IRQ for this specific device */
922 PIOS_I2C_EV_IRQ_Handler(pios_i2c_flexiport_adapter_id
);
925 void PIOS_I2C_flexiport_adapter_er_irq_handler(void)
927 /* Call into the generic code to handle the IRQ for this specific device */
928 PIOS_I2C_ER_IRQ_Handler(pios_i2c_flexiport_adapter_id
);
932 void PIOS_I2C_pressure_adapter_ev_irq_handler(void);
933 void PIOS_I2C_pressure_adapter_er_irq_handler(void);
934 void I2C3_EV_IRQHandler() __attribute__((alias("PIOS_I2C_pressure_adapter_ev_irq_handler")));
935 void I2C3_ER_IRQHandler() __attribute__((alias("PIOS_I2C_pressure_adapter_er_irq_handler")));
937 static const struct pios_i2c_adapter_cfg pios_i2c_pressure_adapter_cfg
= {
939 .remapSCL
= GPIO_AF_I2C3
,
940 .remapSDA
= GPIO_AF_I2C3
,
942 .I2C_Mode
= I2C_Mode_I2C
,
943 .I2C_OwnAddress1
= 0,
944 .I2C_Ack
= I2C_Ack_Enable
,
945 .I2C_AcknowledgedAddress
= I2C_AcknowledgedAddress_7bit
,
946 .I2C_DutyCycle
= I2C_DutyCycle_2
,
947 .I2C_ClockSpeed
= 400000, /* bits/s */
949 .transfer_timeout_ms
= 50,
953 .GPIO_Pin
= GPIO_Pin_8
,
954 .GPIO_Mode
= GPIO_Mode_AF
,
955 .GPIO_Speed
= GPIO_Speed_50MHz
,
956 .GPIO_OType
= GPIO_OType_OD
,
957 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
963 .GPIO_Pin
= GPIO_Pin_9
,
964 .GPIO_Mode
= GPIO_Mode_AF
,
965 .GPIO_Speed
= GPIO_Speed_50MHz
,
966 .GPIO_OType
= GPIO_OType_OD
,
967 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
971 .flags
= 0, /* FIXME: check this */
973 .NVIC_IRQChannel
= I2C3_EV_IRQn
,
974 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
975 .NVIC_IRQChannelSubPriority
= 0,
976 .NVIC_IRQChannelCmd
= ENABLE
,
980 .flags
= 0, /* FIXME: check this */
982 .NVIC_IRQChannel
= I2C3_ER_IRQn
,
983 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGHEST
,
984 .NVIC_IRQChannelSubPriority
= 0,
985 .NVIC_IRQChannelCmd
= ENABLE
,
990 uint32_t pios_i2c_pressure_adapter_id
;
991 void PIOS_I2C_pressure_adapter_ev_irq_handler(void)
993 /* Call into the generic code to handle the IRQ for this specific device */
994 PIOS_I2C_EV_IRQ_Handler(pios_i2c_pressure_adapter_id
);
997 void PIOS_I2C_pressure_adapter_er_irq_handler(void)
999 /* Call into the generic code to handle the IRQ for this specific device */
1000 PIOS_I2C_ER_IRQ_Handler(pios_i2c_pressure_adapter_id
);
1002 #endif /* PIOS_INCLUDE_I2C */
1004 #if defined(PIOS_INCLUDE_RTC)
1006 * Realtime Clock (RTC)
1008 #include <pios_rtc_priv.h>
1010 void PIOS_RTC_IRQ_Handler(void);
1011 void RTC_WKUP_IRQHandler() __attribute__((alias("PIOS_RTC_IRQ_Handler")));
1012 static const struct pios_rtc_cfg pios_rtc_main_cfg
= {
1013 .clksrc
= RCC_RTCCLKSource_HSE_Div16
, // Divide 8 Mhz crystal down to 1
1014 // For some reason it's acting like crystal is 16 Mhz. This clock is then divided
1015 // by another 16 to give a nominal 62.5 khz clock
1016 .prescaler
= 100, // Every 100 cycles gives 625 Hz
1019 .NVIC_IRQChannel
= RTC_WKUP_IRQn
,
1020 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1021 .NVIC_IRQChannelSubPriority
= 0,
1022 .NVIC_IRQChannelCmd
= ENABLE
,
1027 void PIOS_RTC_IRQ_Handler(void)
1029 PIOS_RTC_irq_handler();
1032 #endif /* if defined(PIOS_INCLUDE_RTC) */
1034 #include "pios_tim_priv.h"
1036 static const TIM_TimeBaseInitTypeDef tim_2_3_5_time_base
= {
1037 .TIM_Prescaler
= (PIOS_PERIPHERAL_APB1_CLOCK
/ 1000000) - 1,
1038 .TIM_ClockDivision
= TIM_CKD_DIV1
,
1039 .TIM_CounterMode
= TIM_CounterMode_Up
,
1040 .TIM_Period
= ((1000000 / PIOS_SERVO_UPDATE_HZ
) - 1),
1041 .TIM_RepetitionCounter
= 0x0000,
1044 static const TIM_TimeBaseInitTypeDef tim_9_10_11_time_base
= {
1045 .TIM_Prescaler
= (PIOS_PERIPHERAL_APB2_CLOCK
/ 1000000) - 1,
1046 .TIM_ClockDivision
= TIM_CKD_DIV1
,
1047 .TIM_CounterMode
= TIM_CounterMode_Up
,
1048 .TIM_Period
= ((1000000 / PIOS_SERVO_UPDATE_HZ
) - 1),
1049 .TIM_RepetitionCounter
= 0x0000,
1052 // Set up timers that only have inputs on APB2
1053 static const TIM_TimeBaseInitTypeDef tim_1_time_base
= {
1054 .TIM_Prescaler
= (PIOS_PERIPHERAL_APB2_CLOCK
/ 1000000) - 1,
1055 .TIM_ClockDivision
= TIM_CKD_DIV1
,
1056 .TIM_CounterMode
= TIM_CounterMode_Up
,
1057 .TIM_Period
= 0xFFFF,
1058 .TIM_RepetitionCounter
= 0x0000,
1061 static const TIM_TimeBaseInitTypeDef tim_8_time_base
= {
1062 .TIM_Prescaler
= (PIOS_PERIPHERAL_APB2_CLOCK
/ 1000000) - 1,
1063 .TIM_ClockDivision
= TIM_CKD_DIV1
,
1064 .TIM_CounterMode
= TIM_CounterMode_Up
,
1065 .TIM_Period
= 0xFFFF,
1066 .TIM_RepetitionCounter
= 0x0000,
1069 // Set up timers that only have inputs on APB1
1070 static const TIM_TimeBaseInitTypeDef tim_4_time_base
= {
1071 .TIM_Prescaler
= (PIOS_PERIPHERAL_APB1_CLOCK
/ 1000000) - 1,
1072 .TIM_ClockDivision
= TIM_CKD_DIV1
,
1073 .TIM_CounterMode
= TIM_CounterMode_Up
,
1074 .TIM_Period
= 0xFFFF,
1075 .TIM_RepetitionCounter
= 0x0000,
1079 static const struct pios_tim_clock_cfg tim_2_cfg
= {
1081 .time_base_init
= &tim_2_3_5_time_base
,
1084 .NVIC_IRQChannel
= TIM2_IRQn
,
1085 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1086 .NVIC_IRQChannelSubPriority
= 0,
1087 .NVIC_IRQChannelCmd
= ENABLE
,
1093 static const struct pios_tim_clock_cfg tim_3_cfg
= {
1095 .time_base_init
= &tim_2_3_5_time_base
,
1098 .NVIC_IRQChannel
= TIM3_IRQn
,
1099 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1100 .NVIC_IRQChannelSubPriority
= 0,
1101 .NVIC_IRQChannelCmd
= ENABLE
,
1107 static const struct pios_tim_clock_cfg tim_5_cfg
= {
1109 .time_base_init
= &tim_2_3_5_time_base
,
1112 .NVIC_IRQChannel
= TIM5_IRQn
,
1113 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1114 .NVIC_IRQChannelSubPriority
= 0,
1115 .NVIC_IRQChannelCmd
= ENABLE
,
1120 static const struct pios_tim_clock_cfg tim_8_cfg
= {
1122 .time_base_init
= &tim_8_time_base
,
1125 .NVIC_IRQChannel
= TIM8_CC_IRQn
,
1126 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1127 .NVIC_IRQChannelSubPriority
= 0,
1128 .NVIC_IRQChannelCmd
= ENABLE
,
1133 static const struct pios_tim_clock_cfg tim_9_cfg
= {
1135 .time_base_init
= &tim_9_10_11_time_base
,
1138 .NVIC_IRQChannel
= TIM1_BRK_TIM9_IRQn
,
1139 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1140 .NVIC_IRQChannelSubPriority
= 0,
1141 .NVIC_IRQChannelCmd
= ENABLE
,
1146 static const struct pios_tim_clock_cfg tim_10_cfg
= {
1148 .time_base_init
= &tim_9_10_11_time_base
,
1151 .NVIC_IRQChannel
= TIM1_UP_TIM10_IRQn
,
1152 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1153 .NVIC_IRQChannelSubPriority
= 0,
1154 .NVIC_IRQChannelCmd
= ENABLE
,
1159 static const struct pios_tim_clock_cfg tim_11_cfg
= {
1161 .time_base_init
= &tim_9_10_11_time_base
,
1164 .NVIC_IRQChannel
= TIM1_TRG_COM_TIM11_IRQn
,
1165 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1166 .NVIC_IRQChannelSubPriority
= 0,
1167 .NVIC_IRQChannelCmd
= ENABLE
,
1172 static const struct pios_tim_clock_cfg tim_1_cfg
= {
1174 .time_base_init
= &tim_1_time_base
,
1177 .NVIC_IRQChannel
= TIM1_CC_IRQn
,
1178 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1179 .NVIC_IRQChannelSubPriority
= 0,
1180 .NVIC_IRQChannelCmd
= ENABLE
,
1185 static const struct pios_tim_clock_cfg tim_4_cfg
= {
1187 .time_base_init
= &tim_4_time_base
,
1190 .NVIC_IRQChannel
= TIM4_IRQn
,
1191 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_MID
,
1192 .NVIC_IRQChannelSubPriority
= 0,
1193 .NVIC_IRQChannelCmd
= ENABLE
,
1199 * Pios servo configuration structures
1201 #include <pios_servo_priv.h>
1202 static const struct pios_tim_channel pios_tim_servoport_all_pins
[] = {
1205 .timer_chan
= TIM_Channel_1
,
1209 .GPIO_Pin
= GPIO_Pin_5
,
1210 .GPIO_Speed
= GPIO_Speed_2MHz
,
1211 .GPIO_Mode
= GPIO_Mode_AF
,
1212 .GPIO_OType
= GPIO_OType_PP
,
1213 .GPIO_PuPd
= GPIO_PuPd_UP
1215 .pin_source
= GPIO_PinSource5
,
1217 .remap
= GPIO_AF_TIM9
,
1221 .timer_chan
= TIM_Channel_2
,
1225 .GPIO_Pin
= GPIO_Pin_6
,
1226 .GPIO_Speed
= GPIO_Speed_2MHz
,
1227 .GPIO_Mode
= GPIO_Mode_AF
,
1228 .GPIO_OType
= GPIO_OType_PP
,
1229 .GPIO_PuPd
= GPIO_PuPd_UP
1231 .pin_source
= GPIO_PinSource6
,
1233 .remap
= GPIO_AF_TIM9
,
1237 .timer_chan
= TIM_Channel_1
,
1241 .GPIO_Pin
= GPIO_Pin_9
,
1242 .GPIO_Speed
= GPIO_Speed_2MHz
,
1243 .GPIO_Mode
= GPIO_Mode_AF
,
1244 .GPIO_OType
= GPIO_OType_PP
,
1245 .GPIO_PuPd
= GPIO_PuPd_UP
1247 .pin_source
= GPIO_PinSource9
,
1249 .remap
= GPIO_AF_TIM11
,
1253 .timer_chan
= TIM_Channel_1
,
1257 .GPIO_Pin
= GPIO_Pin_8
,
1258 .GPIO_Speed
= GPIO_Speed_2MHz
,
1259 .GPIO_Mode
= GPIO_Mode_AF
,
1260 .GPIO_OType
= GPIO_OType_PP
,
1261 .GPIO_PuPd
= GPIO_PuPd_UP
1263 .pin_source
= GPIO_PinSource8
,
1265 .remap
= GPIO_AF_TIM10
,
1269 .timer_chan
= TIM_Channel_3
,
1273 .GPIO_Pin
= GPIO_Pin_2
,
1274 .GPIO_Speed
= GPIO_Speed_2MHz
,
1275 .GPIO_Mode
= GPIO_Mode_AF
,
1276 .GPIO_OType
= GPIO_OType_PP
,
1277 .GPIO_PuPd
= GPIO_PuPd_UP
1279 .pin_source
= GPIO_PinSource2
,
1281 .remap
= GPIO_AF_TIM5
,
1285 .timer_chan
= TIM_Channel_4
,
1289 .GPIO_Pin
= GPIO_Pin_3
,
1290 .GPIO_Speed
= GPIO_Speed_2MHz
,
1291 .GPIO_Mode
= GPIO_Mode_AF
,
1292 .GPIO_OType
= GPIO_OType_PP
,
1293 .GPIO_PuPd
= GPIO_PuPd_UP
1295 .pin_source
= GPIO_PinSource3
,
1297 .remap
= GPIO_AF_TIM5
,
1301 .timer_chan
= TIM_Channel_3
,
1305 .GPIO_Pin
= GPIO_Pin_0
,
1306 .GPIO_Speed
= GPIO_Speed_2MHz
,
1307 .GPIO_Mode
= GPIO_Mode_AF
,
1308 .GPIO_OType
= GPIO_OType_PP
,
1309 .GPIO_PuPd
= GPIO_PuPd_UP
1311 .pin_source
= GPIO_PinSource0
,
1313 .remap
= GPIO_AF_TIM3
,
1317 .timer_chan
= TIM_Channel_4
,
1321 .GPIO_Pin
= GPIO_Pin_1
,
1322 .GPIO_Speed
= GPIO_Speed_2MHz
,
1323 .GPIO_Mode
= GPIO_Mode_AF
,
1324 .GPIO_OType
= GPIO_OType_PP
,
1325 .GPIO_PuPd
= GPIO_PuPd_UP
1327 .pin_source
= GPIO_PinSource1
,
1329 .remap
= GPIO_AF_TIM3
,
1331 // PB3 - TIM2 CH2 LED1
1334 .timer_chan
= TIM_Channel_2
,
1338 .GPIO_Pin
= GPIO_Pin_3
,
1339 .GPIO_Speed
= GPIO_Speed_2MHz
,
1340 .GPIO_Mode
= GPIO_Mode_AF
,
1341 .GPIO_OType
= GPIO_OType_PP
,
1342 .GPIO_PuPd
= GPIO_PuPd_UP
1344 .pin_source
= GPIO_PinSource3
,
1346 .remap
= GPIO_AF_TIM2
,
1348 // PB4 - TIM3 CH1 LED2
1351 .timer_chan
= TIM_Channel_1
,
1355 .GPIO_Pin
= GPIO_Pin_4
,
1356 .GPIO_Speed
= GPIO_Speed_2MHz
,
1357 .GPIO_Mode
= GPIO_Mode_AF
,
1358 .GPIO_OType
= GPIO_OType_PP
,
1359 .GPIO_PuPd
= GPIO_PuPd_UP
1361 .pin_source
= GPIO_PinSource4
,
1363 .remap
= GPIO_AF_TIM3
,
1367 const struct pios_servo_cfg pios_servo_cfg
= {
1369 .TIM_OCMode
= TIM_OCMode_PWM1
,
1370 .TIM_OutputState
= TIM_OutputState_Enable
,
1371 .TIM_OutputNState
= TIM_OutputNState_Disable
,
1372 .TIM_Pulse
= PIOS_SERVOS_INITIAL_POSITION
,
1373 .TIM_OCPolarity
= TIM_OCPolarity_High
,
1374 .TIM_OCNPolarity
= TIM_OCPolarity_High
,
1375 .TIM_OCIdleState
= TIM_OCIdleState_Reset
,
1376 .TIM_OCNIdleState
= TIM_OCNIdleState_Reset
,
1378 .channels
= pios_tim_servoport_all_pins
,
1379 .num_channels
= NELEMENTS(pios_tim_servoport_all_pins
),
1386 #if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
1387 #include <pios_pwm_priv.h>
1388 static const struct pios_tim_channel pios_tim_rcvrport_all_channels
[] = {
1391 .timer_chan
= TIM_Channel_4
,
1395 .GPIO_Pin
= GPIO_Pin_15
,
1396 .GPIO_Speed
= GPIO_Speed_2MHz
,
1397 .GPIO_Mode
= GPIO_Mode_AF
,
1398 .GPIO_OType
= GPIO_OType_PP
,
1399 .GPIO_PuPd
= GPIO_PuPd_UP
1401 .pin_source
= GPIO_PinSource15
,
1403 .remap
= GPIO_AF_TIM4
,
1407 .timer_chan
= TIM_Channel_3
,
1411 .GPIO_Pin
= GPIO_Pin_14
,
1412 .GPIO_Speed
= GPIO_Speed_2MHz
,
1413 .GPIO_Mode
= GPIO_Mode_AF
,
1414 .GPIO_OType
= GPIO_OType_PP
,
1415 .GPIO_PuPd
= GPIO_PuPd_UP
1417 .pin_source
= GPIO_PinSource14
,
1419 .remap
= GPIO_AF_TIM4
,
1423 .timer_chan
= TIM_Channel_2
,
1427 .GPIO_Pin
= GPIO_Pin_13
,
1428 .GPIO_Speed
= GPIO_Speed_2MHz
,
1429 .GPIO_Mode
= GPIO_Mode_AF
,
1430 .GPIO_OType
= GPIO_OType_PP
,
1431 .GPIO_PuPd
= GPIO_PuPd_UP
1433 .pin_source
= GPIO_PinSource13
,
1435 .remap
= GPIO_AF_TIM4
,
1439 .timer_chan
= TIM_Channel_1
,
1443 .GPIO_Pin
= GPIO_Pin_12
,
1444 .GPIO_Speed
= GPIO_Speed_2MHz
,
1445 .GPIO_Mode
= GPIO_Mode_AF
,
1446 .GPIO_OType
= GPIO_OType_PP
,
1447 .GPIO_PuPd
= GPIO_PuPd_UP
1449 .pin_source
= GPIO_PinSource12
,
1451 .remap
= GPIO_AF_TIM4
,
1455 .timer_chan
= TIM_Channel_4
,
1459 .GPIO_Pin
= GPIO_Pin_14
,
1460 .GPIO_Speed
= GPIO_Speed_2MHz
,
1461 .GPIO_Mode
= GPIO_Mode_AF
,
1462 .GPIO_OType
= GPIO_OType_PP
,
1463 .GPIO_PuPd
= GPIO_PuPd_UP
1465 .pin_source
= GPIO_PinSource14
,
1467 .remap
= GPIO_AF_TIM1
,
1471 .timer_chan
= TIM_Channel_3
,
1475 .GPIO_Pin
= GPIO_Pin_13
,
1476 .GPIO_Speed
= GPIO_Speed_2MHz
,
1477 .GPIO_Mode
= GPIO_Mode_AF
,
1478 .GPIO_OType
= GPIO_OType_PP
,
1479 .GPIO_PuPd
= GPIO_PuPd_UP
1481 .pin_source
= GPIO_PinSource13
,
1483 .remap
= GPIO_AF_TIM1
,
1487 .timer_chan
= TIM_Channel_2
,
1491 .GPIO_Pin
= GPIO_Pin_11
,
1492 .GPIO_Speed
= GPIO_Speed_2MHz
,
1493 .GPIO_Mode
= GPIO_Mode_AF
,
1494 .GPIO_OType
= GPIO_OType_PP
,
1495 .GPIO_PuPd
= GPIO_PuPd_UP
1497 .pin_source
= GPIO_PinSource11
,
1499 .remap
= GPIO_AF_TIM1
,
1503 .timer_chan
= TIM_Channel_1
,
1507 .GPIO_Pin
= GPIO_Pin_9
,
1508 .GPIO_Speed
= GPIO_Speed_2MHz
,
1509 .GPIO_Mode
= GPIO_Mode_AF
,
1510 .GPIO_OType
= GPIO_OType_PP
,
1511 .GPIO_PuPd
= GPIO_PuPd_UP
1513 .pin_source
= GPIO_PinSource9
,
1515 .remap
= GPIO_AF_TIM1
,
1519 const struct pios_pwm_cfg pios_pwm_cfg
= {
1521 .TIM_ICPolarity
= TIM_ICPolarity_Rising
,
1522 .TIM_ICSelection
= TIM_ICSelection_DirectTI
,
1523 .TIM_ICPrescaler
= TIM_ICPSC_DIV1
,
1524 .TIM_ICFilter
= 0x0,
1526 .channels
= pios_tim_rcvrport_all_channels
,
1527 .num_channels
= NELEMENTS(pios_tim_rcvrport_all_channels
),
1529 #endif /* if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM) */
1534 #if defined(PIOS_INCLUDE_PPM)
1535 #include <pios_ppm_priv.h>
1536 static const struct pios_ppm_cfg pios_ppm_cfg
= {
1538 .TIM_ICPolarity
= TIM_ICPolarity_Rising
,
1539 .TIM_ICSelection
= TIM_ICSelection_DirectTI
,
1540 .TIM_ICPrescaler
= TIM_ICPSC_DIV1
,
1541 .TIM_ICFilter
= 0x0,
1542 .TIM_Channel
= TIM_Channel_2
,
1544 /* Use only the first channel for ppm */
1545 .channels
= &pios_tim_rcvrport_all_channels
[0],
1551 #if defined(PIOS_INCLUDE_GCSRCVR)
1552 #include "pios_gcsrcvr_priv.h"
1553 #endif /* PIOS_INCLUDE_GCSRCVR */
1555 #if defined(PIOS_INCLUDE_RCVR)
1556 #include "pios_rcvr_priv.h"
1557 #endif /* PIOS_INCLUDE_RCVR */
1562 #if defined(PIOS_INCLUDE_HCSR04)
1563 #include <pios_hcsr04_priv.h>
1565 static const struct pios_tim_channel pios_tim_hcsr04_port_all_channels
[] = {
1568 .timer_chan
= TIM_Channel_3
,
1572 .GPIO_Pin
= GPIO_Pin_8
,
1573 .GPIO_Mode
= GPIO_Mode_AF
,
1574 .GPIO_Speed
= GPIO_Speed_2MHz
,
1575 .GPIO_PuPd
= GPIO_PuPd_DOWN
1577 .pin_source
= GPIO_PinSource8
,
1579 .remap
= GPIO_AF_TIM8
,
1583 const struct pios_hcsr04_cfg pios_hcsr04_cfg
= {
1585 .TIM_ICPolarity
= TIM_ICPolarity_Rising
,
1586 .TIM_ICSelection
= TIM_ICSelection_DirectTI
,
1587 .TIM_ICPrescaler
= TIM_ICPSC_DIV1
,
1588 .TIM_ICFilter
= 0x0,
1590 .channels
= pios_tim_hcsr04_port_all_channels
,
1591 .num_channels
= NELEMENTS(pios_tim_hcsr04_port_all_channels
),
1595 .GPIO_Pin
= GPIO_Pin_10
,
1596 .GPIO_Mode
= GPIO_Mode_OUT
,
1597 .GPIO_OType
= GPIO_OType_PP
,
1598 .GPIO_PuPd
= GPIO_PuPd_UP
,
1599 .GPIO_Speed
= GPIO_Speed_2MHz
,
1603 #endif /* if defined(PIOS_INCLUDE_HCSR04) */
1605 #if defined(PIOS_INCLUDE_USB)
1606 #include "pios_usb_priv.h"
1608 static const struct pios_usb_cfg pios_usb_main_cfg
= {
1611 .NVIC_IRQChannel
= OTG_FS_IRQn
,
1612 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
1613 .NVIC_IRQChannelSubPriority
= 0,
1614 .NVIC_IRQChannelCmd
= ENABLE
,
1620 .GPIO_Pin
= GPIO_Pin_11
,
1621 .GPIO_Speed
= GPIO_Speed_25MHz
,
1622 .GPIO_Mode
= GPIO_Mode_IN
,
1623 .GPIO_OType
= GPIO_OType_OD
,
1626 .vsense_active_low
= false
1628 const struct pios_usb_cfg
*PIOS_BOARD_HW_DEFS_GetUsbCfg(__attribute__((unused
)) uint32_t board_revision
)
1630 return &pios_usb_main_cfg
;
1632 #endif /* PIOS_INCLUDE_USB */
1636 * Sensor configurations
1639 #if defined(PIOS_INCLUDE_ADC)
1640 #include "pios_adc_priv.h"
1641 void PIOS_ADC_DMC_irq_handler(void);
1642 void DMA2_Stream4_IRQHandler(void) __attribute__((alias("PIOS_ADC_DMC_irq_handler")));
1643 struct pios_adc_cfg pios_adc_cfg
= {
1647 .flags
= (DMA_FLAG_TCIF4
| DMA_FLAG_TEIF4
| DMA_FLAG_HTIF4
),
1649 .NVIC_IRQChannel
= DMA2_Stream4_IRQn
,
1650 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_LOW
,
1651 .NVIC_IRQChannelSubPriority
= 0,
1652 .NVIC_IRQChannelCmd
= ENABLE
,
1656 .channel
= DMA2_Stream4
,
1658 .DMA_Channel
= DMA_Channel_0
,
1659 .DMA_PeripheralBaseAddr
= (uint32_t)&ADC1
->DR
1663 .half_flag
= DMA_IT_HTIF4
,
1664 .full_flag
= DMA_IT_TCIF4
,
1666 void PIOS_ADC_DMC_irq_handler(void)
1668 /* Call into the generic code to handle the IRQ for this specific device */
1669 PIOS_ADC_DMA_Handler();
1671 const struct pios_adc_cfg
*PIOS_BOARD_HW_DEFS_GetAdcCfg(__attribute__((unused
)) uint32_t board_revision
)
1673 return &pios_adc_cfg
;
1675 #endif /* if defined(PIOS_INCLUDE_ADC) */
1677 #if defined(PIOS_INCLUDE_HMC5X83)
1678 #include "pios_hmc5x83.h"
1680 #ifdef PIOS_HMC5X83_HAS_GPIOS
1681 bool pios_board_internal_mag_handler()
1683 return PIOS_HMC5x83_IRQHandler(pios_hmc5x83_internal_id
);
1685 static const struct pios_exti_cfg pios_exti_hmc5x83_cfg __exti_config
= {
1686 .vector
= pios_board_internal_mag_handler
,
1691 .GPIO_Pin
= GPIO_Pin_5
,
1692 .GPIO_Speed
= GPIO_Speed_100MHz
,
1693 .GPIO_Mode
= GPIO_Mode_IN
,
1694 .GPIO_OType
= GPIO_OType_OD
,
1695 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
1700 .NVIC_IRQChannel
= EXTI9_5_IRQn
,
1701 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_LOW
,
1702 .NVIC_IRQChannelSubPriority
= 0,
1703 .NVIC_IRQChannelCmd
= ENABLE
,
1708 .EXTI_Line
= EXTI_Line5
, // matches above GPIO pin
1709 .EXTI_Mode
= EXTI_Mode_Interrupt
,
1710 .EXTI_Trigger
= EXTI_Trigger_Rising
,
1711 .EXTI_LineCmd
= ENABLE
,
1715 #endif /* PIOS_HMC5X83_HAS_GPIOS */
1717 static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg
= {
1718 #ifdef PIOS_HMC5X83_HAS_GPIOS
1719 .exti_cfg
= &pios_exti_hmc5x83_cfg
,
1721 .M_ODR
= PIOS_HMC5x83_ODR_75
,
1722 .Meas_Conf
= PIOS_HMC5x83_MEASCONF_NORMAL
,
1723 .Gain
= PIOS_HMC5x83_GAIN_1_9
,
1724 .Mode
= PIOS_HMC5x83_MODE_CONTINUOUS
,
1725 .TempCompensation
= false,
1726 .Driver
= &PIOS_HMC5x83_I2C_DRIVER
,
1727 .Orientation
= PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP
,
1730 const struct pios_hmc5x83_cfg
*PIOS_BOARD_HW_DEFS_GetInternalHMC5x83Cfg(__attribute__((unused
)) uint32_t board_revision
)
1732 return &pios_hmc5x83_internal_cfg
;
1735 static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg
= {
1736 #ifdef PIOS_HMC5X83_HAS_GPIOS
1739 .M_ODR
= PIOS_HMC5x83_ODR_75
, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
1740 .Meas_Conf
= PIOS_HMC5x83_MEASCONF_NORMAL
,
1741 .Gain
= PIOS_HMC5x83_GAIN_1_9
,
1742 .Mode
= PIOS_HMC5x83_MODE_CONTINUOUS
,
1743 .TempCompensation
= false,
1744 .Driver
= &PIOS_HMC5x83_I2C_DRIVER
,
1745 .Orientation
= PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP
,
1748 const struct pios_hmc5x83_cfg
*PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attribute__((unused
)) uint32_t board_revision
)
1750 return &pios_hmc5x83_external_cfg
;
1752 #endif /* PIOS_INCLUDE_HMC5X83 */
1755 * Configuration for the MS5611 chip
1757 #if defined(PIOS_INCLUDE_MS56XX)
1758 #include "pios_ms56xx.h"
1759 static const struct pios_ms56xx_cfg pios_ms56xx_cfg
= {
1761 .version
= MS56XX_VERSION_5611
,
1762 .oversampling
= MS56XX_OSR_4096
,
1764 const struct pios_ms56xx_cfg
*PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused
)) uint32_t board_revision
)
1766 return &pios_ms56xx_cfg
;
1768 #endif /* PIOS_INCLUDE_MS56XX */
1771 * Configuration for the BMA180 chip
1773 #if defined(PIOS_INCLUDE_BMA180)
1774 #include "pios_bma180.h"
1775 static const struct pios_exti_cfg pios_exti_bma180_cfg __exti_config
= {
1776 .vector
= PIOS_BMA180_IRQHandler
,
1781 .GPIO_Pin
= GPIO_Pin_4
,
1782 .GPIO_Speed
= GPIO_Speed_100MHz
,
1783 .GPIO_Mode
= GPIO_Mode_IN
,
1784 .GPIO_OType
= GPIO_OType_OD
,
1785 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
1790 .NVIC_IRQChannel
= EXTI4_IRQn
,
1791 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_LOW
,
1792 .NVIC_IRQChannelSubPriority
= 0,
1793 .NVIC_IRQChannelCmd
= ENABLE
,
1798 .EXTI_Line
= EXTI_Line4
, // matches above GPIO pin
1799 .EXTI_Mode
= EXTI_Mode_Interrupt
,
1800 .EXTI_Trigger
= EXTI_Trigger_Rising
,
1801 .EXTI_LineCmd
= ENABLE
,
1805 static const struct pios_bma180_cfg pios_bma180_cfg
= {
1806 .exti_cfg
= &pios_exti_bma180_cfg
,
1807 .bandwidth
= BMA_BW_600HZ
,
1808 .range
= BMA_RANGE_8G
,
1810 const struct pios_bma180_cfg
*PIOS_BOARD_HW_DEFS_GetBMA180Cfg(uint32_t board_revision
)
1812 return (board_revision
== 0x01) ? &pios_bma180_cfg
: 0;
1814 #endif /* PIOS_INCLUDE_BMA180 */
1817 * Configuration for the MPU6000 chip
1819 #if defined(PIOS_INCLUDE_MPU6000)
1820 #include "pios_mpu6000.h"
1821 static const struct pios_exti_cfg pios_exti_mpu6000_cfg __exti_config
= {
1822 .vector
= PIOS_MPU6000_IRQHandler
,
1827 .GPIO_Pin
= GPIO_Pin_8
,
1828 .GPIO_Speed
= GPIO_Speed_100MHz
,
1829 .GPIO_Mode
= GPIO_Mode_IN
,
1830 .GPIO_OType
= GPIO_OType_OD
,
1831 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
1836 .NVIC_IRQChannel
= EXTI9_5_IRQn
,
1837 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
1838 .NVIC_IRQChannelSubPriority
= 0,
1839 .NVIC_IRQChannelCmd
= ENABLE
,
1844 .EXTI_Line
= EXTI_Line8
, // matches above GPIO pin
1845 .EXTI_Mode
= EXTI_Mode_Interrupt
,
1846 .EXTI_Trigger
= EXTI_Trigger_Rising
,
1847 .EXTI_LineCmd
= ENABLE
,
1852 static const struct pios_mpu6000_cfg pios_mpu6000_cfg
= {
1853 .exti_cfg
= &pios_exti_mpu6000_cfg
,
1854 .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
,
1856 .Smpl_rate_div_no_dlp
= 0,
1857 // with dlp on output rate is 1000Hz
1858 .Smpl_rate_div_dlp
= 0,
1859 .interrupt_cfg
= PIOS_MPU6000_INT_CLR_ANYRD
,
1860 .interrupt_en
= PIOS_MPU6000_INTEN_DATA_RDY
,
1861 .User_ctl
= PIOS_MPU6000_USERCTL_DIS_I2C
,
1862 .Pwr_mgmt_clk
= PIOS_MPU6000_PWRMGMT_PLL_X_CLK
,
1863 .accel_range
= PIOS_MPU6000_ACCEL_8G
,
1864 .gyro_range
= PIOS_MPU6000_SCALE_2000_DEG
,
1865 .filter
= PIOS_MPU6000_LOWPASS_256_HZ
,
1866 .orientation
= PIOS_MPU6000_TOP_0DEG
,
1867 .fast_prescaler
= PIOS_SPI_PRESCALER_4
,
1868 .std_prescaler
= PIOS_SPI_PRESCALER_64
,
1869 .max_downsample
= 16,
1872 const struct pios_mpu6000_cfg
*PIOS_BOARD_HW_DEFS_GetMPU6000Cfg(uint32_t board_revision
)
1874 return (board_revision
== 0x02) ? &pios_mpu6000_cfg
: 0;
1876 #endif /* PIOS_INCLUDE_MPU6000 */
1879 * Configuration for L3GD20 chip
1881 #if defined(PIOS_INCLUDE_L3GD20)
1882 #include "pios_l3gd20.h"
1883 static const struct pios_exti_cfg pios_exti_l3gd20_cfg __exti_config
= {
1884 .vector
= PIOS_L3GD20_IRQHandler
,
1889 .GPIO_Pin
= GPIO_Pin_8
,
1890 .GPIO_Speed
= GPIO_Speed_100MHz
,
1891 .GPIO_Mode
= GPIO_Mode_IN
,
1892 .GPIO_OType
= GPIO_OType_OD
,
1893 .GPIO_PuPd
= GPIO_PuPd_NOPULL
,
1898 .NVIC_IRQChannel
= EXTI9_5_IRQn
,
1899 .NVIC_IRQChannelPreemptionPriority
= PIOS_IRQ_PRIO_HIGH
,
1900 .NVIC_IRQChannelSubPriority
= 0,
1901 .NVIC_IRQChannelCmd
= ENABLE
,
1906 .EXTI_Line
= EXTI_Line8
, // matches above GPIO pin
1907 .EXTI_Mode
= EXTI_Mode_Interrupt
,
1908 .EXTI_Trigger
= EXTI_Trigger_Rising
,
1909 .EXTI_LineCmd
= ENABLE
,
1914 static const struct pios_l3gd20_cfg pios_l3gd20_cfg
= {
1915 .exti_cfg
= &pios_exti_l3gd20_cfg
,
1916 .range
= PIOS_L3GD20_SCALE_500_DEG
,
1919 const struct pios_l3gd20_cfg
*PIOS_BOARD_HW_DEFS_GetL3GD20Cfg(uint32_t board_revision
)
1921 return (board_revision
== 0x01) ? &pios_l3gd20_cfg
: 0;
1923 #endif /* PIOS_INCLUDE_L3GD20 */