33 #include <pios_config.h>
36 #if defined(PIOS_INCLUDE_ANNUNC)
44 .GPIO_Pin = GPIO_Pin_3,
45 .GPIO_Speed = GPIO_Speed_50MHz,
46 .GPIO_Mode = GPIO_Mode_OUT,
47 .GPIO_OType = GPIO_OType_PP,
48 .GPIO_PuPd = GPIO_PuPd_NOPULL
57 .GPIO_Pin = GPIO_Pin_15,
58 .GPIO_Speed = GPIO_Speed_50MHz,
59 .GPIO_Mode = GPIO_Mode_OUT,
60 .GPIO_OType = GPIO_OType_PP,
61 .GPIO_PuPd = GPIO_PuPd_NOPULL
70 .num_annunciators =
NELEMENTS(pios_annuncs),
73 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
75 return &pios_annunc_cfg;
81 #if defined(PIOS_INCLUDE_I2C)
85 #include <pios_i2c_priv.h>
90 void PIOS_I2C_internal_ev_irq_handler(
void);
91 void PIOS_I2C_internal_er_irq_handler(
void);
99 .I2C_Mode = I2C_Mode_I2C,
100 .I2C_OwnAddress1 = 0,
101 .I2C_Ack = I2C_Ack_Enable,
102 .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
103 .I2C_DigitalFilter = 0x00,
104 .I2C_AnalogFilter = I2C_AnalogFilter_Enable,
105 .I2C_Timing = 0x00310309,
107 .transfer_timeout_ms = 50,
111 .GPIO_Pin = GPIO_Pin_6,
112 .GPIO_Mode = GPIO_Mode_AF,
113 .GPIO_Speed = GPIO_Speed_50MHz,
114 .GPIO_OType = GPIO_OType_PP,
115 .GPIO_PuPd = GPIO_PuPd_NOPULL,
117 .pin_source = GPIO_PinSource6,
122 .GPIO_Pin = GPIO_Pin_7,
123 .GPIO_Mode = GPIO_Mode_AF,
124 .GPIO_Speed = GPIO_Speed_50MHz,
125 .GPIO_OType = GPIO_OType_PP,
126 .GPIO_PuPd = GPIO_PuPd_NOPULL,
128 .pin_source = GPIO_PinSource7,
133 .NVIC_IRQChannel = I2C1_EV_IRQn,
135 .NVIC_IRQChannelSubPriority = 0,
136 .NVIC_IRQChannelCmd = ENABLE,
142 .NVIC_IRQChannel = I2C1_ER_IRQn,
144 .NVIC_IRQChannelSubPriority = 0,
145 .NVIC_IRQChannelCmd = ENABLE,
151 void PIOS_I2C_internal_ev_irq_handler(
void)
157 void PIOS_I2C_internal_er_irq_handler(
void)
165 #if defined(PIOS_INCLUDE_SPI)
175 .SPI_Mode = SPI_Mode_Master,
176 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
177 .SPI_DataSize = SPI_DataSize_8b,
178 .SPI_NSS = SPI_NSS_Soft,
179 .SPI_FirstBit = SPI_FirstBit_MSB,
180 .SPI_CRCPolynomial = 7,
181 .SPI_CPOL = SPI_CPOL_Low,
182 .SPI_CPHA = SPI_CPHA_1Edge,
183 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
188 .GPIO_Pin = GPIO_Pin_5,
189 .GPIO_Speed = GPIO_Speed_50MHz,
190 .GPIO_Mode = GPIO_Mode_AF,
191 .GPIO_OType = GPIO_OType_PP,
192 .GPIO_PuPd = GPIO_PuPd_NOPULL
194 .pin_source = GPIO_PinSource5,
199 .GPIO_Pin = GPIO_Pin_6,
200 .GPIO_Speed = GPIO_Speed_50MHz,
201 .GPIO_Mode = GPIO_Mode_AF,
202 .GPIO_OType = GPIO_OType_PP,
203 .GPIO_PuPd = GPIO_PuPd_NOPULL
205 .pin_source = GPIO_PinSource4,
210 .GPIO_Pin = GPIO_Pin_7,
211 .GPIO_Speed = GPIO_Speed_50MHz,
212 .GPIO_Mode = GPIO_Mode_AF,
213 .GPIO_OType = GPIO_OType_PP,
214 .GPIO_PuPd = GPIO_PuPd_NOPULL
216 .pin_source = GPIO_PinSource5,
224 .GPIO_Pin = GPIO_Pin_4,
225 .GPIO_Speed = GPIO_Speed_50MHz,
226 .GPIO_Mode = GPIO_Mode_OUT,
227 .GPIO_OType = GPIO_OType_PP,
228 .GPIO_PuPd = GPIO_PuPd_UP
235 .GPIO_Pin = GPIO_Pin_1,
236 .GPIO_Speed = GPIO_Speed_50MHz,
237 .GPIO_Mode = GPIO_Mode_OUT,
238 .GPIO_OType = GPIO_OType_PP,
239 .GPIO_PuPd = GPIO_PuPd_UP
246 #if defined(PIOS_INCLUDE_FLASH)
251 .arena_size = 0x00002000,
252 .slot_size = 0x00000100,
270 uintptr_t pios_internal_flash_id;
273 .chip_id = &pios_internal_flash_id,
275 .sector_blocks = stm32f3_sectors,
276 .num_blocks =
NELEMENTS(stm32f3_sectors),
282 .chip_desc = &pios_flash_chip_internal,
291 .chip_desc = &pios_flash_chip_internal,
300 .chip_desc = &pios_flash_chip_internal,
309 .chip_desc = &pios_flash_chip_internal,
321 *num_partitions =
NELEMENTS(pios_flash_partition_table);
329 #if defined(PIOS_INCLUDE_USART)
333 #if defined(PIOS_INCLUDE_DSM)
339 static const struct pios_dsm_cfg pios_uart1_dsm_aux_cfg = {
343 .GPIO_Pin = GPIO_Pin_10,
344 .GPIO_Speed = GPIO_Speed_2MHz,
345 .GPIO_Mode = GPIO_Mode_OUT,
346 .GPIO_OType = GPIO_OType_PP,
347 .GPIO_PuPd = GPIO_PuPd_NOPULL
352 static const struct pios_dsm_cfg pios_uart2_dsm_aux_cfg = {
356 .GPIO_Pin = GPIO_Pin_15,
357 .GPIO_Speed = GPIO_Speed_2MHz,
358 .GPIO_Mode = GPIO_Mode_OUT,
359 .GPIO_OType = GPIO_OType_PP,
360 .GPIO_PuPd = GPIO_PuPd_NOPULL
365 static const struct pios_dsm_cfg pios_uart3_dsm_aux_cfg = {
369 .GPIO_Pin = GPIO_Pin_11,
370 .GPIO_Speed = GPIO_Speed_2MHz,
371 .GPIO_Mode = GPIO_Mode_OUT,
372 .GPIO_OType = GPIO_OType_PP,
373 .GPIO_PuPd = GPIO_PuPd_NOPULL
385 .NVIC_IRQChannel = USART1_IRQn,
387 .NVIC_IRQChannelSubPriority = 0,
388 .NVIC_IRQChannelCmd = ENABLE,
394 .GPIO_Pin = GPIO_Pin_10,
395 .GPIO_Speed = GPIO_Speed_2MHz,
396 .GPIO_Mode = GPIO_Mode_AF,
397 .GPIO_OType = GPIO_OType_PP,
398 .GPIO_PuPd = GPIO_PuPd_UP
400 .pin_source = GPIO_PinSource10,
405 .GPIO_Pin = GPIO_Pin_9,
406 .GPIO_Speed = GPIO_Speed_2MHz,
407 .GPIO_Mode = GPIO_Mode_AF,
408 .GPIO_OType = GPIO_OType_PP,
409 .GPIO_PuPd = GPIO_PuPd_DOWN
411 .pin_source = GPIO_PinSource9,
420 .NVIC_IRQChannel = USART2_IRQn,
422 .NVIC_IRQChannelSubPriority = 0,
423 .NVIC_IRQChannelCmd = ENABLE,
429 .GPIO_Pin = GPIO_Pin_15,
430 .GPIO_Speed = GPIO_Speed_2MHz,
431 .GPIO_Mode = GPIO_Mode_AF,
432 .GPIO_OType = GPIO_OType_PP,
433 .GPIO_PuPd = GPIO_PuPd_UP
435 .pin_source = GPIO_PinSource15,
440 .GPIO_Pin = GPIO_Pin_14,
441 .GPIO_Speed = GPIO_Speed_2MHz,
442 .GPIO_Mode = GPIO_Mode_AF,
443 .GPIO_OType = GPIO_OType_PP,
444 .GPIO_PuPd = GPIO_PuPd_DOWN
446 .pin_source = GPIO_PinSource14,
455 .NVIC_IRQChannel = USART3_IRQn,
457 .NVIC_IRQChannelSubPriority = 0,
458 .NVIC_IRQChannelCmd = ENABLE,
464 .GPIO_Pin = GPIO_Pin_11,
465 .GPIO_Speed = GPIO_Speed_2MHz,
466 .GPIO_Mode = GPIO_Mode_AF,
467 .GPIO_OType = GPIO_OType_PP,
468 .GPIO_PuPd = GPIO_PuPd_UP
470 .pin_source = GPIO_PinSource11,
475 .GPIO_Pin = GPIO_Pin_10,
476 .GPIO_Speed = GPIO_Speed_2MHz,
477 .GPIO_Mode = GPIO_Mode_AF,
478 .GPIO_OType = GPIO_OType_PP,
479 .GPIO_PuPd = GPIO_PuPd_DOWN
481 .pin_source = GPIO_PinSource10,
487 #if defined(PIOS_INCLUDE_COM)
493 #if defined(PIOS_INCLUDE_RTC)
497 #include <pios_rtc_priv.h>
499 void PIOS_RTC_IRQ_Handler (
void);
502 .
clksrc = RCC_RTCCLKSource_HSE_Div32,
506 .NVIC_IRQChannel = RTC_WKUP_IRQn,
508 .NVIC_IRQChannelSubPriority = 0,
509 .NVIC_IRQChannelCmd = ENABLE,
514 void PIOS_RTC_IRQ_Handler (
void)
525 .TIM_ClockDivision = TIM_CKD_DIV1,
526 .TIM_CounterMode = TIM_CounterMode_Up,
528 .TIM_RepetitionCounter = 0x0000,
533 .TIM_ClockDivision = TIM_CKD_DIV1,
534 .TIM_CounterMode = TIM_CounterMode_Up,
536 .TIM_RepetitionCounter = 0x0000,
544 .NVIC_IRQChannel = TIM2_IRQn,
546 .NVIC_IRQChannelSubPriority = 0,
547 .NVIC_IRQChannelCmd = ENABLE,
557 .NVIC_IRQChannel = TIM3_IRQn,
559 .NVIC_IRQChannelSubPriority = 0,
560 .NVIC_IRQChannelCmd = ENABLE,
570 .NVIC_IRQChannel = TIM8_CC_IRQn,
572 .NVIC_IRQChannelSubPriority = 0,
573 .NVIC_IRQChannelCmd = ENABLE,
578 .NVIC_IRQChannel = TIM8_UP_IRQn,
580 .NVIC_IRQChannelSubPriority = 0,
581 .NVIC_IRQChannelCmd = ENABLE,
591 .NVIC_IRQChannel = TIM1_BRK_TIM15_IRQn,
593 .NVIC_IRQChannelSubPriority = 0,
594 .NVIC_IRQChannelCmd = ENABLE,
602 .timer_chan = TIM_Channel_2,
607 .GPIO_Pin = GPIO_Pin_8,
608 .GPIO_Speed = GPIO_Speed_2MHz,
609 .GPIO_Mode = GPIO_Mode_AF,
610 .GPIO_OType = GPIO_OType_PP,
611 .GPIO_PuPd = GPIO_PuPd_UP
613 .pin_source = GPIO_PinSource8,
618 .timer_chan = TIM_Channel_3,
623 .GPIO_Pin = GPIO_Pin_9,
624 .GPIO_Speed = GPIO_Speed_2MHz,
625 .GPIO_Mode = GPIO_Mode_AF,
626 .GPIO_OType = GPIO_OType_PP,
627 .GPIO_PuPd = GPIO_PuPd_UP
629 .pin_source = GPIO_PinSource9,
634 .timer_chan = TIM_Channel_4,
639 .GPIO_Pin = GPIO_Pin_3,
640 .GPIO_Speed = GPIO_Speed_2MHz,
641 .GPIO_Mode = GPIO_Mode_AF,
642 .GPIO_OType = GPIO_OType_PP,
643 .GPIO_PuPd = GPIO_PuPd_UP
645 .pin_source = GPIO_PinSource3,
650 .timer_chan = TIM_Channel_1,
655 .GPIO_Pin = GPIO_Pin_2,
656 .GPIO_Speed = GPIO_Speed_2MHz,
657 .GPIO_Mode = GPIO_Mode_AF,
658 .GPIO_OType = GPIO_OType_PP,
659 .GPIO_PuPd = GPIO_PuPd_UP
661 .pin_source = GPIO_PinSource2,
672 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
680 .TIM_OCMode = TIM_OCMode_PWM1,
681 .TIM_OutputState = TIM_OutputState_Enable,
682 .TIM_OutputNState = TIM_OutputNState_Disable,
684 .TIM_OCPolarity = TIM_OCPolarity_High,
685 .TIM_OCNPolarity = TIM_OCPolarity_High,
686 .TIM_OCIdleState = TIM_OCIdleState_Reset,
687 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
690 .num_channels =
NELEMENTS(pios_tim_servoport_pins),
693 struct pios_servo_cfg pios_servo_slow_cfg = {
695 .TIM_OCMode = TIM_OCMode_PWM1,
696 .TIM_OutputState = TIM_OutputState_Enable,
697 .TIM_OutputNState = TIM_OutputNState_Disable,
699 .TIM_OCPolarity = TIM_OCPolarity_High,
700 .TIM_OCNPolarity = TIM_OCPolarity_High,
701 .TIM_OCIdleState = TIM_OCIdleState_Reset,
702 .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
706 .num_channels =
NELEMENTS(pios_tim_servoport_pins),
716 #if defined(PIOS_INCLUDE_PPM)
727 .timer_chan = TIM_Channel_1,
732 .GPIO_Pin = GPIO_Pin_4,
733 .GPIO_Speed = GPIO_Speed_2MHz,
734 .GPIO_Mode = GPIO_Mode_AF,
735 .GPIO_OType = GPIO_OType_PP,
736 .GPIO_PuPd = GPIO_PuPd_UP
738 .pin_source = GPIO_PinSource4,
747 #if defined(PIOS_INCLUDE_PPM)
751 .TIM_ICPolarity = TIM_ICPolarity_Rising,
752 .TIM_ICSelection = TIM_ICSelection_DirectTI,
753 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
755 .TIM_Channel = TIM_Channel_1,
758 .channels = pios_tim_rxport_ppm,
764 #if defined(PIOS_INCLUDE_ADC)
772 void PIOS_ADC_DMA_irq_handler(
void)
791 .
flags = (DMA1_FLAG_TC1 | DMA1_FLAG_TE1 | DMA1_FLAG_HT1 | DMA1_FLAG_GL1),
793 .NVIC_IRQChannel = DMA1_Channel1_IRQn,
795 .NVIC_IRQChannelSubPriority = 0,
796 .NVIC_IRQChannelCmd = ENABLE,
800 .channel = DMA1_Channel1,
802 .DMA_Priority = DMA_Priority_High,
806 .half_flag = DMA1_IT_HT1,
807 .full_flag = DMA1_IT_TC1,
811 {GPIOA, GPIO_Pin_0, ADC_Channel_1,
true},
812 {GPIOA, GPIO_Pin_1, ADC_Channel_2,
true},
814 .adc_dev_master = ADC1,
818 #if defined(PIOS_INCLUDE_RCVR)
822 #if defined(PIOS_INCLUDE_USB)
828 .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
830 .NVIC_IRQChannelSubPriority = 0,
831 .NVIC_IRQChannelCmd = ENABLE,
834 #ifdef BOOTLOADER_VERSION
840 .GPIO_Pin = GPIO_Pin_5,
841 .GPIO_Speed = GPIO_Speed_2MHz,
842 .GPIO_Mode = GPIO_Mode_IN,
843 .GPIO_OType = GPIO_OType_OD,
844 .GPIO_PuPd = GPIO_PuPd_DOWN,
852 return &pios_usb_main_cfg;
862 #if defined(PIOS_INCLUDE_WS2811)
869 .timer_chan = TIM_Channel_1,
871 .gpio_pin = GPIO_Pin_8,
873 .timer_dma_source = TIM_DMA_Update,
874 .dma_chan = DMA1_Channel5,
875 .dma_tcif = DMA1_FLAG_TC5,
876 .dma_irqn = DMA1_Channel5_IRQn,
880 #if defined(PIOS_INCLUDE_COM_MSG)
886 #if defined(PIOS_INCLUDE_USB_HID)
896 #if defined(PIOS_INCLUDE_USB_CDC)
912 #if defined(PIOS_INCLUDE_MPU)
920 .GPIO_Pin = GPIO_Pin_13,
921 .GPIO_Speed = GPIO_Speed_50MHz,
922 .GPIO_Mode = GPIO_Mode_IN,
923 .GPIO_OType = GPIO_OType_OD,
924 .GPIO_PuPd = GPIO_PuPd_NOPULL,
929 .NVIC_IRQChannel = EXTI15_10_IRQn,
931 .NVIC_IRQChannelSubPriority = 0,
932 .NVIC_IRQChannelCmd = ENABLE,
937 .EXTI_Line = EXTI_Line13,
938 .EXTI_Mode = EXTI_Mode_Interrupt,
939 .EXTI_Trigger = EXTI_Trigger_Rising,
940 .EXTI_LineCmd = ENABLE,
947 .default_samplerate = 1000,
949 .use_internal_mag =
true,
954 #ifdef PIOS_INCLUDE_HMC5883
966 #ifdef PIOS_INCLUDE_HMC5983_I2C
static const struct pios_tim_clock_cfg tim_2_cfg
const struct pios_exti_cfg * exti_cfg
#define PIOS_HMC5883_ODR_75
Main PiOS header to include all the compiled in PiOS options.
static const struct pios_tim_clock_cfg tim_8_cfg
HMC5983 functions header.
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
#define PIOS_HMC5883_MODE_CONTINUOUS
#define PIOS_IRQ_PRIO_HIGHEST
#define PIOS_SERVOS_INITIAL_POSITION
static const TIM_TimeBaseInitTypeDef tim_1_8_15_time_base
Defines the API to set up the HID + CDC USB descriptor config.
static const struct pios_tim_clock_cfg tim_3_cfg
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
#define DMA1_Channel1_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
static const TIM_TimeBaseInitTypeDef tim_2_3_time_base
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
USB COM HID private definitions.
Servo private structures.
#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
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.
static const struct pios_tim_channel pios_tim_servoport_pins[]
#define PIOS_HMC5983_AVERAGING_1
Defines the API to the board-specific USB data setup code.