36 #include <pios_config.h>
39 #if defined(PIOS_INCLUDE_ANNUNC)
47 .GPIO_Pin = GPIO_Pin_13,
48 .GPIO_Speed = GPIO_Speed_50MHz,
49 .GPIO_Mode = GPIO_Mode_OUT,
50 .GPIO_OType = GPIO_OType_PP,
51 .GPIO_PuPd = GPIO_PuPd_NOPULL
60 .GPIO_Pin = GPIO_Pin_14,
61 .GPIO_Speed = GPIO_Speed_50MHz,
62 .GPIO_Mode = GPIO_Mode_OUT,
63 .GPIO_OType = GPIO_OType_PP,
64 .GPIO_PuPd = GPIO_PuPd_NOPULL
73 .GPIO_Pin = GPIO_Pin_15,
74 .GPIO_Speed = GPIO_Speed_50MHz,
75 .GPIO_Mode = GPIO_Mode_OUT,
76 .GPIO_OType = GPIO_OType_PP,
77 .GPIO_PuPd = GPIO_PuPd_NOPULL
87 .GPIO_Pin = GPIO_Pin_2,
88 .GPIO_Speed = GPIO_Speed_50MHz,
89 .GPIO_Mode = GPIO_Mode_OUT,
90 .GPIO_OType = GPIO_OType_PP,
91 .GPIO_PuPd = GPIO_PuPd_NOPULL
100 .num_annunciators =
NELEMENTS(pios_annuncs),
103 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
105 return &pios_annunc_cfg;
110 #if defined(PIOS_INCLUDE_SPI)
120 .SPI_Mode = SPI_Mode_Master,
121 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
122 .SPI_DataSize = SPI_DataSize_8b,
123 .SPI_NSS = SPI_NSS_Soft,
124 .SPI_FirstBit = SPI_FirstBit_MSB,
125 .SPI_CRCPolynomial = 7,
126 .SPI_CPOL = SPI_CPOL_Low,
127 .SPI_CPHA = SPI_CPHA_1Edge,
128 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
133 .GPIO_Pin = GPIO_Pin_3,
134 .GPIO_Speed = GPIO_Speed_50MHz,
135 .GPIO_Mode = GPIO_Mode_AF,
136 .GPIO_OType = GPIO_OType_PP,
137 .GPIO_PuPd = GPIO_PuPd_NOPULL
139 .pin_source = GPIO_PinSource3,
144 .GPIO_Pin = GPIO_Pin_4,
145 .GPIO_Speed = GPIO_Speed_50MHz,
146 .GPIO_Mode = GPIO_Mode_AF,
147 .GPIO_OType = GPIO_OType_PP,
148 .GPIO_PuPd = GPIO_PuPd_NOPULL
150 .pin_source = GPIO_PinSource4,
155 .GPIO_Pin = GPIO_Pin_5,
156 .GPIO_Speed = GPIO_Speed_50MHz,
157 .GPIO_Mode = GPIO_Mode_AF,
158 .GPIO_OType = GPIO_OType_PP,
159 .GPIO_PuPd = GPIO_PuPd_NOPULL
161 .pin_source = GPIO_PinSource5,
167 .GPIO_Pin = GPIO_Pin_14,
168 .GPIO_Speed = GPIO_Speed_50MHz,
169 .GPIO_Mode = GPIO_Mode_OUT,
170 .GPIO_OType = GPIO_OType_PP,
171 .GPIO_PuPd = GPIO_PuPd_UP
177 #if defined(PIOS_INCLUDE_FLASH)
182 .arena_size = 0x00002000,
183 .slot_size = 0x00000100,
201 uintptr_t pios_internal_flash_id;
204 .chip_id = &pios_internal_flash_id,
206 .sector_blocks = stm32f3_sectors,
207 .num_blocks =
NELEMENTS(stm32f3_sectors),
213 .chip_desc = &pios_flash_chip_internal,
222 .chip_desc = &pios_flash_chip_internal,
231 .chip_desc = &pios_flash_chip_internal,
240 .chip_desc = &pios_flash_chip_internal,
252 *num_partitions =
NELEMENTS(pios_flash_partition_table);
260 #if defined(PIOS_INCLUDE_USART)
264 #if defined(PIOS_INCLUDE_DSM)
274 .GPIO_Pin = GPIO_Pin_7,
275 .GPIO_Speed = GPIO_Speed_2MHz,
276 .GPIO_Mode = GPIO_Mode_OUT,
277 .GPIO_OType = GPIO_OType_PP,
278 .GPIO_PuPd = GPIO_PuPd_NOPULL
287 .GPIO_Pin = GPIO_Pin_3,
288 .GPIO_Speed = GPIO_Speed_2MHz,
289 .GPIO_Mode = GPIO_Mode_OUT,
290 .GPIO_OType = GPIO_OType_PP,
291 .GPIO_PuPd = GPIO_PuPd_NOPULL
300 .GPIO_Pin = GPIO_Pin_11,
301 .GPIO_Speed = GPIO_Speed_2MHz,
302 .GPIO_Mode = GPIO_Mode_OUT,
303 .GPIO_OType = GPIO_OType_PP,
304 .GPIO_PuPd = GPIO_PuPd_NOPULL
316 .NVIC_IRQChannel = USART1_IRQn,
318 .NVIC_IRQChannelSubPriority = 0,
319 .NVIC_IRQChannelCmd = ENABLE,
325 .GPIO_Pin = GPIO_Pin_7,
326 .GPIO_Speed = GPIO_Speed_2MHz,
327 .GPIO_Mode = GPIO_Mode_AF,
328 .GPIO_OType = GPIO_OType_PP,
329 .GPIO_PuPd = GPIO_PuPd_UP
331 .pin_source = GPIO_PinSource7,
336 .GPIO_Pin = GPIO_Pin_6,
337 .GPIO_Speed = GPIO_Speed_2MHz,
338 .GPIO_Mode = GPIO_Mode_AF,
339 .GPIO_OType = GPIO_OType_PP,
340 .GPIO_PuPd = GPIO_PuPd_DOWN
342 .pin_source = GPIO_PinSource6,
351 .NVIC_IRQChannel = USART2_IRQn,
353 .NVIC_IRQChannelSubPriority = 0,
354 .NVIC_IRQChannelCmd = ENABLE,
360 .GPIO_Pin = GPIO_Pin_3,
361 .GPIO_Speed = GPIO_Speed_2MHz,
362 .GPIO_Mode = GPIO_Mode_AF,
363 .GPIO_OType = GPIO_OType_PP,
364 .GPIO_PuPd = GPIO_PuPd_UP
366 .pin_source = GPIO_PinSource3,
371 .GPIO_Pin = GPIO_Pin_2,
372 .GPIO_Speed = GPIO_Speed_2MHz,
373 .GPIO_Mode = GPIO_Mode_AF,
374 .GPIO_OType = GPIO_OType_PP,
375 .GPIO_PuPd = GPIO_PuPd_DOWN
377 .pin_source = GPIO_PinSource2,
386 .NVIC_IRQChannel = USART3_IRQn,
388 .NVIC_IRQChannelSubPriority = 0,
389 .NVIC_IRQChannelCmd = ENABLE,
395 .GPIO_Pin = GPIO_Pin_11,
396 .GPIO_Speed = GPIO_Speed_2MHz,
397 .GPIO_Mode = GPIO_Mode_AF,
398 .GPIO_OType = GPIO_OType_PP,
399 .GPIO_PuPd = GPIO_PuPd_UP
401 .pin_source = GPIO_PinSource11,
406 .GPIO_Pin = GPIO_Pin_10,
407 .GPIO_Speed = GPIO_Speed_2MHz,
408 .GPIO_Mode = GPIO_Mode_AF,
409 .GPIO_OType = GPIO_OType_PP,
410 .GPIO_PuPd = GPIO_PuPd_DOWN
412 .pin_source = GPIO_PinSource10,
417 #if defined(PIOS_INCLUDE_COM)
423 #if defined(PIOS_INCLUDE_RTC)
427 #include <pios_rtc_priv.h>
429 void PIOS_RTC_IRQ_Handler (
void);
432 .
clksrc = RCC_RTCCLKSource_HSE_Div32,
436 .NVIC_IRQChannel = RTC_WKUP_IRQn,
438 .NVIC_IRQChannelSubPriority = 0,
439 .NVIC_IRQChannelCmd = ENABLE,
444 void PIOS_RTC_IRQ_Handler (
void)
456 .TIM_ClockDivision = TIM_CKD_DIV1,
457 .TIM_CounterMode = TIM_CounterMode_Up,
459 .TIM_RepetitionCounter = 0x0000,
464 .TIM_ClockDivision = TIM_CKD_DIV1,
465 .TIM_CounterMode = TIM_CounterMode_Up,
467 .TIM_RepetitionCounter = 0x0000,
475 .NVIC_IRQChannel = TIM2_IRQn,
477 .NVIC_IRQChannelSubPriority = 0,
478 .NVIC_IRQChannelCmd = ENABLE,
488 .NVIC_IRQChannel = TIM1_CC_IRQn,
490 .NVIC_IRQChannelSubPriority = 0,
491 .NVIC_IRQChannelCmd = ENABLE,
500 .NVIC_IRQChannel = TIM1_BRK_TIM15_IRQn,
502 .NVIC_IRQChannelSubPriority = 0,
503 .NVIC_IRQChannelCmd = ENABLE,
513 .NVIC_IRQChannel = TIM1_UP_TIM16_IRQn,
515 .NVIC_IRQChannelSubPriority = 0,
516 .NVIC_IRQChannelCmd = ENABLE,
525 .NVIC_IRQChannel = TIM1_TRG_COM_TIM17_IRQn,
527 .NVIC_IRQChannelSubPriority = 0,
528 .NVIC_IRQChannelCmd = ENABLE,
550 .timer_chan = TIM_Channel_3,
555 .GPIO_Pin = GPIO_Pin_8,
556 .GPIO_Speed = GPIO_Speed_2MHz,
557 .GPIO_Mode = GPIO_Mode_AF,
558 .GPIO_OType = GPIO_OType_PP,
559 .GPIO_PuPd = GPIO_PuPd_UP
561 .pin_source = GPIO_PinSource8,
566 .timer_chan = TIM_Channel_4,
571 .GPIO_Pin = GPIO_Pin_9,
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_PinSource9,
582 .timer_chan = TIM_Channel_4,
587 .GPIO_Pin = GPIO_Pin_10,
588 .GPIO_Speed = GPIO_Speed_2MHz,
589 .GPIO_Mode = GPIO_Mode_AF,
590 .GPIO_OType = GPIO_OType_PP,
591 .GPIO_PuPd = GPIO_PuPd_UP
593 .pin_source = GPIO_PinSource10,
598 .timer_chan = TIM_Channel_3,
603 .GPIO_Pin = GPIO_Pin_9,
604 .GPIO_Speed = GPIO_Speed_2MHz,
605 .GPIO_Mode = GPIO_Mode_AF,
606 .GPIO_OType = GPIO_OType_PP,
607 .GPIO_PuPd = GPIO_PuPd_UP
609 .pin_source = GPIO_PinSource9,
614 .timer_chan = TIM_Channel_1,
619 .GPIO_Pin = GPIO_Pin_0,
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_PinSource0,
630 .timer_chan = TIM_Channel_2,
635 .GPIO_Pin = GPIO_Pin_1,
636 .GPIO_Speed = GPIO_Speed_2MHz,
637 .GPIO_Mode = GPIO_Mode_AF,
638 .GPIO_OType = GPIO_OType_PP,
639 .GPIO_PuPd = GPIO_PuPd_UP
641 .pin_source = GPIO_PinSource1,
646 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
654 .TIM_OCMode = TIM_OCMode_PWM1,
655 .TIM_OutputState = TIM_OutputState_Enable,
656 .TIM_OutputNState = TIM_OutputNState_Disable,
658 .TIM_OCPolarity = TIM_OCPolarity_High,
659 .TIM_OCNPolarity = TIM_OCPolarity_High,
660 .TIM_OCIdleState = TIM_OCIdleState_Reset,
661 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
664 .num_channels =
NELEMENTS(pios_tim_servoport_pins),
674 #if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
684 .timer_chan = TIM_Channel_1,
689 .GPIO_Pin = GPIO_Pin_8,
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_PinSource8,
703 .timer_chan = TIM_Channel_1,
708 .GPIO_Pin = GPIO_Pin_8,
709 .GPIO_Speed = GPIO_Speed_2MHz,
710 .GPIO_Mode = GPIO_Mode_AF,
711 .GPIO_OType = GPIO_OType_PP,
712 .GPIO_PuPd = GPIO_PuPd_UP
714 .pin_source = GPIO_PinSource8,
724 #if defined(PIOS_INCLUDE_PPM)
728 .TIM_ICPolarity = TIM_ICPolarity_Rising,
729 .TIM_ICSelection = TIM_ICSelection_DirectTI,
730 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
732 .TIM_Channel = TIM_Channel_1,
741 #if defined(PIOS_INCLUDE_ADC)
745 #define DTFC_VOLTAGE_CALIBRATION_VALUE 90.9091f // mV/V
746 #define DTFC_CURRENT_CALIBRATION_VALUE 24.95f // mV/A
752 void PIOS_ADC_DMA_irq_handler(
void)
761 .
flags = (DMA2_FLAG_TC1 | DMA2_FLAG_TE1 | DMA2_FLAG_HT1 | DMA2_FLAG_GL1),
763 .NVIC_IRQChannel = DMA2_Channel1_IRQn,
765 .NVIC_IRQChannelSubPriority = 0,
766 .NVIC_IRQChannelCmd = ENABLE,
770 .channel = DMA2_Channel1,
772 .DMA_Priority = DMA_Priority_High,
776 .half_flag = DMA2_IT_HT1,
777 .full_flag = DMA2_IT_TC1,
781 {GPIOA,GPIO_Pin_5,ADC_Channel_2,
true},
782 {GPIOA,GPIO_Pin_4,ADC_Channel_1,
true},
784 .adc_dev_master = ADC2,
789 #if defined(PIOS_INCLUDE_RCVR)
793 #if defined(PIOS_INCLUDE_USB)
799 .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
801 .NVIC_IRQChannelSubPriority = 0,
802 .NVIC_IRQChannelCmd = ENABLE,
808 .GPIO_Pin = GPIO_Pin_7,
809 .GPIO_Speed = GPIO_Speed_2MHz,
810 .GPIO_Mode = GPIO_Mode_IN,
811 .GPIO_OType = GPIO_OType_OD,
812 .GPIO_PuPd = GPIO_PuPd_NOPULL,
819 return &pios_usb_main_cfg;
829 #if defined(PIOS_INCLUDE_COM_MSG)
835 #if defined(PIOS_INCLUDE_USB_HID)
845 #if defined(PIOS_INCLUDE_USB_CDC)
861 #if defined(PIOS_INCLUDE_MPU)
869 .GPIO_Pin = GPIO_Pin_13,
870 .GPIO_Speed = GPIO_Speed_50MHz,
871 .GPIO_Mode = GPIO_Mode_IN,
872 .GPIO_OType = GPIO_OType_OD,
873 .GPIO_PuPd = GPIO_PuPd_NOPULL,
878 .NVIC_IRQChannel = EXTI15_10_IRQn,
880 .NVIC_IRQChannelSubPriority = 0,
881 .NVIC_IRQChannelCmd = ENABLE,
886 .EXTI_Line = EXTI_Line13,
887 .EXTI_Mode = EXTI_Mode_Interrupt,
888 .EXTI_Trigger = EXTI_Trigger_Rising,
889 .EXTI_LineCmd = ENABLE,
896 .default_samplerate = 1000,
static const TIM_TimeBaseInitTypeDef tim_2_3_time_base
#define DMA2_Channel1_IRQHandler
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
static const struct pios_tim_channel pios_tim_servoport_pins[]
#define PIOS_IRQ_PRIO_HIGHEST
#define PIOS_SERVOS_INITIAL_POSITION
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
USART private definitions.
Spektrum/JR DSMx satellite receiver private structures.
const struct pios_exti_cfg * exti_cfg
#define PIOS_SERVO_UPDATE_HZ
uintptr_t pios_internal_adc_id
static const struct pios_tim_channel pios_tim_rcvrport_ppm[]
#define PIOS_PERIPHERAL_APB1_CLOCK
static const struct pios_tim_clock_cfg tim_2_cfg
static const struct pios_tim_clock_cfg tim_15_cfg
const struct pios_annunc * annunciators
static const struct pios_tim_clock_cfg tim_1_cfg
TIM_OCInitTypeDef tim_oc_init
USB COM HID private definitions.
Servo private structures.
TIM_ICInitTypeDef tim_ic_init
Defines the API to set up the HID-only USB descriptor config.
static const TIM_TimeBaseInitTypeDef tim_1_15_16_17_time_base
void PIOS_RTC_irq_handler(void)
#define PIOS_PERIPHERAL_APB2_CLOCK
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[]
static const struct pios_tim_clock_cfg tim_17_cfg
#define PIOS_IRQ_PRIO_HIGH
static const struct pios_tim_clock_cfg tim_16_cfg
USB COM CDC private definitions.
enum pios_flash_partition_labels label
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
#define PIOS_ANNUNCIATOR_BUZZER
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.