33 #include <pios_config.h>
36 #if defined(PIOS_INCLUDE_ANNUNC)
44 .GPIO_Pin = GPIO_Pin_8,
45 .GPIO_Speed = GPIO_Speed_50MHz,
46 .GPIO_Mode = GPIO_Mode_OUT,
47 .GPIO_OType = GPIO_OType_PP,
48 .GPIO_PuPd = GPIO_PuPd_NOPULL
59 .GPIO_Pin = GPIO_Pin_15,
60 .GPIO_Speed = GPIO_Speed_50MHz,
61 .GPIO_Mode = GPIO_Mode_OUT,
62 .GPIO_OType = GPIO_OType_PP,
63 .GPIO_PuPd = GPIO_PuPd_NOPULL
72 .num_annunciators =
NELEMENTS(pios_annuncs),
75 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
77 return &pios_annunc_cfg;
81 #if defined(PIOS_INCLUDE_I2C)
84 #include <pios_i2c_priv.h>
89 void PIOS_I2C_internal_ev_irq_handler(
void);
90 void PIOS_I2C_internal_er_irq_handler(
void);
98 .I2C_Mode = I2C_Mode_I2C,
100 .I2C_Ack = I2C_Ack_Enable,
101 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
102 .I2C_DigitalFilter = 0x00,
103 .I2C_AnalogFilter = I2C_AnalogFilter_Enable,
104 .I2C_Timing = 0x00310309,
106 .transfer_timeout_ms = 50,
110 .GPIO_Pin = GPIO_Pin_6,
111 .GPIO_Mode = GPIO_Mode_AF,
112 .GPIO_Speed = GPIO_Speed_50MHz,
113 .GPIO_OType = GPIO_OType_PP,
114 .GPIO_PuPd = GPIO_PuPd_NOPULL,
116 .pin_source = GPIO_PinSource6,
121 .GPIO_Pin = GPIO_Pin_7,
122 .GPIO_Mode = GPIO_Mode_AF,
123 .GPIO_Speed = GPIO_Speed_50MHz,
124 .GPIO_OType = GPIO_OType_PP,
125 .GPIO_PuPd = GPIO_PuPd_NOPULL,
127 .pin_source = GPIO_PinSource7,
132 .NVIC_IRQChannel = I2C1_EV_IRQn,
134 .NVIC_IRQChannelSubPriority = 0,
135 .NVIC_IRQChannelCmd = ENABLE,
141 .NVIC_IRQChannel = I2C1_ER_IRQn,
143 .NVIC_IRQChannelSubPriority = 0,
144 .NVIC_IRQChannelCmd = ENABLE,
150 void PIOS_I2C_internal_ev_irq_handler(
void)
156 void PIOS_I2C_internal_er_irq_handler(
void)
164 #ifdef PIOS_INCLUDE_BMP280
173 #if defined(PIOS_INCLUDE_SPI)
183 .SPI_Mode = SPI_Mode_Master,
184 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
185 .SPI_DataSize = SPI_DataSize_8b,
186 .SPI_NSS = SPI_NSS_Soft,
187 .SPI_FirstBit = SPI_FirstBit_MSB,
188 .SPI_CRCPolynomial = 7,
189 .SPI_CPOL = SPI_CPOL_Low,
190 .SPI_CPHA = SPI_CPHA_1Edge,
191 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
196 .GPIO_Pin = GPIO_Pin_3,
197 .GPIO_Speed = GPIO_Speed_50MHz,
198 .GPIO_Mode = GPIO_Mode_AF,
199 .GPIO_OType = GPIO_OType_PP,
200 .GPIO_PuPd = GPIO_PuPd_NOPULL
202 .pin_source = GPIO_PinSource3,
207 .GPIO_Pin = GPIO_Pin_4,
208 .GPIO_Speed = GPIO_Speed_50MHz,
209 .GPIO_Mode = GPIO_Mode_AF,
210 .GPIO_OType = GPIO_OType_PP,
211 .GPIO_PuPd = GPIO_PuPd_NOPULL
213 .pin_source = GPIO_PinSource4,
218 .GPIO_Pin = GPIO_Pin_5,
219 .GPIO_Speed = GPIO_Speed_50MHz,
220 .GPIO_Mode = GPIO_Mode_AF,
221 .GPIO_OType = GPIO_OType_PP,
222 .GPIO_PuPd = GPIO_PuPd_NOPULL
224 .pin_source = GPIO_PinSource5,
230 .GPIO_Pin = GPIO_Pin_9,
231 .GPIO_Speed = GPIO_Speed_50MHz,
232 .GPIO_Mode = GPIO_Mode_OUT,
233 .GPIO_OType = GPIO_OType_PP,
234 .GPIO_PuPd = GPIO_PuPd_UP
240 #if defined(PIOS_INCLUDE_FLASH)
245 .arena_size = 0x00002000,
246 .slot_size = 0x00000100,
264 uintptr_t pios_internal_flash_id;
267 .chip_id = &pios_internal_flash_id,
269 .sector_blocks = stm32f3_sectors,
270 .num_blocks =
NELEMENTS(stm32f3_sectors),
276 .chip_desc = &pios_flash_chip_internal,
285 .chip_desc = &pios_flash_chip_internal,
294 .chip_desc = &pios_flash_chip_internal,
303 .chip_desc = &pios_flash_chip_internal,
315 *num_partitions =
NELEMENTS(pios_flash_partition_table);
323 #if defined(PIOS_INCLUDE_USART)
327 #if defined(PIOS_INCLUDE_DSM)
333 static const struct pios_dsm_cfg pios_uart1_dsm_aux_cfg = {
337 .GPIO_Pin = GPIO_Pin_10,
338 .GPIO_Speed = GPIO_Speed_2MHz,
339 .GPIO_Mode = GPIO_Mode_OUT,
340 .GPIO_OType = GPIO_OType_PP,
341 .GPIO_PuPd = GPIO_PuPd_NOPULL
346 static const struct pios_dsm_cfg pios_uart2_dsm_aux_cfg = {
350 .GPIO_Pin = GPIO_Pin_15,
351 .GPIO_Speed = GPIO_Speed_2MHz,
352 .GPIO_Mode = GPIO_Mode_OUT,
353 .GPIO_OType = GPIO_OType_PP,
354 .GPIO_PuPd = GPIO_PuPd_NOPULL
359 static const struct pios_dsm_cfg pios_uart3_dsm_aux_cfg = {
363 .GPIO_Pin = GPIO_Pin_11,
364 .GPIO_Speed = GPIO_Speed_2MHz,
365 .GPIO_Mode = GPIO_Mode_OUT,
366 .GPIO_OType = GPIO_OType_PP,
367 .GPIO_PuPd = GPIO_PuPd_NOPULL
379 .NVIC_IRQChannel = USART1_IRQn,
381 .NVIC_IRQChannelSubPriority = 0,
382 .NVIC_IRQChannelCmd = ENABLE,
388 .GPIO_Pin = GPIO_Pin_10,
389 .GPIO_Speed = GPIO_Speed_2MHz,
390 .GPIO_Mode = GPIO_Mode_AF,
391 .GPIO_OType = GPIO_OType_PP,
392 .GPIO_PuPd = GPIO_PuPd_UP
394 .pin_source = GPIO_PinSource10,
399 .GPIO_Pin = GPIO_Pin_9,
400 .GPIO_Speed = GPIO_Speed_2MHz,
401 .GPIO_Mode = GPIO_Mode_AF,
402 .GPIO_OType = GPIO_OType_PP,
403 .GPIO_PuPd = GPIO_PuPd_DOWN
405 .pin_source = GPIO_PinSource9,
414 .NVIC_IRQChannel = USART2_IRQn,
416 .NVIC_IRQChannelSubPriority = 0,
417 .NVIC_IRQChannelCmd = ENABLE,
423 .GPIO_Pin = GPIO_Pin_15,
424 .GPIO_Speed = GPIO_Speed_2MHz,
425 .GPIO_Mode = GPIO_Mode_AF,
426 .GPIO_OType = GPIO_OType_PP,
427 .GPIO_PuPd = GPIO_PuPd_UP
429 .pin_source = GPIO_PinSource15,
434 .GPIO_Pin = GPIO_Pin_14,
435 .GPIO_Speed = GPIO_Speed_2MHz,
436 .GPIO_Mode = GPIO_Mode_AF,
437 .GPIO_OType = GPIO_OType_PP,
438 .GPIO_PuPd = GPIO_PuPd_DOWN
440 .pin_source = GPIO_PinSource14,
449 .NVIC_IRQChannel = USART3_IRQn,
451 .NVIC_IRQChannelSubPriority = 0,
452 .NVIC_IRQChannelCmd = ENABLE,
458 .GPIO_Pin = GPIO_Pin_11,
459 .GPIO_Speed = GPIO_Speed_2MHz,
460 .GPIO_Mode = GPIO_Mode_AF,
461 .GPIO_OType = GPIO_OType_PP,
462 .GPIO_PuPd = GPIO_PuPd_UP
464 .pin_source = GPIO_PinSource11,
469 .GPIO_Pin = GPIO_Pin_10,
470 .GPIO_Speed = GPIO_Speed_2MHz,
471 .GPIO_Mode = GPIO_Mode_AF,
472 .GPIO_OType = GPIO_OType_PP,
473 .GPIO_PuPd = GPIO_PuPd_DOWN
475 .pin_source = GPIO_PinSource10,
481 #if defined(PIOS_INCLUDE_COM)
487 #if defined(PIOS_INCLUDE_RTC)
491 #include <pios_rtc_priv.h>
493 void PIOS_RTC_IRQ_Handler (
void);
496 .
clksrc = RCC_RTCCLKSource_HSE_Div32,
500 .NVIC_IRQChannel = RTC_WKUP_IRQn,
502 .NVIC_IRQChannelSubPriority = 0,
503 .NVIC_IRQChannelCmd = ENABLE,
508 void PIOS_RTC_IRQ_Handler (
void)
519 .TIM_ClockDivision = TIM_CKD_DIV1,
520 .TIM_CounterMode = TIM_CounterMode_Up,
522 .TIM_RepetitionCounter = 0x0000,
527 .TIM_ClockDivision = TIM_CKD_DIV1,
528 .TIM_CounterMode = TIM_CounterMode_Up,
530 .TIM_RepetitionCounter = 0x0000,
538 .NVIC_IRQChannel = TIM2_IRQn,
540 .NVIC_IRQChannelSubPriority = 0,
541 .NVIC_IRQChannelCmd = ENABLE,
551 .NVIC_IRQChannel = TIM3_IRQn,
553 .NVIC_IRQChannelSubPriority = 0,
554 .NVIC_IRQChannelCmd = ENABLE,
564 .NVIC_IRQChannel = TIM8_CC_IRQn,
566 .NVIC_IRQChannelSubPriority = 0,
567 .NVIC_IRQChannelCmd = ENABLE,
572 .NVIC_IRQChannel = TIM8_UP_IRQn,
574 .NVIC_IRQChannelSubPriority = 0,
575 .NVIC_IRQChannelCmd = ENABLE,
585 .NVIC_IRQChannel = TIM1_BRK_TIM15_IRQn,
587 .NVIC_IRQChannelSubPriority = 0,
588 .NVIC_IRQChannelCmd = ENABLE,
598 .NVIC_IRQChannel = TIM1_UP_TIM16_IRQn,
600 .NVIC_IRQChannelSubPriority = 0,
601 .NVIC_IRQChannelCmd = ENABLE,
611 .NVIC_IRQChannel = TIM1_TRG_COM_TIM17_IRQn,
613 .NVIC_IRQChannelSubPriority = 0,
614 .NVIC_IRQChannelCmd = ENABLE,
622 .timer_chan = TIM_Channel_1,
627 .GPIO_Pin = GPIO_Pin_0,
628 .GPIO_Speed = GPIO_Speed_2MHz,
629 .GPIO_Mode = GPIO_Mode_AF,
630 .GPIO_OType = GPIO_OType_PP,
631 .GPIO_PuPd = GPIO_PuPd_UP
633 .pin_source = GPIO_PinSource0,
638 .timer_chan = TIM_Channel_2,
643 .GPIO_Pin = GPIO_Pin_1,
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_PinSource1,
654 .timer_chan = TIM_Channel_1,
659 .GPIO_Pin = GPIO_Pin_2,
660 .GPIO_Speed = GPIO_Speed_2MHz,
661 .GPIO_Mode = GPIO_Mode_AF,
662 .GPIO_OType = GPIO_OType_PP,
663 .GPIO_PuPd = GPIO_PuPd_UP
665 .pin_source = GPIO_PinSource2,
670 .timer_chan = TIM_Channel_2,
675 .GPIO_Pin = GPIO_Pin_3,
676 .GPIO_Speed = GPIO_Speed_2MHz,
677 .GPIO_Mode = GPIO_Mode_AF,
678 .GPIO_OType = GPIO_OType_PP,
679 .GPIO_PuPd = GPIO_PuPd_UP
681 .pin_source = GPIO_PinSource3,
686 .timer_chan = TIM_Channel_1,
691 .GPIO_Pin = GPIO_Pin_6,
692 .GPIO_Speed = GPIO_Speed_2MHz,
693 .GPIO_Mode = GPIO_Mode_AF,
694 .GPIO_OType = GPIO_OType_PP,
695 .GPIO_PuPd = GPIO_PuPd_UP
697 .pin_source = GPIO_PinSource6,
702 .timer_chan = TIM_Channel_2,
707 .GPIO_Pin = GPIO_Pin_7,
708 .GPIO_Speed = GPIO_Speed_2MHz,
709 .GPIO_Mode = GPIO_Mode_AF,
710 .GPIO_OType = GPIO_OType_PP,
711 .GPIO_PuPd = GPIO_PuPd_UP
713 .pin_source = GPIO_PinSource7,
718 .timer_chan = TIM_Channel_3,
723 .GPIO_Pin = GPIO_Pin_0,
724 .GPIO_Speed = GPIO_Speed_2MHz,
725 .GPIO_Mode = GPIO_Mode_AF,
726 .GPIO_OType = GPIO_OType_PP,
727 .GPIO_PuPd = GPIO_PuPd_UP
729 .pin_source = GPIO_PinSource0,
734 .timer_chan = TIM_Channel_4,
739 .GPIO_Pin = GPIO_Pin_1,
740 .GPIO_Speed = GPIO_Speed_2MHz,
741 .GPIO_Mode = GPIO_Mode_AF,
742 .GPIO_OType = GPIO_OType_PP,
743 .GPIO_PuPd = GPIO_PuPd_UP
745 .pin_source = GPIO_PinSource1,
757 .TIM_OCMode = TIM_OCMode_PWM1,
758 .TIM_OutputState = TIM_OutputState_Enable,
759 .TIM_OutputNState = TIM_OutputNState_Disable,
761 .TIM_OCPolarity = TIM_OCPolarity_High,
762 .TIM_OCNPolarity = TIM_OCPolarity_High,
763 .TIM_OCIdleState = TIM_OCIdleState_Reset,
764 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
767 .num_channels =
NELEMENTS(pios_tim_servoport_pins),
770 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
771 struct pios_servo_cfg pios_servo_slow_cfg = {
773 .TIM_OCMode = TIM_OCMode_PWM1,
774 .TIM_OutputState = TIM_OutputState_Enable,
775 .TIM_OutputNState = TIM_OutputNState_Disable,
777 .TIM_OCPolarity = TIM_OCPolarity_High,
778 .TIM_OCNPolarity = TIM_OCPolarity_High,
779 .TIM_OCIdleState = TIM_OCIdleState_Reset,
780 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
784 .num_channels =
NELEMENTS(pios_tim_servoport_pins),
794 #if defined(PIOS_INCLUDE_PPM)
804 .timer_chan = TIM_Channel_1,
809 .GPIO_Pin = GPIO_Pin_15,
810 .GPIO_Speed = GPIO_Speed_2MHz,
811 .GPIO_Mode = GPIO_Mode_AF,
812 .GPIO_OType = GPIO_OType_PP,
813 .GPIO_PuPd = GPIO_PuPd_UP
815 .pin_source = GPIO_PinSource15,
824 #if defined(PIOS_INCLUDE_PPM)
828 .TIM_ICPolarity = TIM_ICPolarity_Rising,
829 .TIM_ICSelection = TIM_ICSelection_DirectTI,
830 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
832 .TIM_Channel = TIM_Channel_1,
835 .channels = pios_tim_rxport_ppm,
841 #if defined(PIOS_INCLUDE_ADC)
848 void PIOS_ADC_DMA_irq_handler(
void)
864 .
flags = (DMA2_FLAG_TC1 | DMA2_FLAG_TE1 | DMA2_FLAG_HT1 | DMA2_FLAG_GL1),
866 .NVIC_IRQChannel = DMA2_Channel1_IRQn,
868 .NVIC_IRQChannelSubPriority = 0,
869 .NVIC_IRQChannelCmd = ENABLE,
873 .channel = DMA2_Channel1,
875 .DMA_Priority = DMA_Priority_High,
879 .half_flag = DMA2_IT_HT1,
880 .full_flag = DMA2_IT_TC1,
884 {GPIOA, GPIO_Pin_4, ADC_Channel_1,
true},
885 {GPIOA, GPIO_Pin_5, ADC_Channel_2,
true},
886 {GPIOB, GPIO_Pin_2, ADC_Channel_12,
true},
888 .adc_dev_master = ADC2,
894 #if defined(PIOS_INCLUDE_RCVR)
898 #if defined(PIOS_INCLUDE_USB)
904 .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
906 .NVIC_IRQChannelSubPriority = 0,
907 .NVIC_IRQChannelCmd = ENABLE,
917 return &pios_usb_main_cfg;
927 #if defined(PIOS_INCLUDE_WS2811)
934 .timer_chan = TIM_Channel_1,
936 .gpio_pin = GPIO_Pin_8,
938 .timer_dma_source = TIM_DMA_Update,
939 .dma_chan = DMA1_Channel5,
940 .dma_tcif = DMA1_FLAG_TC5,
941 .dma_irqn = DMA1_Channel5_IRQn,
945 #if defined(PIOS_INCLUDE_COM_MSG)
951 #if defined(PIOS_INCLUDE_USB_HID)
961 #if defined(PIOS_INCLUDE_USB_CDC)
977 #if defined(PIOS_INCLUDE_MPU)
985 .GPIO_Pin = GPIO_Pin_13,
986 .GPIO_Speed = GPIO_Speed_50MHz,
987 .GPIO_Mode = GPIO_Mode_IN,
988 .GPIO_OType = GPIO_OType_OD,
989 .GPIO_PuPd = GPIO_PuPd_NOPULL,
994 .NVIC_IRQChannel = EXTI15_10_IRQn,
996 .NVIC_IRQChannelSubPriority = 0,
997 .NVIC_IRQChannelCmd = ENABLE,
1002 .EXTI_Line = EXTI_Line13,
1003 .EXTI_Mode = EXTI_Mode_Interrupt,
1004 .EXTI_Trigger = EXTI_Trigger_Rising,
1005 .EXTI_LineCmd = ENABLE,
1012 .default_samplerate = 1000,
1014 .use_internal_mag =
true,
1019 #ifdef PIOS_INCLUDE_HMC5883
1031 #ifdef PIOS_INCLUDE_HMC5983_I2C
const struct pios_exti_cfg * exti_cfg
#define PIOS_HMC5883_ODR_75
Main PiOS header to include all the compiled in PiOS options.
HMC5983 functions header.
#define DMA2_Channel1_IRQHandler
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
#define PIOS_HMC5883_MODE_CONTINUOUS
#define PIOS_IRQ_PRIO_HIGHEST
Configuration structure for the BMP280 driver.
#define PIOS_SERVOS_INITIAL_POSITION
static const struct pios_tim_clock_cfg tim_16_cfg
Defines the API to set up the HID + CDC USB descriptor config.
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
static const struct pios_tim_clock_cfg tim_15_cfg
#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
#define PIOS_HMC5983_MEASCONF_NORMAL
const struct pios_exti_cfg * exti_cfg
#define PIOS_HMC5983_MODE_CONTINUOUS
uintptr_t pios_internal_adc_id
struct pios_i2c_adapter * pios_i2c_t
#define PIOS_PERIPHERAL_APB1_CLOCK
const struct pios_annunc * annunciators
void PIOS_I2C_EV_IRQ_Handler(pios_i2c_t i2c_id)
#define PIOS_HMC5883_GAIN_1_9
#define PIOS_HMC5983_ODR_75
#define I2C1_ER_IRQHandler
TIM_OCInitTypeDef tim_oc_init
static const struct pios_tim_clock_cfg tim_17_cfg
USB COM HID private definitions.
Servo private structures.
static const TIM_TimeBaseInitTypeDef tim_1_8_15_16_17_time_base
static const struct pios_tim_clock_cfg tim_8_cfg
#define PIOS_HMC5983_GAIN_1_9
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_MEASCONF_NORMAL
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[]
#define I2C1_EV_EXTI23_IRQHandler
#define PIOS_IRQ_PRIO_HIGH
static const struct pios_tim_clock_cfg tim_2_cfg
USB COM CDC private definitions.
static const TIM_TimeBaseInitTypeDef tim_2_3_time_base
enum pios_flash_partition_labels label
static const struct pios_tim_channel pios_tim_servoport_pins[]
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
static const struct pios_tim_clock_cfg tim_3_cfg
#define BMP280_HIGH_RESOLUTION
#define PIOS_ANNUNCIATOR_BUZZER
const struct pios_flash_driver pios_internal_flash_driver
USART private definitions.
#define PIOS_LED_HEARTBEAT
#define PIOS_HMC5983_AVERAGING_1
Defines the API to the board-specific USB data setup code.