31 #include <pios_config.h>
34 #if defined(PIOS_INCLUDE_ANNUNC)
42 .GPIO_Pin = GPIO_Pin_2,
43 .GPIO_Speed = GPIO_Speed_50MHz,
44 .GPIO_Mode = GPIO_Mode_OUT,
45 .GPIO_OType = GPIO_OType_PP,
46 .GPIO_PuPd = GPIO_PuPd_DOWN
56 .GPIO_Pin = GPIO_Pin_12,
57 .GPIO_Speed = GPIO_Speed_50MHz,
58 .GPIO_Mode = GPIO_Mode_OUT,
59 .GPIO_OType = GPIO_OType_PP,
60 .GPIO_PuPd = GPIO_PuPd_DOWN
70 .num_annunciators =
NELEMENTS(pios_annuncs),
73 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
75 return &pios_annunc_cfg;
81 #if defined(PIOS_INCLUDE_SPI)
89 .remap = GPIO_AF_SPI3,
91 .SPI_Mode = SPI_Mode_Master,
92 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
93 .SPI_DataSize = SPI_DataSize_8b,
94 .SPI_NSS = SPI_NSS_Soft,
95 .SPI_FirstBit = SPI_FirstBit_MSB,
96 .SPI_CRCPolynomial = 7,
97 .SPI_CPOL = SPI_CPOL_High,
98 .SPI_CPHA = SPI_CPHA_2Edge,
99 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
104 .GPIO_Pin = GPIO_Pin_10,
105 .GPIO_Speed = GPIO_Speed_100MHz,
106 .GPIO_Mode = GPIO_Mode_AF,
107 .GPIO_OType = GPIO_OType_PP,
108 .GPIO_PuPd = GPIO_PuPd_NOPULL
110 .pin_source = GPIO_PinSource10,
115 .GPIO_Pin = GPIO_Pin_11,
116 .GPIO_Speed = GPIO_Speed_50MHz,
117 .GPIO_Mode = GPIO_Mode_AF,
118 .GPIO_OType = GPIO_OType_PP,
119 .GPIO_PuPd = GPIO_PuPd_NOPULL
121 .pin_source = GPIO_PinSource11,
126 .GPIO_Pin = GPIO_Pin_12,
127 .GPIO_Speed = GPIO_Speed_50MHz,
128 .GPIO_Mode = GPIO_Mode_AF,
129 .GPIO_OType = GPIO_OType_PP,
130 .GPIO_PuPd = GPIO_PuPd_NOPULL
132 .pin_source = GPIO_PinSource12,
138 .GPIO_Pin = GPIO_Pin_15,
139 .GPIO_Speed = GPIO_Speed_50MHz,
140 .GPIO_Mode = GPIO_Mode_OUT,
141 .GPIO_OType = GPIO_OType_PP,
142 .GPIO_PuPd = GPIO_PuPd_UP
144 .pin_source = GPIO_PinSource15,
152 #if defined(PIOS_INCLUDE_FLASH)
157 .arena_size = 0x00004000,
158 .slot_size = 0x00000100,
161 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
166 .expect_memorytype = 0x20,
167 .expect_capacity = 0x17,
168 .sector_erase = 0x20,
172 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
181 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
201 uintptr_t pios_internal_flash_id;
204 .chip_id = &pios_internal_flash_id,
206 .sector_blocks = stm32f4_sectors,
207 .num_blocks =
NELEMENTS(stm32f4_sectors),
211 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
220 uintptr_t pios_external_flash_id;
223 .chip_id = &pios_external_flash_id,
225 .sector_blocks = mx25_sectors,
231 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
234 .chip_desc = &pios_flash_chip_internal,
245 .chip_desc = &pios_flash_chip_internal,
257 .chip_desc = &pios_flash_chip_external,
266 .chip_desc = &pios_flash_chip_external,
275 .chip_desc = &pios_flash_chip_external,
288 *num_partitions =
NELEMENTS(pios_flash_partition_table);
295 #if defined(PIOS_INCLUDE_I2C)
297 #include <pios_i2c_priv.h>
302 void PIOS_I2C_internal_ev_irq_handler(
void);
303 void PIOS_I2C_internal_er_irq_handler(
void);
309 .remap = GPIO_AF_I2C1,
311 .I2C_Mode = I2C_Mode_I2C,
312 .I2C_OwnAddress1 = 0,
313 .I2C_Ack = I2C_Ack_Enable,
314 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
315 .I2C_DutyCycle = I2C_DutyCycle_2,
316 .I2C_ClockSpeed = 400000,
318 .transfer_timeout_ms = 50,
322 .GPIO_Pin = GPIO_Pin_8,
323 .GPIO_Mode = GPIO_Mode_AF,
324 .GPIO_Speed = GPIO_Speed_50MHz,
325 .GPIO_OType = GPIO_OType_OD,
326 .GPIO_PuPd = GPIO_PuPd_NOPULL,
328 .pin_source = GPIO_PinSource8,
333 .GPIO_Pin = GPIO_Pin_9,
334 .GPIO_Mode = GPIO_Mode_AF,
335 .GPIO_Speed = GPIO_Speed_50MHz,
336 .GPIO_OType = GPIO_OType_OD,
337 .GPIO_PuPd = GPIO_PuPd_NOPULL,
339 .pin_source = GPIO_PinSource9,
344 .NVIC_IRQChannel = I2C1_EV_IRQn,
346 .NVIC_IRQChannelSubPriority = 0,
347 .NVIC_IRQChannelCmd = ENABLE,
353 .NVIC_IRQChannel = I2C1_ER_IRQn,
355 .NVIC_IRQChannelSubPriority = 0,
356 .NVIC_IRQChannelCmd = ENABLE,
362 void PIOS_I2C_internal_ev_irq_handler(
void)
368 void PIOS_I2C_internal_er_irq_handler(
void)
375 void PIOS_I2C_flexi_ev_irq_handler(
void);
376 void PIOS_I2C_flexi_er_irq_handler(
void);
382 .remap = GPIO_AF_I2C2,
384 .I2C_Mode = I2C_Mode_I2C,
385 .I2C_OwnAddress1 = 0,
386 .I2C_Ack = I2C_Ack_Enable,
387 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
388 .I2C_DutyCycle = I2C_DutyCycle_2,
389 .I2C_ClockSpeed = 400000,
391 .transfer_timeout_ms = 50,
395 .GPIO_Pin = GPIO_Pin_10,
396 .GPIO_Mode = GPIO_Mode_AF,
397 .GPIO_Speed = GPIO_Speed_50MHz,
398 .GPIO_OType = GPIO_OType_OD,
399 .GPIO_PuPd = GPIO_PuPd_NOPULL,
401 .pin_source = GPIO_PinSource10,
406 .GPIO_Pin = GPIO_Pin_11,
407 .GPIO_Mode = GPIO_Mode_AF,
408 .GPIO_Speed = GPIO_Speed_50MHz,
409 .GPIO_OType = GPIO_OType_OD,
410 .GPIO_PuPd = GPIO_PuPd_NOPULL,
412 .pin_source = GPIO_PinSource11,
417 .NVIC_IRQChannel = I2C2_EV_IRQn,
419 .NVIC_IRQChannelSubPriority = 0,
420 .NVIC_IRQChannelCmd = ENABLE,
426 .NVIC_IRQChannel = I2C2_ER_IRQn,
428 .NVIC_IRQChannelSubPriority = 0,
429 .NVIC_IRQChannelCmd = ENABLE,
435 void PIOS_I2C_flexi_ev_irq_handler(
void)
441 void PIOS_I2C_flexi_er_irq_handler(
void)
450 #if defined(PIOS_INCLUDE_USART)
454 #if defined(PIOS_INCLUDE_DSM)
460 static const struct pios_dsm_cfg pios_mainport_dsm_aux_cfg = {
464 .GPIO_Pin = GPIO_Pin_7,
465 .GPIO_Speed = GPIO_Speed_2MHz,
466 .GPIO_Mode = GPIO_Mode_OUT,
467 .GPIO_OType = GPIO_OType_PP,
468 .GPIO_PuPd = GPIO_PuPd_NOPULL
473 static const struct pios_dsm_cfg pios_flxport_dsm_aux_cfg = {
477 .GPIO_Pin = GPIO_Pin_11,
478 .GPIO_Speed = GPIO_Speed_2MHz,
479 .GPIO_Mode = GPIO_Mode_OUT,
480 .GPIO_OType = GPIO_OType_PP,
481 .GPIO_PuPd = GPIO_PuPd_NOPULL
486 static const struct pios_dsm_cfg pios_rxportusart_dsm_aux_cfg = {
490 .GPIO_Pin = GPIO_Pin_7,
491 .GPIO_Speed = GPIO_Speed_2MHz,
492 .GPIO_Mode = GPIO_Mode_OUT,
493 .GPIO_OType = GPIO_OType_PP,
494 .GPIO_PuPd = GPIO_PuPd_NOPULL
501 #if defined(PIOS_INCLUDE_SBUS)
505 static const struct pios_sbus_cfg pios_mainport_sbus_aux_cfg = {
510 .GPIO_Pin = GPIO_Pin_14,
511 .GPIO_Speed = GPIO_Speed_2MHz,
512 .GPIO_Mode = GPIO_Mode_OUT,
513 .GPIO_OType = GPIO_OType_PP,
514 .GPIO_PuPd = GPIO_PuPd_NOPULL
517 .gpio_inv_enable = Bit_SET,
524 .remap = GPIO_AF_USART1,
527 .NVIC_IRQChannel = USART1_IRQn,
529 .NVIC_IRQChannelSubPriority = 0,
530 .NVIC_IRQChannelCmd = ENABLE,
536 .GPIO_Pin = GPIO_Pin_7,
537 .GPIO_Speed = GPIO_Speed_2MHz,
538 .GPIO_Mode = GPIO_Mode_AF,
539 .GPIO_OType = GPIO_OType_PP,
540 .GPIO_PuPd = GPIO_PuPd_UP
542 .pin_source = GPIO_PinSource7,
547 .GPIO_Pin = GPIO_Pin_6,
548 .GPIO_Speed = GPIO_Speed_2MHz,
549 .GPIO_Mode = GPIO_Mode_AF,
550 .GPIO_OType = GPIO_OType_PP,
551 .GPIO_PuPd = GPIO_PuPd_UP
553 .pin_source = GPIO_PinSource6,
559 .remap = GPIO_AF_USART3,
562 .NVIC_IRQChannel = USART3_IRQn,
564 .NVIC_IRQChannelSubPriority = 0,
565 .NVIC_IRQChannelCmd = ENABLE,
571 .GPIO_Pin = GPIO_Pin_11,
572 .GPIO_Speed = GPIO_Speed_2MHz,
573 .GPIO_Mode = GPIO_Mode_AF,
574 .GPIO_OType = GPIO_OType_PP,
575 .GPIO_PuPd = GPIO_PuPd_UP
577 .pin_source = GPIO_PinSource11,
582 .GPIO_Pin = GPIO_Pin_10,
583 .GPIO_Speed = GPIO_Speed_2MHz,
584 .GPIO_Mode = GPIO_Mode_AF,
585 .GPIO_OType = GPIO_OType_PP,
586 .GPIO_PuPd = GPIO_PuPd_UP
588 .pin_source = GPIO_PinSource10,
594 .remap = GPIO_AF_USART6,
597 .NVIC_IRQChannel = USART6_IRQn,
599 .NVIC_IRQChannelSubPriority = 0,
600 .NVIC_IRQChannelCmd = ENABLE,
606 .GPIO_Pin = GPIO_Pin_7,
607 .GPIO_Speed = GPIO_Speed_2MHz,
608 .GPIO_Mode = GPIO_Mode_AF,
609 .GPIO_OType = GPIO_OType_PP,
610 .GPIO_PuPd = GPIO_PuPd_UP
612 .pin_source = GPIO_PinSource7,
617 .GPIO_Pin = GPIO_Pin_6,
618 .GPIO_Speed = GPIO_Speed_2MHz,
619 .GPIO_Mode = GPIO_Mode_AF,
620 .GPIO_OType = GPIO_OType_PP,
621 .GPIO_PuPd = GPIO_PuPd_UP
623 .pin_source = GPIO_PinSource6,
631 #if defined(PIOS_INCLUDE_COM)
637 #if defined(PIOS_INCLUDE_RTC)
641 #include <pios_rtc_priv.h>
643 void PIOS_RTC_IRQ_Handler (
void);
647 .
clksrc = RCC_RTCCLKSource_HSE_Div16,
653 .NVIC_IRQChannel = RTC_WKUP_IRQn,
655 .NVIC_IRQChannelSubPriority = 0,
656 .NVIC_IRQChannelCmd = ENABLE,
661 void PIOS_RTC_IRQ_Handler (
void)
674 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
675 .TIM_ClockDivision = TIM_CKD_DIV1,
676 .TIM_CounterMode = TIM_CounterMode_Up,
677 .TIM_Period = 0xFFFF,
678 .TIM_RepetitionCounter = 0x0000,
682 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
683 .TIM_ClockDivision = TIM_CKD_DIV1,
684 .TIM_CounterMode = TIM_CounterMode_Up,
685 .TIM_Period = 0xFFFF,
686 .TIM_RepetitionCounter = 0x0000,
694 .NVIC_IRQChannel = TIM8_CC_IRQn,
696 .NVIC_IRQChannelSubPriority = 0,
697 .NVIC_IRQChannelCmd = ENABLE,
707 .NVIC_IRQChannel = TIM8_BRK_TIM12_IRQn,
709 .NVIC_IRQChannelSubPriority = 0,
710 .NVIC_IRQChannelCmd = ENABLE,
719 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
720 .TIM_ClockDivision = TIM_CKD_DIV1,
721 .TIM_CounterMode = TIM_CounterMode_Up,
723 .TIM_RepetitionCounter = 0x0000,
731 .NVIC_IRQChannel = TIM5_IRQn,
733 .NVIC_IRQChannelSubPriority = 0,
734 .NVIC_IRQChannelCmd = ENABLE,
754 .timer_chan = TIM_Channel_1,
755 .remap = GPIO_AF_TIM5,
759 .GPIO_Pin = GPIO_Pin_0,
760 .GPIO_Speed = GPIO_Speed_2MHz,
761 .GPIO_Mode = GPIO_Mode_AF,
762 .GPIO_OType = GPIO_OType_PP,
763 .GPIO_PuPd = GPIO_PuPd_UP
765 .pin_source = GPIO_PinSource0,
770 .timer_chan = TIM_Channel_2,
771 .remap = GPIO_AF_TIM5,
775 .GPIO_Pin = GPIO_Pin_1,
776 .GPIO_Speed = GPIO_Speed_2MHz,
777 .GPIO_Mode = GPIO_Mode_AF,
778 .GPIO_OType = GPIO_OType_PP,
779 .GPIO_PuPd = GPIO_PuPd_UP
781 .pin_source = GPIO_PinSource1,
786 .timer_chan = TIM_Channel_3,
787 .remap = GPIO_AF_TIM5,
791 .GPIO_Pin = GPIO_Pin_2,
792 .GPIO_Speed = GPIO_Speed_2MHz,
793 .GPIO_Mode = GPIO_Mode_AF,
794 .GPIO_OType = GPIO_OType_PP,
795 .GPIO_PuPd = GPIO_PuPd_UP
797 .pin_source = GPIO_PinSource2,
802 .timer_chan = TIM_Channel_4,
803 .remap = GPIO_AF_TIM5,
807 .GPIO_Pin = GPIO_Pin_3,
808 .GPIO_Speed = GPIO_Speed_2MHz,
809 .GPIO_Mode = GPIO_Mode_AF,
810 .GPIO_OType = GPIO_OType_PP,
811 .GPIO_PuPd = GPIO_PuPd_UP
813 .pin_source = GPIO_PinSource3,
833 .timer_chan = TIM_Channel_1,
834 .remap = GPIO_AF_TIM5,
838 .GPIO_Pin = GPIO_Pin_0,
839 .GPIO_Speed = GPIO_Speed_2MHz,
840 .GPIO_Mode = GPIO_Mode_AF,
841 .GPIO_OType = GPIO_OType_PP,
842 .GPIO_PuPd = GPIO_PuPd_UP
844 .pin_source = GPIO_PinSource0,
849 .timer_chan = TIM_Channel_2,
850 .remap = GPIO_AF_TIM5,
854 .GPIO_Pin = GPIO_Pin_1,
855 .GPIO_Speed = GPIO_Speed_2MHz,
856 .GPIO_Mode = GPIO_Mode_AF,
857 .GPIO_OType = GPIO_OType_PP,
858 .GPIO_PuPd = GPIO_PuPd_UP
860 .pin_source = GPIO_PinSource1,
865 .timer_chan = TIM_Channel_3,
866 .remap = GPIO_AF_TIM5,
870 .GPIO_Pin = GPIO_Pin_2,
871 .GPIO_Speed = GPIO_Speed_2MHz,
872 .GPIO_Mode = GPIO_Mode_AF,
873 .GPIO_OType = GPIO_OType_PP,
874 .GPIO_PuPd = GPIO_PuPd_UP
876 .pin_source = GPIO_PinSource2,
881 .timer_chan = TIM_Channel_4,
882 .remap = GPIO_AF_TIM5,
886 .GPIO_Pin = GPIO_Pin_3,
887 .GPIO_Speed = GPIO_Speed_2MHz,
888 .GPIO_Mode = GPIO_Mode_AF,
889 .GPIO_OType = GPIO_OType_PP,
890 .GPIO_PuPd = GPIO_PuPd_UP
892 .pin_source = GPIO_PinSource3,
897 .timer_chan = TIM_Channel_3,
898 .remap = GPIO_AF_TIM8,
902 .GPIO_Pin = GPIO_Pin_8,
903 .GPIO_Speed = GPIO_Speed_2MHz,
904 .GPIO_Mode = GPIO_Mode_AF,
905 .GPIO_OType = GPIO_OType_PP,
906 .GPIO_PuPd = GPIO_PuPd_UP
908 .pin_source = GPIO_PinSource8,
913 .timer_chan = TIM_Channel_4,
914 .remap = GPIO_AF_TIM8,
918 .GPIO_Pin = GPIO_Pin_9,
919 .GPIO_Speed = GPIO_Speed_2MHz,
920 .GPIO_Mode = GPIO_Mode_AF,
921 .GPIO_OType = GPIO_OType_PP,
922 .GPIO_PuPd = GPIO_PuPd_UP
924 .pin_source = GPIO_PinSource9,
929 .timer_chan = TIM_Channel_1,
930 .remap = GPIO_AF_TIM8,
934 .GPIO_Pin = GPIO_Pin_6,
935 .GPIO_Speed = GPIO_Speed_2MHz,
936 .GPIO_Mode = GPIO_Mode_AF,
937 .GPIO_OType = GPIO_OType_PP,
938 .GPIO_PuPd = GPIO_PuPd_UP
940 .pin_source = GPIO_PinSource6,
945 .timer_chan = TIM_Channel_2,
946 .remap = GPIO_AF_TIM8,
950 .GPIO_Pin = GPIO_Pin_7,
951 .GPIO_Speed = GPIO_Speed_2MHz,
952 .GPIO_Mode = GPIO_Mode_AF,
953 .GPIO_OType = GPIO_OType_PP,
954 .GPIO_PuPd = GPIO_PuPd_UP
956 .pin_source = GPIO_PinSource7,
961 .timer_chan = TIM_Channel_1,
962 .remap = GPIO_AF_TIM12,
966 .GPIO_Pin = GPIO_Pin_14,
967 .GPIO_Speed = GPIO_Speed_2MHz,
968 .GPIO_Mode = GPIO_Mode_AF,
969 .GPIO_OType = GPIO_OType_PP,
970 .GPIO_PuPd = GPIO_PuPd_UP
972 .pin_source = GPIO_PinSource14,
977 .timer_chan = TIM_Channel_2,
978 .remap = GPIO_AF_TIM12,
982 .GPIO_Pin = GPIO_Pin_15,
983 .GPIO_Speed = GPIO_Speed_2MHz,
984 .GPIO_Mode = GPIO_Mode_AF,
985 .GPIO_OType = GPIO_OType_PP,
986 .GPIO_PuPd = GPIO_PuPd_UP
988 .pin_source = GPIO_PinSource15,
993 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
1001 .TIM_OCMode = TIM_OCMode_PWM1,
1002 .TIM_OutputState = TIM_OutputState_Enable,
1003 .TIM_OutputNState = TIM_OutputNState_Disable,
1005 .TIM_OCPolarity = TIM_OCPolarity_High,
1006 .TIM_OCNPolarity = TIM_OCPolarity_High,
1007 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1008 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1011 .num_channels =
NELEMENTS(pios_tim_servoport_all_pins),
1014 const struct pios_servo_cfg pios_servo_rcvr_ppm_cfg = {
1016 .TIM_OCMode = TIM_OCMode_PWM1,
1017 .TIM_OutputState = TIM_OutputState_Enable,
1018 .TIM_OutputNState = TIM_OutputNState_Disable,
1020 .TIM_OCPolarity = TIM_OCPolarity_High,
1021 .TIM_OCNPolarity = TIM_OCPolarity_High,
1022 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1023 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1026 .num_channels =
NELEMENTS(pios_tim_servoport_rcvrport_pins) - 2,
1029 const struct pios_servo_cfg pios_servo_rcvr_ppm_uart_out_cfg = {
1031 .TIM_OCMode = TIM_OCMode_PWM1,
1032 .TIM_OutputState = TIM_OutputState_Enable,
1033 .TIM_OutputNState = TIM_OutputNState_Disable,
1035 .TIM_OCPolarity = TIM_OCPolarity_High,
1036 .TIM_OCNPolarity = TIM_OCPolarity_High,
1037 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1038 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1041 .num_channels =
NELEMENTS(pios_tim_servoport_rcvrport_pins) - 4,
1044 const struct pios_servo_cfg pios_servo_rcvr_all_cfg = {
1046 .TIM_OCMode = TIM_OCMode_PWM1,
1047 .TIM_OutputState = TIM_OutputState_Enable,
1048 .TIM_OutputNState = TIM_OutputNState_Disable,
1050 .TIM_OCPolarity = TIM_OCPolarity_High,
1051 .TIM_OCNPolarity = TIM_OCPolarity_High,
1052 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1053 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1056 .num_channels =
NELEMENTS(pios_tim_servoport_rcvrport_pins),
1059 #if defined(PIOS_INCLUDE_DMASHOT)
1070 .stream = DMA1_Stream6,
1071 .channel = DMA_Channel_6,
1072 .tcif = DMA_FLAG_TCIF6
1076 .stream = DMA2_Stream1,
1077 .channel = DMA_Channel_7,
1078 .tcif = DMA_FLAG_TCIF1
1084 .num_timers =
NELEMENTS(dmashot_tim_cfg)
1087 #endif // defined(PIOS_INCLUDE_DMASHOT)
1103 .timer_chan = TIM_Channel_1,
1104 .remap = GPIO_AF_TIM12,
1108 .GPIO_Pin = GPIO_Pin_14,
1109 .GPIO_Speed = GPIO_Speed_2MHz,
1110 .GPIO_Mode = GPIO_Mode_AF,
1111 .GPIO_OType = GPIO_OType_PP,
1112 .GPIO_PuPd = GPIO_PuPd_UP
1114 .pin_source = GPIO_PinSource14,
1119 .timer_chan = TIM_Channel_2,
1120 .remap = GPIO_AF_TIM12,
1124 .GPIO_Pin = GPIO_Pin_15,
1125 .GPIO_Speed = GPIO_Speed_2MHz,
1126 .GPIO_Mode = GPIO_Mode_AF,
1127 .GPIO_OType = GPIO_OType_PP,
1128 .GPIO_PuPd = GPIO_PuPd_UP
1130 .pin_source = GPIO_PinSource15,
1135 .timer_chan = TIM_Channel_1,
1136 .remap = GPIO_AF_TIM8,
1140 .GPIO_Pin = GPIO_Pin_6,
1141 .GPIO_Speed = GPIO_Speed_2MHz,
1142 .GPIO_Mode = GPIO_Mode_AF,
1143 .GPIO_OType = GPIO_OType_PP,
1144 .GPIO_PuPd = GPIO_PuPd_UP
1146 .pin_source = GPIO_PinSource6,
1151 .timer_chan = TIM_Channel_2,
1152 .remap = GPIO_AF_TIM8,
1156 .GPIO_Pin = GPIO_Pin_7,
1157 .GPIO_Speed = GPIO_Speed_2MHz,
1158 .GPIO_Mode = GPIO_Mode_AF,
1159 .GPIO_OType = GPIO_OType_PP,
1160 .GPIO_PuPd = GPIO_PuPd_UP
1162 .pin_source = GPIO_PinSource7,
1167 .timer_chan = TIM_Channel_3,
1168 .remap = GPIO_AF_TIM8,
1172 .GPIO_Pin = GPIO_Pin_8,
1173 .GPIO_Speed = GPIO_Speed_2MHz,
1174 .GPIO_Mode = GPIO_Mode_AF,
1175 .GPIO_OType = GPIO_OType_PP,
1176 .GPIO_PuPd = GPIO_PuPd_UP
1178 .pin_source = GPIO_PinSource8,
1183 .timer_chan = TIM_Channel_4,
1184 .remap = GPIO_AF_TIM8,
1188 .GPIO_Pin = GPIO_Pin_9,
1189 .GPIO_Speed = GPIO_Speed_2MHz,
1190 .GPIO_Mode = GPIO_Mode_AF,
1191 .GPIO_OType = GPIO_OType_PP,
1192 .GPIO_PuPd = GPIO_PuPd_UP
1194 .pin_source = GPIO_PinSource9,
1202 #if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
1207 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1208 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1209 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1210 .TIM_ICFilter = 0x0,
1213 .num_channels =
NELEMENTS(pios_tim_rcvrport_all_channels),
1216 const struct pios_pwm_cfg pios_pwm_with_ppm_cfg = {
1218 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1219 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1220 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1221 .TIM_ICFilter = 0x0,
1224 .channels = &pios_tim_rcvrport_all_channels[1],
1225 .num_channels =
NELEMENTS(pios_tim_rcvrport_all_channels) - 1,
1234 #if defined(PIOS_INCLUDE_PPM)
1238 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1239 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1240 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1241 .TIM_ICFilter = 0x0,
1242 .TIM_Channel = TIM_Channel_3,
1245 .channels = &pios_tim_rcvrport_all_channels[0],
1251 #if defined(PIOS_INCLUDE_RCVR)
1256 #if defined(PIOS_INCLUDE_USB)
1262 .NVIC_IRQChannel = OTG_FS_IRQn,
1264 .NVIC_IRQChannelSubPriority = 0,
1265 .NVIC_IRQChannelCmd = ENABLE,
1271 .GPIO_Pin = GPIO_Pin_9,
1272 .GPIO_Speed = GPIO_Speed_25MHz,
1273 .GPIO_Mode = GPIO_Mode_IN,
1274 .GPIO_OType = GPIO_OType_OD,
1275 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1287 #if defined(PIOS_INCLUDE_COM_MSG)
1293 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
1303 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
1317 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1324 #if defined(PIOS_INCLUDE_ADC)
1328 void PIOS_ADC_DMA_irq_handler(
void);
1334 .flags = (DMA_FLAG_TCIF4 | DMA_FLAG_TEIF4 | DMA_FLAG_HTIF4),
1336 .NVIC_IRQChannel = DMA2_Stream4_IRQn,
1338 .NVIC_IRQChannelSubPriority = 0,
1339 .NVIC_IRQChannelCmd = ENABLE,
1343 .channel = DMA2_Stream4,
1345 .DMA_Channel = DMA_Channel_0,
1346 .DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR
1350 .half_flag = DMA_IT_HTIF4,
1351 .full_flag = DMA_IT_TCIF4,
1353 { GPIOC, GPIO_Pin_0, ADC_Channel_10 },
1354 { GPIOC, GPIO_Pin_1, ADC_Channel_11 },
1355 { GPIOC, GPIO_Pin_3, ADC_Channel_13 },
1356 { NULL, 0, ADC_Channel_Vrefint },
1357 { NULL, 0, ADC_Channel_TempSensor }
1362 void PIOS_ADC_DMA_irq_handler(
void)
1372 #if defined(PIOS_INCLUDE_VIDEO)
1375 void set_bw_levels(uint8_t black, uint8_t white)
1387 .GPIO_Pin = GPIO_Pin_7,
1388 .GPIO_Speed = GPIO_Speed_100MHz,
1389 .GPIO_Mode = GPIO_Mode_IN,
1390 .GPIO_OType = GPIO_OType_OD,
1391 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1396 .NVIC_IRQChannel = EXTI9_5_IRQn,
1398 .NVIC_IRQChannelSubPriority = 0,
1399 .NVIC_IRQChannelCmd = ENABLE,
1404 .EXTI_Line = EXTI_Line7,
1405 .EXTI_Mode = EXTI_Mode_Interrupt,
1406 .EXTI_Trigger = EXTI_Trigger_Falling,
1407 .EXTI_LineCmd = ENABLE,
1416 .remap = GPIO_AF_SPI1,
1418 .SPI_Mode = SPI_Mode_Slave,
1419 .SPI_Direction = SPI_Direction_1Line_Tx,
1420 .SPI_DataSize = SPI_DataSize_8b,
1421 .SPI_NSS = SPI_NSS_Soft,
1422 .SPI_FirstBit = SPI_FirstBit_MSB,
1423 .SPI_CRCPolynomial = 7,
1424 .SPI_CPOL = SPI_CPOL_Low,
1425 .SPI_CPHA = SPI_CPHA_2Edge,
1426 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1430 .flags = (DMA_IT_TCIF3),
1432 .NVIC_IRQChannel = DMA2_Stream3_IRQn,
1434 .NVIC_IRQChannelSubPriority = 0,
1435 .NVIC_IRQChannelCmd = ENABLE,
1440 .channel = DMA2_Stream3,
1442 .DMA_Channel = DMA_Channel_3,
1443 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
1444 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1446 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1447 .DMA_MemoryInc = DMA_MemoryInc_Enable,
1448 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1449 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1450 .DMA_Mode = DMA_Mode_Normal,
1451 .DMA_Priority = DMA_Priority_VeryHigh,
1452 .DMA_FIFOMode = DMA_FIFOMode_Enable,
1453 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1454 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1455 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1462 .GPIO_Pin = GPIO_Pin_5,
1463 .GPIO_Speed = GPIO_Speed_100MHz,
1464 .GPIO_Mode = GPIO_Mode_AF,
1465 .GPIO_OType = GPIO_OType_PP,
1466 .GPIO_PuPd = GPIO_PuPd_NOPULL
1472 .GPIO_Pin = GPIO_Pin_6,
1473 .GPIO_Speed = GPIO_Speed_50MHz,
1474 .GPIO_Mode = GPIO_Mode_AF,
1475 .GPIO_OType = GPIO_OType_PP,
1476 .GPIO_PuPd = GPIO_PuPd_NOPULL
1484 .remap = GPIO_AF_SPI2,
1486 .SPI_Mode = SPI_Mode_Slave,
1487 .SPI_Direction = SPI_Direction_1Line_Tx,
1488 .SPI_DataSize = SPI_DataSize_8b,
1489 .SPI_NSS = SPI_NSS_Soft,
1490 .SPI_FirstBit = SPI_FirstBit_MSB,
1491 .SPI_CRCPolynomial = 7,
1492 .SPI_CPOL = SPI_CPOL_Low,
1493 .SPI_CPHA = SPI_CPHA_2Edge,
1494 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1498 .flags = (DMA_IT_TCIF4),
1500 .NVIC_IRQChannel = DMA1_Stream4_IRQn,
1502 .NVIC_IRQChannelSubPriority = 0,
1503 .NVIC_IRQChannelCmd = ENABLE,
1508 .channel = DMA1_Stream4,
1510 .DMA_Channel = DMA_Channel_0,
1511 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
1512 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1514 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1515 .DMA_MemoryInc = DMA_MemoryInc_Enable,
1516 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1517 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1518 .DMA_Mode = DMA_Mode_Normal,
1519 .DMA_Priority = DMA_Priority_VeryHigh,
1520 .DMA_FIFOMode = DMA_FIFOMode_Enable,
1521 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1522 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1523 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1530 .GPIO_Pin = GPIO_Pin_13,
1531 .GPIO_Speed = GPIO_Speed_100MHz,
1532 .GPIO_Mode = GPIO_Mode_AF,
1533 .GPIO_OType = GPIO_OType_PP,
1534 .GPIO_PuPd = GPIO_PuPd_UP
1540 .GPIO_Pin = GPIO_Pin_2,
1541 .GPIO_Speed = GPIO_Speed_50MHz,
1542 .GPIO_Mode = GPIO_Mode_AF,
1543 .GPIO_OType = GPIO_OType_PP,
1544 .GPIO_PuPd = GPIO_PuPd_UP
1550 .vsync = &pios_exti_vsync_cfg,
1554 .timer_chan = TIM_Channel_2,
1558 .GPIO_Pin = GPIO_Pin_3,
1559 .GPIO_Speed = GPIO_Speed_100MHz,
1560 .GPIO_Mode = GPIO_Mode_AF,
1561 .GPIO_OType = GPIO_OType_PP,
1562 .GPIO_PuPd = GPIO_PuPd_UP
1564 .pin_source = GPIO_PinSource3,
1566 .remap = GPIO_AF_TIM2,
1571 .timer_chan = TIM_Channel_1,
1575 .GPIO_Pin = GPIO_Pin_4,
1576 .GPIO_Speed = GPIO_Speed_100MHz,
1577 .GPIO_Mode = GPIO_Mode_AF,
1578 .GPIO_OType = GPIO_OType_PP,
1579 .GPIO_PuPd = GPIO_PuPd_UP
1581 .pin_source = GPIO_PinSource4,
1583 .remap = GPIO_AF_TIM3,
1587 .TIM_OCMode = TIM_OCMode_PWM1,
1588 .TIM_OutputState = TIM_OutputState_Enable,
1589 .TIM_OutputNState = TIM_OutputNState_Disable,
1591 .TIM_OCPolarity = TIM_OCPolarity_High,
1592 .TIM_OCNPolarity = TIM_OCPolarity_High,
1593 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1594 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1601 #if defined(PIOS_INCLUDE_DAC)
1617 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 600000) - 1,
1618 .TIM_ClockDivision = TIM_CKD_DIV1,
1619 .TIM_CounterMode = TIM_CounterMode_Up,
1623 .NVIC_IRQChannel = DMA1_Stream5_IRQn,
1625 .NVIC_IRQChannelSubPriority = 0,
1626 .NVIC_IRQChannelCmd = ENABLE,
1629 .gpio_pin = GPIO_Pin_4,
1630 .dma_stream = DMA1_Stream5,
1631 .dma_channel = DMA_Channel_7,
1632 .dac_channel = DAC_Channel_1,
1633 .dac_trigger = DAC_Trigger_T6_TRGO,
1634 .dac_outreg = (uintptr_t) (&DAC->DHR12L1),
1635 .dma_tcif = DMA_IT_TCIF5,
1644 #if defined(PIOS_INCLUDE_MPU)
1646 static const struct pios_exti_cfg pios_exti_mpu_cfg __exti_config = {
1648 .line = EXTI_Line13,
1652 .GPIO_Pin = GPIO_Pin_13,
1653 .GPIO_Speed = GPIO_Speed_2MHz,
1654 .GPIO_Mode = GPIO_Mode_IN,
1655 .GPIO_OType = GPIO_OType_OD,
1656 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1661 .NVIC_IRQChannel = EXTI15_10_IRQn,
1663 .NVIC_IRQChannelSubPriority = 0,
1664 .NVIC_IRQChannelCmd = ENABLE,
1669 .EXTI_Line = EXTI_Line13,
1670 .EXTI_Mode = EXTI_Mode_Interrupt,
1671 .EXTI_Trigger = EXTI_Trigger_Rising,
1672 .EXTI_LineCmd = ENABLE,
1679 .default_samplerate = 1000,
1681 .use_internal_mag =
true,
1688 #if defined(PIOS_INCLUDE_MS5611)
1692 .temperature_interleaving = 1,
uint8_t expect_manufacturer
#define DMA2_Stream4_IRQHandler
const struct pios_dmashot_timer_cfg * timer_cfg
#define DMA1_Stream5_IRQHandler
static const TIM_TimeBaseInitTypeDef tim_5_time_base
const struct pios_flash_driver pios_jedec_flash_driver
static const struct pios_tim_clock_cfg tim_5_cfg
#define I2C2_EV_IRQHandler
OSD gen module, handles OSD draw. Parts from CL-OSD and SUPEROSD projects.
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
TIM_ICInitTypeDef tim_ic_init
static const struct pios_tim_channel pios_tim_servoport_all_pins[]
void(* set_bw_levels)(uint8_t, uint8_t)
#define PIOS_IRQ_PRIO_HIGHEST
#define PIOS_SERVOS_INITIAL_POSITION
Defines the API to set up the HID + CDC USB descriptor config.
static const struct pios_tim_channel pios_tim_servoport_rcvrport_pins[]
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
#define PIOS_IRQ_PRIO_MID
Configuration structure for the MS5611 driver.
USART private definitions.
Spektrum/JR DSMx satellite receiver private structures.
enum pios_ms5611_osr oversampling
#define I2C2_ER_IRQHandler
#define FLASH_SECTOR_64KB
const struct pios_exti_cfg * exti_cfg
Driver for talking to most JEDEC flash chips.
#define PIOS_SERVO_UPDATE_HZ
Configuration struct holding all timer configurations.
Configuration struct to assign a DMA channel and stream to a timer, and optionally specify a master t...
static const struct pios_tim_channel pios_tim_rcvrport_all_channels[]
struct pios_i2c_adapter * pios_i2c_t
const struct pios_annunc * annunciators
void PIOS_I2C_EV_IRQ_Handler(pios_i2c_t i2c_id)
ADC_TypeDef * adc_dev_master
#define I2C1_ER_IRQHandler
#define PIOS_INCLUDE_FLASH_JEDEC
TIM_OCInitTypeDef tim_oc_init
USB COM HID private definitions.
#define I2C1_EV_IRQHandler
Servo private structures.
#define FLASH_SECTOR_16KB
NVIC_InitTypeDef interrupt
void PIOS_I2C_ER_IRQ_Handler(pios_i2c_t i2c_id)
TIM_ICInitTypeDef tim_ic_init
static const TIM_TimeBaseInitTypeDef tim_8_time_base
Defines the API to set up the HID-only USB descriptor config.
static const struct pios_tim_clock_cfg tim_12_cfg
void PIOS_RTC_irq_handler(void)
Futaba S.Bus Private structures.
struct dac_dev_s * dac_dev_t
bool PIOS_MPU_IRQHandler(void)
The IMU interrupt handler. Fetches new data from the IMU.
const struct pios_flash_driver * driver
const struct pios_flash_partition pios_flash_partition_table[]
USB COM CDC private definitions.
#define JEDEC_MANUFACTURER_MACRONIX
enum pios_flash_partition_labels label
static const TIM_TimeBaseInitTypeDef tim_12_time_base
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
static const struct pios_tim_clock_cfg tim_8_cfg
void PIOS_DAC_dma_interrupt_handler(dac_dev_t dev)
Handles a DMA completion interrupt on dma_stream.
#define FLASH_SECTOR_128KB
const struct pios_flash_driver pios_internal_flash_driver
USART private definitions.
#define PIOS_LED_HEARTBEAT
Defines the API to the board-specific USB data setup code.