dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_board.c
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 /* Pull in the board-specific static HW definitions.
31  * Including .c files is a bit ugly but this allows all of
32  * the HW definitions to be const and static to limit their
33  * scope.
34  *
35  * NOTE: THIS IS THE ONLY PLACE THAT SHOULD EVER INCLUDE THIS FILE
36  */
37 
38 #include "board_hw_defs.c"
39 
40 #include <pios.h>
41 #include <pios_hal.h>
42 #include <openpilot.h>
43 #include <uavobjectsinit.h>
44 #include "hwbrain.h"
45 #include "modulesettings.h"
46 #include "manualcontrolsettings.h"
47 #include "onscreendisplaysettings.h"
48 
52 
54 
59 #if defined(PIOS_INCLUDE_VIDEO)
60 void OSD_configure_bw_levels(void)
61 {
62  GPIO_InitTypeDef GPIO_InitStructure;
63  TIM_OCInitTypeDef TIM_OCInitStructure;
64  TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
65 
66  /* --------------------------- System Clocks Configuration -----------------*/
67  /* TIM1 clock enable */
68  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
69 
70  /* GPIOA clock enable */
71  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
72 
73  /* Connect TIM1 pins to AF */
74  GPIO_PinAFConfig(GPIOA, GPIO_PinSource8, GPIO_AF_TIM1);
75  GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_TIM1);
76 
77  /*-------------------------- GPIO Configuration ----------------------------*/
78  GPIO_StructInit(&GPIO_InitStructure); // Reset init structure
79  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_10;
80  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
81  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
82  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
83  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
84  GPIO_Init(GPIOA, &GPIO_InitStructure);
85 
86 
87  /* Time base configuration */
88  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
89  TIM_TimeBaseStructure.TIM_Prescaler = (PIOS_SYSCLK / 25500000) - 1; // Get clock to 25 MHz on STM32F2/F4
90  TIM_TimeBaseStructure.TIM_Period = 255;
91  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
92  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
93  TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
94 
95  /* Enable TIM1 Preload register on ARR */
96  TIM_ARRPreloadConfig(TIM1, ENABLE);
97 
98  /* TIM PWM1 Mode configuration */
99  TIM_OCStructInit(&TIM_OCInitStructure);
100  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
101  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
102  TIM_OCInitStructure.TIM_Pulse = 90;
103  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
104 
105  /* Output Compare PWM1 Mode configuration: Channel1 PA.08 */
106  TIM_OC1Init(TIM1, &TIM_OCInitStructure);
107  TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Enable);
108  TIM_OC3Init(TIM1, &TIM_OCInitStructure);
109  TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
110 
111  /* TIM1 Main Output Enable */
112  TIM_CtrlPWMOutputs(TIM1, ENABLE);
113 
114  /* TIM1 enable counter */
115  TIM_Cmd(TIM1, ENABLE);
116  TIM1->CCR1 = 30;
117  TIM1->CCR3 = 110;
118 }
119 #endif /* PIOS_INCLUDE_VIDEO */
120 
127 #include <pios_board_info.h>
128 
129 void PIOS_Board_Init(void) {
130  bool use_rxport_usart = false;
131 
132 #if defined(PIOS_INCLUDE_ANNUNC)
134 #endif /* PIOS_INCLUDE_ANNUNC */
135 
136 #if defined(PIOS_INCLUDE_I2C)
137  if (PIOS_I2C_Init(&pios_i2c_internal_id, &pios_i2c_internal_cfg)) {
139  }
140  if (PIOS_I2C_CheckClear(pios_i2c_internal_id) != 0)
142 #endif
143 
144 #if defined(PIOS_INCLUDE_SPI)
145  if (PIOS_SPI_Init(&pios_spi_flash_id, &pios_spi_flash_cfg)) {
147  }
148 #endif
149 
150 #if defined(PIOS_INCLUDE_FLASH)
151  /* Inititialize all flash drivers */
152  if (PIOS_Flash_Internal_Init(&pios_internal_flash_id, &flash_internal_cfg) != 0)
154  if (PIOS_Flash_Jedec_Init(&pios_external_flash_id, pios_spi_flash_id, 0, &flash_mx25_cfg) != 0)
156 
157  /* Register the partition table */
159 
160  /* Mount all filesystems */
163 #endif /* PIOS_INCLUDE_FLASH */
164 
165  HwBrainInitialize();
166  ModuleSettingsInitialize();
167 
168 #if defined(PIOS_INCLUDE_RTC)
169  /* Initialize the real-time clock and its associated tick */
170  PIOS_RTC_Init(&pios_rtc_main_cfg);
171 #endif
172 
173  /* Initialize watchdog as early as possible to catch faults during init
174  * but do it only if there is no debugger connected
175  */
176  if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == 0) {
177  PIOS_WDG_Init();
178  }
179 
180  /* Initialize the alarms library */
183 
184  /* Set up pulse timers */
185  //inputs
188  //outputs
190 
191  /* IAP System Setup */
192  PIOS_IAP_Init();
193  uint16_t boot_count = PIOS_IAP_ReadBootCount();
194  if (boot_count < 3) {
195  PIOS_IAP_WriteBootCount(++boot_count);
196  AlarmsClear(SYSTEMALARMS_ALARM_BOOTFAULT);
197  } else {
198  /* Too many failed boot attempts, force hw config to defaults */
199  HwBrainSetDefaults(HwBrainHandle(), 0);
200  ModuleSettingsSetDefaults(ModuleSettingsHandle(),0);
201  AlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_CRITICAL);
202  }
203 
204 #if defined(PIOS_INCLUDE_USB)
205  /* Initialize board specific USB data */
207 
208  /* Flags to determine if various USB interfaces are advertised */
209  bool usb_hid_present = false;
210  bool usb_cdc_present = false;
211 
212 #if defined(PIOS_INCLUDE_USB_CDC)
214  PIOS_Assert(0);
215  }
216  usb_hid_present = true;
217  usb_cdc_present = true;
218 #else
220  PIOS_Assert(0);
221  }
222  usb_hid_present = true;
223 #endif
224 
225  uintptr_t pios_usb_id;
226  PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg);
227 
228 #if defined(PIOS_INCLUDE_USB_CDC)
229 
230  uint8_t hw_usb_vcpport;
231  /* Configure the USB VCP port */
232  HwBrainUSB_VCPPortGet(&hw_usb_vcpport);
233 
234  if (!usb_cdc_present) {
235  /* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */
236  hw_usb_vcpport = HWBRAIN_USB_VCPPORT_DISABLED;
237  }
238 
239  PIOS_HAL_ConfigureCDC(hw_usb_vcpport, pios_usb_id, &pios_usb_cdc_cfg);
240 
241 #endif /* PIOS_INCLUDE_USB_CDC */
242 
243 #if defined(PIOS_INCLUDE_USB_HID)
244  /* Configure the usb HID port */
245  uint8_t hw_usb_hidport;
246  HwBrainUSB_HIDPortGet(&hw_usb_hidport);
247 
248  if (!usb_hid_present) {
249  /* Force HID port function to disabled if we haven't advertised HID in our USB descriptor */
250  hw_usb_hidport = HWBRAIN_USB_HIDPORT_DISABLED;
251  }
252 
253  PIOS_HAL_ConfigureHID(hw_usb_hidport, pios_usb_id, &pios_usb_hid_cfg);
254 
255 #endif /* PIOS_INCLUDE_USB_HID */
256 
257  if (usb_hid_present || usb_cdc_present) {
259  }
260 #endif /* PIOS_INCLUDE_USB */
261 
262  /* Configure the IO ports */
263  HwBrainDSMxModeOptions hw_DSMxMode;
264  HwBrainDSMxModeGet(&hw_DSMxMode);
265 
266  /* Main Port */
267  uint8_t hw_mainport;
268  HwBrainMainPortGet(&hw_mainport);
269 
270  PIOS_HAL_ConfigurePort(hw_mainport, // port type protocol
271  &pios_mainport_cfg, // usart_port_cfg
272  &pios_usart_com_driver, // com_driver
273  NULL, // i2c_id
274  NULL, // i2c_cfg
275  NULL, // ppm_cfg
276  NULL, // pwm_cfg
277  PIOS_LED_ALARM, // led_id
278  &pios_mainport_dsm_aux_cfg, // dsm_cfg
279  0, // dsm_mode
280  &pios_mainport_sbus_aux_cfg); // sbus_cfg
281 
282  /* Flx Port */
283  uint8_t hw_flxport;
284  HwBrainFlxPortGet(&hw_flxport);
285 
286  PIOS_HAL_ConfigurePort(hw_flxport, // port type protocol
287  &pios_flxport_cfg, // usart_port_cfg
288  &pios_usart_com_driver, // com_driver
289  &pios_i2c_flexi_id, // i2c_id
290  &pios_i2c_flexi_cfg, // i2c_cfg
291  NULL, // ppm_cfg
292  NULL, // pwm_cfg
293  PIOS_LED_ALARM, // led_id
294  &pios_flxport_dsm_aux_cfg, // dsm_cfg
295  hw_DSMxMode, // dsm_mode
296  NULL); // sbus_cfg
297 
298  /* Configure the rcvr port */
299  uint8_t hw_rxport;
300  HwBrainRxPortGet(&hw_rxport);
301 
302  switch (hw_rxport) {
303  case HWBRAIN_RXPORT_DISABLED:
304  break;
305 
306  case HWBRAIN_RXPORT_PWM:
307  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PWM, // port type protocol
308  NULL, // usart_port_cfg
309  NULL, // com_driver
310  NULL, // i2c_id
311  NULL, // i2c_cfg
312  NULL, // ppm_cfg
313  &pios_pwm_cfg, // pwm_cfg
314  PIOS_LED_ALARM, // led_id
315  NULL, // dsm_cfg
316  0, // dsm_mode
317  NULL); // sbus_cfg
318  break;
319 
320  case HWBRAIN_RXPORT_PPM:
321  case HWBRAIN_RXPORT_PPMOUTPUTS:
322  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PPM, // port type protocol
323  NULL, // usart_port_cfg
324  NULL, // com_driver
325  NULL, // i2c_id
326  NULL, // i2c_cfg
327  &pios_ppm_cfg, // ppm_cfg
328  NULL, // pwm_cfg
329  PIOS_LED_ALARM, // led_id
330  NULL, // dsm_cfg
331  0, // dsm_mode
332  NULL); // sbus_cfg
333  break;
334 
335  case HWBRAIN_RXPORT_UART:
336  case HWBRAIN_RXPORT_UARTOUTPUTS:
337  use_rxport_usart = true;
338  break;
339 
340  case HWBRAIN_RXPORT_PPMUART:
341  case HWBRAIN_RXPORT_PPMUARTOUTPUTS:
342  use_rxport_usart = true;
343 
344  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PPM, // port type protocol
345  NULL, // usart_port_cfg
346  NULL, // com_driver
347  NULL, // i2c_id
348  NULL, // i2c_cfg
349  &pios_ppm_cfg, // ppm_cfg
350  NULL, // pwm_cfg
351  PIOS_LED_ALARM, // led_id
352  NULL, // dsm_cfg
353  0, // dsm_mode
354  NULL); // sbus_cfg
355  break;
356  }
357 
358  /* Configure the RxPort USART */
359  if (use_rxport_usart) {
360  uint8_t hw_rxportusart;
361  HwBrainRxPortUsartGet(&hw_rxportusart);
362 
363  PIOS_HAL_ConfigurePort(hw_rxportusart, // port type protocol
364  &pios_rxportusart_cfg, // usart_port_cfg
365  &pios_usart_com_driver, // com_driver
366  NULL, // i2c_id
367  NULL, // i2c_cfg
368  NULL, // ppm_cfg
369  NULL, // pwm_cfg
370  PIOS_LED_ALARM, // led_id
371  &pios_rxportusart_dsm_aux_cfg, // dsm_cfg
372  hw_DSMxMode, // dsm_mode
373  NULL); // sbus_cfg
374  }
375 
376 #if defined(PIOS_INCLUDE_SERVO) & defined(PIOS_INCLUDE_DMASHOT)
377  PIOS_DMAShot_Init(&dmashot_config);
378 #endif // defined(PIOS_INCLUDE_DMASHOT)
379 
380 #ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS
381  switch (hw_rxport) {
382  case HWBRAIN_RXPORT_DISABLED:
383  case HWBRAIN_RXPORT_PWM:
384  case HWBRAIN_RXPORT_PPM:
385  case HWBRAIN_RXPORT_UART:
386  case HWBRAIN_RXPORT_PPMUART:
387  /* Set up the servo outputs */
388 #ifdef PIOS_INCLUDE_SERVO
390 #endif
391  break;
392  case HWBRAIN_RXPORT_PPMOUTPUTS:
393 #ifdef PIOS_INCLUDE_SERVO
394  PIOS_Servo_Init(&pios_servo_rcvr_ppm_cfg);
395 #endif
396  break;
397  case HWBRAIN_RXPORT_PPMUARTOUTPUTS:
398  case HWBRAIN_RXPORT_UARTOUTPUTS:
399 #ifdef PIOS_INCLUDE_SERVO
400  PIOS_Servo_Init(&pios_servo_rcvr_ppm_uart_out_cfg);
401 #endif
402  break;
403  case HWBRAIN_RXPORT_OUTPUTS:
404 #ifdef PIOS_INCLUDE_SERVO
405  PIOS_Servo_Init(&pios_servo_rcvr_all_cfg);
406 #endif
407  break;
408  }
409 #else
410  PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels));
411 #endif
412 
413 #ifdef PIOS_INCLUDE_DAC
414  PIOS_DAC_init(&pios_dac, &pios_dac_cfg);
415 
416  PIOS_HAL_ConfigureDAC(pios_dac);
417 #endif /* PIOS_INCLUDE_DAC */
418 
419 
420  /* init sensor queue registration */
422 
423  //I2C is slow, sensor init as well, reset watchdog to prevent reset here
424  PIOS_WDG_Clear();
425 
426 #if defined(PIOS_INCLUDE_MS5611)
427  if ((PIOS_MS5611_Init(&pios_ms5611_cfg, pios_i2c_internal_id) != 0)
428  || (PIOS_MS5611_Test() != 0))
430 #endif
431 
432  PIOS_WDG_Clear();
433 
434  /* Magnetometer selection */
435  uint8_t hw_magnetometer;
436  HwBrainMagnetometerGet(&hw_magnetometer);
437  switch (hw_magnetometer) {
438  case HWBRAIN_MAGNETOMETER_NONE:
439  pios_mpu_cfg.use_internal_mag = false;
440  break;
441 
442  case HWBRAIN_MAGNETOMETER_INTERNAL:
443  pios_mpu_cfg.use_internal_mag = true;
444  break;
445 
446  /* default external mags and handle them in PiOS HAL rather than maintaining list here */
447  default:
448  pios_mpu_cfg.use_internal_mag = false;
449 
450  if (hw_flxport == HWSHARED_PORTTYPES_I2C) {
451  uint8_t hw_orientation;
452  HwBrainExtMagOrientationGet(&hw_orientation);
453 
454  PIOS_HAL_ConfigureExternalMag(hw_magnetometer, hw_orientation,
455  &pios_i2c_flexi_id, &pios_i2c_flexi_cfg);
456  } else {
458  }
459  break;
460  }
461 
462 #if defined(PIOS_INCLUDE_MPU)
463  uint8_t hw_mpu9250_dlpf;
464  HwBrainMPU9250GyroLPFGet(&hw_mpu9250_dlpf);
465  uint16_t gyro_lpf = \
466  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_184) ? 184 : \
467  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_92) ? 92 : \
468  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_41) ? 41 : \
469  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_20) ? 20 : \
470  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_10) ? 10 : \
471  (hw_mpu9250_dlpf == HWBRAIN_MPU9250GYROLPF_5) ? 5 : \
472  184;
473 
474  HwBrainMPU9250AccelLPFGet(&hw_mpu9250_dlpf);
475  uint16_t accel_lpf = \
476  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_460) ? 460 : \
477  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_184) ? 184 : \
478  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_92) ? 92 : \
479  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_41) ? 41 : \
480  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_20) ? 20 : \
481  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_10) ? 10 : \
482  (hw_mpu9250_dlpf == HWBRAIN_MPU9250ACCELLPF_5) ? 5 : \
483  184;
484 
485  pios_mpu_dev_t mpu_dev = NULL;
486  int retval;
487  retval = PIOS_MPU_I2C_Init(&mpu_dev, pios_i2c_internal_id, &pios_mpu_cfg);
488  if (retval != 0)
490 
491  PIOS_MPU_SetGyroBandwidth(gyro_lpf);
492  PIOS_MPU_SetAccelBandwidth(accel_lpf);
493 
494  // To be safe map from UAVO enum to driver enum
495  uint8_t hw_gyro_range;
496  HwBrainGyroFullScaleGet(&hw_gyro_range);
497  switch (hw_gyro_range) {
498  case HWBRAIN_GYROFULLSCALE_250:
500  break;
501  case HWBRAIN_GYROFULLSCALE_500:
503  break;
504  case HWBRAIN_GYROFULLSCALE_1000:
506  break;
507  case HWBRAIN_GYROFULLSCALE_2000:
509  break;
510  }
511 
512  uint8_t hw_accel_range;
513  HwBrainAccelFullScaleGet(&hw_accel_range);
514  switch (hw_accel_range) {
515  case HWBRAIN_ACCELFULLSCALE_2G:
517  break;
518  case HWBRAIN_ACCELFULLSCALE_4G:
520  break;
521  case HWBRAIN_ACCELFULLSCALE_8G:
523  break;
524  case HWBRAIN_ACCELFULLSCALE_16G:
526  break;
527  }
528 #endif /* PIOS_INCLUDE_MPU9250_BRAIN */
529 
530  PIOS_WDG_Clear();
531 
532 #if defined(PIOS_INCLUDE_ADC)
533  uintptr_t internal_adc_id;
534  PIOS_INTERNAL_ADC_Init(&internal_adc_id, &pios_adc_cfg);
536 #endif
537 
538 #if defined(PIOS_INCLUDE_VIDEO)
539  // make sure the mask pin is low
540  GPIO_Init(pios_video_cfg.mask.miso.gpio, (GPIO_InitTypeDef*)&pios_video_cfg.mask.miso.init);
541  GPIO_ResetBits(pios_video_cfg.mask.miso.gpio, pios_video_cfg.mask.miso.init.GPIO_Pin);
542 
543  // Initialize settings
544  OnScreenDisplaySettingsInitialize();
545 
546  uint8_t osd_state;
547  OnScreenDisplaySettingsOSDEnabledGet(&osd_state);
548  if (osd_state == ONSCREENDISPLAYSETTINGS_OSDENABLED_ENABLED) {
549  OSD_configure_bw_levels();
550  }
551 #endif
552 
553  /* Make sure we have at least one telemetry link configured or else fail initialization */
555 }
556 
int32_t PIOS_MPU_I2C_Init(pios_mpu_dev_t *dev, pios_i2c_t i2c_id, const struct pios_mpu_cfg *cfg)
Initialize the MPU-xxxx 6/9-axis sensor on I2C.
int32_t PIOS_Flash_Internal_Init(uintptr_t *flash_id, const struct pios_flash_internal_cfg *cfg)
int32_t PIOS_USB_DESC_HID_CDC_Init(void)
void PIOS_HAL_ConfigureCDC(HwSharedUSB_VCPPortOptions port_type, uintptr_t usb_id, const struct pios_usb_cdc_cfg *cdc_cfg)
Main PiOS header to include all the compiled in PiOS options.
int32_t PIOS_INTERNAL_ADC_Init(uintptr_t *internal_adc_id, const struct pios_internal_adc_cfg *cfg)
GPIO_InitTypeDef init
Definition: pios_stm32.h:61
int32_t PIOS_I2C_CheckClear(pios_i2c_t i2c_id)
#define NELEMENTS(x)
Definition: pios.h:192
int32_t PIOS_Flash_Jedec_Init(uintptr_t *flash_id, pios_spi_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg *cfg)
GPIO_TypeDef * gpio
Definition: pios_stm32.h:60
#define PIOS_DEBUG_Assert(test)
Definition: pios_debug.h:51
int PIOS_HAL_ConfigureExternalMag(HwSharedMagOptions mag, HwSharedMagOrientationOptions orientation, pios_i2c_t *i2c_id, const struct pios_i2c_adapter_cfg *i2c_cfg)
Definition: pios_hal.c:1298
int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity)
Definition: alarms.c:97
uintptr_t pios_uavo_settings_fs_id
Definition: pios_board.c:50
uint16_t PIOS_IAP_ReadBootCount(void)
Definition: pios_iap.c:93
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t *fs_id, const struct flashfs_logfs_cfg *cfg, enum pios_flash_partition_labels partition_label)
Initialize the flash object setting FS.
static const struct pios_tim_clock_cfg tim_8_cfg
struct pios_mpu_dev * pios_mpu_dev_t
Definition: pios_mpu.h:150
#define PIOS_LED_ALARM
Definition: pios_board.h:86
Configuration structure for the MS5611 driver.
int32_t PIOS_I2C_Init(pios_i2c_t *i2c_id, const char *path)
void PIOS_WDG_Clear(void)
Clear the watchdog timer.
Definition: pios_wdg.c:147
int PIOS_DAC_init(dac_dev_t *dev_out, const struct pios_dac_cfg *cfg)
Allocate and initialise DAC device.
void PIOS_DEBUG_Init(const struct pios_tim_channel *channels, uint8_t num_channels)
Definition: pios_debug.c:44
uintptr_t pios_com_telem_serial_id
Definition: pios_hal.c:127
const struct pios_com_driver pios_usart_com_driver
static const struct pios_tim_clock_cfg tim_5_cfg
void PIOS_IAP_Init(void)
PIOS_IAP_Init - performs required initializations for iap module.
Definition: pios_iap.c:44
int32_t PIOS_MPU_SetAccelRange(enum pios_mpu_accel_range range)
const struct pios_adc_driver pios_internal_adc_driver
int32_t PIOS_TIM_InitClock(const struct pios_tim_clock_cfg *cfg)
Definition: pios_tim.c:62
const struct pios_spi_cfg mask
Definition: pios_video.h:97
uintptr_t pios_internal_adc_id
Definition: pios_board.c:51
int32_t PIOS_SPI_Init(pios_spi_t *spi_dev, const struct pios_spi_cfg *cfg)
void PIOS_Board_Init()
Definition: pios_board.c:44
int32_t PIOS_ANNUNC_Init(const struct pios_annunc_cfg *cfg)
int32_t PIOS_SENSORS_Init()
Initialize the PIOS_SENSORS interface.
Definition: pios_sensors.c:51
void PIOS_RTC_Init(const struct pios_rtc_cfg *cfg)
int32_t PIOS_USB_DESC_HID_ONLY_Init(void)
void PIOS_HAL_ConfigureHID(HwSharedUSB_HIDPortOptions port_type, uintptr_t usb_id, const struct pios_usb_hid_cfg *hid_cfg)
int32_t PIOS_Servo_Init(const struct pios_servo_cfg *cfg)
Definition: pios_servo.c:109
void PIOS_MPU_SetGyroBandwidth(uint16_t bandwidth)
Sets the bandwidth desired from the gyro. The driver will automatically select the lowest bandwidth l...
uintptr_t pios_com_openlog_logging_id
Definition: pios_board.c:49
uintptr_t pios_com_telem_usb_id
Definition: pios_board.c:42
void PIOS_MPU_SetAccelBandwidth(uint16_t bandwidth)
Sets the bandwidth desired from the accelerometer. The driver will automatically select the lowest ba...
uintptr_t pios_com_logging_id
Definition: pios_board.c:50
static const struct pios_tim_clock_cfg tim_12_cfg
void PIOS_USBHOOK_Activate(void)
Definition: pios_usbhook.c:80
void PIOS_FLASH_register_partition_table(const struct pios_flash_partition partition_table[], uint8_t num_partitions)
Includes PiOS and core architecture components.
int32_t AlarmsClear(SystemAlarmsAlarmElem alarm)
Definition: alarms.c:171
int32_t PIOS_USB_Init(uintptr_t *usb_id, const struct pios_usb_cfg *cfg)
uint16_t PIOS_WDG_Init()
Initialize the watchdog timer for a specified timeout.
Definition: pios_wdg.c:63
int32_t PIOS_ADC_Init(uintptr_t *adc_id, const struct pios_adc_driver *driver, uintptr_t lower_id)
const struct pios_flash_partition pios_flash_partition_table[]
Definition: unittest_init.c:50
#define PIOS_SYSCLK
Definition: pios_board.h:143
void PIOS_IAP_WriteBootCount(uint16_t)
Definition: pios_iap.c:98
int32_t PIOS_MS5611_Init(const struct pios_ms5611_cfg *cfg, pios_i2c_t i2c_device)
struct stm32_gpio miso
Definition: pios_spi_priv.h:48
void PIOS_HAL_CriticalError(uint32_t led_id, enum pios_hal_panic code)
Flash a blink code.
Definition: pios_hal.c:291
int32_t AlarmsInitialize(void)
Definition: alarms.c:51
void PIOS_DMAShot_Init(const struct pios_dmashot_cfg *config)
Initializes the DMAShot driver by loading the configuration.
Definition: pios_dmashot.c:96
#define PIOS_Assert(test)
Definition: pios_debug.h:52
int32_t PIOS_MPU_SetGyroRange(enum pios_mpu_gyro_range range)
int32_t PIOS_USB_BOARD_DATA_Init(void)
void PIOS_RESET_Clear(void)
PIOS_RESET_Clear Does nothing on POSIX systems.
Definition: pios_reset.c:38
void PIOS_SENSORS_SetMissing(enum pios_sensor_type type)
Assert that an optional (non-accel/gyro), but expected sensor is missing.
Definition: pios_sensors.c:191