31 #include <pios_config.h>
34 #if defined(PIOS_INCLUDE_ANNUNC)
43 .GPIO_Pin = GPIO_Pin_4,
44 .GPIO_Speed = GPIO_Speed_50MHz,
45 .GPIO_Mode = GPIO_Mode_OUT,
46 .GPIO_OType = GPIO_OType_PP,
47 .GPIO_PuPd = GPIO_PuPd_UP
55 .GPIO_Pin = GPIO_Pin_5,
56 .GPIO_Speed = GPIO_Speed_50MHz,
57 .GPIO_Mode = GPIO_Mode_OUT,
58 .GPIO_OType = GPIO_OType_PP,
59 .GPIO_PuPd = GPIO_PuPd_UP
67 .num_annunciators =
NELEMENTS(pios_annuncs),
70 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
73 return &pios_annunc_cfg;
79 #if defined(PIOS_INCLUDE_FLASH)
84 .arena_size = 0x00004000,
85 .slot_size = 0x00000100,
88 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
97 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
117 uintptr_t pios_internal_flash_id;
120 .chip_id = &pios_internal_flash_id,
122 .sector_blocks = stm32f4_sectors,
123 .num_blocks =
NELEMENTS(stm32f4_sectors),
128 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
131 .chip_desc = &pios_flash_chip_internal,
140 .chip_desc = &pios_flash_chip_internal,
149 .chip_desc = &pios_flash_chip_internal,
164 (void)board_revision;
166 *num_partitions =
NELEMENTS(pios_flash_partition_table_internal);
167 return pios_flash_partition_table_internal;
179 .remap = GPIO_AF_USART3,
182 .NVIC_IRQChannel = USART3_IRQn,
184 .NVIC_IRQChannelSubPriority = 0,
185 .NVIC_IRQChannelCmd = ENABLE,
191 .GPIO_Pin = GPIO_Pin_11,
192 .GPIO_Speed = GPIO_Speed_2MHz,
193 .GPIO_Mode = GPIO_Mode_AF,
194 .GPIO_OType = GPIO_OType_PP,
195 .GPIO_PuPd = GPIO_PuPd_UP
201 .GPIO_Pin = GPIO_Pin_10,
202 .GPIO_Speed = GPIO_Speed_2MHz,
203 .GPIO_Mode = GPIO_Mode_AF,
204 .GPIO_OType = GPIO_OType_PP,
205 .GPIO_PuPd = GPIO_PuPd_UP
210 #if defined(PIOS_INCLUDE_COM)
217 #if defined(PIOS_INCLUDE_RTC)
221 #include <pios_rtc_priv.h>
223 void PIOS_RTC_IRQ_Handler (
void);
226 .
clksrc = RCC_RTCCLKSource_HSE_Div8,
231 .NVIC_IRQChannel = RTC_WKUP_IRQn,
233 .NVIC_IRQChannelSubPriority = 0,
234 .NVIC_IRQChannelCmd = ENABLE,
239 void PIOS_RTC_IRQ_Handler (
void)
251 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
252 .TIM_ClockDivision = TIM_CKD_DIV1,
253 .TIM_CounterMode = TIM_CounterMode_Up,
254 .TIM_Period = 0xFFFF,
255 .TIM_RepetitionCounter = 0x0000,
262 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
263 .TIM_ClockDivision = TIM_CKD_DIV1,
264 .TIM_CounterMode = TIM_CounterMode_Up,
265 .TIM_Period = 0xFFFF,
266 .TIM_RepetitionCounter = 0x0000,
275 .NVIC_IRQChannel = TIM3_IRQn,
277 .NVIC_IRQChannelSubPriority = 0,
278 .NVIC_IRQChannelCmd = ENABLE,
288 .NVIC_IRQChannel = TIM5_IRQn,
290 .NVIC_IRQChannelSubPriority = 0,
291 .NVIC_IRQChannelCmd = ENABLE,
301 .NVIC_IRQChannel = TIM8_CC_IRQn,
303 .NVIC_IRQChannelSubPriority = 0,
304 .NVIC_IRQChannelCmd = ENABLE,
314 .NVIC_IRQChannel = TIM1_BRK_TIM9_IRQn,
316 .NVIC_IRQChannelSubPriority = 0,
317 .NVIC_IRQChannelCmd = ENABLE,
327 .NVIC_IRQChannel = TIM8_BRK_TIM12_IRQn,
329 .NVIC_IRQChannelSubPriority = 0,
330 .NVIC_IRQChannelCmd = ENABLE,
336 #if defined(PIOS_INCLUDE_USB)
342 .NVIC_IRQChannel = OTG_FS_IRQn,
344 .NVIC_IRQChannelSubPriority = 3,
345 .NVIC_IRQChannelCmd = ENABLE,
352 (void)board_revision;
353 return &pios_usb_main_cfg;
363 #if defined(PIOS_INCLUDE_COM_MSG)
369 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
379 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
393 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
401 #if defined(PIOS_INCLUDE_CAN)
408 .CAN_Prescaler = 21-1,
410 .CAN_Mode = CAN_Mode_Normal,
412 .CAN_SJW = CAN_SJW_1tq,
416 .CAN_BS1 = CAN_BS1_9tq,
419 .CAN_BS2 = CAN_BS2_8tq,
434 .remap = GPIO_AF_CAN1,
438 .GPIO_Pin = GPIO_Pin_9,
439 .GPIO_Speed = GPIO_Speed_50MHz,
440 .GPIO_Mode = GPIO_Mode_AF,
441 .GPIO_OType = GPIO_OType_PP,
442 .GPIO_PuPd = GPIO_PuPd_UP
444 .pin_source = GPIO_PinSource9,
449 .GPIO_Pin = GPIO_Pin_8,
450 .GPIO_Speed = GPIO_Speed_50MHz,
451 .GPIO_Mode = GPIO_Mode_AF,
452 .GPIO_OType = GPIO_OType_PP,
453 .GPIO_PuPd = GPIO_PuPd_UP
455 .pin_source = GPIO_PinSource8,
459 .NVIC_IRQChannel = CAN1_RX1_IRQn,
461 .NVIC_IRQChannelSubPriority = 0,
462 .NVIC_IRQChannelCmd = ENABLE,
467 .NVIC_IRQChannel = CAN1_TX_IRQn,
469 .NVIC_IRQChannelSubPriority = 0,
470 .NVIC_IRQChannelCmd = ENABLE,
477 #if defined(PIOS_INCLUDE_VIDEO)
480 void set_bw_levels(uint8_t black, uint8_t white)
492 .GPIO_Pin = GPIO_Pin_1,
493 .GPIO_Speed = GPIO_Speed_100MHz,
494 .GPIO_Mode = GPIO_Mode_IN,
495 .GPIO_OType = GPIO_OType_OD,
496 .GPIO_PuPd = GPIO_PuPd_NOPULL,
501 .NVIC_IRQChannel = EXTI1_IRQn,
503 .NVIC_IRQChannelSubPriority = 0,
504 .NVIC_IRQChannelCmd = ENABLE,
509 .EXTI_Line = EXTI_Line1,
510 .EXTI_Mode = EXTI_Mode_Interrupt,
511 .EXTI_Trigger = EXTI_Trigger_Falling,
512 .EXTI_LineCmd = ENABLE,
521 .remap = GPIO_AF_SPI1,
523 .SPI_Mode = SPI_Mode_Slave,
524 .SPI_Direction = SPI_Direction_1Line_Tx,
525 .SPI_DataSize = SPI_DataSize_8b,
526 .SPI_NSS = SPI_NSS_Soft,
527 .SPI_FirstBit = SPI_FirstBit_MSB,
528 .SPI_CRCPolynomial = 7,
529 .SPI_CPOL = SPI_CPOL_Low,
530 .SPI_CPHA = SPI_CPHA_2Edge,
531 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
535 .flags = (DMA_IT_TCIF3),
537 .NVIC_IRQChannel = DMA2_Stream3_IRQn,
539 .NVIC_IRQChannelSubPriority = 0,
540 .NVIC_IRQChannelCmd = ENABLE,
545 .channel = DMA2_Stream3,
547 .DMA_Channel = DMA_Channel_3,
548 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
549 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
551 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
552 .DMA_MemoryInc = DMA_MemoryInc_Enable,
553 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
554 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
555 .DMA_Mode = DMA_Mode_Normal,
556 .DMA_Priority = DMA_Priority_VeryHigh,
557 .DMA_FIFOMode = DMA_FIFOMode_Enable,
558 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
559 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
560 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
567 .GPIO_Pin = GPIO_Pin_5,
568 .GPIO_Speed = GPIO_Speed_100MHz,
569 .GPIO_Mode = GPIO_Mode_AF,
570 .GPIO_OType = GPIO_OType_PP,
571 .GPIO_PuPd = GPIO_PuPd_NOPULL
577 .GPIO_Pin = GPIO_Pin_6,
578 .GPIO_Speed = GPIO_Speed_50MHz,
579 .GPIO_Mode = GPIO_Mode_AF,
580 .GPIO_OType = GPIO_OType_PP,
581 .GPIO_PuPd = GPIO_PuPd_NOPULL
589 .remap = GPIO_AF_SPI2,
591 .SPI_Mode = SPI_Mode_Slave,
592 .SPI_Direction = SPI_Direction_1Line_Tx,
593 .SPI_DataSize = SPI_DataSize_8b,
594 .SPI_NSS = SPI_NSS_Soft,
595 .SPI_FirstBit = SPI_FirstBit_MSB,
596 .SPI_CRCPolynomial = 7,
597 .SPI_CPOL = SPI_CPOL_Low,
598 .SPI_CPHA = SPI_CPHA_2Edge,
599 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
603 .flags = (DMA_IT_TCIF4),
605 .NVIC_IRQChannel = DMA1_Stream4_IRQn,
607 .NVIC_IRQChannelSubPriority = 0,
608 .NVIC_IRQChannelCmd = ENABLE,
613 .channel = DMA1_Stream4,
615 .DMA_Channel = DMA_Channel_0,
616 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
617 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
619 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
620 .DMA_MemoryInc = DMA_MemoryInc_Enable,
621 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
622 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
623 .DMA_Mode = DMA_Mode_Normal,
624 .DMA_Priority = DMA_Priority_VeryHigh,
625 .DMA_FIFOMode = DMA_FIFOMode_Enable,
626 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
627 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
628 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
635 .GPIO_Pin = GPIO_Pin_13,
636 .GPIO_Speed = GPIO_Speed_100MHz,
637 .GPIO_Mode = GPIO_Mode_AF,
638 .GPIO_OType = GPIO_OType_PP,
639 .GPIO_PuPd = GPIO_PuPd_UP
645 .GPIO_Pin = GPIO_Pin_2,
646 .GPIO_Speed = GPIO_Speed_50MHz,
647 .GPIO_Mode = GPIO_Mode_AF,
648 .GPIO_OType = GPIO_OType_PP,
649 .GPIO_PuPd = GPIO_PuPd_UP
655 .vsync = &pios_exti_vsync_cfg,
659 .timer_chan = TIM_Channel_2,
663 .GPIO_Pin = GPIO_Pin_3,
664 .GPIO_Speed = GPIO_Speed_100MHz,
665 .GPIO_Mode = GPIO_Mode_AF,
666 .GPIO_OType = GPIO_OType_PP,
667 .GPIO_PuPd = GPIO_PuPd_UP
669 .pin_source = GPIO_PinSource3,
671 .remap = GPIO_AF_TIM2,
676 .timer_chan = TIM_Channel_1,
680 .GPIO_Pin = GPIO_Pin_4,
681 .GPIO_Speed = GPIO_Speed_100MHz,
682 .GPIO_Mode = GPIO_Mode_AF,
683 .GPIO_OType = GPIO_OType_PP,
684 .GPIO_PuPd = GPIO_PuPd_UP
686 .pin_source = GPIO_PinSource4,
688 .remap = GPIO_AF_TIM3,
692 .TIM_OCMode = TIM_OCMode_PWM1,
693 .TIM_OutputState = TIM_OutputState_Enable,
694 .TIM_OutputNState = TIM_OutputNState_Disable,
696 .TIM_OCPolarity = TIM_OCPolarity_High,
697 .TIM_OCNPolarity = TIM_OCPolarity_High,
698 .TIM_OCIdleState = TIM_OCIdleState_Reset,
699 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
706 #if defined(PIOS_INCLUDE_SPI)
713 static const struct pios_spi_cfg pios_spi_max7456_cfg = {
715 .remap = GPIO_AF_SPI3,
717 .SPI_Mode = SPI_Mode_Master,
718 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
719 .SPI_DataSize = SPI_DataSize_8b,
720 .SPI_NSS = SPI_NSS_Soft,
721 .SPI_FirstBit = SPI_FirstBit_MSB,
722 .SPI_CRCPolynomial = 7,
723 .SPI_CPOL = SPI_CPOL_Low,
724 .SPI_CPHA = SPI_CPHA_1Edge,
725 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
730 .GPIO_Pin = GPIO_Pin_10,
731 .GPIO_Speed = GPIO_Speed_100MHz,
732 .GPIO_Mode = GPIO_Mode_AF,
733 .GPIO_OType = GPIO_OType_PP,
734 .GPIO_PuPd = GPIO_PuPd_NOPULL
740 .GPIO_Pin = GPIO_Pin_11,
741 .GPIO_Speed = GPIO_Speed_50MHz,
742 .GPIO_Mode = GPIO_Mode_AF,
743 .GPIO_OType = GPIO_OType_PP,
744 .GPIO_PuPd = GPIO_PuPd_NOPULL
750 .GPIO_Pin = GPIO_Pin_12,
751 .GPIO_Speed = GPIO_Speed_50MHz,
752 .GPIO_Mode = GPIO_Mode_AF,
753 .GPIO_OType = GPIO_OType_PP,
754 .GPIO_PuPd = GPIO_PuPd_NOPULL
762 .GPIO_Pin = GPIO_Pin_15,
763 .GPIO_Speed = GPIO_Speed_50MHz,
764 .GPIO_Mode = GPIO_Mode_OUT,
765 .GPIO_OType = GPIO_OType_PP,
766 .GPIO_PuPd = GPIO_PuPd_UP
774 #endif // defined(PIOS_INCLUDE_SPI)
static const struct pios_tim_clock_cfg tim_12_cfg
static const struct pios_tim_clock_cfg tim_3_cfg
static const TIM_TimeBaseInitTypeDef tim_apb2_time_base
OSD gen module, handles OSD draw. Parts from CL-OSD and SUPEROSD projects.
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
void(* set_bw_levels)(uint8_t, uint8_t)
static const struct pios_usart_cfg pios_usart_main_cfg
#define PIOS_IRQ_PRIO_HIGHEST
PiOS CAN interface header.
Defines the API to set up the HID + CDC USB descriptor config.
static const struct pios_tim_clock_cfg tim_8_cfg
#define RTC_WKUP_IRQHandler
#define PIOS_IRQ_PRIO_MID
USART private definitions.
#define FLASH_SECTOR_64KB
static const TIM_TimeBaseInitTypeDef tim_apb1_time_base
static const struct pios_tim_clock_cfg tim_5_cfg
const struct pios_annunc * annunciators
USB COM HID private definitions.
#define FLASH_SECTOR_16KB
Defines the API to set up the HID-only USB descriptor config.
void PIOS_RTC_irq_handler(void)
const struct pios_flash_driver * driver
static const struct pios_tim_clock_cfg tim_9_cfg
USB COM CDC private definitions.
enum pios_flash_partition_labels label
#define PIOS_Assert(test)
#define FLASH_SECTOR_128KB
const struct pios_flash_driver pios_internal_flash_driver
#define PIOS_LED_HEARTBEAT
Defines the API to the board-specific USB data setup code.