31 #include <pios_config.h>
34 #if defined(PIOS_INCLUDE_ANNUNC)
42 .GPIO_Pin = GPIO_Pin_5,
43 .GPIO_Speed = GPIO_Speed_2MHz,
44 .GPIO_Mode = GPIO_Mode_OUT,
45 .GPIO_OType = GPIO_OType_PP,
46 .GPIO_PuPd = GPIO_PuPd_NOPULL,
56 .GPIO_Pin = GPIO_Pin_6,
57 .GPIO_Speed = GPIO_Speed_2MHz,
58 .GPIO_Mode = GPIO_Mode_OUT,
59 .GPIO_OType = GPIO_OType_PP,
60 .GPIO_PuPd = GPIO_PuPd_NOPULL,
70 .GPIO_Pin = GPIO_Pin_7,
71 .GPIO_Speed = GPIO_Speed_50MHz,
72 .GPIO_Mode = GPIO_Mode_OUT,
73 .GPIO_OType = GPIO_OType_PP,
74 .GPIO_PuPd = GPIO_PuPd_NOPULL
83 .num_annunciators =
NELEMENTS(pios_annuncs),
86 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
88 return &pios_annunc_cfg;
93 #if defined(PIOS_INCLUDE_SPI)
100 static const struct pios_spi_cfg pios_spi_sdCard_cfg = {
102 .remap = GPIO_AF_SPI1,
104 .SPI_Mode = SPI_Mode_Master,
105 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
106 .SPI_DataSize = SPI_DataSize_8b,
107 .SPI_NSS = SPI_NSS_Soft,
108 .SPI_FirstBit = SPI_FirstBit_MSB,
109 .SPI_CRCPolynomial = 7,
110 .SPI_CPOL = SPI_CPOL_High,
111 .SPI_CPHA = SPI_CPHA_2Edge,
112 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32,
117 .GPIO_Pin = GPIO_Pin_5,
118 .GPIO_Speed = GPIO_Speed_100MHz,
119 .GPIO_Mode = GPIO_Mode_AF,
120 .GPIO_OType = GPIO_OType_PP,
121 .GPIO_PuPd = GPIO_PuPd_NOPULL
123 .pin_source = GPIO_PinSource5,
128 .GPIO_Pin = GPIO_Pin_6,
129 .GPIO_Speed = GPIO_Speed_100MHz,
130 .GPIO_Mode = GPIO_Mode_AF,
131 .GPIO_OType = GPIO_OType_PP,
132 .GPIO_PuPd = GPIO_PuPd_NOPULL
134 .pin_source = GPIO_PinSource6,
139 .GPIO_Pin = GPIO_Pin_7,
140 .GPIO_Speed = GPIO_Speed_100MHz,
141 .GPIO_Mode = GPIO_Mode_AF,
142 .GPIO_OType = GPIO_OType_PP,
143 .GPIO_PuPd = GPIO_PuPd_NOPULL
145 .pin_source = GPIO_PinSource7,
151 .GPIO_Pin = GPIO_Pin_10,
152 .GPIO_Speed = GPIO_Speed_100MHz,
153 .GPIO_Mode = GPIO_Mode_OUT,
154 .GPIO_OType = GPIO_OType_PP,
155 .GPIO_PuPd = GPIO_PuPd_NOPULL
166 static const struct pios_spi_cfg pios_spi_external_cfg = {
168 .remap = GPIO_AF_SPI2,
170 .SPI_Mode = SPI_Mode_Master,
171 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
172 .SPI_DataSize = SPI_DataSize_8b,
173 .SPI_NSS = SPI_NSS_Soft,
174 .SPI_FirstBit = SPI_FirstBit_MSB,
175 .SPI_CRCPolynomial = 7,
176 .SPI_CPOL = SPI_CPOL_Low,
177 .SPI_CPHA = SPI_CPHA_1Edge,
178 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
183 .GPIO_Pin = GPIO_Pin_13,
184 .GPIO_Speed = GPIO_Speed_100MHz,
185 .GPIO_Mode = GPIO_Mode_AF,
186 .GPIO_OType = GPIO_OType_PP,
187 .GPIO_PuPd = GPIO_PuPd_NOPULL
189 .pin_source = GPIO_PinSource13,
194 .GPIO_Pin = GPIO_Pin_14,
195 .GPIO_Speed = GPIO_Speed_100MHz,
196 .GPIO_Mode = GPIO_Mode_AF,
197 .GPIO_OType = GPIO_OType_PP,
198 .GPIO_PuPd = GPIO_PuPd_NOPULL
200 .pin_source = GPIO_PinSource14,
205 .GPIO_Pin = GPIO_Pin_15,
206 .GPIO_Speed = GPIO_Speed_100MHz,
207 .GPIO_Mode = GPIO_Mode_AF,
208 .GPIO_OType = GPIO_OType_PP,
209 .GPIO_PuPd = GPIO_PuPd_NOPULL
211 .pin_source = GPIO_PinSource15,
217 .GPIO_Pin = GPIO_Pin_3,
218 .GPIO_Speed = GPIO_Speed_100MHz,
219 .GPIO_Mode = GPIO_Mode_OUT,
220 .GPIO_OType = GPIO_OType_PP,
221 .GPIO_PuPd = GPIO_PuPd_NOPULL
232 static const struct pios_spi_cfg pios_spi_internal_cfg = {
234 .remap = GPIO_AF_SPI3,
236 .SPI_Mode = SPI_Mode_Master,
237 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
238 .SPI_DataSize = SPI_DataSize_8b,
239 .SPI_NSS = SPI_NSS_Soft,
240 .SPI_FirstBit = SPI_FirstBit_MSB,
241 .SPI_CRCPolynomial = 7,
242 .SPI_CPOL = SPI_CPOL_High,
243 .SPI_CPHA = SPI_CPHA_2Edge,
244 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32,
249 .GPIO_Pin = GPIO_Pin_10,
250 .GPIO_Speed = GPIO_Speed_100MHz,
251 .GPIO_Mode = GPIO_Mode_AF,
252 .GPIO_OType = GPIO_OType_PP,
253 .GPIO_PuPd = GPIO_PuPd_NOPULL
255 .pin_source = GPIO_PinSource10,
260 .GPIO_Pin = GPIO_Pin_11,
261 .GPIO_Speed = GPIO_Speed_100MHz,
262 .GPIO_Mode = GPIO_Mode_AF,
263 .GPIO_OType = GPIO_OType_PP,
264 .GPIO_PuPd = GPIO_PuPd_NOPULL
266 .pin_source = GPIO_PinSource11,
271 .GPIO_Pin = GPIO_Pin_12,
272 .GPIO_Speed = GPIO_Speed_100MHz,
273 .GPIO_Mode = GPIO_Mode_AF,
274 .GPIO_OType = GPIO_OType_PP,
275 .GPIO_PuPd = GPIO_PuPd_NOPULL
277 .pin_source = GPIO_PinSource12,
283 .GPIO_Pin = GPIO_Pin_8,
284 .GPIO_Speed = GPIO_Speed_100MHz,
285 .GPIO_Mode = GPIO_Mode_OUT,
286 .GPIO_OType = GPIO_OType_PP,
287 .GPIO_PuPd = GPIO_PuPd_NOPULL
296 #if defined(PIOS_INCLUDE_I2C)
298 #include <pios_i2c_priv.h>
300 void PIOS_I2C_internal_ev_irq_handler(
void);
301 void PIOS_I2C_internal_er_irq_handler(
void);
308 .remap = GPIO_AF_I2C1,
310 .I2C_Mode = I2C_Mode_I2C,
311 .I2C_OwnAddress1 = 0,
312 .I2C_Ack = I2C_Ack_Enable,
313 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
314 .I2C_DutyCycle = I2C_DutyCycle_2,
315 .I2C_ClockSpeed = 400000,
317 .transfer_timeout_ms = 50,
321 .GPIO_Pin = GPIO_Pin_6,
322 .GPIO_Mode = GPIO_Mode_AF,
323 .GPIO_Speed = GPIO_Speed_50MHz,
324 .GPIO_OType = GPIO_OType_OD,
325 .GPIO_PuPd = GPIO_PuPd_UP,
327 .pin_source = GPIO_PinSource6,
332 .GPIO_Pin = GPIO_Pin_7,
333 .GPIO_Mode = GPIO_Mode_AF,
334 .GPIO_Speed = GPIO_Speed_50MHz,
335 .GPIO_OType = GPIO_OType_OD,
336 .GPIO_PuPd = GPIO_PuPd_UP,
338 .pin_source = GPIO_PinSource7,
343 .NVIC_IRQChannel = I2C1_EV_IRQn,
345 .NVIC_IRQChannelSubPriority = 0,
346 .NVIC_IRQChannelCmd = ENABLE,
352 .NVIC_IRQChannel = I2C1_ER_IRQn,
354 .NVIC_IRQChannelSubPriority = 0,
355 .NVIC_IRQChannelCmd = ENABLE,
361 void PIOS_I2C_internal_ev_irq_handler(
void)
367 void PIOS_I2C_internal_er_irq_handler(
void)
373 void PIOS_I2C_external_ev_irq_handler(
void);
374 void PIOS_I2C_external_er_irq_handler(
void);
381 .remap = GPIO_AF_I2C2,
383 .I2C_Mode = I2C_Mode_I2C,
384 .I2C_OwnAddress1 = 0,
385 .I2C_Ack = I2C_Ack_Enable,
386 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
387 .I2C_DutyCycle = I2C_DutyCycle_2,
388 .I2C_ClockSpeed = 400000,
390 .transfer_timeout_ms = 50,
394 .GPIO_Pin = GPIO_Pin_10,
395 .GPIO_Mode = GPIO_Mode_AF,
396 .GPIO_Speed = GPIO_Speed_50MHz,
397 .GPIO_OType = GPIO_OType_OD,
398 .GPIO_PuPd = GPIO_PuPd_UP,
400 .pin_source = GPIO_PinSource10,
405 .GPIO_Pin = GPIO_Pin_11,
406 .GPIO_Mode = GPIO_Mode_AF,
407 .GPIO_Speed = GPIO_Speed_50MHz,
408 .GPIO_OType = GPIO_OType_OD,
409 .GPIO_PuPd = GPIO_PuPd_UP,
411 .pin_source = GPIO_PinSource11,
416 .NVIC_IRQChannel = I2C2_EV_IRQn,
418 .NVIC_IRQChannelSubPriority = 0,
419 .NVIC_IRQChannelCmd = ENABLE,
425 .NVIC_IRQChannel = I2C2_ER_IRQn,
427 .NVIC_IRQChannelSubPriority = 0,
428 .NVIC_IRQChannelCmd = ENABLE,
434 void PIOS_I2C_external_ev_irq_handler(
void)
440 void PIOS_I2C_external_er_irq_handler(
void)
448 #if defined(PIOS_INCLUDE_FLASH)
453 .arena_size = 0x00004000,
454 .slot_size = 0x00000100,
483 uintptr_t pios_internal_flash_id;
486 .chip_id = &pios_internal_flash_id,
488 .sector_blocks = stm32f4_sectors,
489 .num_blocks =
NELEMENTS(stm32f4_sectors),
495 .chip_desc = &pios_flash_chip_internal,
504 .chip_desc = &pios_flash_chip_internal,
515 .chip_desc = &pios_flash_chip_internal,
526 .chip_desc = &pios_flash_chip_internal,
542 *num_partitions =
NELEMENTS(pios_flash_partition_table);
548 #if defined(PIOS_INCLUDE_USART)
552 #if defined(PIOS_INCLUDE_DSM)
558 static const struct pios_dsm_cfg pios_usart4_dsm_aux_cfg = {
562 .GPIO_Pin = GPIO_Pin_1,
563 .GPIO_Speed = GPIO_Speed_2MHz,
564 .GPIO_Mode = GPIO_Mode_OUT,
565 .GPIO_OType = GPIO_OType_PP,
566 .GPIO_PuPd = GPIO_PuPd_NOPULL
571 static const struct pios_dsm_cfg pios_usart6_dsm_aux_cfg = {
575 .GPIO_Pin = GPIO_Pin_7,
576 .GPIO_Speed = GPIO_Speed_2MHz,
577 .GPIO_Mode = GPIO_Mode_OUT,
578 .GPIO_OType = GPIO_OType_PP,
579 .GPIO_PuPd = GPIO_PuPd_NOPULL
586 #if defined(PIOS_INCLUDE_SBUS)
590 static const struct pios_sbus_cfg pios_usart3_sbus_aux_cfg = {
595 .GPIO_Pin = GPIO_Pin_12,
596 .GPIO_Speed = GPIO_Speed_2MHz,
597 .GPIO_Mode = GPIO_Mode_OUT,
598 .GPIO_OType = GPIO_OType_PP,
599 .GPIO_PuPd = GPIO_PuPd_NOPULL
602 .gpio_inv_enable = Bit_SET,
603 .gpio_inv_disable = Bit_RESET,
610 .remap = GPIO_AF_USART1,
613 .NVIC_IRQChannel = USART1_IRQn,
615 .NVIC_IRQChannelSubPriority = 0,
616 .NVIC_IRQChannelCmd = ENABLE,
622 .GPIO_Pin = GPIO_Pin_10,
623 .GPIO_Speed = GPIO_Speed_2MHz,
624 .GPIO_Mode = GPIO_Mode_AF,
625 .GPIO_OType = GPIO_OType_PP,
626 .GPIO_PuPd = GPIO_PuPd_UP
628 .pin_source = GPIO_PinSource10,
633 .GPIO_Pin = GPIO_Pin_9,
634 .GPIO_Speed = GPIO_Speed_2MHz,
635 .GPIO_Mode = GPIO_Mode_AF,
636 .GPIO_OType = GPIO_OType_PP,
637 .GPIO_PuPd = GPIO_PuPd_UP
639 .pin_source = GPIO_PinSource9,
645 .remap = GPIO_AF_USART2,
648 .NVIC_IRQChannel = USART2_IRQn,
650 .NVIC_IRQChannelSubPriority = 0,
651 .NVIC_IRQChannelCmd = ENABLE,
657 .GPIO_Pin = GPIO_Pin_6,
658 .GPIO_Speed = GPIO_Speed_2MHz,
659 .GPIO_Mode = GPIO_Mode_AF,
660 .GPIO_OType = GPIO_OType_PP,
661 .GPIO_PuPd = GPIO_PuPd_UP
663 .pin_source = GPIO_PinSource6,
668 .GPIO_Pin = GPIO_Pin_5,
669 .GPIO_Speed = GPIO_Speed_2MHz,
670 .GPIO_Mode = GPIO_Mode_AF,
671 .GPIO_OType = GPIO_OType_PP,
672 .GPIO_PuPd = GPIO_PuPd_UP
674 .pin_source = GPIO_PinSource5,
680 .remap = GPIO_AF_USART3,
683 .NVIC_IRQChannel = USART3_IRQn,
685 .NVIC_IRQChannelSubPriority = 0,
686 .NVIC_IRQChannelCmd = ENABLE,
692 .GPIO_Pin = GPIO_Pin_9,
693 .GPIO_Speed = GPIO_Speed_2MHz,
694 .GPIO_Mode = GPIO_Mode_AF,
695 .GPIO_OType = GPIO_OType_PP,
696 .GPIO_PuPd = GPIO_PuPd_UP
698 .pin_source = GPIO_PinSource9,
703 .GPIO_Pin = GPIO_Pin_8,
704 .GPIO_Speed = GPIO_Speed_2MHz,
705 .GPIO_Mode = GPIO_Mode_AF,
706 .GPIO_OType = GPIO_OType_PP,
707 .GPIO_PuPd = GPIO_PuPd_UP
709 .pin_source = GPIO_PinSource8,
715 .remap = GPIO_AF_UART4,
718 .NVIC_IRQChannel = UART4_IRQn,
720 .NVIC_IRQChannelSubPriority = 0,
721 .NVIC_IRQChannelCmd = ENABLE,
727 .GPIO_Pin = GPIO_Pin_1,
728 .GPIO_Speed = GPIO_Speed_2MHz,
729 .GPIO_Mode = GPIO_Mode_AF,
730 .GPIO_OType = GPIO_OType_PP,
731 .GPIO_PuPd = GPIO_PuPd_UP
733 .pin_source = GPIO_PinSource1,
738 .GPIO_Pin = GPIO_Pin_0,
739 .GPIO_Speed = GPIO_Speed_2MHz,
740 .GPIO_Mode = GPIO_Mode_AF,
741 .GPIO_OType = GPIO_OType_PP,
742 .GPIO_PuPd = GPIO_PuPd_UP
744 .pin_source = GPIO_PinSource0,
750 .remap = GPIO_AF_USART6,
753 .NVIC_IRQChannel = USART6_IRQn,
755 .NVIC_IRQChannelSubPriority = 0,
756 .NVIC_IRQChannelCmd = ENABLE,
762 .GPIO_Pin = GPIO_Pin_7,
763 .GPIO_Speed = GPIO_Speed_2MHz,
764 .GPIO_Mode = GPIO_Mode_AF,
765 .GPIO_OType = GPIO_OType_PP,
766 .GPIO_PuPd = GPIO_PuPd_UP
768 .pin_source = GPIO_PinSource7,
773 .GPIO_Pin = GPIO_Pin_6,
774 .GPIO_Speed = GPIO_Speed_2MHz,
775 .GPIO_Mode = GPIO_Mode_AF,
776 .GPIO_OType = GPIO_OType_PP,
777 .GPIO_PuPd = GPIO_PuPd_UP
779 .pin_source = GPIO_PinSource6,
785 #if defined(PIOS_INCLUDE_COM)
791 #if defined(PIOS_INCLUDE_RTC)
795 #include <pios_rtc_priv.h>
797 void PIOS_RTC_IRQ_Handler (
void);
800 .
clksrc = RCC_RTCCLKSource_HSE_Div8,
806 .NVIC_IRQChannel = RTC_WKUP_IRQn,
808 .NVIC_IRQChannelSubPriority = 0,
809 .NVIC_IRQChannelCmd = ENABLE,
814 void PIOS_RTC_IRQ_Handler (
void)
827 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
828 .TIM_ClockDivision = TIM_CKD_DIV1,
829 .TIM_CounterMode = TIM_CounterMode_Up,
830 .TIM_Period = 0xFFFF,
831 .TIM_RepetitionCounter = 0x0000,
839 .NVIC_IRQChannel = TIM5_IRQn,
841 .NVIC_IRQChannelSubPriority = 0,
842 .NVIC_IRQChannelCmd = ENABLE,
851 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
852 .TIM_ClockDivision = TIM_CKD_DIV1,
853 .TIM_CounterMode = TIM_CounterMode_Up,
855 .TIM_RepetitionCounter = 0x0000,
860 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
861 .TIM_ClockDivision = TIM_CKD_DIV1,
862 .TIM_CounterMode = TIM_CounterMode_Up,
864 .TIM_RepetitionCounter = 0x0000,
872 .NVIC_IRQChannel = TIM2_IRQn,
874 .NVIC_IRQChannelSubPriority = 0,
875 .NVIC_IRQChannelCmd = ENABLE,
885 .NVIC_IRQChannel = TIM3_IRQn,
887 .NVIC_IRQChannelSubPriority = 0,
888 .NVIC_IRQChannelCmd = ENABLE,
898 .NVIC_IRQChannel = TIM4_IRQn,
900 .NVIC_IRQChannelSubPriority = 0,
901 .NVIC_IRQChannelCmd = ENABLE,
911 .NVIC_IRQChannel = TIM8_CC_IRQn,
913 .NVIC_IRQChannelSubPriority = 0,
914 .NVIC_IRQChannelCmd = ENABLE,
939 .timer_chan = TIM_Channel_4,
940 .remap = GPIO_AF_TIM8,
944 .GPIO_Pin = GPIO_Pin_9,
945 .GPIO_Speed = GPIO_Speed_2MHz,
946 .GPIO_Mode = GPIO_Mode_AF,
947 .GPIO_OType = GPIO_OType_PP,
948 .GPIO_PuPd = GPIO_PuPd_NOPULL
950 .pin_source = GPIO_PinSource9,
955 .timer_chan = TIM_Channel_3,
956 .remap = GPIO_AF_TIM8,
960 .GPIO_Pin = GPIO_Pin_8,
961 .GPIO_Speed = GPIO_Speed_2MHz,
962 .GPIO_Mode = GPIO_Mode_AF,
963 .GPIO_OType = GPIO_OType_PP,
964 .GPIO_PuPd = GPIO_PuPd_NOPULL
966 .pin_source = GPIO_PinSource8,
971 .timer_chan = TIM_Channel_1,
972 .remap = GPIO_AF_TIM2,
976 .GPIO_Pin = GPIO_Pin_15,
977 .GPIO_Speed = GPIO_Speed_2MHz,
978 .GPIO_Mode = GPIO_Mode_AF,
979 .GPIO_OType = GPIO_OType_PP,
980 .GPIO_PuPd = GPIO_PuPd_NOPULL
982 .pin_source = GPIO_PinSource15,
987 .timer_chan = TIM_Channel_2,
988 .remap = GPIO_AF_TIM2,
992 .GPIO_Pin = GPIO_Pin_3,
993 .GPIO_Speed = GPIO_Speed_2MHz,
994 .GPIO_Mode = GPIO_Mode_AF,
995 .GPIO_OType = GPIO_OType_PP,
996 .GPIO_PuPd = GPIO_PuPd_NOPULL
998 .pin_source = GPIO_PinSource3,
1003 .timer_chan = TIM_Channel_1,
1004 .remap = GPIO_AF_TIM3,
1008 .GPIO_Pin = GPIO_Pin_4,
1009 .GPIO_Speed = GPIO_Speed_2MHz,
1010 .GPIO_Mode = GPIO_Mode_AF,
1011 .GPIO_OType = GPIO_OType_PP,
1012 .GPIO_PuPd = GPIO_PuPd_NOPULL
1014 .pin_source = GPIO_PinSource4,
1019 .timer_chan = TIM_Channel_2,
1020 .remap = GPIO_AF_TIM3,
1024 .GPIO_Pin = GPIO_Pin_5,
1025 .GPIO_Speed = GPIO_Speed_2MHz,
1026 .GPIO_Mode = GPIO_Mode_AF,
1027 .GPIO_OType = GPIO_OType_PP,
1028 .GPIO_PuPd = GPIO_PuPd_NOPULL
1030 .pin_source = GPIO_PinSource5,
1035 .timer_chan = TIM_Channel_1,
1036 .remap = GPIO_AF_TIM4,
1040 .GPIO_Pin = GPIO_Pin_12,
1041 .GPIO_Speed = GPIO_Speed_2MHz,
1042 .GPIO_Mode = GPIO_Mode_AF,
1043 .GPIO_OType = GPIO_OType_PP,
1044 .GPIO_PuPd = GPIO_PuPd_NOPULL
1046 .pin_source = GPIO_PinSource12,
1051 .timer_chan = TIM_Channel_2,
1052 .remap = GPIO_AF_TIM4,
1056 .GPIO_Pin = GPIO_Pin_13,
1057 .GPIO_Speed = GPIO_Speed_2MHz,
1058 .GPIO_Mode = GPIO_Mode_AF,
1059 .GPIO_OType = GPIO_OType_PP,
1060 .GPIO_PuPd = GPIO_PuPd_NOPULL
1062 .pin_source = GPIO_PinSource13,
1067 .timer_chan = TIM_Channel_3,
1068 .remap = GPIO_AF_TIM4,
1072 .GPIO_Pin = GPIO_Pin_14,
1073 .GPIO_Speed = GPIO_Speed_2MHz,
1074 .GPIO_Mode = GPIO_Mode_AF,
1075 .GPIO_OType = GPIO_OType_PP,
1076 .GPIO_PuPd = GPIO_PuPd_NOPULL
1078 .pin_source = GPIO_PinSource14,
1083 .timer_chan = TIM_Channel_4,
1084 .remap = GPIO_AF_TIM4,
1088 .GPIO_Pin = GPIO_Pin_15,
1089 .GPIO_Speed = GPIO_Speed_2MHz,
1090 .GPIO_Mode = GPIO_Mode_AF,
1091 .GPIO_OType = GPIO_OType_PP,
1092 .GPIO_PuPd = GPIO_PuPd_NOPULL
1094 .pin_source = GPIO_PinSource15,
1099 #if defined(PIOS_INCLUDE_DMASHOT)
1108 .stream = DMA2_Stream1,
1109 .channel = DMA_Channel_7,
1110 .tcif = DMA_FLAG_TCIF1
1114 .stream = DMA1_Stream7,
1115 .channel = DMA_Channel_3,
1116 .tcif = DMA_FLAG_TCIF7
1120 .stream = DMA1_Stream2,
1121 .channel = DMA_Channel_5,
1122 .tcif = DMA_FLAG_TCIF2
1126 .stream = DMA1_Stream6,
1127 .channel = DMA_Channel_2,
1128 .tcif = DMA_FLAG_TCIF6
1134 .num_timers =
NELEMENTS(dmashot_tim_cfg)
1137 #endif // defined(PIOS_INCLUDE_DMASHOT)
1139 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
1147 .TIM_OCMode = TIM_OCMode_PWM1,
1148 .TIM_OutputState = TIM_OutputState_Enable,
1149 .TIM_OutputNState = TIM_OutputNState_Disable,
1151 .TIM_OCPolarity = TIM_OCPolarity_High,
1152 .TIM_OCNPolarity = TIM_OCPolarity_High,
1153 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1154 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1157 .num_channels =
NELEMENTS(pios_tim_outputs_pins),
1169 .timer_chan = TIM_Channel_3,
1170 .remap = GPIO_AF_TIM5,
1174 .GPIO_Pin = GPIO_Pin_2,
1175 .GPIO_Speed = GPIO_Speed_2MHz,
1176 .GPIO_Mode = GPIO_Mode_AF,
1177 .GPIO_OType = GPIO_OType_PP,
1178 .GPIO_PuPd = GPIO_PuPd_UP
1180 .pin_source = GPIO_PinSource2,
1188 #if defined(PIOS_INCLUDE_PPM)
1196 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1197 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1198 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1199 .TIM_ICFilter = 0x0,
1200 .TIM_Channel = TIM_Channel_3,
1203 .channels = &pios_tim_rcvrport_ppm[0],
1209 #if defined(PIOS_INCLUDE_RCVR)
1213 #if defined(PIOS_INCLUDE_USB)
1219 .NVIC_IRQChannel = OTG_FS_IRQn,
1221 .NVIC_IRQChannelSubPriority = 0,
1222 .NVIC_IRQChannelCmd = ENABLE,
1231 .GPIO_Pin = GPIO_Pin_11,
1232 .GPIO_Speed = GPIO_Speed_2MHz,
1233 .GPIO_Mode = GPIO_Mode_OUT,
1234 .GPIO_OType = GPIO_OType_OD,
1235 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1242 return &pios_usb_main_cfg;
1252 #if defined(PIOS_INCLUDE_COM_MSG)
1258 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
1268 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
1282 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1289 #if defined(PIOS_INCLUDE_ADC)
1293 void PIOS_ADC_DMA_irq_handler(
void);
1299 .flags = (DMA_FLAG_TCIF0 | DMA_FLAG_TEIF0 | DMA_FLAG_HTIF0),
1301 .NVIC_IRQChannel = DMA2_Stream0_IRQn,
1303 .NVIC_IRQChannelSubPriority = 0,
1304 .NVIC_IRQChannelCmd = ENABLE,
1308 .channel = DMA2_Stream0,
1310 .DMA_Channel = DMA_Channel_0,
1311 .DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR
1315 .half_flag = DMA_IT_HTIF0,
1316 .full_flag = DMA_IT_TCIF0,
1318 { GPIOC, GPIO_Pin_4, ADC_Channel_14 }, \
1319 { GPIOC, GPIO_Pin_0, ADC_Channel_10 }, \
1320 { GPIOB, GPIO_Pin_1, ADC_Channel_9 }, \
1321 { GPIOC, GPIO_Pin_5, ADC_Channel_15 }, \
1322 { GPIOC, GPIO_Pin_2, ADC_Channel_12 }, \
1327 void PIOS_ADC_DMA_irq_handler(
void)
1339 #if defined(PIOS_INCLUDE_WS2811)
1351 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 12000000) - 1,
1352 .TIM_ClockDivision = TIM_CKD_DIV1,
1353 .TIM_CounterMode = TIM_CounterMode_Up,
1357 .NVIC_IRQChannel = DMA2_Stream6_IRQn,
1359 .NVIC_IRQChannelSubPriority = 0,
1360 .NVIC_IRQChannelCmd = ENABLE,
1362 .bit_clear_dma_tcif = DMA_IT_TCIF6,
1366 .gpio_pin = GPIO_Pin_0,
1367 .bit_set_dma_stream = DMA2_Stream4,
1368 .bit_set_dma_channel = DMA_Channel_6,
1369 .bit_clear_dma_stream = DMA2_Stream6,
1370 .bit_clear_dma_channel = DMA_Channel_0,
1374 #if defined(PIOS_INCLUDE_DAC)
1390 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 600000) - 1,
1391 .TIM_ClockDivision = TIM_CKD_DIV1,
1392 .TIM_CounterMode = TIM_CounterMode_Up,
1396 .NVIC_IRQChannel = DMA1_Stream5_IRQn,
1398 .NVIC_IRQChannelSubPriority = 0,
1399 .NVIC_IRQChannelCmd = ENABLE,
1402 .gpio_pin = GPIO_Pin_4,
1403 .dma_stream = DMA1_Stream5,
1404 .dma_channel = DMA_Channel_7,
1405 .dac_channel = DAC_Channel_1,
1406 .dac_trigger = DAC_Trigger_T6_TRGO,
1407 .dac_outreg = (uintptr_t) (&DAC->DHR12L1),
1408 .dma_tcif = DMA_IT_TCIF5,
1416 #if defined(PIOS_INCLUDE_MPU)
1424 .GPIO_Pin = GPIO_Pin_4,
1425 .GPIO_Speed = GPIO_Speed_100MHz,
1426 .GPIO_Mode = GPIO_Mode_IN,
1427 .GPIO_OType = GPIO_OType_OD,
1428 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1433 .NVIC_IRQChannel = EXTI4_IRQn,
1435 .NVIC_IRQChannelSubPriority = 0,
1436 .NVIC_IRQChannelCmd = ENABLE,
1441 .EXTI_Line = EXTI_Line4,
1442 .EXTI_Mode = EXTI_Mode_Interrupt,
1443 .EXTI_Trigger = EXTI_Trigger_Rising,
1444 .EXTI_LineCmd = ENABLE,
1451 .default_samplerate = 1000,
1460 #if defined(PIOS_INCLUDE_HMC5883)
1462 static const struct pios_exti_cfg pios_exti_hmc5883_internal_cfg __exti_config = {
1468 .GPIO_Pin = GPIO_Pin_2,
1469 .GPIO_Speed = GPIO_Speed_100MHz,
1470 .GPIO_Mode = GPIO_Mode_IN,
1471 .GPIO_OType = GPIO_OType_OD,
1472 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1477 .NVIC_IRQChannel = EXTI2_IRQn,
1479 .NVIC_IRQChannelSubPriority = 0,
1480 .NVIC_IRQChannelCmd = ENABLE,
1485 .EXTI_Line = EXTI_Line2,
1486 .EXTI_Mode = EXTI_Mode_Interrupt,
1487 .EXTI_Trigger = EXTI_Trigger_Rising,
1488 .EXTI_LineCmd = ENABLE,
1494 .
exti_cfg = &pios_exti_hmc5883_internal_cfg,
1506 #if defined(PIOS_INCLUDE_MS5611)
1510 .temperature_interleaving = 1,
1511 .use_0x76_address =
true,
const struct pios_exti_cfg * exti_cfg
const struct pios_dmashot_timer_cfg * timer_cfg
#define PIOS_HMC5883_ODR_75
#define DMA1_Stream5_IRQHandler
#define I2C2_EV_IRQHandler
static const TIM_TimeBaseInitTypeDef tim_5_time_base
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
static const TIM_TimeBaseInitTypeDef tim_1_8_time_base
#define PIOS_HMC5883_MODE_CONTINUOUS
bool PIOS_HMC5883_IRQHandler()
#define PIOS_IRQ_PRIO_HIGHEST
#define PIOS_SERVOS_INITIAL_POSITION
static const struct pios_tim_clock_cfg tim_8_cfg
Defines the API to set up the HID + CDC USB descriptor config.
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
#define PIOS_IRQ_PRIO_MID
Configuration structure for the MS5611 driver.
USART private definitions.
#define DMA2_Stream0_IRQHandler
Spektrum/JR DSMx satellite receiver private structures.
enum pios_ms5611_osr oversampling
#define I2C2_ER_IRQHandler
static const struct pios_tim_clock_cfg tim_4_cfg
#define FLASH_SECTOR_64KB
const struct pios_exti_cfg * exti_cfg
#define PIOS_SERVO_UPDATE_HZ
static const struct pios_tim_clock_cfg tim_5_cfg
Configuration struct holding all timer configurations.
Configuration struct to assign a DMA channel and stream to a timer, and optionally specify a master t...
struct pios_i2c_adapter * pios_i2c_t
static const struct pios_tim_channel pios_tim_rcvrport_ppm[]
const struct pios_annunc * annunciators
void PIOS_I2C_EV_IRQ_Handler(pios_i2c_t i2c_id)
#define PIOS_HMC5883_GAIN_1_9
ADC_TypeDef * adc_dev_master
#define I2C1_ER_IRQHandler
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
#define DMA2_Stream6_IRQHandler
static const TIM_TimeBaseInitTypeDef tim_2_3_4_time_base
Defines the API to set up the HID-only USB descriptor config.
NVIC_InitTypeDef interrupt
#define PIOS_HMC5883_MEASCONF_NORMAL
void PIOS_RTC_irq_handler(void)
Futaba S.Bus Private structures.
void PIOS_WS2811_dma_interrupt_handler(ws2811_dev_t dev)
Handles a DMA completion interrupt on bit_clear_dma_stream.
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
static const struct pios_tim_channel pios_tim_outputs_pins[]
const struct pios_flash_partition pios_flash_partition_table[]
#define PIOS_IRQ_PRIO_HIGH
static const struct pios_tim_clock_cfg tim_3_cfg
USB COM CDC private definitions.
enum pios_flash_partition_labels label
static const struct pios_tim_clock_cfg tim_2_cfg
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
void PIOS_DAC_dma_interrupt_handler(dac_dev_t dev)
Handles a DMA completion interrupt on dma_stream.
#define PIOS_ANNUNCIATOR_BUZZER
#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.