35 #include <pios_config.h>
38 #if defined(PIOS_INCLUDE_ANNUNC)
46 .GPIO_Pin = GPIO_Pin_14,
47 .GPIO_Speed = GPIO_Speed_2MHz,
48 .GPIO_Mode = GPIO_Mode_OUT,
49 .GPIO_OType = GPIO_OType_PP,
50 .GPIO_PuPd = GPIO_PuPd_DOWN
61 .GPIO_Pin = GPIO_Pin_5,
62 .GPIO_Speed = GPIO_Speed_2MHz,
63 .GPIO_Mode = GPIO_Mode_OUT,
64 .GPIO_OType = GPIO_OType_PP,
65 .GPIO_PuPd = GPIO_PuPd_DOWN
75 .num_annunciators =
NELEMENTS(pios_annuncs),
78 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
80 return &pios_annunc_cfg;
86 #if defined(PIOS_INCLUDE_SPI)
94 static const struct pios_spi_cfg pios_spi_gyro_accel_cfg = {
96 .remap = GPIO_AF_SPI3,
98 .SPI_Mode = SPI_Mode_Master,
99 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
100 .SPI_DataSize = SPI_DataSize_8b,
101 .SPI_NSS = SPI_NSS_Soft,
102 .SPI_FirstBit = SPI_FirstBit_MSB,
103 .SPI_CRCPolynomial = 7,
104 .SPI_CPOL = SPI_CPOL_High,
105 .SPI_CPHA = SPI_CPHA_2Edge,
106 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32,
111 .GPIO_Pin = GPIO_Pin_10,
112 .GPIO_Speed = GPIO_Speed_100MHz,
113 .GPIO_Mode = GPIO_Mode_AF,
114 .GPIO_OType = GPIO_OType_PP,
115 .GPIO_PuPd = GPIO_PuPd_NOPULL
117 .pin_source = GPIO_PinSource10,
122 .GPIO_Pin = GPIO_Pin_11,
123 .GPIO_Speed = GPIO_Speed_100MHz,
124 .GPIO_Mode = GPIO_Mode_AF,
125 .GPIO_OType = GPIO_OType_PP,
126 .GPIO_PuPd = GPIO_PuPd_NOPULL
128 .pin_source = GPIO_PinSource11,
133 .GPIO_Pin = GPIO_Pin_12,
134 .GPIO_Speed = GPIO_Speed_100MHz,
135 .GPIO_Mode = GPIO_Mode_AF,
136 .GPIO_OType = GPIO_OType_PP,
137 .GPIO_PuPd = GPIO_PuPd_NOPULL
139 .pin_source = GPIO_PinSource12,
147 .GPIO_Pin = GPIO_Pin_2,
148 .GPIO_Speed = GPIO_Speed_100MHz,
149 .GPIO_Mode = GPIO_Mode_OUT,
150 .GPIO_OType = GPIO_OType_PP,
151 .GPIO_PuPd = GPIO_PuPd_UP
158 .GPIO_Pin = GPIO_Pin_7,
159 .GPIO_Speed = GPIO_Speed_100MHz,
160 .GPIO_Mode = GPIO_Mode_OUT,
161 .GPIO_OType = GPIO_OType_PP,
162 .GPIO_PuPd = GPIO_PuPd_UP
169 .GPIO_Pin = GPIO_Pin_13,
170 .GPIO_Speed = GPIO_Speed_100MHz,
171 .GPIO_Mode = GPIO_Mode_OUT,
172 .GPIO_OType = GPIO_OType_PP,
173 .GPIO_PuPd = GPIO_PuPd_UP
184 #if defined(PIOS_INCLUDE_BMI160)
193 .GPIO_Pin = GPIO_Pin_4,
194 .GPIO_Speed = GPIO_Speed_2MHz,
195 .GPIO_Mode = GPIO_Mode_IN,
196 .GPIO_OType = GPIO_OType_OD,
197 .GPIO_PuPd = GPIO_PuPd_DOWN,
202 .NVIC_IRQChannel = EXTI4_IRQn,
204 .NVIC_IRQChannelSubPriority = 0,
205 .NVIC_IRQChannelCmd = ENABLE,
210 .EXTI_Line = EXTI_Line4,
211 .EXTI_Mode = EXTI_Mode_Interrupt,
212 .EXTI_Trigger = EXTI_Trigger_Rising,
213 .EXTI_LineCmd = ENABLE,
224 .temperature_interleaving = 50
228 #ifdef PIOS_INCLUDE_LIS3MDL
237 #ifdef PIOS_INCLUDE_BMP280_SPI
248 #if defined(PIOS_INCLUDE_I2C)
250 #include <pios_i2c_priv.h>
256 void PIOS_I2C_usart3_ev_irq_handler(
void);
257 void PIOS_I2C_usart3_er_irq_handler(
void);
263 .remap = GPIO_AF_I2C2,
265 .I2C_Mode = I2C_Mode_I2C,
266 .I2C_OwnAddress1 = 0,
267 .I2C_Ack = I2C_Ack_Enable,
268 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
269 .I2C_DutyCycle = I2C_DutyCycle_2,
270 .I2C_ClockSpeed = 400000,
272 .transfer_timeout_ms = 50,
276 .GPIO_Pin = GPIO_Pin_10,
277 .GPIO_Mode = GPIO_Mode_AF,
278 .GPIO_Speed = GPIO_Speed_50MHz,
279 .GPIO_OType = GPIO_OType_OD,
280 .GPIO_PuPd = GPIO_PuPd_NOPULL,
282 .pin_source = GPIO_PinSource10,
287 .GPIO_Pin = GPIO_Pin_11,
288 .GPIO_Mode = GPIO_Mode_AF,
289 .GPIO_Speed = GPIO_Speed_50MHz,
290 .GPIO_OType = GPIO_OType_OD,
291 .GPIO_PuPd = GPIO_PuPd_NOPULL,
293 .pin_source = GPIO_PinSource11,
298 .NVIC_IRQChannel = I2C2_EV_IRQn,
300 .NVIC_IRQChannelSubPriority = 0,
301 .NVIC_IRQChannelCmd = ENABLE,
307 .NVIC_IRQChannel = I2C2_ER_IRQn,
309 .NVIC_IRQChannelSubPriority = 0,
310 .NVIC_IRQChannelCmd = ENABLE,
316 void PIOS_I2C_usart3_ev_irq_handler(
void)
322 void PIOS_I2C_usart3_er_irq_handler(
void)
329 #if defined(PIOS_INCLUDE_FLASH)
334 .arena_size = 0x00020000,
335 .slot_size = 0x00000100,
338 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
347 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
367 uintptr_t pios_internal_flash_id;
370 .chip_id = &pios_internal_flash_id,
372 .sector_blocks = stm32f4_sectors,
373 .num_blocks =
NELEMENTS(stm32f4_sectors),
378 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
381 .chip_desc = &pios_flash_chip_internal,
389 .chip_desc = &pios_flash_chip_internal,
398 .chip_desc = &pios_flash_chip_internal,
406 .chip_desc = &pios_flash_chip_internal,
414 .chip_desc = &pios_flash_chip_internal,
428 *num_partitions =
NELEMENTS(pios_flash_partition_table);
434 #if defined(PIOS_INCLUDE_USART)
438 #if defined(PIOS_INCLUDE_DSM)
444 static const struct pios_dsm_cfg pios_usart1_dsm_aux_cfg = {
448 .GPIO_Pin = GPIO_Pin_10,
449 .GPIO_Speed = GPIO_Speed_2MHz,
450 .GPIO_Mode = GPIO_Mode_OUT,
451 .GPIO_OType = GPIO_OType_PP,
452 .GPIO_PuPd = GPIO_PuPd_NOPULL
460 static const struct pios_dsm_cfg pios_usart2_dsm_aux_cfg = {
464 .GPIO_Pin = GPIO_Pin_5,
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_usart3_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_uart4_dsm_aux_cfg = {
490 .GPIO_Pin = GPIO_Pin_1,
491 .GPIO_Speed = GPIO_Speed_2MHz,
492 .GPIO_Mode = GPIO_Mode_OUT,
493 .GPIO_OType = GPIO_OType_PP,
494 .GPIO_PuPd = GPIO_PuPd_NOPULL
499 static const struct pios_dsm_cfg pios_usart6_dsm_aux_cfg = {
503 .GPIO_Pin = GPIO_Pin_7,
504 .GPIO_Speed = GPIO_Speed_2MHz,
505 .GPIO_Mode = GPIO_Mode_OUT,
506 .GPIO_OType = GPIO_OType_PP,
507 .GPIO_PuPd = GPIO_PuPd_NOPULL
514 #if defined(PIOS_INCLUDE_SBUS)
518 static const struct pios_sbus_cfg pios_usart2_sbus_aux_cfg = {
523 .GPIO_Pin = GPIO_Pin_8,
524 .GPIO_Speed = GPIO_Speed_2MHz,
525 .GPIO_Mode = GPIO_Mode_OUT,
526 .GPIO_OType = GPIO_OType_PP,
527 .GPIO_PuPd = GPIO_PuPd_NOPULL
530 .gpio_inv_enable = Bit_SET,
537 .remap = GPIO_AF_USART1,
540 .NVIC_IRQChannel = USART1_IRQn,
542 .NVIC_IRQChannelSubPriority = 0,
543 .NVIC_IRQChannelCmd = ENABLE,
549 .GPIO_Pin = GPIO_Pin_10,
550 .GPIO_Speed = GPIO_Speed_2MHz,
551 .GPIO_Mode = GPIO_Mode_AF,
552 .GPIO_OType = GPIO_OType_PP,
553 .GPIO_PuPd = GPIO_PuPd_UP
555 .pin_source = GPIO_PinSource10,
560 .GPIO_Pin = GPIO_Pin_9,
561 .GPIO_Speed = GPIO_Speed_2MHz,
562 .GPIO_Mode = GPIO_Mode_AF,
563 .GPIO_OType = GPIO_OType_PP,
564 .GPIO_PuPd = GPIO_PuPd_UP
566 .pin_source = GPIO_PinSource9,
572 .remap = GPIO_AF_USART2,
575 .NVIC_IRQChannel = USART2_IRQn,
577 .NVIC_IRQChannelSubPriority = 0,
578 .NVIC_IRQChannelCmd = ENABLE,
584 .GPIO_Pin = GPIO_Pin_3,
585 .GPIO_Speed = GPIO_Speed_2MHz,
586 .GPIO_Mode = GPIO_Mode_AF,
587 .GPIO_OType = GPIO_OType_PP,
588 .GPIO_PuPd = GPIO_PuPd_UP
590 .pin_source = GPIO_PinSource3,
596 .remap = GPIO_AF_USART3,
599 .NVIC_IRQChannel = USART3_IRQn,
601 .NVIC_IRQChannelSubPriority = 0,
602 .NVIC_IRQChannelCmd = ENABLE,
608 .GPIO_Pin = GPIO_Pin_11,
609 .GPIO_Speed = GPIO_Speed_2MHz,
610 .GPIO_Mode = GPIO_Mode_AF,
611 .GPIO_OType = GPIO_OType_PP,
612 .GPIO_PuPd = GPIO_PuPd_UP
614 .pin_source = GPIO_PinSource11,
619 .GPIO_Pin = GPIO_Pin_10,
620 .GPIO_Speed = GPIO_Speed_2MHz,
621 .GPIO_Mode = GPIO_Mode_AF,
622 .GPIO_OType = GPIO_OType_PP,
623 .GPIO_PuPd = GPIO_PuPd_UP
625 .pin_source = GPIO_PinSource10,
631 .remap = GPIO_AF_UART4,
634 .NVIC_IRQChannel = UART4_IRQn,
636 .NVIC_IRQChannelSubPriority = 0,
637 .NVIC_IRQChannelCmd = ENABLE,
643 .GPIO_Pin = GPIO_Pin_0,
644 .GPIO_Speed = GPIO_Speed_2MHz,
645 .GPIO_Mode = GPIO_Mode_AF,
646 .GPIO_OType = GPIO_OType_PP,
647 .GPIO_PuPd = GPIO_PuPd_UP
649 .pin_source = GPIO_PinSource0,
654 .GPIO_Pin = GPIO_Pin_1,
655 .GPIO_Speed = GPIO_Speed_2MHz,
656 .GPIO_Mode = GPIO_Mode_AF,
657 .GPIO_OType = GPIO_OType_PP,
658 .GPIO_PuPd = GPIO_PuPd_UP
660 .pin_source = GPIO_PinSource1,
666 .remap = GPIO_AF_USART6,
669 .NVIC_IRQChannel = USART6_IRQn,
671 .NVIC_IRQChannelSubPriority = 0,
672 .NVIC_IRQChannelCmd = ENABLE,
678 .GPIO_Pin = GPIO_Pin_7,
679 .GPIO_Speed = GPIO_Speed_2MHz,
680 .GPIO_Mode = GPIO_Mode_AF,
681 .GPIO_OType = GPIO_OType_PP,
682 .GPIO_PuPd = GPIO_PuPd_UP
684 .pin_source = GPIO_PinSource7,
689 .GPIO_Pin = GPIO_Pin_6,
690 .GPIO_Speed = GPIO_Speed_2MHz,
691 .GPIO_Mode = GPIO_Mode_AF,
692 .GPIO_OType = GPIO_OType_PP,
693 .GPIO_PuPd = GPIO_PuPd_UP
695 .pin_source = GPIO_PinSource6,
701 #if defined(PIOS_INCLUDE_COM)
707 #if defined(PIOS_INCLUDE_RTC)
711 #include <pios_rtc_priv.h>
713 void PIOS_RTC_IRQ_Handler (
void);
716 .
clksrc = RCC_RTCCLKSource_HSE_Div8,
720 .NVIC_IRQChannel = RTC_WKUP_IRQn,
722 .NVIC_IRQChannelSubPriority = 0,
723 .NVIC_IRQChannelCmd = ENABLE,
728 void PIOS_RTC_IRQ_Handler (
void)
739 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
740 .TIM_ClockDivision = TIM_CKD_DIV1,
741 .TIM_CounterMode = TIM_CounterMode_Up,
743 .TIM_RepetitionCounter = 0x0000,
748 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
749 .TIM_ClockDivision = TIM_CKD_DIV1,
750 .TIM_CounterMode = TIM_CounterMode_Up,
752 .TIM_RepetitionCounter = 0x0000,
760 .NVIC_IRQChannel = TIM3_IRQn,
762 .NVIC_IRQChannelSubPriority = 0,
763 .NVIC_IRQChannelCmd = ENABLE,
773 .NVIC_IRQChannel = TIM4_IRQn,
775 .NVIC_IRQChannelSubPriority = 0,
776 .NVIC_IRQChannelCmd = ENABLE,
786 .NVIC_IRQChannel = TIM5_IRQn,
788 .NVIC_IRQChannelSubPriority = 0,
789 .NVIC_IRQChannelCmd = ENABLE,
799 .NVIC_IRQChannel = TIM8_TRG_COM_TIM14_IRQn,
801 .NVIC_IRQChannelSubPriority = 0,
802 .NVIC_IRQChannelCmd = ENABLE,
812 .NVIC_IRQChannel = TIM8_UP_TIM13_IRQn,
814 .NVIC_IRQChannelSubPriority = 0,
815 .NVIC_IRQChannelCmd = ENABLE,
842 .timer_chan = TIM_Channel_4,
843 .remap = GPIO_AF_TIM8,
847 .GPIO_Pin = GPIO_Pin_9,
848 .GPIO_Speed = GPIO_Speed_2MHz,
849 .GPIO_Mode = GPIO_Mode_AF,
850 .GPIO_OType = GPIO_OType_PP,
851 .GPIO_PuPd = GPIO_PuPd_UP
853 .pin_source = GPIO_PinSource9,
858 .timer_chan = TIM_Channel_3,
859 .remap = GPIO_AF_TIM8,
863 .GPIO_Pin = GPIO_Pin_8,
864 .GPIO_Speed = GPIO_Speed_2MHz,
865 .GPIO_Mode = GPIO_Mode_AF,
866 .GPIO_OType = GPIO_OType_PP,
867 .GPIO_PuPd = GPIO_PuPd_UP
869 .pin_source = GPIO_PinSource8,
874 .timer_chan = TIM_Channel_1,
875 .remap = GPIO_AF_TIM14,
879 .GPIO_Pin = GPIO_Pin_7,
880 .GPIO_Speed = GPIO_Speed_2MHz,
881 .GPIO_Mode = GPIO_Mode_AF,
882 .GPIO_OType = GPIO_OType_PP,
883 .GPIO_PuPd = GPIO_PuPd_UP
885 .pin_source = GPIO_PinSource7,
890 .timer_chan = TIM_Channel_1,
891 .remap = GPIO_AF_TIM3,
895 .GPIO_Pin = GPIO_Pin_4,
896 .GPIO_Speed = GPIO_Speed_2MHz,
897 .GPIO_Mode = GPIO_Mode_AF,
898 .GPIO_OType = GPIO_OType_PP,
899 .GPIO_PuPd = GPIO_PuPd_UP
901 .pin_source = GPIO_PinSource4,
906 .timer_chan = TIM_Channel_3,
907 .remap = GPIO_AF_TIM3,
911 .GPIO_Pin = GPIO_Pin_0,
912 .GPIO_Speed = GPIO_Speed_2MHz,
913 .GPIO_Mode = GPIO_Mode_AF,
914 .GPIO_OType = GPIO_OType_PP,
915 .GPIO_PuPd = GPIO_PuPd_UP
917 .pin_source = GPIO_PinSource0,
922 .timer_chan = TIM_Channel_4,
923 .remap = GPIO_AF_TIM3,
927 .GPIO_Pin = GPIO_Pin_1,
928 .GPIO_Speed = GPIO_Speed_2MHz,
929 .GPIO_Mode = GPIO_Mode_AF,
930 .GPIO_OType = GPIO_OType_PP,
931 .GPIO_PuPd = GPIO_PuPd_UP
933 .pin_source = GPIO_PinSource1,
938 .timer_chan = TIM_Channel_1,
939 .remap = GPIO_AF_TIM5,
943 .GPIO_Pin = GPIO_Pin_0,
944 .GPIO_Speed = GPIO_Speed_2MHz,
945 .GPIO_Mode = GPIO_Mode_AF,
946 .GPIO_OType = GPIO_OType_PP,
947 .GPIO_PuPd = GPIO_PuPd_UP
949 .pin_source = GPIO_PinSource0,
954 .timer_chan = TIM_Channel_2,
955 .remap = GPIO_AF_TIM5,
959 .GPIO_Pin = GPIO_Pin_1,
960 .GPIO_Speed = GPIO_Speed_2MHz,
961 .GPIO_Mode = GPIO_Mode_AF,
962 .GPIO_OType = GPIO_OType_PP,
963 .GPIO_PuPd = GPIO_PuPd_UP
965 .pin_source = GPIO_PinSource1,
970 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
972 #if defined(PIOS_INCLUDE_DMASHOT)
986 .stream = DMA2_Stream1,
987 .channel = DMA_Channel_7,
988 .tcif = DMA_FLAG_TCIF1,
992 .master_timer = TIM4,
993 .master_config = TIM_DMA_Update | TIM_DMABase_CCR1,
995 .stream = DMA1_Stream6,
996 .channel = DMA_Channel_2,
997 .tcif = DMA_FLAG_TCIF6,
1001 .stream = DMA1_Stream2,
1002 .channel = DMA_Channel_5,
1003 .tcif = DMA_FLAG_TCIF2,
1007 .stream = DMA1_Stream0,
1008 .channel = DMA_Channel_6,
1009 .tcif = DMA_FLAG_TCIF0,
1015 .num_timers =
NELEMENTS(dmashot_tim_cfg)
1028 .TIM_OCMode = TIM_OCMode_PWM1,
1029 .TIM_OutputState = TIM_OutputState_Enable,
1030 .TIM_OutputNState = TIM_OutputNState_Disable,
1032 .TIM_OCPolarity = TIM_OCPolarity_High,
1033 .TIM_OCNPolarity = TIM_OCPolarity_High,
1034 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1035 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1038 .num_channels =
NELEMENTS(pios_tim_servoport_all_pins),
1041 const struct pios_servo_cfg pios_servo_with_uart_cfg = {
1043 .TIM_OCMode = TIM_OCMode_PWM1,
1044 .TIM_OutputState = TIM_OutputState_Enable,
1045 .TIM_OutputNState = TIM_OutputNState_Disable,
1047 .TIM_OCPolarity = TIM_OCPolarity_High,
1048 .TIM_OCNPolarity = TIM_OCPolarity_High,
1049 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1050 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1054 .num_channels =
NELEMENTS(pios_tim_servoport_all_pins) - 2,
1063 .timer_chan = TIM_Channel_4,
1064 .remap = GPIO_AF_TIM5,
1068 .GPIO_Pin = GPIO_Pin_3,
1069 .GPIO_Speed = GPIO_Speed_2MHz,
1070 .GPIO_Mode = GPIO_Mode_AF,
1071 .GPIO_OType = GPIO_OType_PP,
1072 .GPIO_PuPd = GPIO_PuPd_UP
1074 .pin_source = GPIO_PinSource3,
1082 #if defined(PIOS_INCLUDE_PPM)
1087 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1088 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1089 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1090 .TIM_ICFilter = 0x0,
1091 .TIM_Channel = TIM_Channel_2,
1094 .channels = &pios_tim_rcvrport_all_channels[0],
1099 #if defined(PIOS_INCLUDE_RCVR)
1104 #if defined(PIOS_INCLUDE_USB)
1110 .NVIC_IRQChannel = OTG_FS_IRQn,
1112 .NVIC_IRQChannelSubPriority = 0,
1113 .NVIC_IRQChannelCmd = ENABLE,
1116 #ifdef BOOTLOADER_VERSION
1121 .GPIO_Pin = GPIO_Pin_8,
1122 .GPIO_Speed = GPIO_Speed_25MHz,
1123 .GPIO_Mode = GPIO_Mode_IN,
1124 .GPIO_OType = GPIO_OType_OD,
1125 .GPIO_PuPd = GPIO_PuPd_DOWN,
1133 return &pios_usb_main_cfg;
1143 #if defined(PIOS_INCLUDE_COM_MSG)
1149 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
1159 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
1173 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1180 #if defined(PIOS_INCLUDE_ADC)
1184 void PIOS_ADC_DMA_irq_handler(
void);
1190 .flags = (DMA_FLAG_TCIF0 | DMA_FLAG_TEIF0 | DMA_FLAG_HTIF0),
1192 .NVIC_IRQChannel = DMA2_Stream0_IRQn,
1194 .NVIC_IRQChannelSubPriority = 0,
1195 .NVIC_IRQChannelCmd = ENABLE,
1199 .channel = DMA2_Stream0,
1201 .DMA_Channel = DMA_Channel_0,
1202 .DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR
1206 .half_flag = DMA_IT_HTIF0,
1207 .full_flag = DMA_IT_TCIF0,
1209 { GPIOC, GPIO_Pin_0, ADC_Channel_10 }, \
1210 { GPIOC, GPIO_Pin_1, ADC_Channel_11 }, \
1211 { GPIOC, GPIO_Pin_2, ADC_Channel_12 }, \
1212 { GPIOC, GPIO_Pin_3, ADC_Channel_13 }, \
1213 { NULL, 0, ADC_Channel_Vrefint }, \
1214 { NULL, 0, ADC_Channel_TempSensor }, \
1219 void PIOS_ADC_DMA_irq_handler(
void)
1230 .GPIO_Pin = GPIO_Pin_6,
1231 .GPIO_Speed = GPIO_Speed_25MHz,
1232 .GPIO_Mode = GPIO_Mode_AF,
1233 .GPIO_OType = GPIO_OType_PP,
1234 .GPIO_PuPd = GPIO_PuPd_NOPULL
1238 #if defined(PIOS_INCLUDE_VIDEO)
1241 void set_bw_levels(uint8_t black, uint8_t white)
1243 uint16_t black_calc = black + 82;
1245 if (black_calc > 191) {
1249 uint16_t white_calc = white + 82;
1251 if (white_calc > 191) {
1255 TIM12->CCR2 = black_calc;
1256 TIM11->CCR1 = white_calc;
1259 static const struct pios_exti_cfg pios_exti_vsync_cfg __exti_config = {
1261 .line = EXTI_Line12,
1265 .GPIO_Pin = GPIO_Pin_12,
1266 .GPIO_Speed = GPIO_Speed_100MHz,
1267 .GPIO_Mode = GPIO_Mode_IN,
1268 .GPIO_OType = GPIO_OType_OD,
1269 .GPIO_PuPd = GPIO_PuPd_DOWN,
1275 .NVIC_IRQChannel = EXTI15_10_IRQn,
1277 .NVIC_IRQChannelSubPriority = 0,
1278 .NVIC_IRQChannelCmd = ENABLE,
1283 .EXTI_Line = EXTI_Line12,
1284 .EXTI_Mode = EXTI_Mode_Interrupt,
1285 .EXTI_Trigger = EXTI_Trigger_Falling,
1286 .EXTI_LineCmd = ENABLE,
1295 .remap = GPIO_AF_SPI1,
1297 .SPI_Mode = SPI_Mode_Slave,
1298 .SPI_Direction = SPI_Direction_1Line_Tx,
1299 .SPI_DataSize = SPI_DataSize_8b,
1300 .SPI_NSS = SPI_NSS_Soft,
1301 .SPI_FirstBit = SPI_FirstBit_MSB,
1302 .SPI_CRCPolynomial = 7,
1303 .SPI_CPOL = SPI_CPOL_Low,
1304 .SPI_CPHA = SPI_CPHA_2Edge,
1305 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1309 .flags = (DMA_IT_TCIF3),
1311 .NVIC_IRQChannel = DMA2_Stream3_IRQn,
1313 .NVIC_IRQChannelSubPriority = 0,
1314 .NVIC_IRQChannelCmd = ENABLE,
1319 .channel = DMA2_Stream3,
1321 .DMA_Channel = DMA_Channel_3,
1322 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
1323 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1325 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1326 .DMA_MemoryInc = DMA_MemoryInc_Enable,
1327 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1328 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1329 .DMA_Mode = DMA_Mode_Normal,
1330 .DMA_Priority = DMA_Priority_VeryHigh,
1331 .DMA_FIFOMode = DMA_FIFOMode_Enable,
1332 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1333 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1334 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1341 .GPIO_Pin = GPIO_Pin_3,
1342 .GPIO_Speed = GPIO_Speed_25MHz,
1343 .GPIO_Mode = GPIO_Mode_AF,
1344 .GPIO_OType = GPIO_OType_PP,
1345 .GPIO_PuPd = GPIO_PuPd_NOPULL
1351 .GPIO_Pin = GPIO_Pin_6,
1352 .GPIO_Speed = GPIO_Speed_25MHz,
1353 .GPIO_Mode = GPIO_Mode_AF,
1354 .GPIO_OType = GPIO_OType_PP,
1355 .GPIO_PuPd = GPIO_PuPd_NOPULL
1362 .remap = GPIO_AF_SPI2,
1364 .SPI_Mode = SPI_Mode_Slave,
1365 .SPI_Direction = SPI_Direction_1Line_Tx,
1366 .SPI_DataSize = SPI_DataSize_8b,
1367 .SPI_NSS = SPI_NSS_Soft,
1368 .SPI_FirstBit = SPI_FirstBit_MSB,
1369 .SPI_CRCPolynomial = 7,
1370 .SPI_CPOL = SPI_CPOL_Low,
1371 .SPI_CPHA = SPI_CPHA_2Edge,
1372 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1376 .flags = (DMA_IT_TCIF4),
1378 .NVIC_IRQChannel = DMA1_Stream4_IRQn,
1380 .NVIC_IRQChannelSubPriority = 0,
1381 .NVIC_IRQChannelCmd = ENABLE,
1386 .channel = DMA1_Stream4,
1388 .DMA_Channel = DMA_Channel_0,
1389 .DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
1390 .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1392 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1393 .DMA_MemoryInc = DMA_MemoryInc_Enable,
1394 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1395 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1396 .DMA_Mode = DMA_Mode_Normal,
1397 .DMA_Priority = DMA_Priority_VeryHigh,
1398 .DMA_FIFOMode = DMA_FIFOMode_Enable,
1399 .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1400 .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1401 .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1408 .GPIO_Pin = GPIO_Pin_13,
1409 .GPIO_Speed = GPIO_Speed_25MHz,
1410 .GPIO_Mode = GPIO_Mode_AF,
1411 .GPIO_OType = GPIO_OType_PP,
1412 .GPIO_PuPd = GPIO_PuPd_UP
1418 .GPIO_Pin = GPIO_Pin_14,
1419 .GPIO_Speed = GPIO_Speed_25MHz,
1420 .GPIO_Mode = GPIO_Mode_AF,
1421 .GPIO_OType = GPIO_OType_PP,
1422 .GPIO_PuPd = GPIO_PuPd_UP
1426 .vsync = &pios_exti_vsync_cfg,
1430 .timer_chan = TIM_Channel_1,
1434 .GPIO_Pin = GPIO_Pin_15,
1435 .GPIO_Speed = GPIO_Speed_100MHz,
1436 .GPIO_Mode = GPIO_Mode_AF,
1437 .GPIO_OType = GPIO_OType_PP,
1438 .GPIO_PuPd = GPIO_PuPd_UP
1440 .pin_source = GPIO_PinSource15,
1442 .remap = GPIO_AF_TIM2,
1446 .timer_chan = TIM_Channel_1,
1450 .GPIO_Pin = GPIO_Pin_2,
1451 .GPIO_Speed = GPIO_Speed_25MHz,
1452 .GPIO_Mode = GPIO_Mode_AF,
1453 .GPIO_OType = GPIO_OType_PP,
1454 .GPIO_PuPd = GPIO_PuPd_UP
1456 .pin_source = GPIO_PinSource2,
1458 .remap = GPIO_AF_TIM9,
1462 .TIM_OCMode = TIM_OCMode_PWM1,
1463 .TIM_OutputState = TIM_OutputState_Enable,
1464 .TIM_OutputNState = TIM_OutputNState_Disable,
1466 .TIM_OCPolarity = TIM_OCPolarity_High,
1467 .TIM_OCNPolarity = TIM_OCPolarity_High,
1468 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1469 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1480 #if defined(PIOS_INCLUDE_WS2811)
1492 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 12000000) - 1,
1493 .TIM_ClockDivision = TIM_CKD_DIV1,
1494 .TIM_CounterMode = TIM_CounterMode_Up,
1498 .NVIC_IRQChannel = DMA2_Stream6_IRQn,
1500 .NVIC_IRQChannelSubPriority = 0,
1501 .NVIC_IRQChannelCmd = ENABLE,
1503 .bit_clear_dma_tcif = DMA_IT_TCIF6,
1507 .gpio_pin = GPIO_Pin_15,
1508 .bit_set_dma_stream = DMA2_Stream4,
1509 .bit_set_dma_channel = DMA_Channel_6,
1510 .bit_clear_dma_stream = DMA2_Stream6,
1511 .bit_clear_dma_channel = DMA_Channel_0,
1515 #if defined(PIOS_INCLUDE_DAC)
1531 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 600000) - 1,
1532 .TIM_ClockDivision = TIM_CKD_DIV1,
1533 .TIM_CounterMode = TIM_CounterMode_Up,
1537 .NVIC_IRQChannel = DMA1_Stream5_IRQn,
1539 .NVIC_IRQChannelSubPriority = 0,
1540 .NVIC_IRQChannelCmd = ENABLE,
1543 .gpio_pin = GPIO_Pin_4,
1544 .dma_stream = DMA1_Stream5,
1545 .dma_channel = DMA_Channel_7,
1546 .dac_channel = DAC_Channel_1,
1547 .dac_trigger = DAC_Trigger_T6_TRGO,
1548 .dac_outreg = (uintptr_t) (&DAC->DHR12L1),
1549 .dma_tcif = DMA_IT_TCIF5,
const struct pios_dmashot_timer_cfg * timer_cfg
const struct stm32_gpio video_mask_pin
#define DMA1_Stream5_IRQHandler
static const struct pios_tim_clock_cfg tim_14_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.
void(* set_bw_levels)(uint8_t, uint8_t)
#define PIOS_IRQ_PRIO_HIGHEST
Configuration structure for the BMP280 driver.
#define PIOS_SERVOS_INITIAL_POSITION
enum pios_lis3mdl_orientation orientation
Defines the API to set up the HID + CDC USB descriptor config.
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
static const TIM_TimeBaseInitTypeDef tim_3_4_5_14_time_base
static const struct pios_tim_clock_cfg tim_8_cfg
#define PIOS_IRQ_PRIO_MID
static const struct pios_tim_clock_cfg tim_4_cfg
USART private definitions.
#define DMA2_Stream0_IRQHandler
Spektrum/JR DSMx satellite receiver private structures.
#define I2C2_ER_IRQHandler
#define FLASH_SECTOR_64KB
#define PIOS_SERVO_UPDATE_HZ
static const struct pios_tim_channel pios_tim_rcvrport_all_channels[]
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
const struct pios_annunc * annunciators
void PIOS_I2C_EV_IRQ_Handler(pios_i2c_t i2c_id)
static const struct pios_tim_clock_cfg tim_3_cfg
ADC_TypeDef * adc_dev_master
bool PIOS_BMI160_IRQHandler(void)
TIM_OCInitTypeDef tim_oc_init
USB COM HID private definitions.
Servo private structures.
#define FLASH_SECTOR_16KB
NVIC_InitTypeDef interrupt
void PIOS_I2C_ER_IRQ_Handler(pios_i2c_t i2c_id)
static const struct pios_tim_clock_cfg tim_5_cfg
TIM_ICInitTypeDef tim_ic_init
#define DMA2_Stream6_IRQHandler
Defines the API to set up the HID-only USB descriptor config.
static const struct pios_tim_channel pios_tim_servoport_all_pins[]
NVIC_InitTypeDef interrupt
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
const struct pios_flash_driver * driver
const struct pios_flash_partition pios_flash_partition_table[]
const struct pios_exti_cfg * exti_cfg
#define PIOS_IRQ_PRIO_HIGH
USB COM CDC private definitions.
enum pios_flash_partition_labels label
#define PIOS_IRQ_PRIO_LOW
static const TIM_TimeBaseInitTypeDef tim_8_time_base
#define PIOS_Assert(test)
void PIOS_DAC_dma_interrupt_handler(dac_dev_t dev)
Handles a DMA completion interrupt on dma_stream.
#define BMP280_HIGH_RESOLUTION
#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.