dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board_hw_defs.c
Go to the documentation of this file.
1 
16 /*
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with this program; if not, see <http://www.gnu.org/licenses/>
29  */
30 
31 #include <pios_config.h>
32 #include <pios_board_info.h>
33 
34 #if defined(PIOS_INCLUDE_ANNUNC)
35 
36 #include <pios_annunc_priv.h>
37 static const struct pios_annunc pios_annuncs[] = {
38  [PIOS_LED_HEARTBEAT] = {
39  .pin = {
40  .gpio = GPIOD,
41  .init = {
42  .GPIO_Pin = GPIO_Pin_2,
43  .GPIO_Speed = GPIO_Speed_50MHz,
44  .GPIO_Mode = GPIO_Mode_OUT,
45  .GPIO_OType = GPIO_OType_PP,
46  .GPIO_PuPd = GPIO_PuPd_DOWN
47  },
48  },
49  .remap = 0,
50  .active_high = false,
51  },
52  [PIOS_LED_ALARM] = {
53  .pin = {
54  .gpio = GPIOB,
55  .init = {
56  .GPIO_Pin = GPIO_Pin_12,
57  .GPIO_Speed = GPIO_Speed_50MHz,
58  .GPIO_Mode = GPIO_Mode_OUT,
59  .GPIO_OType = GPIO_OType_PP,
60  .GPIO_PuPd = GPIO_PuPd_DOWN
61  },
62  },
63  .remap = 0,
64  .active_high = false,
65  }
66 };
67 
68 static const struct pios_annunc_cfg pios_annunc_cfg = {
69  .annunciators = pios_annuncs,
70  .num_annunciators = NELEMENTS(pios_annuncs),
71 };
72 
73 const struct pios_annunc_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t board_revision)
74 {
75  return &pios_annunc_cfg;
76 }
77 
78 #endif /* PIOS_INCLUDE_ANNUNC */
79 
80 
81 #if defined(PIOS_INCLUDE_SPI)
82 #include <pios_spi_priv.h>
83 
84 /* SPI3 Interface
85  * - Used for flash communications
86  */
87 static const struct pios_spi_cfg pios_spi_flash_cfg = {
88  .regs = SPI3,
89  .remap = GPIO_AF_SPI3,
90  .init = {
91  .SPI_Mode = SPI_Mode_Master,
92  .SPI_Direction = SPI_Direction_2Lines_FullDuplex,
93  .SPI_DataSize = SPI_DataSize_8b,
94  .SPI_NSS = SPI_NSS_Soft,
95  .SPI_FirstBit = SPI_FirstBit_MSB,
96  .SPI_CRCPolynomial = 7,
97  .SPI_CPOL = SPI_CPOL_High,
98  .SPI_CPHA = SPI_CPHA_2Edge,
99  .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2, //@ APB1 PCLK1 42MHz / 2 == 21MHz
100  },
101  .sclk = {
102  .gpio = GPIOC,
103  .init = {
104  .GPIO_Pin = GPIO_Pin_10,
105  .GPIO_Speed = GPIO_Speed_100MHz,
106  .GPIO_Mode = GPIO_Mode_AF,
107  .GPIO_OType = GPIO_OType_PP,
108  .GPIO_PuPd = GPIO_PuPd_NOPULL
109  },
110  .pin_source = GPIO_PinSource10,
111  },
112  .miso = {
113  .gpio = GPIOC,
114  .init = {
115  .GPIO_Pin = GPIO_Pin_11,
116  .GPIO_Speed = GPIO_Speed_50MHz,
117  .GPIO_Mode = GPIO_Mode_AF,
118  .GPIO_OType = GPIO_OType_PP,
119  .GPIO_PuPd = GPIO_PuPd_NOPULL
120  },
121  .pin_source = GPIO_PinSource11,
122  },
123  .mosi = {
124  .gpio = GPIOC,
125  .init = {
126  .GPIO_Pin = GPIO_Pin_12,
127  .GPIO_Speed = GPIO_Speed_50MHz,
128  .GPIO_Mode = GPIO_Mode_AF,
129  .GPIO_OType = GPIO_OType_PP,
130  .GPIO_PuPd = GPIO_PuPd_NOPULL
131  },
132  .pin_source = GPIO_PinSource12,
133  },
134  .slave_count = 1,
135  .ssel = { {
136  .gpio = GPIOA,
137  .init = {
138  .GPIO_Pin = GPIO_Pin_15,
139  .GPIO_Speed = GPIO_Speed_50MHz,
140  .GPIO_Mode = GPIO_Mode_OUT,
141  .GPIO_OType = GPIO_OType_PP,
142  .GPIO_PuPd = GPIO_PuPd_UP
143  },
144  .pin_source = GPIO_PinSource15,
145  } },
146 };
147 
148 pios_spi_t pios_spi_flash_id;
149 
150 #endif /* PIOS_INCLUDE_SPI */
151 
152 #if defined(PIOS_INCLUDE_FLASH)
153 #include "pios_flashfs_logfs_priv.h"
154 
155 static const struct flashfs_logfs_cfg flashfs_settings_cfg = {
156  .fs_magic = 0x3bb141cf,
157  .arena_size = 0x00004000, /* 64 * slot size */
158  .slot_size = 0x00000100, /* 256 bytes */
159 };
160 
161 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
162 #include "pios_flash_jedec_priv.h"
163 
164 static const struct pios_flash_jedec_cfg flash_mx25_cfg = {
166  .expect_memorytype = 0x20,
167  .expect_capacity = 0x17,
168  .sector_erase = 0x20,
169 };
170 #endif /* PIOS_INCLUDE_FLASH_JEDEC */
171 
172 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
174 
175 static const struct pios_flash_internal_cfg flash_internal_cfg = {
176 };
177 #endif /* PIOS_INCLUDE_FLASH_INTERNAL */
178 
179 #include "pios_flash_priv.h"
180 
181 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
182 static const struct pios_flash_sector_range stm32f4_sectors[] = {
183  {
184  .base_sector = 0,
185  .last_sector = 3,
186  .sector_size = FLASH_SECTOR_16KB,
187  },
188  {
189  .base_sector = 4,
190  .last_sector = 4,
191  .sector_size = FLASH_SECTOR_64KB,
192  },
193  {
194  .base_sector = 5,
195  .last_sector = 11,
196  .sector_size = FLASH_SECTOR_128KB,
197  },
198 
199 };
200 
201 uintptr_t pios_internal_flash_id;
202 static const struct pios_flash_chip pios_flash_chip_internal = {
204  .chip_id = &pios_internal_flash_id,
205  .page_size = 16, /* 128-bit rows */
206  .sector_blocks = stm32f4_sectors,
207  .num_blocks = NELEMENTS(stm32f4_sectors),
208 };
209 #endif /* PIOS_INCLUDE_FLASH_INTERNAL */
210 
211 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
212 static const struct pios_flash_sector_range mx25_sectors[] = {
213  {
214  .base_sector = 0,
215  .last_sector = 2047,
216  .sector_size = FLASH_SECTOR_4KB,
217  },
218 };
219 
220 uintptr_t pios_external_flash_id;
221 static const struct pios_flash_chip pios_flash_chip_external = {
223  .chip_id = &pios_external_flash_id,
224  .page_size = 256,
225  .sector_blocks = mx25_sectors,
226  .num_blocks = NELEMENTS(mx25_sectors),
227 };
228 #endif /* PIOS_INCLUDE_FLASH_JEDEC */
229 
230 static const struct pios_flash_partition pios_flash_partition_table[] = {
231 #if defined(PIOS_INCLUDE_FLASH_INTERNAL)
232  {
234  .chip_desc = &pios_flash_chip_internal,
235  .first_sector = 0,
236  .last_sector = 1,
237  .chip_offset = 0,
238  .size = (1 - 0 + 1) * FLASH_SECTOR_16KB,
239  },
240 
241  /* NOTE: sectors 2-4 of the internal flash are currently unallocated */
242 
243  {
244  .label = FLASH_PARTITION_LABEL_FW,
245  .chip_desc = &pios_flash_chip_internal,
246  .first_sector = 5,
247  .last_sector = 11,
248  .chip_offset = (4 * FLASH_SECTOR_16KB) + (1 * FLASH_SECTOR_64KB),
249  .size = (11 - 5 + 1) * FLASH_SECTOR_128KB,
250  },
251 
252 #endif /* PIOS_INCLUDE_FLASH_INTERNAL */
253 
254 #if defined(PIOS_INCLUDE_FLASH_JEDEC)
255  {
257  .chip_desc = &pios_flash_chip_external,
258  .first_sector = 0,
259  .last_sector = 15,
260  .chip_offset = 0,
261  .size = (15 - 0 + 1) * FLASH_SECTOR_4KB,
262  },
263 
264  {
266  .chip_desc = &pios_flash_chip_external,
267  .first_sector = 16,
268  .last_sector = 31,
269  .chip_offset = (16 * FLASH_SECTOR_4KB),
270  .size = (31 - 16 + 1) * FLASH_SECTOR_4KB,
271  },
272 
273  {
274  .label = FLASH_PARTITION_LABEL_LOG,
275  .chip_desc = &pios_flash_chip_external,
276  .first_sector = 32,
277  .last_sector = 2047,
278  .chip_offset = (32 * FLASH_SECTOR_4KB),
279  .size = (2047 - 32 + 1) * FLASH_SECTOR_4KB,
280  },
281 #endif /* PIOS_INCLUDE_FLASH_JEDEC */
282 };
283 
284 const struct pios_flash_partition * PIOS_BOARD_HW_DEFS_GetPartitionTable (uint32_t board_revision, uint32_t * num_partitions)
285 {
286  PIOS_Assert(num_partitions);
287 
288  *num_partitions = NELEMENTS(pios_flash_partition_table);
290 }
291 
292 
293 #endif /* PIOS_INCLUDE_FLASH */
294 
295 #if defined(PIOS_INCLUDE_I2C)
296 
297 #include <pios_i2c_priv.h>
298 
299 /*
300  * I2C Adapters
301  */
302 void PIOS_I2C_internal_ev_irq_handler(void);
303 void PIOS_I2C_internal_er_irq_handler(void);
304 void I2C1_EV_IRQHandler() __attribute__ ((alias ("PIOS_I2C_internal_ev_irq_handler")));
305 void I2C1_ER_IRQHandler() __attribute__ ((alias ("PIOS_I2C_internal_er_irq_handler")));
306 
307 static const struct pios_i2c_adapter_cfg pios_i2c_internal_cfg = {
308  .regs = I2C1,
309  .remap = GPIO_AF_I2C1,
310  .init = {
311  .I2C_Mode = I2C_Mode_I2C,
312  .I2C_OwnAddress1 = 0,
313  .I2C_Ack = I2C_Ack_Enable,
314  .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
315  .I2C_DutyCycle = I2C_DutyCycle_2,
316  .I2C_ClockSpeed = 400000, /* bits/s */
317  },
318  .transfer_timeout_ms = 50,
319  .scl = {
320  .gpio = GPIOB,
321  .init = {
322  .GPIO_Pin = GPIO_Pin_8,
323  .GPIO_Mode = GPIO_Mode_AF,
324  .GPIO_Speed = GPIO_Speed_50MHz,
325  .GPIO_OType = GPIO_OType_OD,
326  .GPIO_PuPd = GPIO_PuPd_NOPULL,
327  },
328  .pin_source = GPIO_PinSource8,
329  },
330  .sda = {
331  .gpio = GPIOB,
332  .init = {
333  .GPIO_Pin = GPIO_Pin_9,
334  .GPIO_Mode = GPIO_Mode_AF,
335  .GPIO_Speed = GPIO_Speed_50MHz,
336  .GPIO_OType = GPIO_OType_OD,
337  .GPIO_PuPd = GPIO_PuPd_NOPULL,
338  },
339  .pin_source = GPIO_PinSource9,
340  },
341  .event = {
342  .flags = 0, /* FIXME: check this */
343  .init = {
344  .NVIC_IRQChannel = I2C1_EV_IRQn,
345  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
346  .NVIC_IRQChannelSubPriority = 0,
347  .NVIC_IRQChannelCmd = ENABLE,
348  },
349  },
350  .error = {
351  .flags = 0, /* FIXME: check this */
352  .init = {
353  .NVIC_IRQChannel = I2C1_ER_IRQn,
354  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
355  .NVIC_IRQChannelSubPriority = 0,
356  .NVIC_IRQChannelCmd = ENABLE,
357  },
358  },
359 };
360 
361 pios_i2c_t pios_i2c_internal_id;
362 void PIOS_I2C_internal_ev_irq_handler(void)
363 {
364  /* Call into the generic code to handle the IRQ for this specific device */
365  PIOS_I2C_EV_IRQ_Handler(pios_i2c_internal_id);
366 }
367 
368 void PIOS_I2C_internal_er_irq_handler(void)
369 {
370  /* Call into the generic code to handle the IRQ for this specific device */
371  PIOS_I2C_ER_IRQ_Handler(pios_i2c_internal_id);
372 }
373 
374 
375 void PIOS_I2C_flexi_ev_irq_handler(void);
376 void PIOS_I2C_flexi_er_irq_handler(void);
377 void I2C2_EV_IRQHandler() __attribute__ ((alias ("PIOS_I2C_flexi_ev_irq_handler")));
378 void I2C2_ER_IRQHandler() __attribute__ ((alias ("PIOS_I2C_flexi_er_irq_handler")));
379 
380 static const struct pios_i2c_adapter_cfg pios_i2c_flexi_cfg = {
381  .regs = I2C2,
382  .remap = GPIO_AF_I2C2,
383  .init = {
384  .I2C_Mode = I2C_Mode_I2C,
385  .I2C_OwnAddress1 = 0,
386  .I2C_Ack = I2C_Ack_Enable,
387  .I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
388  .I2C_DutyCycle = I2C_DutyCycle_2,
389  .I2C_ClockSpeed = 400000, /* bits/s */
390  },
391  .transfer_timeout_ms = 50,
392  .scl = {
393  .gpio = GPIOB,
394  .init = {
395  .GPIO_Pin = GPIO_Pin_10,
396  .GPIO_Mode = GPIO_Mode_AF,
397  .GPIO_Speed = GPIO_Speed_50MHz,
398  .GPIO_OType = GPIO_OType_OD,
399  .GPIO_PuPd = GPIO_PuPd_NOPULL,
400  },
401  .pin_source = GPIO_PinSource10,
402  },
403  .sda = {
404  .gpio = GPIOB,
405  .init = {
406  .GPIO_Pin = GPIO_Pin_11,
407  .GPIO_Mode = GPIO_Mode_AF,
408  .GPIO_Speed = GPIO_Speed_50MHz,
409  .GPIO_OType = GPIO_OType_OD,
410  .GPIO_PuPd = GPIO_PuPd_NOPULL,
411  },
412  .pin_source = GPIO_PinSource11,
413  },
414  .event = {
415  .flags = 0, /* FIXME: check this */
416  .init = {
417  .NVIC_IRQChannel = I2C2_EV_IRQn,
418  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
419  .NVIC_IRQChannelSubPriority = 0,
420  .NVIC_IRQChannelCmd = ENABLE,
421  },
422  },
423  .error = {
424  .flags = 0, /* FIXME: check this */
425  .init = {
426  .NVIC_IRQChannel = I2C2_ER_IRQn,
427  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
428  .NVIC_IRQChannelSubPriority = 0,
429  .NVIC_IRQChannelCmd = ENABLE,
430  },
431  },
432 };
433 
434 pios_i2c_t pios_i2c_flexi_id;
435 void PIOS_I2C_flexi_ev_irq_handler(void)
436 {
437  /* Call into the generic code to handle the IRQ for this specific device */
438  PIOS_I2C_EV_IRQ_Handler(pios_i2c_flexi_id);
439 }
440 
441 void PIOS_I2C_flexi_er_irq_handler(void)
442 {
443  /* Call into the generic code to handle the IRQ for this specific device */
444  PIOS_I2C_ER_IRQ_Handler(pios_i2c_flexi_id);
445 }
446 
447 #endif /* PIOS_INCLUDE_I2C */
448 
449 
450 #if defined(PIOS_INCLUDE_USART)
451 
452 #include "pios_usart_priv.h"
453 
454 #if defined(PIOS_INCLUDE_DSM)
455 /*
456  * Spektrum/JR DSM USART
457  */
458 #include <pios_dsm_priv.h>
459 
460 static const struct pios_dsm_cfg pios_mainport_dsm_aux_cfg = {
461  .bind = {
462  .gpio = GPIOB,
463  .init = {
464  .GPIO_Pin = GPIO_Pin_7,
465  .GPIO_Speed = GPIO_Speed_2MHz,
466  .GPIO_Mode = GPIO_Mode_OUT,
467  .GPIO_OType = GPIO_OType_PP,
468  .GPIO_PuPd = GPIO_PuPd_NOPULL
469  },
470  },
471 };
472 
473 static const struct pios_dsm_cfg pios_flxport_dsm_aux_cfg = {
474  .bind = {
475  .gpio = GPIOB,
476  .init = {
477  .GPIO_Pin = GPIO_Pin_11,
478  .GPIO_Speed = GPIO_Speed_2MHz,
479  .GPIO_Mode = GPIO_Mode_OUT,
480  .GPIO_OType = GPIO_OType_PP,
481  .GPIO_PuPd = GPIO_PuPd_NOPULL
482  },
483  },
484 };
485 
486 static const struct pios_dsm_cfg pios_rxportusart_dsm_aux_cfg = {
487  .bind = {
488  .gpio = GPIOC,
489  .init = {
490  .GPIO_Pin = GPIO_Pin_7,
491  .GPIO_Speed = GPIO_Speed_2MHz,
492  .GPIO_Mode = GPIO_Mode_OUT,
493  .GPIO_OType = GPIO_OType_PP,
494  .GPIO_PuPd = GPIO_PuPd_NOPULL
495  },
496  },
497 };
498 
499 #endif /* PIOS_INCLUDE_DSM */
500 
501 #if defined(PIOS_INCLUDE_SBUS)
502 
503 #include <pios_sbus_priv.h>
504 
505 static const struct pios_sbus_cfg pios_mainport_sbus_aux_cfg = {
506  /* Inverter configuration */
507  .inv = {
508  .gpio = GPIOC,
509  .init = {
510  .GPIO_Pin = GPIO_Pin_14,
511  .GPIO_Speed = GPIO_Speed_2MHz,
512  .GPIO_Mode = GPIO_Mode_OUT,
513  .GPIO_OType = GPIO_OType_PP,
514  .GPIO_PuPd = GPIO_PuPd_NOPULL
515  },
516  },
517  .gpio_inv_enable = Bit_SET,
518 };
519 
520 #endif /* PIOS_INCLUDE_SBUS */
521 
522 static const struct pios_usart_cfg pios_mainport_cfg = {
523  .regs = USART1,
524  .remap = GPIO_AF_USART1,
525  .irq = {
526  .init = {
527  .NVIC_IRQChannel = USART1_IRQn,
528  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
529  .NVIC_IRQChannelSubPriority = 0,
530  .NVIC_IRQChannelCmd = ENABLE,
531  },
532  },
533  .rx = {
534  .gpio = GPIOB,
535  .init = {
536  .GPIO_Pin = GPIO_Pin_7,
537  .GPIO_Speed = GPIO_Speed_2MHz,
538  .GPIO_Mode = GPIO_Mode_AF,
539  .GPIO_OType = GPIO_OType_PP,
540  .GPIO_PuPd = GPIO_PuPd_UP
541  },
542  .pin_source = GPIO_PinSource7,
543  },
544  .tx = {
545  .gpio = GPIOB,
546  .init = {
547  .GPIO_Pin = GPIO_Pin_6,
548  .GPIO_Speed = GPIO_Speed_2MHz,
549  .GPIO_Mode = GPIO_Mode_AF,
550  .GPIO_OType = GPIO_OType_PP,
551  .GPIO_PuPd = GPIO_PuPd_UP
552  },
553  .pin_source = GPIO_PinSource6,
554  },
555 };
556 
557 static const struct pios_usart_cfg pios_flxport_cfg = {
558  .regs = USART3,
559  .remap = GPIO_AF_USART3,
560  .irq = {
561  .init = {
562  .NVIC_IRQChannel = USART3_IRQn,
563  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
564  .NVIC_IRQChannelSubPriority = 0,
565  .NVIC_IRQChannelCmd = ENABLE,
566  },
567  },
568  .rx = {
569  .gpio = GPIOB,
570  .init = {
571  .GPIO_Pin = GPIO_Pin_11,
572  .GPIO_Speed = GPIO_Speed_2MHz,
573  .GPIO_Mode = GPIO_Mode_AF,
574  .GPIO_OType = GPIO_OType_PP,
575  .GPIO_PuPd = GPIO_PuPd_UP
576  },
577  .pin_source = GPIO_PinSource11,
578  },
579  .tx = {
580  .gpio = GPIOB,
581  .init = {
582  .GPIO_Pin = GPIO_Pin_10,
583  .GPIO_Speed = GPIO_Speed_2MHz,
584  .GPIO_Mode = GPIO_Mode_AF,
585  .GPIO_OType = GPIO_OType_PP,
586  .GPIO_PuPd = GPIO_PuPd_UP
587  },
588  .pin_source = GPIO_PinSource10,
589  },
590 };
591 
592 static const struct pios_usart_cfg pios_rxportusart_cfg = {
593  .regs = USART6,
594  .remap = GPIO_AF_USART6,
595  .irq = {
596  .init = {
597  .NVIC_IRQChannel = USART6_IRQn,
598  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
599  .NVIC_IRQChannelSubPriority = 0,
600  .NVIC_IRQChannelCmd = ENABLE,
601  },
602  },
603  .rx = {
604  .gpio = GPIOC,
605  .init = {
606  .GPIO_Pin = GPIO_Pin_7,
607  .GPIO_Speed = GPIO_Speed_2MHz,
608  .GPIO_Mode = GPIO_Mode_AF,
609  .GPIO_OType = GPIO_OType_PP,
610  .GPIO_PuPd = GPIO_PuPd_UP
611  },
612  .pin_source = GPIO_PinSource7,
613  },
614  .tx = {
615  .gpio = GPIOC,
616  .init = {
617  .GPIO_Pin = GPIO_Pin_6,
618  .GPIO_Speed = GPIO_Speed_2MHz,
619  .GPIO_Mode = GPIO_Mode_AF,
620  .GPIO_OType = GPIO_OType_PP,
621  .GPIO_PuPd = GPIO_PuPd_UP
622  },
623  .pin_source = GPIO_PinSource6,
624  },
625 };
626 
627 /* uart 4 and 5 are RX only and available */
628 
629 #endif /* PIOS_INCLUDE_USART */
630 
631 #if defined(PIOS_INCLUDE_COM)
632 
633 #include "pios_com_priv.h"
634 
635 #endif /* PIOS_INCLUDE_COM */
636 
637 #if defined(PIOS_INCLUDE_RTC)
638 /*
639  * Realtime Clock (RTC)
640  */
641 #include <pios_rtc_priv.h>
642 
643 void PIOS_RTC_IRQ_Handler (void);
644 void RTC_WKUP_IRQHandler() __attribute__ ((alias ("PIOS_RTC_IRQ_Handler")));
645 static const struct pios_rtc_cfg pios_rtc_main_cfg = {
646  // FIXME for real board the clock is 16MHz
647  .clksrc = RCC_RTCCLKSource_HSE_Div16, // Divide 8 Mhz crystal down to 1
648  // For some reason it's acting like crystal is 16 Mhz. This clock is then divided
649  // by another 16 to give a nominal 62.5 khz clock
650  .prescaler = 100, // Every 100 cycles gives 625 Hz
651  .irq = {
652  .init = {
653  .NVIC_IRQChannel = RTC_WKUP_IRQn,
654  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
655  .NVIC_IRQChannelSubPriority = 0,
656  .NVIC_IRQChannelCmd = ENABLE,
657  },
658  },
659 };
660 
661 void PIOS_RTC_IRQ_Handler (void)
662 {
664 }
665 
666 #endif
667 
668 
669 #include "pios_tim_priv.h"
670 
671 //Timers used for inputs (8, 12)
672 
673 static const TIM_TimeBaseInitTypeDef tim_8_time_base = {
674  .TIM_Prescaler = (PIOS_PERIPHERAL_APB2_COUNTER_CLOCK / 1000000) - 1,
675  .TIM_ClockDivision = TIM_CKD_DIV1,
676  .TIM_CounterMode = TIM_CounterMode_Up,
677  .TIM_Period = 0xFFFF,
678  .TIM_RepetitionCounter = 0x0000,
679 };
680 
681 static const TIM_TimeBaseInitTypeDef tim_12_time_base = {
682  .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
683  .TIM_ClockDivision = TIM_CKD_DIV1,
684  .TIM_CounterMode = TIM_CounterMode_Up,
685  .TIM_Period = 0xFFFF,
686  .TIM_RepetitionCounter = 0x0000,
687 };
688 
689 static const struct pios_tim_clock_cfg tim_8_cfg = {
690  .timer = TIM8,
691  .time_base_init = &tim_8_time_base,
692  .irq = {
693  .init = {
694  .NVIC_IRQChannel = TIM8_CC_IRQn,
695  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
696  .NVIC_IRQChannelSubPriority = 0,
697  .NVIC_IRQChannelCmd = ENABLE,
698  },
699  },
700 };
701 
702 static const struct pios_tim_clock_cfg tim_12_cfg = {
703  .timer = TIM12,
704  .time_base_init = &tim_12_time_base,
705  .irq = {
706  .init = {
707  .NVIC_IRQChannel = TIM8_BRK_TIM12_IRQn,
708  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
709  .NVIC_IRQChannelSubPriority = 0,
710  .NVIC_IRQChannelCmd = ENABLE,
711  },
712  },
713 };
714 
715 // Timers used for outputs (5))
716 
717 // Set up timers that only have inputs on APB1
718 static const TIM_TimeBaseInitTypeDef tim_5_time_base = {
719  .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 1000000) - 1,
720  .TIM_ClockDivision = TIM_CKD_DIV1,
721  .TIM_CounterMode = TIM_CounterMode_Up,
722  .TIM_Period = ((1000000 / PIOS_SERVO_UPDATE_HZ) - 1),
723  .TIM_RepetitionCounter = 0x0000,
724 };
725 
726 static const struct pios_tim_clock_cfg tim_5_cfg = {
727  .timer = TIM5,
728  .time_base_init = &tim_5_time_base,
729  .irq = {
730  .init = {
731  .NVIC_IRQChannel = TIM5_IRQn,
732  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
733  .NVIC_IRQChannelSubPriority = 0,
734  .NVIC_IRQChannelCmd = ENABLE,
735  },
736  },
737 };
738 
743 /*
744  * OUTPUTS
745  1: TIM5_CH1 (PA0)
746  2: TIM5_CH2 (PA1)
747  3: TIM5_CH3 (PA2)
748  4: TIM5_CH4 (PA3)
749  */
750 
752  {
753  .timer = TIM5,
754  .timer_chan = TIM_Channel_1,
755  .remap = GPIO_AF_TIM5,
756  .pin = {
757  .gpio = GPIOA,
758  .init = {
759  .GPIO_Pin = GPIO_Pin_0,
760  .GPIO_Speed = GPIO_Speed_2MHz,
761  .GPIO_Mode = GPIO_Mode_AF,
762  .GPIO_OType = GPIO_OType_PP,
763  .GPIO_PuPd = GPIO_PuPd_UP
764  },
765  .pin_source = GPIO_PinSource0,
766  },
767  },
768  {
769  .timer = TIM5,
770  .timer_chan = TIM_Channel_2,
771  .remap = GPIO_AF_TIM5,
772  .pin = {
773  .gpio = GPIOA,
774  .init = {
775  .GPIO_Pin = GPIO_Pin_1,
776  .GPIO_Speed = GPIO_Speed_2MHz,
777  .GPIO_Mode = GPIO_Mode_AF,
778  .GPIO_OType = GPIO_OType_PP,
779  .GPIO_PuPd = GPIO_PuPd_UP
780  },
781  .pin_source = GPIO_PinSource1,
782  },
783  },
784  {
785  .timer = TIM5,
786  .timer_chan = TIM_Channel_3,
787  .remap = GPIO_AF_TIM5,
788  .pin = {
789  .gpio = GPIOA,
790  .init = {
791  .GPIO_Pin = GPIO_Pin_2,
792  .GPIO_Speed = GPIO_Speed_2MHz,
793  .GPIO_Mode = GPIO_Mode_AF,
794  .GPIO_OType = GPIO_OType_PP,
795  .GPIO_PuPd = GPIO_PuPd_UP
796  },
797  .pin_source = GPIO_PinSource2,
798  },
799  },
800  {
801  .timer = TIM5,
802  .timer_chan = TIM_Channel_4,
803  .remap = GPIO_AF_TIM5,
804  .pin = {
805  .gpio = GPIOA,
806  .init = {
807  .GPIO_Pin = GPIO_Pin_3,
808  .GPIO_Speed = GPIO_Speed_2MHz,
809  .GPIO_Mode = GPIO_Mode_AF,
810  .GPIO_OType = GPIO_OType_PP,
811  .GPIO_PuPd = GPIO_PuPd_UP
812  },
813  .pin_source = GPIO_PinSource3,
814  },
815  }
816 };
817 
818 /*
819  * OUTPUTS with extra outputs on recieverport
820  * 1: TIM5_CH1 (PA0)
821  2: TIM5_CH2 (PA1)
822  3: TIM5_CH3 (PA2)
823  4: TIM5_CH4 (PA3)
824  5: TIM8_CH1 (PC6)
825  6: TIM8_CH2 (PC7)
826  7: TIM8_CH3 (PC8)
827  8: TIM8_CH4 (PC9)
828  */
829 
831  { // output 1
832  .timer = TIM5,
833  .timer_chan = TIM_Channel_1,
834  .remap = GPIO_AF_TIM5,
835  .pin = {
836  .gpio = GPIOA,
837  .init = {
838  .GPIO_Pin = GPIO_Pin_0,
839  .GPIO_Speed = GPIO_Speed_2MHz,
840  .GPIO_Mode = GPIO_Mode_AF,
841  .GPIO_OType = GPIO_OType_PP,
842  .GPIO_PuPd = GPIO_PuPd_UP
843  },
844  .pin_source = GPIO_PinSource0,
845  },
846  },
847  { // output 2
848  .timer = TIM5,
849  .timer_chan = TIM_Channel_2,
850  .remap = GPIO_AF_TIM5,
851  .pin = {
852  .gpio = GPIOA,
853  .init = {
854  .GPIO_Pin = GPIO_Pin_1,
855  .GPIO_Speed = GPIO_Speed_2MHz,
856  .GPIO_Mode = GPIO_Mode_AF,
857  .GPIO_OType = GPIO_OType_PP,
858  .GPIO_PuPd = GPIO_PuPd_UP
859  },
860  .pin_source = GPIO_PinSource1,
861  },
862  },
863  { // output 3
864  .timer = TIM5,
865  .timer_chan = TIM_Channel_3,
866  .remap = GPIO_AF_TIM5,
867  .pin = {
868  .gpio = GPIOA,
869  .init = {
870  .GPIO_Pin = GPIO_Pin_2,
871  .GPIO_Speed = GPIO_Speed_2MHz,
872  .GPIO_Mode = GPIO_Mode_AF,
873  .GPIO_OType = GPIO_OType_PP,
874  .GPIO_PuPd = GPIO_PuPd_UP
875  },
876  .pin_source = GPIO_PinSource2,
877  },
878  },
879  { // output 4
880  .timer = TIM5,
881  .timer_chan = TIM_Channel_4,
882  .remap = GPIO_AF_TIM5,
883  .pin = {
884  .gpio = GPIOA,
885  .init = {
886  .GPIO_Pin = GPIO_Pin_3,
887  .GPIO_Speed = GPIO_Speed_2MHz,
888  .GPIO_Mode = GPIO_Mode_AF,
889  .GPIO_OType = GPIO_OType_PP,
890  .GPIO_PuPd = GPIO_PuPd_UP
891  },
892  .pin_source = GPIO_PinSource3,
893  },
894  },
895  { // output 5
896  .timer = TIM8,
897  .timer_chan = TIM_Channel_3,
898  .remap = GPIO_AF_TIM8,
899  .pin = {
900  .gpio = GPIOC,
901  .init = {
902  .GPIO_Pin = GPIO_Pin_8,
903  .GPIO_Speed = GPIO_Speed_2MHz,
904  .GPIO_Mode = GPIO_Mode_AF,
905  .GPIO_OType = GPIO_OType_PP,
906  .GPIO_PuPd = GPIO_PuPd_UP
907  },
908  .pin_source = GPIO_PinSource8,
909  },
910  },
911  { // output 6
912  .timer = TIM8,
913  .timer_chan = TIM_Channel_4,
914  .remap = GPIO_AF_TIM8,
915  .pin = {
916  .gpio = GPIOC,
917  .init = {
918  .GPIO_Pin = GPIO_Pin_9,
919  .GPIO_Speed = GPIO_Speed_2MHz,
920  .GPIO_Mode = GPIO_Mode_AF,
921  .GPIO_OType = GPIO_OType_PP,
922  .GPIO_PuPd = GPIO_PuPd_UP
923  },
924  .pin_source = GPIO_PinSource9,
925  },
926  },
927  { // ouput 7
928  .timer = TIM8,
929  .timer_chan = TIM_Channel_1,
930  .remap = GPIO_AF_TIM8,
931  .pin = {
932  .gpio = GPIOC,
933  .init = {
934  .GPIO_Pin = GPIO_Pin_6,
935  .GPIO_Speed = GPIO_Speed_2MHz,
936  .GPIO_Mode = GPIO_Mode_AF,
937  .GPIO_OType = GPIO_OType_PP,
938  .GPIO_PuPd = GPIO_PuPd_UP
939  },
940  .pin_source = GPIO_PinSource6,
941  },
942  },
943  { // output 8
944  .timer = TIM8,
945  .timer_chan = TIM_Channel_2,
946  .remap = GPIO_AF_TIM8,
947  .pin = {
948  .gpio = GPIOC,
949  .init = {
950  .GPIO_Pin = GPIO_Pin_7,
951  .GPIO_Speed = GPIO_Speed_2MHz,
952  .GPIO_Mode = GPIO_Mode_AF,
953  .GPIO_OType = GPIO_OType_PP,
954  .GPIO_PuPd = GPIO_PuPd_UP
955  },
956  .pin_source = GPIO_PinSource7,
957  },
958  },
959  { // output 9
960  .timer = TIM12,
961  .timer_chan = TIM_Channel_1,
962  .remap = GPIO_AF_TIM12,
963  .pin = {
964  .gpio = GPIOB,
965  .init = {
966  .GPIO_Pin = GPIO_Pin_14,
967  .GPIO_Speed = GPIO_Speed_2MHz,
968  .GPIO_Mode = GPIO_Mode_AF,
969  .GPIO_OType = GPIO_OType_PP,
970  .GPIO_PuPd = GPIO_PuPd_UP
971  },
972  .pin_source = GPIO_PinSource14,
973  },
974  },
975  { // output 10
976  .timer = TIM12,
977  .timer_chan = TIM_Channel_2,
978  .remap = GPIO_AF_TIM12,
979  .pin = {
980  .gpio = GPIOB,
981  .init = {
982  .GPIO_Pin = GPIO_Pin_15,
983  .GPIO_Speed = GPIO_Speed_2MHz,
984  .GPIO_Mode = GPIO_Mode_AF,
985  .GPIO_OType = GPIO_OType_PP,
986  .GPIO_PuPd = GPIO_PuPd_UP
987  },
988  .pin_source = GPIO_PinSource15,
989  },
990  }
991 };
992 
993 #if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
994 /*
995  * Servo outputs
996  */
997 #include <pios_servo_priv.h>
998 
999 const struct pios_servo_cfg pios_servo_cfg = {
1000  .tim_oc_init = {
1001  .TIM_OCMode = TIM_OCMode_PWM1,
1002  .TIM_OutputState = TIM_OutputState_Enable,
1003  .TIM_OutputNState = TIM_OutputNState_Disable,
1004  .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
1005  .TIM_OCPolarity = TIM_OCPolarity_High,
1006  .TIM_OCNPolarity = TIM_OCPolarity_High,
1007  .TIM_OCIdleState = TIM_OCIdleState_Reset,
1008  .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1009  },
1010  .channels = pios_tim_servoport_all_pins,
1011  .num_channels = NELEMENTS(pios_tim_servoport_all_pins),
1012 };
1013 
1014 const struct pios_servo_cfg pios_servo_rcvr_ppm_cfg = {
1015  .tim_oc_init = {
1016  .TIM_OCMode = TIM_OCMode_PWM1,
1017  .TIM_OutputState = TIM_OutputState_Enable,
1018  .TIM_OutputNState = TIM_OutputNState_Disable,
1019  .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
1020  .TIM_OCPolarity = TIM_OCPolarity_High,
1021  .TIM_OCNPolarity = TIM_OCPolarity_High,
1022  .TIM_OCIdleState = TIM_OCIdleState_Reset,
1023  .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1024  },
1026  .num_channels = NELEMENTS(pios_tim_servoport_rcvrport_pins) - 2,
1027 };
1028 
1029 const struct pios_servo_cfg pios_servo_rcvr_ppm_uart_out_cfg = {
1030  .tim_oc_init = {
1031  .TIM_OCMode = TIM_OCMode_PWM1,
1032  .TIM_OutputState = TIM_OutputState_Enable,
1033  .TIM_OutputNState = TIM_OutputNState_Disable,
1034  .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
1035  .TIM_OCPolarity = TIM_OCPolarity_High,
1036  .TIM_OCNPolarity = TIM_OCPolarity_High,
1037  .TIM_OCIdleState = TIM_OCIdleState_Reset,
1038  .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1039  },
1041  .num_channels = NELEMENTS(pios_tim_servoport_rcvrport_pins) - 4,
1042 };
1043 
1044 const struct pios_servo_cfg pios_servo_rcvr_all_cfg = {
1045  .tim_oc_init = {
1046  .TIM_OCMode = TIM_OCMode_PWM1,
1047  .TIM_OutputState = TIM_OutputState_Enable,
1048  .TIM_OutputNState = TIM_OutputNState_Disable,
1049  .TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
1050  .TIM_OCPolarity = TIM_OCPolarity_High,
1051  .TIM_OCNPolarity = TIM_OCPolarity_High,
1052  .TIM_OCIdleState = TIM_OCIdleState_Reset,
1053  .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1054  },
1056  .num_channels = NELEMENTS(pios_tim_servoport_rcvrport_pins),
1057 };
1058 
1059 #if defined(PIOS_INCLUDE_DMASHOT)
1060 
1061 #include <pios_dmashot.h>
1062 
1063 // Enable pins 1-8 for DMA.
1064 // Pins 9 & 10 on TIM12 should fall back onto GPIO DShot.
1065 // Unlikely that these find use configured as such.
1066 
1067 static const struct pios_dmashot_timer_cfg dmashot_tim_cfg[] = {
1068  {
1069  .timer = TIM5,
1070  .stream = DMA1_Stream6,
1071  .channel = DMA_Channel_6,
1072  .tcif = DMA_FLAG_TCIF6
1073  },
1074  {
1075  .timer = TIM8,
1076  .stream = DMA2_Stream1,
1077  .channel = DMA_Channel_7,
1078  .tcif = DMA_FLAG_TCIF1
1079  }
1080 };
1081 
1082 static const struct pios_dmashot_cfg dmashot_config = {
1083  .timer_cfg = &dmashot_tim_cfg[0],
1084  .num_timers = NELEMENTS(dmashot_tim_cfg)
1085 };
1086 
1087 #endif // defined(PIOS_INCLUDE_DMASHOT)
1088 
1089 #endif /* PIOS_INCLUDE_SERVO && PIOS_INCLUDE_TIM */
1090 
1091 /*
1092  * INPUTS
1093  1: TIM12_CH1 (PB14)
1094  2: TIM12_CH2 (PB15)
1095  3: TIM8_CH1 (PC6)
1096  4: TIM8_CH2 (PC7)
1097  5: TIM8_CH3 (PC8)
1098  6: TIM8_CH4 (PC9)
1099  */
1101  {
1102  .timer = TIM12,
1103  .timer_chan = TIM_Channel_1,
1104  .remap = GPIO_AF_TIM12,
1105  .pin = {
1106  .gpio = GPIOB,
1107  .init = {
1108  .GPIO_Pin = GPIO_Pin_14,
1109  .GPIO_Speed = GPIO_Speed_2MHz,
1110  .GPIO_Mode = GPIO_Mode_AF,
1111  .GPIO_OType = GPIO_OType_PP,
1112  .GPIO_PuPd = GPIO_PuPd_UP
1113  },
1114  .pin_source = GPIO_PinSource14,
1115  },
1116  },
1117  {
1118  .timer = TIM12,
1119  .timer_chan = TIM_Channel_2,
1120  .remap = GPIO_AF_TIM12,
1121  .pin = {
1122  .gpio = GPIOB,
1123  .init = {
1124  .GPIO_Pin = GPIO_Pin_15,
1125  .GPIO_Speed = GPIO_Speed_2MHz,
1126  .GPIO_Mode = GPIO_Mode_AF,
1127  .GPIO_OType = GPIO_OType_PP,
1128  .GPIO_PuPd = GPIO_PuPd_UP
1129  },
1130  .pin_source = GPIO_PinSource15,
1131  },
1132  },
1133  {
1134  .timer = TIM8,
1135  .timer_chan = TIM_Channel_1,
1136  .remap = GPIO_AF_TIM8,
1137  .pin = {
1138  .gpio = GPIOC,
1139  .init = {
1140  .GPIO_Pin = GPIO_Pin_6,
1141  .GPIO_Speed = GPIO_Speed_2MHz,
1142  .GPIO_Mode = GPIO_Mode_AF,
1143  .GPIO_OType = GPIO_OType_PP,
1144  .GPIO_PuPd = GPIO_PuPd_UP
1145  },
1146  .pin_source = GPIO_PinSource6,
1147  },
1148  },
1149  {
1150  .timer = TIM8,
1151  .timer_chan = TIM_Channel_2,
1152  .remap = GPIO_AF_TIM8,
1153  .pin = {
1154  .gpio = GPIOC,
1155  .init = {
1156  .GPIO_Pin = GPIO_Pin_7,
1157  .GPIO_Speed = GPIO_Speed_2MHz,
1158  .GPIO_Mode = GPIO_Mode_AF,
1159  .GPIO_OType = GPIO_OType_PP,
1160  .GPIO_PuPd = GPIO_PuPd_UP
1161  },
1162  .pin_source = GPIO_PinSource7,
1163  },
1164  },
1165  {
1166  .timer = TIM8,
1167  .timer_chan = TIM_Channel_3,
1168  .remap = GPIO_AF_TIM8,
1169  .pin = {
1170  .gpio = GPIOC,
1171  .init = {
1172  .GPIO_Pin = GPIO_Pin_8,
1173  .GPIO_Speed = GPIO_Speed_2MHz,
1174  .GPIO_Mode = GPIO_Mode_AF,
1175  .GPIO_OType = GPIO_OType_PP,
1176  .GPIO_PuPd = GPIO_PuPd_UP
1177  },
1178  .pin_source = GPIO_PinSource8,
1179  },
1180  },
1181  {
1182  .timer = TIM8,
1183  .timer_chan = TIM_Channel_4,
1184  .remap = GPIO_AF_TIM8,
1185  .pin = {
1186  .gpio = GPIOC,
1187  .init = {
1188  .GPIO_Pin = GPIO_Pin_9,
1189  .GPIO_Speed = GPIO_Speed_2MHz,
1190  .GPIO_Mode = GPIO_Mode_AF,
1191  .GPIO_OType = GPIO_OType_PP,
1192  .GPIO_PuPd = GPIO_PuPd_UP
1193  },
1194  .pin_source = GPIO_PinSource9,
1195  },
1196  }
1197 };
1198 
1199 /*
1200  * PWM Inputs
1201  */
1202 #if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
1203 #include <pios_pwm_priv.h>
1204 
1205 const struct pios_pwm_cfg pios_pwm_cfg = {
1206  .tim_ic_init = {
1207  .TIM_ICPolarity = TIM_ICPolarity_Rising,
1208  .TIM_ICSelection = TIM_ICSelection_DirectTI,
1209  .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1210  .TIM_ICFilter = 0x0,
1211  },
1212  .channels = pios_tim_rcvrport_all_channels,
1213  .num_channels = NELEMENTS(pios_tim_rcvrport_all_channels),
1214 };
1215 
1216 const struct pios_pwm_cfg pios_pwm_with_ppm_cfg = {
1217  .tim_ic_init = {
1218  .TIM_ICPolarity = TIM_ICPolarity_Rising,
1219  .TIM_ICSelection = TIM_ICSelection_DirectTI,
1220  .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1221  .TIM_ICFilter = 0x0,
1222  },
1223  /* Leave the first channel for PPM use and use the rest for PWM */
1224  .channels = &pios_tim_rcvrport_all_channels[1],
1225  .num_channels = NELEMENTS(pios_tim_rcvrport_all_channels) - 1,
1226 };
1227 
1228 
1229 #endif
1230 
1231 /*
1232  * PPM Input
1233  */
1234 #if defined(PIOS_INCLUDE_PPM)
1235 #include <pios_ppm_priv.h>
1236 static const struct pios_ppm_cfg pios_ppm_cfg = {
1237  .tim_ic_init = {
1238  .TIM_ICPolarity = TIM_ICPolarity_Rising,
1239  .TIM_ICSelection = TIM_ICSelection_DirectTI,
1240  .TIM_ICPrescaler = TIM_ICPSC_DIV1,
1241  .TIM_ICFilter = 0x0,
1242  .TIM_Channel = TIM_Channel_3,
1243  },
1244  /* Use only the first channel for ppm */
1245  .channels = &pios_tim_rcvrport_all_channels[0],
1246  .num_channels = 1,
1247 };
1248 
1249 #endif //PPM
1250 
1251 #if defined(PIOS_INCLUDE_RCVR)
1252 #include "pios_rcvr_priv.h"
1253 #endif /* PIOS_INCLUDE_RCVR */
1254 
1255 
1256 #if defined(PIOS_INCLUDE_USB)
1257 #include "pios_usb_priv.h"
1258 
1259 static const struct pios_usb_cfg pios_usb_main_cfg = {
1260  .irq = {
1261  .init = {
1262  .NVIC_IRQChannel = OTG_FS_IRQn,
1263  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
1264  .NVIC_IRQChannelSubPriority = 0,
1265  .NVIC_IRQChannelCmd = ENABLE,
1266  },
1267  },
1268  .vsense = {
1269  .gpio = GPIOA,
1270  .init = {
1271  .GPIO_Pin = GPIO_Pin_9,
1272  .GPIO_Speed = GPIO_Speed_25MHz,
1273  .GPIO_Mode = GPIO_Mode_IN,
1274  .GPIO_OType = GPIO_OType_OD,
1275  .GPIO_PuPd = GPIO_PuPd_NOPULL,
1276  },
1277  }
1278 };
1279 
1280 #include "pios_usb_board_data_priv.h"
1283 #include "pios_usbhook.h"
1284 
1285 #endif /* PIOS_INCLUDE_USB */
1286 
1287 #if defined(PIOS_INCLUDE_COM_MSG)
1288 
1289 #include <pios_com_msg_priv.h>
1290 
1291 #endif /* PIOS_INCLUDE_COM_MSG */
1292 
1293 #if defined(PIOS_INCLUDE_USB_HID) && !defined(PIOS_INCLUDE_USB_CDC)
1294 #include <pios_usb_hid_priv.h>
1295 
1296 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1297  .data_if = 0,
1298  .data_rx_ep = 1,
1299  .data_tx_ep = 1,
1300 };
1301 #endif /* PIOS_INCLUDE_USB_HID && !PIOS_INCLUDE_USB_CDC */
1302 
1303 #if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_USB_CDC)
1304 #include <pios_usb_cdc_priv.h>
1305 
1306 const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
1307  .ctrl_if = 0,
1308  .ctrl_tx_ep = 2,
1309 
1310  .data_if = 1,
1311  .data_rx_ep = 3,
1312  .data_tx_ep = 3,
1313 };
1314 
1315 #include <pios_usb_hid_priv.h>
1316 
1317 const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
1318  .data_if = 2,
1319  .data_rx_ep = 1,
1320  .data_tx_ep = 1,
1321 };
1322 #endif /* PIOS_INCLUDE_USB_HID && PIOS_INCLUDE_USB_CDC */
1323 
1324 #if defined(PIOS_INCLUDE_ADC)
1325 #include "pios_adc_priv.h"
1326 #include "pios_internal_adc_priv.h"
1327 
1328 void PIOS_ADC_DMA_irq_handler(void);
1329 void DMA2_Stream4_IRQHandler(void) __attribute__((alias("PIOS_ADC_DMA_irq_handler")));
1330 struct pios_internal_adc_cfg pios_adc_cfg = {
1331  .adc_dev_master = ADC1,
1332  .dma = {
1333  .irq = {
1334  .flags = (DMA_FLAG_TCIF4 | DMA_FLAG_TEIF4 | DMA_FLAG_HTIF4),
1335  .init = {
1336  .NVIC_IRQChannel = DMA2_Stream4_IRQn,
1337  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
1338  .NVIC_IRQChannelSubPriority = 0,
1339  .NVIC_IRQChannelCmd = ENABLE,
1340  },
1341  },
1342  .rx = {
1343  .channel = DMA2_Stream4,
1344  .init = {
1345  .DMA_Channel = DMA_Channel_0,
1346  .DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR
1347  },
1348  }
1349  },
1350  .half_flag = DMA_IT_HTIF4,
1351  .full_flag = DMA_IT_TCIF4,
1352  .adc_pins = {
1353  { GPIOC, GPIO_Pin_0, ADC_Channel_10 },
1354  { GPIOC, GPIO_Pin_1, ADC_Channel_11 },
1355  { GPIOC, GPIO_Pin_3, ADC_Channel_13 },
1356  { NULL, 0, ADC_Channel_Vrefint }, /* Voltage reference */
1357  { NULL, 0, ADC_Channel_TempSensor } /* Temperature sensor */
1358  },
1359  .adc_pin_count = 5
1360 };
1361 
1362 void PIOS_ADC_DMA_irq_handler(void)
1363 {
1364  /* Call into the generic code to handle the IRQ for this specific device */
1366 }
1367 
1368 #endif /* PIOS_INCLUDE_ADC */
1369 
1370 
1371 
1372 #if defined(PIOS_INCLUDE_VIDEO)
1373 #include <pios_video.h>
1374 
1375 void set_bw_levels(uint8_t black, uint8_t white)
1376 {
1377  TIM1->CCR1 = black;
1378  TIM1->CCR3 = white;
1379 }
1380 
1381 static const struct pios_exti_cfg pios_exti_vsync_cfg __exti_config = {
1382  .vector = PIOS_Vsync_ISR,
1383  .line = EXTI_Line7,
1384  .pin = {
1385  .gpio = GPIOA,
1386  .init = {
1387  .GPIO_Pin = GPIO_Pin_7,
1388  .GPIO_Speed = GPIO_Speed_100MHz,
1389  .GPIO_Mode = GPIO_Mode_IN,
1390  .GPIO_OType = GPIO_OType_OD,
1391  .GPIO_PuPd = GPIO_PuPd_NOPULL,
1392  },
1393  },
1394  .irq = {
1395  .init = {
1396  .NVIC_IRQChannel = EXTI9_5_IRQn,
1397  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
1398  .NVIC_IRQChannelSubPriority = 0,
1399  .NVIC_IRQChannelCmd = ENABLE,
1400  },
1401  },
1402  .exti = {
1403  .init = {
1404  .EXTI_Line = EXTI_Line7, // matches above GPIO pin
1405  .EXTI_Mode = EXTI_Mode_Interrupt,
1406  .EXTI_Trigger = EXTI_Trigger_Falling,
1407  .EXTI_LineCmd = ENABLE,
1408  },
1409  },
1410 };
1411 
1412 const struct pios_video_cfg pios_video_cfg = {
1413  .mask_dma = DMA2,
1414  .mask = {
1415  .regs = SPI1,
1416  .remap = GPIO_AF_SPI1,
1417  .init = {
1418  .SPI_Mode = SPI_Mode_Slave,
1419  .SPI_Direction = SPI_Direction_1Line_Tx,
1420  .SPI_DataSize = SPI_DataSize_8b,
1421  .SPI_NSS = SPI_NSS_Soft,
1422  .SPI_FirstBit = SPI_FirstBit_MSB,
1423  .SPI_CRCPolynomial = 7,
1424  .SPI_CPOL = SPI_CPOL_Low,
1425  .SPI_CPHA = SPI_CPHA_2Edge,
1426  .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1427  },
1428  .dma = {
1429  .irq = {
1430  .flags = (DMA_IT_TCIF3),
1431  .init = {
1432  .NVIC_IRQChannel = DMA2_Stream3_IRQn,
1433  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
1434  .NVIC_IRQChannelSubPriority = 0,
1435  .NVIC_IRQChannelCmd = ENABLE,
1436  },
1437  },
1438  /*.rx = {},*/
1439  .tx = {
1440  .channel = DMA2_Stream3,
1441  .init = {
1442  .DMA_Channel = DMA_Channel_3,
1443  .DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
1444  .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1445  .DMA_BufferSize = BUFFER_WIDTH,
1446  .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1447  .DMA_MemoryInc = DMA_MemoryInc_Enable,
1448  .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1449  .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1450  .DMA_Mode = DMA_Mode_Normal,
1451  .DMA_Priority = DMA_Priority_VeryHigh,
1452  .DMA_FIFOMode = DMA_FIFOMode_Enable,
1453  .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1454  .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1455  .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1456  },
1457  },
1458  },
1459  .sclk = {
1460  .gpio = GPIOA,
1461  .init = {
1462  .GPIO_Pin = GPIO_Pin_5,
1463  .GPIO_Speed = GPIO_Speed_100MHz,
1464  .GPIO_Mode = GPIO_Mode_AF,
1465  .GPIO_OType = GPIO_OType_PP,
1466  .GPIO_PuPd = GPIO_PuPd_NOPULL
1467  },
1468  },
1469  .miso = {
1470  .gpio = GPIOA,
1471  .init = {
1472  .GPIO_Pin = GPIO_Pin_6,
1473  .GPIO_Speed = GPIO_Speed_50MHz,
1474  .GPIO_Mode = GPIO_Mode_AF,
1475  .GPIO_OType = GPIO_OType_PP,
1476  .GPIO_PuPd = GPIO_PuPd_NOPULL
1477  },
1478  },
1479  .slave_count = 1,
1480  },
1481  .level_dma = DMA1,
1482  .level = {
1483  .regs = SPI2,
1484  .remap = GPIO_AF_SPI2,
1485  .init = {
1486  .SPI_Mode = SPI_Mode_Slave,
1487  .SPI_Direction = SPI_Direction_1Line_Tx,
1488  .SPI_DataSize = SPI_DataSize_8b,
1489  .SPI_NSS = SPI_NSS_Soft,
1490  .SPI_FirstBit = SPI_FirstBit_MSB,
1491  .SPI_CRCPolynomial = 7,
1492  .SPI_CPOL = SPI_CPOL_Low,
1493  .SPI_CPHA = SPI_CPHA_2Edge,
1494  .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
1495  },
1496  .dma = {
1497  .irq = {
1498  .flags = (DMA_IT_TCIF4),
1499  .init = {
1500  .NVIC_IRQChannel = DMA1_Stream4_IRQn,
1501  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
1502  .NVIC_IRQChannelSubPriority = 0,
1503  .NVIC_IRQChannelCmd = ENABLE,
1504  },
1505  },
1506  /*.rx = {},*/
1507  .tx = {
1508  .channel = DMA1_Stream4,
1509  .init = {
1510  .DMA_Channel = DMA_Channel_0,
1511  .DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
1512  .DMA_DIR = DMA_DIR_MemoryToPeripheral,
1513  .DMA_BufferSize = BUFFER_WIDTH,
1514  .DMA_PeripheralInc = DMA_PeripheralInc_Disable,
1515  .DMA_MemoryInc = DMA_MemoryInc_Enable,
1516  .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
1517  .DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
1518  .DMA_Mode = DMA_Mode_Normal,
1519  .DMA_Priority = DMA_Priority_VeryHigh,
1520  .DMA_FIFOMode = DMA_FIFOMode_Enable,
1521  .DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
1522  .DMA_MemoryBurst = DMA_MemoryBurst_INC4,
1523  .DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
1524  },
1525  },
1526  },
1527  .sclk = {
1528  .gpio = GPIOB,
1529  .init = {
1530  .GPIO_Pin = GPIO_Pin_13,
1531  .GPIO_Speed = GPIO_Speed_100MHz,
1532  .GPIO_Mode = GPIO_Mode_AF,
1533  .GPIO_OType = GPIO_OType_PP,
1534  .GPIO_PuPd = GPIO_PuPd_UP
1535  },
1536  },
1537  .miso = {
1538  .gpio = GPIOC,
1539  .init = {
1540  .GPIO_Pin = GPIO_Pin_2,
1541  .GPIO_Speed = GPIO_Speed_50MHz,
1542  .GPIO_Mode = GPIO_Mode_AF,
1543  .GPIO_OType = GPIO_OType_PP,
1544  .GPIO_PuPd = GPIO_PuPd_UP
1545  },
1546  },
1547  .slave_count = 1,
1548  },
1549 
1550  .vsync = &pios_exti_vsync_cfg,
1551 
1552  .hsync_capture = {
1553  .timer = TIM2,
1554  .timer_chan = TIM_Channel_2,
1555  .pin = {
1556  .gpio = GPIOB,
1557  .init = {
1558  .GPIO_Pin = GPIO_Pin_3,
1559  .GPIO_Speed = GPIO_Speed_100MHz,
1560  .GPIO_Mode = GPIO_Mode_AF,
1561  .GPIO_OType = GPIO_OType_PP,
1562  .GPIO_PuPd = GPIO_PuPd_UP
1563  },
1564  .pin_source = GPIO_PinSource3,
1565  },
1566  .remap = GPIO_AF_TIM2,
1567  },
1568 
1569  .pixel_timer = {
1570  .timer = TIM3,
1571  .timer_chan = TIM_Channel_1,
1572  .pin = {
1573  .gpio = GPIOB,
1574  .init = {
1575  .GPIO_Pin = GPIO_Pin_4,
1576  .GPIO_Speed = GPIO_Speed_100MHz,
1577  .GPIO_Mode = GPIO_Mode_AF,
1578  .GPIO_OType = GPIO_OType_PP,
1579  .GPIO_PuPd = GPIO_PuPd_UP
1580  },
1581  .pin_source = GPIO_PinSource4,
1582  },
1583  .remap = GPIO_AF_TIM3,
1584  },
1585 
1586  .tim_oc_init = {
1587  .TIM_OCMode = TIM_OCMode_PWM1,
1588  .TIM_OutputState = TIM_OutputState_Enable,
1589  .TIM_OutputNState = TIM_OutputNState_Disable,
1590  .TIM_Pulse = 1,
1591  .TIM_OCPolarity = TIM_OCPolarity_High,
1592  .TIM_OCNPolarity = TIM_OCPolarity_High,
1593  .TIM_OCIdleState = TIM_OCIdleState_Reset,
1594  .TIM_OCNIdleState = TIM_OCNIdleState_Reset,
1595  },
1596  .set_bw_levels = set_bw_levels,
1597 };
1598 
1599 #endif /* if defined(PIOS_INCLUDE_VIDEO) */
1600 
1601 #if defined(PIOS_INCLUDE_DAC)
1602 #include "pios_dac.h"
1603 
1604 dac_dev_t pios_dac;
1605 
1606 /* DAC 1 is the DAC output on Seppuku; DMA1 Stream 5 Ch7 */
1607 
1608 void DMA1_Stream5_IRQHandler() {
1610 }
1611 
1612 typedef struct dac_dev_s *dac_dev_t;
1613 
1614 struct pios_dac_cfg pios_dac_cfg = {
1615  .timer = TIM6,
1616  .clock_cfg = {
1617  .TIM_Prescaler = (PIOS_PERIPHERAL_APB1_COUNTER_CLOCK / 600000) - 1,
1618  .TIM_ClockDivision = TIM_CKD_DIV1,
1619  .TIM_CounterMode = TIM_CounterMode_Up,
1620  .TIM_Period = 25-1, /* 600000 / 25 = 24000 samples per sec */
1621  },
1622  .interrupt = {
1623  .NVIC_IRQChannel = DMA1_Stream5_IRQn,
1624  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
1625  .NVIC_IRQChannelSubPriority = 0,
1626  .NVIC_IRQChannelCmd = ENABLE,
1627  },
1628  .gpio = GPIOA,
1629  .gpio_pin = GPIO_Pin_4,
1630  .dma_stream = DMA1_Stream5,
1631  .dma_channel = DMA_Channel_7,
1632  .dac_channel = DAC_Channel_1,
1633  .dac_trigger = DAC_Trigger_T6_TRGO,
1634  .dac_outreg = (uintptr_t) (&DAC->DHR12L1),
1635  .dma_tcif = DMA_IT_TCIF5,
1636 };
1637 
1638 #endif /* PIOS_INCLUDE_DAC */
1639 
1640 
1644 #if defined(PIOS_INCLUDE_MPU)
1645 #include "pios_mpu.h"
1646 static const struct pios_exti_cfg pios_exti_mpu_cfg __exti_config = {
1648  .line = EXTI_Line13,
1649  .pin = {
1650  .gpio = GPIOC,
1651  .init = {
1652  .GPIO_Pin = GPIO_Pin_13,
1653  .GPIO_Speed = GPIO_Speed_2MHz, // XXXX
1654  .GPIO_Mode = GPIO_Mode_IN,
1655  .GPIO_OType = GPIO_OType_OD,
1656  .GPIO_PuPd = GPIO_PuPd_NOPULL,
1657  },
1658  },
1659  .irq = {
1660  .init = {
1661  .NVIC_IRQChannel = EXTI15_10_IRQn,
1662  .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
1663  .NVIC_IRQChannelSubPriority = 0,
1664  .NVIC_IRQChannelCmd = ENABLE,
1665  },
1666  },
1667  .exti = {
1668  .init = {
1669  .EXTI_Line = EXTI_Line13, // matches above GPIO pin
1670  .EXTI_Mode = EXTI_Mode_Interrupt,
1671  .EXTI_Trigger = EXTI_Trigger_Rising,
1672  .EXTI_LineCmd = ENABLE,
1673  },
1674  },
1675 };
1676 
1677 static struct pios_mpu_cfg pios_mpu_cfg = {
1678  .exti_cfg = &pios_exti_mpu_cfg,
1679  .default_samplerate = 1000, // Note: has to be generated by dividing 1kHz
1680  .orientation = PIOS_MPU_TOP_0DEG,
1681  .use_internal_mag = true,
1682 };
1683 #endif /* PIOS_INCLUDE_MPU9250 */
1684 
1688 #if defined(PIOS_INCLUDE_MS5611)
1689 #include "pios_ms5611_priv.h"
1690 static const struct pios_ms5611_cfg pios_ms5611_cfg = {
1692  .temperature_interleaving = 1,
1693 };
1694 #endif /* PIOS_INCLUDE_MS5611 */
1695 
struct stm32_gpio pin
MS5611 functions header.
#define DMA2_Stream4_IRQHandler
const struct pios_dmashot_timer_cfg * timer_cfg
Definition: pios_dmashot.h:68
#define DMA1_Stream5_IRQHandler
static const TIM_TimeBaseInitTypeDef tim_5_time_base
const struct pios_flash_driver pios_jedec_flash_driver
SPI private definitions.
#define NELEMENTS(x)
Definition: pios.h:192
TIM_TypeDef * timer
Definition: pios_dmashot.h:53
static const struct pios_tim_clock_cfg tim_5_cfg
#define I2C2_EV_IRQHandler
struct stm32_gpio bind
OSD gen module, handles OSD draw. Parts from CL-OSD and SUPEROSD projects.
COM private definitions.
COM MSG private definitions.
APIs for PIOS_USBHOOK layer.
TIM_ICInitTypeDef tim_ic_init
Definition: pios_pwm_priv.h:39
static const struct pios_tim_channel pios_tim_servoport_all_pins[]
GPIO_TypeDef * gpio
Definition: pios_stm32.h:60
I2C_TypeDef * regs
Definition: pios_i2c_priv.h:37
void(* set_bw_levels)(uint8_t, uint8_t)
Definition: pios_video.h:104
ADC private definitions.
#define PIOS_IRQ_PRIO_HIGHEST
Definition: pios_board.h:172
#define PIOS_SERVOS_INITIAL_POSITION
Definition: pios_board.h:210
#define FLASH_SECTOR_4KB
bool(* vector)(void)
Definition: pios_exti.h:38
Defines the API to set up the HID + CDC USB descriptor config.
static const struct pios_tim_channel pios_tim_servoport_rcvrport_pins[]
void PIOS_INTERNAL_ADC_DMA_Handler()
#define RTC_WKUP_IRQHandler
#define PIOS_LED_ALARM
Definition: pios_board.h:86
#define PIOS_IRQ_PRIO_MID
Definition: pios_board.h:170
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
Definition: pios_mpu.h:140
Driver for talking to most JEDEC flash chips.
#define PIOS_SERVO_UPDATE_HZ
Definition: pios_board.h:209
Configuration struct holding all timer configurations.
Definition: pios_dmashot.h:66
TIM_TypeDef * timer
Definition: pios_tim_priv.h:7
SPI_TypeDef * regs
Definition: pios_spi_priv.h:44
Configuration struct to assign a DMA channel and stream to a timer, and optionally specify a master t...
Definition: pios_dmashot.h:51
static const struct pios_tim_channel pios_tim_rcvrport_all_channels[]
struct pios_i2c_adapter * pios_i2c_t
Definition: pios_i2c.h:48
const struct pios_annunc * annunciators
void PIOS_I2C_EV_IRQ_Handler(pios_i2c_t i2c_id)
ppm private structures.
NVIC_InitTypeDef init
Definition: pios_stm32.h:36
#define I2C1_ER_IRQHandler
#define PIOS_INCLUDE_FLASH_JEDEC
Definition: pios_config.h:44
struct stm32_gpio inv
USART_TypeDef * regs
USB private definitions.
TIM_OCInitTypeDef tim_oc_init
USB COM HID private definitions.
#define I2C1_EV_IRQHandler
ADC private definitions.
Servo private structures.
#define FLASH_SECTOR_16KB
NVIC_InitTypeDef interrupt
Definition: pios_dac.h:46
void PIOS_I2C_ER_IRQ_Handler(pios_i2c_t i2c_id)
DMA_TypeDef * mask_dma
Definition: pios_video.h:96
TIM_ICInitTypeDef tim_ic_init
Definition: pios_ppm_priv.h:37
static const TIM_TimeBaseInitTypeDef tim_8_time_base
Defines the API to set up the HID-only USB descriptor config.
static const struct pios_tim_clock_cfg tim_12_cfg
void PIOS_RTC_irq_handler(void)
Futaba S.Bus Private structures.
struct dac_dev_s * dac_dev_t
Definition: pios_dac.h:40
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[]
Definition: unittest_init.c:50
#define BUFFER_WIDTH
Definition: pios_video.h:147
bool PIOS_Vsync_ISR()
TIM_TypeDef * timer
Definition: pios_tim_priv.h:14
USB COM CDC private definitions.
#define JEDEC_MANUFACTURER_MACRONIX
uint32_t clksrc
Definition: pios_rtc_priv.h:37
enum pios_flash_partition_labels label
board_revision
Definition: board_hw_defs.c:35
TIM_TypeDef * timer
Definition: pios_dac.h:43
static const TIM_TimeBaseInitTypeDef tim_12_time_base
#define PIOS_IRQ_PRIO_LOW
Definition: pios_board.h:169
#define PIOS_Assert(test)
Definition: pios_debug.h:52
static const struct pios_tim_clock_cfg tim_8_cfg
LED private definitions.
void PIOS_DAC_dma_interrupt_handler(dac_dev_t dev)
Handles a DMA completion interrupt on dma_stream.
struct stm32_irq irq
Definition: pios_usb_priv.h:37
#define FLASH_SECTOR_128KB
const struct pios_flash_driver pios_internal_flash_driver
USART private definitions.
#define PIOS_LED_HEARTBEAT
Definition: pios_board.h:85
#define __exti_config
Definition: pios_exti.h:48
Defines the API to the board-specific USB data setup code.