33 #include <pios_config.h>
36 #if defined(PIOS_INCLUDE_ANNUNC)
45 .GPIO_Pin = GPIO_Pin_5,
46 .GPIO_Speed = GPIO_Speed_50MHz,
47 .GPIO_Mode = GPIO_Mode_OUT,
48 .GPIO_OType = GPIO_OType_PP,
49 .GPIO_PuPd = GPIO_PuPd_UP
57 .GPIO_Pin = GPIO_Pin_4,
58 .GPIO_Speed = GPIO_Speed_50MHz,
59 .GPIO_Mode = GPIO_Mode_OUT,
60 .GPIO_OType = GPIO_OType_PP,
61 .GPIO_PuPd = GPIO_PuPd_UP
69 .GPIO_Pin = GPIO_Pin_6,
70 .GPIO_Speed = GPIO_Speed_50MHz,
71 .GPIO_Mode = GPIO_Mode_OUT,
72 .GPIO_OType = GPIO_OType_PP,
73 .GPIO_PuPd = GPIO_PuPd_UP
81 .num_annunciators =
NELEMENTS(pios_annuncs),
84 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
86 return &pios_annunc_cfg;
91 #if defined(PIOS_INCLUDE_SPI)
100 .remap = GPIO_AF_SPI1,
102 .SPI_Mode = SPI_Mode_Master,
103 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
104 .SPI_DataSize = SPI_DataSize_8b,
105 .SPI_NSS = SPI_NSS_Soft,
106 .SPI_FirstBit = SPI_FirstBit_MSB,
107 .SPI_CRCPolynomial = 7,
108 .SPI_CPOL = SPI_CPOL_High,
109 .SPI_CPHA = SPI_CPHA_2Edge,
110 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16,
115 .GPIO_Pin = GPIO_Pin_5,
116 .GPIO_Speed = GPIO_Speed_100MHz,
117 .GPIO_Mode = GPIO_Mode_AF,
118 .GPIO_OType = GPIO_OType_PP,
119 .GPIO_PuPd = GPIO_PuPd_UP
125 .GPIO_Pin = GPIO_Pin_6,
126 .GPIO_Speed = GPIO_Speed_50MHz,
127 .GPIO_Mode = GPIO_Mode_AF,
128 .GPIO_OType = GPIO_OType_PP,
129 .GPIO_PuPd = GPIO_PuPd_UP
135 .GPIO_Pin = GPIO_Pin_7,
136 .GPIO_Speed = GPIO_Speed_50MHz,
137 .GPIO_Mode = GPIO_Mode_AF,
138 .GPIO_OType = GPIO_OType_PP,
139 .GPIO_PuPd = GPIO_PuPd_UP
146 .GPIO_Pin = GPIO_Pin_4,
147 .GPIO_Speed = GPIO_Speed_50MHz,
148 .GPIO_Mode = GPIO_Mode_OUT,
149 .GPIO_OType = GPIO_OType_PP,
150 .GPIO_PuPd = GPIO_PuPd_UP
159 static const struct pios_spi_cfg pios_spi_telem_flash_cfg = {
161 .remap = GPIO_AF_SPI3,
163 .SPI_Mode = SPI_Mode_Master,
164 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
165 .SPI_DataSize = SPI_DataSize_8b,
166 .SPI_NSS = SPI_NSS_Soft,
167 .SPI_FirstBit = SPI_FirstBit_MSB,
168 .SPI_CRCPolynomial = 7,
169 .SPI_CPOL = SPI_CPOL_Low,
170 .SPI_CPHA = SPI_CPHA_1Edge,
171 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
176 .GPIO_Pin = GPIO_Pin_10,
177 .GPIO_Speed = GPIO_Speed_100MHz,
178 .GPIO_Mode = GPIO_Mode_AF,
179 .GPIO_OType = GPIO_OType_PP,
180 .GPIO_PuPd = GPIO_PuPd_NOPULL
186 .GPIO_Pin = GPIO_Pin_11,
187 .GPIO_Speed = GPIO_Speed_50MHz,
188 .GPIO_Mode = GPIO_Mode_AF,
189 .GPIO_OType = GPIO_OType_PP,
190 .GPIO_PuPd = GPIO_PuPd_NOPULL
196 .GPIO_Pin = GPIO_Pin_12,
197 .GPIO_Speed = GPIO_Speed_50MHz,
198 .GPIO_Mode = GPIO_Mode_AF,
199 .GPIO_OType = GPIO_OType_PP,
200 .GPIO_PuPd = GPIO_PuPd_NOPULL
208 .GPIO_Pin = GPIO_Pin_15,
209 .GPIO_Speed = GPIO_Speed_50MHz,
210 .GPIO_Mode = GPIO_Mode_OUT,
211 .GPIO_OType = GPIO_OType_PP,
212 .GPIO_PuPd = GPIO_PuPd_UP
217 .GPIO_Pin = GPIO_Pin_3,
218 .GPIO_Speed = GPIO_Speed_50MHz,
219 .GPIO_Mode = GPIO_Mode_OUT,
220 .GPIO_OType = GPIO_OType_PP,
221 .GPIO_PuPd = GPIO_PuPd_UP
228 #if defined(PIOS_INCLUDE_OPENLRS)
232 pios_openlrs_t openlrs_handle;
234 static bool openlrs_int(
void) {
235 return PIOS_OpenLRS_EXT_Int(openlrs_handle);
239 .vector = openlrs_int,
244 .GPIO_Pin = GPIO_Pin_7,
245 .GPIO_Speed = GPIO_Speed_100MHz,
246 .GPIO_Mode = GPIO_Mode_IN,
247 .GPIO_OType = GPIO_OType_OD,
248 .GPIO_PuPd = GPIO_PuPd_NOPULL,
253 .NVIC_IRQChannel = EXTI9_5_IRQn,
255 .NVIC_IRQChannelSubPriority = 0,
256 .NVIC_IRQChannelCmd = ENABLE,
261 .EXTI_Line = EXTI_Line7,
262 .EXTI_Mode = EXTI_Mode_Interrupt,
263 .EXTI_Trigger = EXTI_Trigger_Falling,
264 .EXTI_LineCmd = ENABLE,
269 static const struct pios_exti_cfg pios_exti_openlrs_pbd2_cfg __exti_config = {
275 .GPIO_Pin = GPIO_Pin_2,
276 .GPIO_Speed = GPIO_Speed_100MHz,
277 .GPIO_Mode = GPIO_Mode_IN,
278 .GPIO_OType = GPIO_OType_OD,
279 .GPIO_PuPd = GPIO_PuPd_NOPULL,
284 .NVIC_IRQChannel = EXTI2_IRQn,
286 .NVIC_IRQChannelSubPriority = 0,
287 .NVIC_IRQChannelCmd = ENABLE,
292 .EXTI_Line = EXTI_Line2,
293 .EXTI_Mode = EXTI_Mode_Interrupt,
294 .EXTI_Trigger = EXTI_Trigger_Falling,
295 .EXTI_LineCmd = ENABLE,
300 const struct pios_openlrs_cfg pios_openlrs_pb7_cfg = {
301 .spi_cfg = &pios_spi_telem_flash_cfg,
302 .exti_cfg = &pios_exti_openlrs_pb7_cfg,
303 .gpio_direction = GPIO0_TX_GPIO1_RX,
306 const struct pios_openlrs_cfg pios_openlrs_pd2_cfg = {
307 .spi_cfg = &pios_spi_telem_flash_cfg,
308 .exti_cfg = &pios_exti_openlrs_pbd2_cfg,
309 .gpio_direction = GPIO0_TX_GPIO1_RX,
312 const struct pios_openlrs_cfg * PIOS_BOARD_HW_DEFS_GetOpenLRSCfg (uint32_t
board_revision)
314 switch(board_revision) {
316 return &pios_openlrs_pd2_cfg;
318 return &pios_openlrs_pd2_cfg;
320 return &pios_openlrs_pb7_cfg;
330 #if defined(PIOS_INCLUDE_FLASH)
335 .arena_size = 0x00004000,
336 .slot_size = 0x00000100,
341 .arena_size = 0x00010000,
342 .slot_size = 0x00000100,
345 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
350 .expect_memorytype = 0x20,
351 .expect_capacity = 0x15,
352 .sector_erase = 0xD8,
356 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
365 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
385 uintptr_t pios_internal_flash_id;
388 .chip_id = &pios_internal_flash_id,
390 .sector_blocks = stm32f4_sectors,
391 .num_blocks =
NELEMENTS(stm32f4_sectors),
395 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
404 uintptr_t pios_external_flash_id;
407 .chip_id = &pios_external_flash_id,
409 .sector_blocks = m25p16_sectors,
415 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
418 .chip_desc = &pios_flash_chip_internal,
427 .chip_desc = &pios_flash_chip_internal,
437 .chip_desc = &pios_flash_chip_internal,
446 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
449 .chip_desc = &pios_flash_chip_external,
458 .chip_desc = &pios_flash_chip_external,
467 .chip_desc = &pios_flash_chip_external,
477 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
480 .chip_desc = &pios_flash_chip_internal,
489 .chip_desc = &pios_flash_chip_internal,
498 .chip_desc = &pios_flash_chip_internal,
506 .chip_desc = &pios_flash_chip_internal,
519 const struct pios_flash_partition * PIOS_BOARD_HW_DEFS_GetPartitionTable (uint32_t board_revision, uint32_t * num_partitions)
523 switch(board_revision) {
525 *num_partitions =
NELEMENTS(pios_flash_partition_table_external);
526 return pios_flash_partition_table_external;
528 *num_partitions =
NELEMENTS(pios_flash_partition_table_internal);
529 return pios_flash_partition_table_internal;
531 *num_partitions =
NELEMENTS(pios_flash_partition_table_internal);
532 return pios_flash_partition_table_internal;
539 const struct flashfs_logfs_cfg * get_flashfs_settings_cfg(uint32_t board_revision)
541 switch(board_revision) {
543 return &flashfs_settings_external_cfg;
545 return &flashfs_settings_internal_cfg;
547 return &flashfs_settings_internal_cfg;
554 bool get_external_flash(uint32_t board_revision)
556 switch(board_revision) {
577 .remap = GPIO_AF_USART1,
580 .NVIC_IRQChannel = USART1_IRQn,
582 .NVIC_IRQChannelSubPriority = 0,
583 .NVIC_IRQChannelCmd = ENABLE,
589 .GPIO_Pin = GPIO_Pin_10,
590 .GPIO_Speed = GPIO_Speed_2MHz,
591 .GPIO_Mode = GPIO_Mode_AF,
592 .GPIO_OType = GPIO_OType_PP,
593 .GPIO_PuPd = GPIO_PuPd_UP
599 .GPIO_Pin = GPIO_Pin_9,
600 .GPIO_Speed = GPIO_Speed_2MHz,
601 .GPIO_Mode = GPIO_Mode_AF,
602 .GPIO_OType = GPIO_OType_PP,
603 .GPIO_PuPd = GPIO_PuPd_UP
610 .remap = GPIO_AF_USART6,
613 .NVIC_IRQChannel = USART6_IRQn,
615 .NVIC_IRQChannelSubPriority = 0,
616 .NVIC_IRQChannelCmd = ENABLE,
622 .GPIO_Pin = GPIO_Pin_7,
623 .GPIO_Speed = GPIO_Speed_2MHz,
624 .GPIO_Mode = GPIO_Mode_AF,
625 .GPIO_OType = GPIO_OType_PP,
626 .GPIO_PuPd = GPIO_PuPd_UP
633 .remap = GPIO_AF_UART5,
636 .NVIC_IRQChannel = UART5_IRQn,
638 .NVIC_IRQChannelSubPriority = 0,
639 .NVIC_IRQChannelCmd = ENABLE,
645 .GPIO_Pin = GPIO_Pin_2,
646 .GPIO_Speed = GPIO_Speed_2MHz,
647 .GPIO_Mode = GPIO_Mode_AF,
648 .GPIO_OType = GPIO_OType_PP,
649 .GPIO_PuPd = GPIO_PuPd_UP
657 switch(board_revision) {
670 #if defined(PIOS_INCLUDE_SBUS)
679 .GPIO_Pin = GPIO_Pin_6,
680 .GPIO_Speed = GPIO_Speed_2MHz,
681 .GPIO_Mode = GPIO_Mode_OUT,
682 .GPIO_OType = GPIO_OType_PP,
683 .GPIO_PuPd = GPIO_PuPd_UP
686 .gpio_inv_enable = Bit_SET,
687 .gpio_inv_disable = Bit_RESET,
690 const struct pios_sbus_cfg *
get_sbus_cfg(uint32_t board_revision)
692 switch(board_revision) {
694 return &pios_sbus_cfg;
696 return &pios_sbus_cfg;
711 .remap = GPIO_AF_USART3,
714 .NVIC_IRQChannel = USART3_IRQn,
716 .NVIC_IRQChannelSubPriority = 0,
717 .NVIC_IRQChannelCmd = ENABLE,
723 .GPIO_Pin = GPIO_Pin_11,
724 .GPIO_Speed = GPIO_Speed_2MHz,
725 .GPIO_Mode = GPIO_Mode_AF,
726 .GPIO_OType = GPIO_OType_PP,
727 .GPIO_PuPd = GPIO_PuPd_UP
733 .GPIO_Pin = GPIO_Pin_10,
734 .GPIO_Speed = GPIO_Speed_2MHz,
735 .GPIO_Mode = GPIO_Mode_AF,
736 .GPIO_OType = GPIO_OType_PP,
737 .GPIO_PuPd = GPIO_PuPd_UP
742 #if defined(PIOS_INCLUDE_DSM)
752 .GPIO_Pin = GPIO_Pin_10,
753 .GPIO_Speed = GPIO_Speed_2MHz,
754 .GPIO_Mode = GPIO_Mode_OUT,
755 .GPIO_OType = GPIO_OType_PP,
756 .GPIO_PuPd = GPIO_PuPd_NOPULL
765 .GPIO_Pin = GPIO_Pin_11,
766 .GPIO_Speed = GPIO_Speed_2MHz,
767 .GPIO_Mode = GPIO_Mode_OUT,
768 .GPIO_OType = GPIO_OType_PP,
769 .GPIO_PuPd = GPIO_PuPd_NOPULL
781 .GPIO_Pin = GPIO_Pin_7,
782 .GPIO_Speed = GPIO_Speed_2MHz,
783 .GPIO_Mode = GPIO_Mode_IN,
784 .GPIO_OType = GPIO_OType_PP,
785 .GPIO_PuPd = GPIO_PuPd_NOPULL
791 #if defined(PIOS_INCLUDE_COM)
797 #if defined(PIOS_INCLUDE_I2C)
799 #include <pios_i2c_priv.h>
804 void PIOS_I2C_mag_pressure_adapter_ev_irq_handler(
void);
805 void PIOS_I2C_mag_pressureadapter_er_irq_handler(
void);
807 __attribute__ ((alias("PIOS_I2C_mag_pressure_adapter_ev_irq_handler")));
809 __attribute__ ((alias("PIOS_I2C_mag_pressure_adapter_er_irq_handler")));
813 .remap = GPIO_AF_I2C1,
815 .I2C_Mode = I2C_Mode_I2C,
816 .I2C_OwnAddress1 = 0,
817 .I2C_Ack = I2C_Ack_Enable,
818 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
819 .I2C_DutyCycle = I2C_DutyCycle_2,
820 .I2C_ClockSpeed = 400000,
822 .transfer_timeout_ms = 50,
826 .GPIO_Pin = GPIO_Pin_8,
827 .GPIO_Mode = GPIO_Mode_AF,
828 .GPIO_Speed = GPIO_Speed_50MHz,
829 .GPIO_OType = GPIO_OType_OD,
830 .GPIO_PuPd = GPIO_PuPd_NOPULL,
836 .GPIO_Pin = GPIO_Pin_9,
837 .GPIO_Mode = GPIO_Mode_AF,
838 .GPIO_Speed = GPIO_Speed_50MHz,
839 .GPIO_OType = GPIO_OType_OD,
840 .GPIO_PuPd = GPIO_PuPd_NOPULL,
846 .NVIC_IRQChannel = I2C1_EV_IRQn,
848 .NVIC_IRQChannelSubPriority = 0,
849 .NVIC_IRQChannelCmd = ENABLE,
855 .NVIC_IRQChannel = I2C1_ER_IRQn,
857 .NVIC_IRQChannelSubPriority = 0,
858 .NVIC_IRQChannelCmd = ENABLE,
864 void PIOS_I2C_mag_pressure_adapter_ev_irq_handler(
void)
870 void PIOS_I2C_mag_pressure_adapter_er_irq_handler(
void)
877 void PIOS_I2C_flexiport_adapter_ev_irq_handler(
void);
878 void PIOS_I2C_flexiport_adapter_er_irq_handler(
void);
884 .remap = GPIO_AF_I2C2,
886 .I2C_Mode = I2C_Mode_I2C,
887 .I2C_OwnAddress1 = 0,
888 .I2C_Ack = I2C_Ack_Enable,
889 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
890 .I2C_DutyCycle = I2C_DutyCycle_2,
891 .I2C_ClockSpeed = 400000,
893 .transfer_timeout_ms = 50,
897 .GPIO_Pin = GPIO_Pin_10,
898 .GPIO_Mode = GPIO_Mode_AF,
899 .GPIO_Speed = GPIO_Speed_50MHz,
900 .GPIO_OType = GPIO_OType_OD,
901 .GPIO_PuPd = GPIO_PuPd_NOPULL,
907 .GPIO_Pin = GPIO_Pin_11,
908 .GPIO_Mode = GPIO_Mode_AF,
909 .GPIO_Speed = GPIO_Speed_50MHz,
910 .GPIO_OType = GPIO_OType_OD,
911 .GPIO_PuPd = GPIO_PuPd_NOPULL,
917 .NVIC_IRQChannel = I2C2_EV_IRQn,
919 .NVIC_IRQChannelSubPriority = 0,
920 .NVIC_IRQChannelCmd = ENABLE,
926 .NVIC_IRQChannel = I2C2_ER_IRQn,
928 .NVIC_IRQChannelSubPriority = 0,
929 .NVIC_IRQChannelCmd = ENABLE,
935 void PIOS_I2C_flexiport_adapter_ev_irq_handler(
void)
941 void PIOS_I2C_flexiport_adapter_er_irq_handler(
void)
948 void PIOS_I2C_pressure_adapter_ev_irq_handler(
void);
949 void PIOS_I2C_pressure_adapter_er_irq_handler(
void);
953 #if defined(PIOS_INCLUDE_RTC)
957 #include <pios_rtc_priv.h>
959 void PIOS_RTC_IRQ_Handler (
void);
962 .
clksrc = RCC_RTCCLKSource_HSE_Div8,
967 .NVIC_IRQChannel = RTC_WKUP_IRQn,
969 .NVIC_IRQChannelSubPriority = 0,
970 .NVIC_IRQChannelCmd = ENABLE,
975 void PIOS_RTC_IRQ_Handler (
void)
987 .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
988 .TIM_ClockDivision = TIM_CKD_DIV1,
989 .TIM_CounterMode = TIM_CounterMode_Up,
990 .TIM_Period = 0xFFFF,
991 .TIM_RepetitionCounter = 0x0000,
998 .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
999 .TIM_ClockDivision = TIM_CKD_DIV1,
1000 .TIM_CounterMode = TIM_CounterMode_Up,
1001 .TIM_Period = 0xFFFF,
1002 .TIM_RepetitionCounter = 0x0000,
1011 .NVIC_IRQChannel = TIM3_IRQn,
1013 .NVIC_IRQChannelSubPriority = 0,
1014 .NVIC_IRQChannelCmd = ENABLE,
1024 .NVIC_IRQChannel = TIM5_IRQn,
1026 .NVIC_IRQChannelSubPriority = 0,
1027 .NVIC_IRQChannelCmd = ENABLE,
1037 .NVIC_IRQChannel = TIM8_CC_IRQn,
1039 .NVIC_IRQChannelSubPriority = 0,
1040 .NVIC_IRQChannelCmd = ENABLE,
1050 .NVIC_IRQChannel = TIM1_BRK_TIM9_IRQn,
1052 .NVIC_IRQChannelSubPriority = 0,
1053 .NVIC_IRQChannelCmd = ENABLE,
1063 .NVIC_IRQChannel = TIM8_BRK_TIM12_IRQn,
1065 .NVIC_IRQChannelSubPriority = 0,
1066 .NVIC_IRQChannelCmd = ENABLE,
1080 .timer_chan = TIM_Channel_3,
1084 .GPIO_Pin = GPIO_Pin_0,
1085 .GPIO_Speed = GPIO_Speed_2MHz,
1086 .GPIO_Mode = GPIO_Mode_AF,
1087 .GPIO_OType = GPIO_OType_PP,
1088 .GPIO_PuPd = GPIO_PuPd_DOWN
1090 .pin_source = GPIO_PinSource0,
1092 .remap = GPIO_AF_TIM3,
1096 .timer_chan = TIM_Channel_4,
1100 .GPIO_Pin = GPIO_Pin_1,
1101 .GPIO_Speed = GPIO_Speed_2MHz,
1102 .GPIO_Mode = GPIO_Mode_AF,
1103 .GPIO_OType = GPIO_OType_PP,
1104 .GPIO_PuPd = GPIO_PuPd_DOWN
1106 .pin_source = GPIO_PinSource1,
1108 .remap = GPIO_AF_TIM3,
1112 .timer_chan = TIM_Channel_2,
1116 .GPIO_Pin = GPIO_Pin_3,
1117 .GPIO_Speed = GPIO_Speed_2MHz,
1118 .GPIO_Mode = GPIO_Mode_AF,
1119 .GPIO_OType = GPIO_OType_PP,
1120 .GPIO_PuPd = GPIO_PuPd_DOWN
1122 .pin_source = GPIO_PinSource3,
1124 .remap = GPIO_AF_TIM9,
1128 .timer_chan = TIM_Channel_1,
1132 .GPIO_Pin = GPIO_Pin_2,
1133 .GPIO_Speed = GPIO_Speed_2MHz,
1134 .GPIO_Mode = GPIO_Mode_AF,
1135 .GPIO_OType = GPIO_OType_PP,
1136 .GPIO_PuPd = GPIO_PuPd_DOWN
1138 .pin_source = GPIO_PinSource2,
1140 .remap = GPIO_AF_TIM9,
1144 .timer_chan = TIM_Channel_2,
1148 .GPIO_Pin = GPIO_Pin_1,
1149 .GPIO_Speed = GPIO_Speed_2MHz,
1150 .GPIO_Mode = GPIO_Mode_AF,
1151 .GPIO_OType = GPIO_OType_PP,
1152 .GPIO_PuPd = GPIO_PuPd_DOWN
1154 .pin_source = GPIO_PinSource1,
1156 .remap = GPIO_AF_TIM5,
1160 .timer_chan = TIM_Channel_1,
1164 .GPIO_Pin = GPIO_Pin_0,
1165 .GPIO_Speed = GPIO_Speed_2MHz,
1166 .GPIO_Mode = GPIO_Mode_AF,
1167 .GPIO_OType = GPIO_OType_PP,
1168 .GPIO_PuPd = GPIO_PuPd_DOWN
1170 .pin_source = GPIO_PinSource0,
1172 .remap = GPIO_AF_TIM5,
1178 .timer_chan = TIM_Channel_4,
1182 .GPIO_Pin = GPIO_Pin_9,
1183 .GPIO_Speed = GPIO_Speed_2MHz,
1184 .GPIO_Mode = GPIO_Mode_AF,
1185 .GPIO_OType = GPIO_OType_PP,
1186 .GPIO_PuPd = GPIO_PuPd_DOWN
1188 .pin_source = GPIO_PinSource9,
1190 .remap = GPIO_AF_TIM8,
1194 .timer_chan = TIM_Channel_3,
1198 .GPIO_Pin = GPIO_Pin_8,
1199 .GPIO_Speed = GPIO_Speed_2MHz,
1200 .GPIO_Mode = GPIO_Mode_AF,
1201 .GPIO_OType = GPIO_OType_PP,
1202 .GPIO_PuPd = GPIO_PuPd_DOWN
1204 .pin_source = GPIO_PinSource8,
1206 .remap = GPIO_AF_TIM8,
1210 .timer_chan = TIM_Channel_2,
1214 .GPIO_Pin = GPIO_Pin_15,
1215 .GPIO_Speed = GPIO_Speed_2MHz,
1216 .GPIO_Mode = GPIO_Mode_AF,
1217 .GPIO_OType = GPIO_OType_PP,
1218 .GPIO_PuPd = GPIO_PuPd_DOWN
1220 .pin_source = GPIO_PinSource15,
1222 .remap = GPIO_AF_TIM12,
1226 .timer_chan = TIM_Channel_1,
1230 .GPIO_Pin = GPIO_Pin_14,
1231 .GPIO_Speed = GPIO_Speed_2MHz,
1232 .GPIO_Mode = GPIO_Mode_AF,
1233 .GPIO_OType = GPIO_OType_PP,
1234 .GPIO_PuPd = GPIO_PuPd_DOWN
1236 .pin_source = GPIO_PinSource14,
1238 .remap = GPIO_AF_TIM12,
1246 .TIM_OCMode = TIM_OCMode_PWM1,
1247 .TIM_OutputState = TIM_OutputState_Enable,
1248 .TIM_OutputNState = TIM_OutputNState_Disable,
1250 .TIM_OCPolarity = TIM_OCPolarity_High,
1251 .TIM_OCNPolarity = TIM_OCPolarity_High,
1252 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1253 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1256 .num_channels =
NELEMENTS(pios_tim_servoport_all_pins),
1262 .TIM_OCMode = TIM_OCMode_PWM1,
1263 .TIM_OutputState = TIM_OutputState_Enable,
1264 .TIM_OutputNState = TIM_OutputNState_Disable,
1266 .TIM_OCPolarity = TIM_OCPolarity_High,
1267 .TIM_OCNPolarity = TIM_OCPolarity_High,
1268 .TIM_OCIdleState = TIM_OCIdleState_Reset,
1269 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1272 .num_channels =
NELEMENTS(pios_tim_servoport_all_pins)-2,
1277 switch(board_revision) {
1289 #if defined(PIOS_INCLUDE_PPM)
1296 .timer_chan = TIM_Channel_2,
1300 .GPIO_Pin = GPIO_Pin_7,
1301 .GPIO_Speed = GPIO_Speed_2MHz,
1302 .GPIO_Mode = GPIO_Mode_AF,
1303 .GPIO_OType = GPIO_OType_PP,
1304 .GPIO_PuPd = GPIO_PuPd_UP
1306 .pin_source = GPIO_PinSource7,
1308 .remap = GPIO_AF_TIM8,
1314 .TIM_ICPolarity = TIM_ICPolarity_Rising,
1315 .TIM_ICSelection = TIM_ICSelection_DirectTI,
1316 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1317 .TIM_ICFilter = 0x0,
1318 .TIM_Channel = TIM_Channel_2,
1321 .channels = &pios_tim_rcvrport,
1327 #if defined(PIOS_INCLUDE_RCVR)
1331 #if defined(PIOS_INCLUDE_USB)
1337 .NVIC_IRQChannel = OTG_FS_IRQn,
1339 .NVIC_IRQChannelSubPriority = 3,
1340 .NVIC_IRQChannelCmd = ENABLE,
1346 .GPIO_Pin = GPIO_Pin_8,
1347 .GPIO_Speed = GPIO_Speed_25MHz,
1348 .GPIO_Mode = GPIO_Mode_IN,
1349 .GPIO_OType = GPIO_OType_OD,
1354 const struct pios_usb_cfg * PIOS_BOARD_HW_DEFS_GetUsbCfg (uint32_t board_revision)
1356 return &pios_usb_main_cfg;
1366 #if defined(PIOS_INCLUDE_COM_MSG)
1372 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
1382 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
1396 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1403 #if defined(PIOS_INCLUDE_ADC)
1407 static void PIOS_ADC_DMA_irq_handler(
void);
1413 .flags = (DMA_FLAG_TCIF4 | DMA_FLAG_TEIF4 | DMA_FLAG_HTIF4),
1415 .NVIC_IRQChannel = DMA2_Stream4_IRQn,
1417 .NVIC_IRQChannelSubPriority = 0,
1418 .NVIC_IRQChannelCmd = ENABLE,
1422 .channel = DMA2_Stream4,
1424 .DMA_Channel = DMA_Channel_0,
1425 .DMA_PeripheralBaseAddr = (uint32_t) & ADC1->DR
1429 .half_flag = DMA_IT_HTIF4,
1430 .full_flag = DMA_IT_TCIF4,
1432 {GPIOC, GPIO_Pin_2, ADC_Channel_12}, \
1433 {GPIOC, GPIO_Pin_3, ADC_Channel_13}, \
1434 {GPIOA, GPIO_Pin_4, ADC_Channel_4}, \
1435 {NULL, 0, ADC_Channel_Vrefint}, \
1436 {NULL, 0, ADC_Channel_TempSensor} \
1441 static void PIOS_ADC_DMA_irq_handler(
void)
1449 #if defined(PIOS_INCLUDE_CAN)
1456 .CAN_Prescaler = 21-1,
1458 .CAN_Mode = CAN_Mode_Normal,
1460 .CAN_SJW = CAN_SJW_1tq,
1464 .CAN_BS1 = CAN_BS1_9tq,
1467 .CAN_BS2 = CAN_BS2_8tq,
1469 .CAN_TTCM = DISABLE,
1471 .CAN_ABOM = DISABLE,
1473 .CAN_AWUM = DISABLE,
1477 .CAN_RFLM = DISABLE,
1479 .CAN_TXFP = DISABLE,
1482 .remap = GPIO_AF_CAN2,
1486 .GPIO_Pin = GPIO_Pin_13,
1487 .GPIO_Speed = GPIO_Speed_50MHz,
1488 .GPIO_Mode = GPIO_Mode_AF,
1489 .GPIO_OType = GPIO_OType_PP,
1490 .GPIO_PuPd = GPIO_PuPd_UP
1492 .pin_source = GPIO_PinSource13,
1497 .GPIO_Pin = GPIO_Pin_12,
1498 .GPIO_Speed = GPIO_Speed_50MHz,
1499 .GPIO_Mode = GPIO_Mode_AF,
1500 .GPIO_OType = GPIO_OType_PP,
1501 .GPIO_PuPd = GPIO_PuPd_UP
1503 .pin_source = GPIO_PinSource12,
1507 .NVIC_IRQChannel = CAN2_RX1_IRQn,
1509 .NVIC_IRQChannelSubPriority = 0,
1510 .NVIC_IRQChannelCmd = ENABLE,
1515 .NVIC_IRQChannel = CAN2_TX_IRQn,
1517 .NVIC_IRQChannelSubPriority = 0,
1518 .NVIC_IRQChannelCmd = ENABLE,
1524 bool get_use_can(uint32_t board_revision)
1526 switch(board_revision) {
1543 #if defined(PIOS_INCLUDE_MS5611)
1547 .temperature_interleaving = 1,
1554 #if defined(PIOS_INCLUDE_MPU)
1556 static const struct pios_exti_cfg pios_exti_mpu_cfg __exti_config = {
1562 .GPIO_Pin = GPIO_Pin_5,
1563 .GPIO_Speed = GPIO_Speed_100MHz,
1564 .GPIO_Mode = GPIO_Mode_IN,
1565 .GPIO_OType = GPIO_OType_OD,
1566 .GPIO_PuPd = GPIO_PuPd_NOPULL,
1571 .NVIC_IRQChannel = EXTI9_5_IRQn,
1573 .NVIC_IRQChannelSubPriority = 0,
1574 .NVIC_IRQChannelCmd = ENABLE,
1579 .EXTI_Line = EXTI_Line5,
1580 .EXTI_Mode = EXTI_Mode_Interrupt,
1581 .EXTI_Trigger = EXTI_Trigger_Rising,
1582 .EXTI_LineCmd = ENABLE,
1589 .default_samplerate = 1000,
1591 .use_internal_mag =
true,
1598 #if defined(PIOS_INCLUDE_HMC5883)
static const struct pios_usart_cfg pios_usart_rcvr_pd2_cfg
uint8_t expect_manufacturer
const struct pios_exti_cfg * exti_cfg
#define DMA2_Stream4_IRQHandler
#define PIOS_HMC5883_ODR_75
static const struct pios_usart_cfg pios_usart_rcvr_pc7_cfg
const struct pios_flash_driver pios_jedec_flash_driver
#define I2C2_EV_IRQHandler
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
const struct pios_servo_cfg pios_servo_8_cfg
Brushed Sparky skips last two output ports.
static const struct pios_tim_clock_cfg tim_8_cfg
static const struct pios_usart_cfg pios_usart_main_cfg
static const struct pios_tim_channel pios_tim_servoport_all_pins[]
#define PIOS_IRQ_PRIO_HIGHEST
PiOS CAN interface header.
#define PIOS_SERVOS_INITIAL_POSITION
#define BRUSHEDSPARKY_V0_1
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.
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.
static const struct pios_tim_clock_cfg tim_3_cfg
static const struct pios_tim_clock_cfg tim_12_cfg
struct pios_i2c_adapter * pios_i2c_t
static const struct pios_tim_clock_cfg tim_5_cfg
const struct pios_annunc * annunciators
const struct pios_usart_cfg * get_usart_rcvr_cfg(uint32_t board_revision)
Get the rcvr uart configuration.
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
#define JEDEC_MANUFACTURER_ST
const struct pios_sbus_cfg * get_sbus_cfg(enum board_revision board_rev)
Servo private structures.
#define FLASH_SECTOR_16KB
const struct pios_servo_cfg pios_servo_cfg
Sparky2 has all 10 outputs.
static const struct pios_usart_cfg pios_usart_flexi_cfg
#define BRUSHEDSPARKY_V0_2
void PIOS_I2C_ER_IRQ_Handler(pios_i2c_t i2c_id)
TIM_ICInitTypeDef tim_ic_init
Defines the API to set up the HID-only USB descriptor config.
#define PIOS_HMC5883_MODE_SINGLE
#define PIOS_HMC5883_MEASCONF_NORMAL
void PIOS_RTC_irq_handler(void)
Futaba S.Bus Private structures.
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_clock_cfg tim_9_cfg
#define PIOS_IRQ_PRIO_HIGH
USB COM CDC private definitions.
const struct pios_servo_cfg * get_servo_cfg(uint32_t board_revision)
Get the flashfs settings.
enum pios_flash_partition_labels label
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
#define FLASH_SECTOR_128KB
static const TIM_TimeBaseInitTypeDef tim_apb1_time_base
Implements an OpenLRS driver for the RFM22B.
const struct pios_flash_driver pios_internal_flash_driver
USART private definitions.
static const TIM_TimeBaseInitTypeDef tim_apb2_time_base
#define PIOS_LED_HEARTBEAT
Defines the API to the board-specific USB data setup code.