16 #include <pios_config.h>
19 #if defined(PIOS_INCLUDE_ANNUNC)
27 .GPIO_Pin = GPIO_Pin_4,
28 .GPIO_Mode = GPIO_Mode_Out_PP,
29 .GPIO_Speed = GPIO_Speed_50MHz,
37 .GPIO_Pin = GPIO_Pin_5,
38 .GPIO_Mode = GPIO_Mode_Out_PP,
39 .GPIO_Speed = GPIO_Speed_50MHz,
47 .GPIO_Pin = GPIO_Pin_6,
48 .GPIO_Mode = GPIO_Mode_Out_PP,
49 .GPIO_Speed = GPIO_Speed_50MHz,
57 .GPIO_Pin = GPIO_Pin_7,
58 .GPIO_Mode = GPIO_Mode_Out_PP,
59 .GPIO_Speed = GPIO_Speed_50MHz,
67 .num_annunciators =
NELEMENTS(pios_annuncs),
70 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t
board_revision)
72 return &pios_annunc_cfg;
77 #if defined(PIOS_INCLUDE_SPI)
93 .SPI_Mode = SPI_Mode_Master,
94 .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
95 .SPI_DataSize = SPI_DataSize_8b,
96 .SPI_NSS = SPI_NSS_Soft,
97 .SPI_FirstBit = SPI_FirstBit_MSB,
98 .SPI_CRCPolynomial = 0,
99 .SPI_CPOL = SPI_CPOL_Low,
100 .SPI_CPHA = SPI_CPHA_1Edge,
101 .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16,
109 .GPIO_Pin = GPIO_Pin_4,
110 .GPIO_Speed = GPIO_Speed_10MHz,
111 .GPIO_Mode = GPIO_Mode_Out_PP,
119 .GPIO_Pin = GPIO_Pin_5,
120 .GPIO_Speed = GPIO_Speed_10MHz,
121 .GPIO_Mode = GPIO_Mode_AF_PP,
129 .GPIO_Pin = GPIO_Pin_6,
130 .GPIO_Speed = GPIO_Speed_10MHz,
131 .GPIO_Mode = GPIO_Mode_IN_FLOATING,
139 .GPIO_Pin = GPIO_Pin_7,
140 .GPIO_Speed = GPIO_Speed_10MHz,
141 .GPIO_Mode = GPIO_Mode_AF_PP,
150 #if defined(PIOS_INCLUDE_OPENLRS)
154 pios_openlrs_t openlrs_handle;
156 static bool openlrs_int(
void) {
157 return PIOS_OpenLRS_EXT_Int(openlrs_handle);
161 .vector = openlrs_int,
166 .GPIO_Pin = GPIO_Pin_2,
167 .GPIO_Mode = GPIO_Mode_IN_FLOATING,
172 .NVIC_IRQChannel = EXTI2_IRQn,
174 .NVIC_IRQChannelSubPriority = 0,
175 .NVIC_IRQChannelCmd = ENABLE,
180 .EXTI_Line = EXTI_Line2,
181 .EXTI_Mode = EXTI_Mode_Interrupt,
182 .EXTI_Trigger = EXTI_Trigger_Falling,
183 .EXTI_LineCmd = ENABLE,
188 const struct stm32_gpio pios_openlrs_taulink_bind_button = {
192 .GPIO_Pin = GPIO_Pin_8,
193 .GPIO_Speed = GPIO_Speed_10MHz,
194 .GPIO_Mode = GPIO_Mode_IPD,
198 const struct pios_openlrs_cfg pios_openlrs_taulink_cfg = {
199 .spi_cfg = &pios_spi_rfm22b_cfg,
200 .exti_cfg = &pios_exti_rfm22b_cfg,
201 .gpio_direction = GPIO0_TX_GPIO1_RX,
203 .bind_button = &pios_openlrs_taulink_bind_button,
205 .bind_active_high =
true,
208 static const struct pios_exti_cfg pios_exti_rfm22b_cfg_module __exti_config = {
214 .GPIO_Pin = GPIO_Pin_1,
215 .GPIO_Mode = GPIO_Mode_IN_FLOATING,
220 .NVIC_IRQChannel = EXTI1_IRQn,
222 .NVIC_IRQChannelSubPriority = 0,
223 .NVIC_IRQChannelCmd = ENABLE,
228 .EXTI_Line = EXTI_Line1,
229 .EXTI_Mode = EXTI_Mode_Interrupt,
230 .EXTI_Trigger = EXTI_Trigger_Falling,
231 .EXTI_LineCmd = ENABLE,
236 struct pios_openlrs_cfg pios_openlrs_taulinkmodule_cfg = {
237 .spi_cfg = &pios_spi_rfm22b_cfg,
238 .exti_cfg = &pios_exti_rfm22b_cfg_module,
239 .gpio_direction = GPIO0_TX_GPIO1_RX,
243 const struct pios_openlrs_cfg * PIOS_BOARD_HW_DEFS_GetOpenLRSCfg (uint32_t
board_revision)
246 return &pios_openlrs_taulink_cfg;
248 return &pios_openlrs_taulinkmodule_cfg;
254 #if defined(PIOS_INCLUDE_ADC)
260 extern void PIOS_ADC_handler(
void);
263 static const struct pios_adc_cfg pios_adc_cfg = {
265 .ahb_clk = RCC_AHBPeriph_DMA1,
267 .
flags = (DMA1_FLAG_TC1 | DMA1_FLAG_TE1 | DMA1_FLAG_HT1 | DMA1_FLAG_GL1),
269 .NVIC_IRQChannel = DMA1_Channel1_IRQn,
271 .NVIC_IRQChannelSubPriority = 0,
272 .NVIC_IRQChannelCmd = ENABLE,
276 .channel = DMA1_Channel1,
278 .DMA_PeripheralBaseAddr = (uint32_t) & ADC1->DR,
279 .DMA_DIR = DMA_DIR_PeripheralSRC,
280 .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
281 .DMA_MemoryInc = DMA_MemoryInc_Enable,
282 .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word,
283 .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
284 .DMA_Mode = DMA_Mode_Circular,
285 .DMA_Priority = DMA_Priority_High,
286 .DMA_M2M = DMA_M2M_Disable,
290 .half_flag = DMA1_IT_HT1,
291 .full_flag = DMA1_IT_TC1,
294 struct pios_adc_dev pios_adc_devs[] = {
296 .cfg = &pios_adc_cfg,
297 .callback_function = NULL,
301 uint8_t pios_adc_num_devices =
NELEMENTS(pios_adc_devs);
303 void PIOS_ADC_handler() {
304 PIOS_ADC_DMA_Handler();
309 #if defined(PIOS_INCLUDE_TIM)
313 static const TIM_TimeBaseInitTypeDef tim_1_2_3_4_time_base = {
315 .TIM_ClockDivision = TIM_CKD_DIV1,
316 .TIM_CounterMode = TIM_CounterMode_Up,
318 .TIM_RepetitionCounter = 0x0000,
323 .time_base_init = &tim_1_2_3_4_time_base,
326 .NVIC_IRQChannel = TIM1_CC_IRQn,
328 .NVIC_IRQChannelSubPriority = 0,
329 .NVIC_IRQChannelCmd = ENABLE,
336 .time_base_init = &tim_1_2_3_4_time_base,
339 .NVIC_IRQChannel = TIM2_IRQn,
341 .NVIC_IRQChannelSubPriority = 0,
342 .NVIC_IRQChannelCmd = ENABLE,
349 .time_base_init = &tim_1_2_3_4_time_base,
352 .NVIC_IRQChannel = TIM3_IRQn,
354 .NVIC_IRQChannelSubPriority = 0,
355 .NVIC_IRQChannelCmd = ENABLE,
362 .time_base_init = &tim_1_2_3_4_time_base,
365 .NVIC_IRQChannel = TIM4_IRQn,
367 .NVIC_IRQChannelSubPriority = 0,
368 .NVIC_IRQChannelCmd = ENABLE,
375 .timer_chan = TIM_Channel_4,
379 .GPIO_Pin = GPIO_Pin_11,
380 .GPIO_Mode = GPIO_Mode_IPD,
381 .GPIO_Speed = GPIO_Speed_2MHz,
384 .remap = GPIO_PartialRemap2_TIM2,
389 #if defined(PIOS_INCLUDE_USART)
403 .NVIC_IRQChannel = USART1_IRQn,
405 .NVIC_IRQChannelSubPriority = 0,
406 .NVIC_IRQChannelCmd = ENABLE,
414 .GPIO_Pin = GPIO_Pin_10,
415 .GPIO_Speed = GPIO_Speed_2MHz,
416 .GPIO_Mode = GPIO_Mode_IPU,
424 .GPIO_Pin = GPIO_Pin_9,
425 .GPIO_Speed = GPIO_Speed_2MHz,
426 .GPIO_Mode = GPIO_Mode_AF_PP,
438 .NVIC_IRQChannel = USART2_IRQn,
440 .NVIC_IRQChannelSubPriority = 0,
441 .NVIC_IRQChannelCmd = ENABLE,
449 .GPIO_Pin = GPIO_Pin_3,
450 .GPIO_Speed = GPIO_Speed_2MHz,
451 .GPIO_Mode = GPIO_Mode_IPU,
459 .GPIO_Pin = GPIO_Pin_2,
460 .GPIO_Speed = GPIO_Speed_2MHz,
461 .GPIO_Mode = GPIO_Mode_AF_PP,
470 .NVIC_IRQChannel = USART3_IRQn,
472 .NVIC_IRQChannelSubPriority = 0,
473 .NVIC_IRQChannelCmd = ENABLE,
479 .GPIO_Pin = GPIO_Pin_10,
480 .GPIO_Speed = GPIO_Speed_2MHz,
481 .GPIO_Mode = GPIO_Mode_AF_PP,
488 #if defined(PIOS_INCLUDE_COM)
494 #if defined(PIOS_INCLUDE_RTC)
498 #include <pios_rtc_priv.h>
500 void PIOS_RTC_IRQ_Handler (
void);
503 .
clksrc = RCC_RTCCLKSource_HSE_Div128,
507 .NVIC_IRQChannel = RTC_IRQn,
509 .NVIC_IRQChannelSubPriority = 0,
510 .NVIC_IRQChannelCmd = ENABLE,
515 void PIOS_RTC_IRQ_Handler (
void)
525 #if defined(PIOS_INCLUDE_PPM)
530 .TIM_ICPolarity = TIM_ICPolarity_Rising,
531 .TIM_ICSelection = TIM_ICSelection_DirectTI,
532 .TIM_ICPrescaler = TIM_ICPSC_DIV1,
535 .channels = &pios_tim_ppm_flexi_port,
541 #if defined(PIOS_INCLUDE_RCVR)
546 #if defined(PIOS_INCLUDE_USB)
552 .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
554 .NVIC_IRQChannelSubPriority = 0,
555 .NVIC_IRQChannelCmd = ENABLE,
561 .GPIO_Pin = GPIO_Pin_8,
562 .GPIO_Speed = GPIO_Speed_10MHz,
563 .GPIO_Mode = GPIO_Mode_AF_OD,
574 #if defined(PIOS_INCLUDE_COM_MSG)
580 #if defined(PIOS_INCLUDE_USB_HID)
590 #if defined(PIOS_INCLUDE_USB_CDC)
603 #if defined(PIOS_INCLUDE_FLASH)
608 .arena_size = 0x00002000,
609 .slot_size = 0x00000100,
627 uintptr_t pios_internal_flash_id;
630 .chip_id = &pios_internal_flash_id,
632 .sector_blocks = stm32f1_sectors,
633 .num_blocks =
NELEMENTS(stm32f1_sectors),
639 .chip_desc = &pios_flash_chip_internal,
648 .chip_desc = &pios_flash_chip_internal,
657 .chip_desc = &pios_flash_chip_internal,
665 const struct pios_flash_partition * PIOS_BOARD_HW_DEFS_GetPartitionTable (uint32_t board_revision, uint32_t * num_partitions)
669 *num_partitions =
NELEMENTS(pios_flash_partition_table);
#define TAULINK_VERSION_STICK
COM MSG private definitions.
Defines the API to set up the HID + CDC USB descriptor config.
#define DMA1_Channel1_IRQHandler
#define PIOS_IRQ_PRIO_MID
USART private definitions.
static const struct pios_tim_clock_cfg tim_4_cfg
#define PIOS_SERVO_UPDATE_HZ
const struct pios_annunc * annunciators
static const struct pios_tim_clock_cfg tim_1_cfg
USB COM HID private definitions.
TIM_ICInitTypeDef tim_ic_init
Defines the API to set up the HID-only USB descriptor config.
void PIOS_RTC_irq_handler(void)
const struct pios_flash_driver * driver
const struct pios_flash_partition pios_flash_partition_table[]
#define PIOS_IRQ_PRIO_HIGH
static const struct pios_tim_clock_cfg tim_3_cfg
USB COM CDC private definitions.
enum pios_flash_partition_labels label
static const struct pios_tim_clock_cfg tim_2_cfg
#define PIOS_IRQ_PRIO_LOW
#define PIOS_Assert(test)
#define TAULINK_VERSION_MODULE
Implements an OpenLRS driver for the RFM22B.
const struct pios_flash_driver pios_internal_flash_driver
USART private definitions.
Defines the API to the board-specific USB data setup code.