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 "hwaq32.h"
45 #include "manualcontrolsettings.h"
46 #include "modulesettings.h"
47 #include "rgbledsettings.h"
48 
52 
53 #ifdef PIOS_INCLUDE_MAX7456
54 max7456_dev_t pios_max7456_id;
55 #endif
56 
63 #include <pios_board_info.h>
64 
65 void PIOS_Board_Init(void) {
66  const struct pios_board_info * bdinfo = &pios_board_info_blob;
67 
68 #if defined(PIOS_INCLUDE_ANNUNC)
69  const struct pios_annunc_cfg * led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
70  PIOS_Assert(led_cfg);
71  PIOS_ANNUNC_Init(led_cfg);
72 #endif /* PIOS_INCLUDE_ANNUNC */
73 
74 #if defined(PIOS_INCLUDE_SPI)
75  if (PIOS_SPI_Init(&pios_spi_internal_id, &pios_spi_internal_cfg)) {
76  PIOS_Assert(0);
77  }
78 #endif
79 
80 #if defined(PIOS_INCLUDE_FLASH)
81  /* Initialize all flash drivers */
82  if (PIOS_Flash_Internal_Init(&pios_internal_flash_id, &flash_internal_cfg) != 0)
84 
85  /* Register the partition table */
86  const struct pios_flash_partition * flash_partition_table;
87  uint32_t num_partitions;
88  flash_partition_table = PIOS_BOARD_HW_DEFS_GetPartitionTable(bdinfo->board_rev, &num_partitions);
89  PIOS_FLASH_register_partition_table(flash_partition_table, num_partitions);
90 
91  /* Mount all filesystems */
94 #endif /* PIOS_INCLUDE_FLASH */
95 
96  HwAQ32Initialize();
97  ModuleSettingsInitialize();
98 
99 #if defined(PIOS_INCLUDE_RTC)
100  /* Initialize the real-time clock and its associated tick */
101  PIOS_RTC_Init(&pios_rtc_main_cfg);
102 #endif
103 
104  /* Initialize watchdog as early as possible to catch faults during init
105  * but do it only if there is no debugger connected
106  */
107  if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == 0) {
108  PIOS_WDG_Init();
109  }
110 
111  /* Set up pulse timers */
112 
113  // Timers used for inputs (5)
115 
116  // Timers used for outputs (2, 3, 4, 8)
121 
122 #ifdef PIOS_INCLUDE_SPI
123  uint8_t hw_osdport;
124 
125  HwAQ32OSDPortGet(&hw_osdport);
126 
127  if (hw_osdport != HWAQ32_OSDPORT_DISABLED) {
128  if (PIOS_SPI_Init(&pios_spi_external_id, &pios_spi_external_cfg)) {
129  PIOS_Assert(0);
130  }
131 
132  switch (hw_osdport) {
133 #ifdef PIOS_INCLUDE_MAX7456
134  case HWAQ32_OSDPORT_MAX7456OSD:
135  if (!PIOS_MAX7456_init(&pios_max7456_id,
136  pios_spi_external_id, 0)) {
137  // XXX do something?
138  }
139  break;
140 #endif
141  default:
142  PIOS_Assert(0);
143  break;
144  }
145  }
146 #endif /* PIOS_INCLUDE_SPI */
147 
148  /* IAP System Setup */
149  PIOS_IAP_Init();
150  uint16_t boot_count = PIOS_IAP_ReadBootCount();
151  if (boot_count < 3) {
152  PIOS_IAP_WriteBootCount(++boot_count);
153  AlarmsClear(SYSTEMALARMS_ALARM_BOOTFAULT);
154  } else {
155  /* Too many failed boot attempts, force hw config to defaults */
156  HwAQ32SetDefaults(HwAQ32Handle(), 0);
157  ModuleSettingsSetDefaults(ModuleSettingsHandle(),0);
158  AlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_CRITICAL);
159  }
160 
161 #if defined(PIOS_INCLUDE_USB)
162  /* Initialize USB disconnect GPIO */
163  GPIO_Init(pios_usb_main_cfg.disconnect.gpio, (GPIO_InitTypeDef*)&pios_usb_main_cfg.disconnect.init);
164  GPIO_SetBits(pios_usb_main_cfg.disconnect.gpio, pios_usb_main_cfg.disconnect.init.GPIO_Pin);
165 
166  /* Initialize board specific USB data */
168 
169  /* Flags to determine if various USB interfaces are advertised */
170  bool usb_hid_present = false;
171  bool usb_cdc_present = false;
172 
173 #if defined(PIOS_INCLUDE_USB_CDC)
175  PIOS_Assert(0);
176  }
177  usb_hid_present = true;
178  usb_cdc_present = true;
179 #else
181  PIOS_Assert(0);
182  }
183  usb_hid_present = true;
184 #endif
185 
186  uintptr_t pios_usb_id;
187  PIOS_USB_Init(&pios_usb_id, PIOS_BOARD_HW_DEFS_GetUsbCfg(bdinfo->board_rev));
188 
189 #if defined(PIOS_INCLUDE_USB_CDC)
190 
191  uint8_t hw_usb_vcpport;
192  /* Configure the USB VCP port */
193  HwAQ32USB_VCPPortGet(&hw_usb_vcpport);
194 
195  if (!usb_cdc_present) {
196  /* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */
197  hw_usb_vcpport = HWAQ32_USB_VCPPORT_DISABLED;
198  }
199 
200  PIOS_HAL_ConfigureCDC(hw_usb_vcpport, pios_usb_id, &pios_usb_cdc_cfg);
201 
202 #endif /* PIOS_INCLUDE_USB_CDC */
203 
204 #if defined(PIOS_INCLUDE_USB_HID)
205  /* Configure the usb HID port */
206  uint8_t hw_usb_hidport;
207  HwAQ32USB_HIDPortGet(&hw_usb_hidport);
208 
209  if (!usb_hid_present) {
210  /* Force HID port function to disabled if we haven't advertised HID in our USB descriptor */
211  hw_usb_hidport = HWAQ32_USB_HIDPORT_DISABLED;
212  }
213 
214  PIOS_HAL_ConfigureHID(hw_usb_hidport, pios_usb_id, &pios_usb_hid_cfg);
215 
216 #endif /* PIOS_INCLUDE_USB_HID */
217 
218  if (usb_hid_present || usb_cdc_present) {
220  }
221 
222  /* Issue USB Disconnect Pulse */
223  PIOS_WDG_Clear();
224 
225  GPIO_ResetBits(pios_usb_main_cfg.disconnect.gpio, pios_usb_main_cfg.disconnect.init.GPIO_Pin);
226 
227  PIOS_DELAY_WaitmS(200);
228 
229  GPIO_SetBits(pios_usb_main_cfg.disconnect.gpio, pios_usb_main_cfg.disconnect.init.GPIO_Pin);
230 
231  PIOS_WDG_Clear();
232 #endif /* PIOS_INCLUDE_USB */
233 
234  /* Configure the IO ports */
235 
236 #if defined(PIOS_INCLUDE_I2C)
237  if (PIOS_I2C_Init(&pios_i2c_internal_id, &pios_i2c_internal_cfg))
239 
240  if (PIOS_I2C_CheckClear(pios_i2c_internal_id) != 0)
242  else
243  if (AlarmsGet(SYSTEMALARMS_ALARM_I2C) == SYSTEMALARMS_ALARM_UNINITIALISED)
244  AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_OK);
245 #endif // PIOS_INCLUDE_I2C
246 
247  HwAQ32DSMxModeOptions hw_DSMxMode;
248  HwAQ32DSMxModeGet(&hw_DSMxMode);
249 
250  /* UART1 Port */
251  uint8_t hw_uart1;
252  HwAQ32Uart1Get(&hw_uart1);
253 
254  PIOS_HAL_ConfigurePort(hw_uart1, // port type protocol
255  &pios_usart1_cfg, // usart_port_cfg
256  &pios_usart_com_driver, // com_driver
257  NULL, // i2c_id
258  NULL, // i2c_cfg
259  NULL, // ppm_cfg
260  NULL, // pwm_cfg
261  PIOS_LED_ALARM, // led_id
262  NULL, // dsm_cfg
263  0, // dsm_mode
264  NULL); // sbus_cfg
265 
266  /* UART2 Port */
267  uint8_t hw_uart2;
268  HwAQ32Uart2Get(&hw_uart2);
269 
270  PIOS_HAL_ConfigurePort(hw_uart2, // port type protocol
271  &pios_usart2_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  NULL, // dsm_cfg
279  0, // dsm_mode
280  NULL); // sbus_cfg
281 
282  /* UART3 Port */
283  uint8_t hw_uart3;
284  HwAQ32Uart3Get(&hw_uart3);
285 
286  PIOS_HAL_ConfigurePort(hw_uart3, // port type protocol
287  &pios_usart3_cfg, // usart_port_cfg
288  &pios_usart_com_driver, // com_driver
289  NULL, // i2c_id
290  NULL, // i2c_cfg
291  NULL, // ppm_cfg
292  NULL, // pwm_cfg
293  PIOS_LED_ALARM, // led_id
294  NULL, // dsm_cfg
295  0, // dsm_mode
296  &pios_usart3_sbus_aux_cfg); // sbus_cfg
297 
298  if (hw_uart3 == HWAQ32_UART3_FRSKYSENSORHUB)
299  {
300  GPIO_Init(pios_usart3_sbus_aux_cfg.inv.gpio, (GPIO_InitTypeDef*)&pios_usart3_sbus_aux_cfg.inv.init);
301  GPIO_WriteBit(pios_usart3_sbus_aux_cfg.inv.gpio, pios_usart3_sbus_aux_cfg.inv.init.GPIO_Pin, pios_usart3_sbus_aux_cfg.gpio_inv_enable);
302  }
303 
304  /* UART4 Port */
305  uint8_t hw_uart4;
306  HwAQ32Uart4Get(&hw_uart4);
307 
308  PIOS_HAL_ConfigurePort(hw_uart4, // port type protocol
309  &pios_usart4_cfg, // usart_port_cfg
310  &pios_usart_com_driver, // com_driver
311  NULL, // i2c_id
312  NULL, // i2c_cfg
313  NULL, // ppm_cfg
314  NULL, // pwm_cfg
315  PIOS_LED_ALARM, // led_id
316  &pios_usart4_dsm_aux_cfg, // dsm_cfg
317  hw_DSMxMode, // dsm_mode
318  NULL); // sbus_cfg
319 
320  /* UART6 Port */
321  uint8_t hw_uart6;
322  HwAQ32Uart6Get(&hw_uart6);
323 
324  PIOS_HAL_ConfigurePort(hw_uart6, // port type protocol
325  &pios_usart6_cfg, // usart_port_cfg
326  &pios_usart_com_driver, // com_driver
327  NULL, // i2c_id
328  NULL, // i2c_cfg
329  NULL, // ppm_cfg
330  NULL, // pwm_cfg
331  PIOS_LED_ALARM, // led_id
332  &pios_usart6_dsm_aux_cfg, // dsm_cfg
333  hw_DSMxMode, // dsm_mode
334  NULL); // sbus_cfg
335 
336  uint8_t hw_rcvrport;
337  HwAQ32RcvrPortGet(&hw_rcvrport);
338 
339  /* Configure the rcvr port */
340  PIOS_HAL_ConfigurePort(hw_rcvrport, // port type protocol
341  NULL, // usart_port_cfg
342  NULL, // com_driver
343  NULL, // i2c_id
344  NULL, // i2c_cfg
345  &pios_ppm_cfg, // ppm_cfg
346  NULL, // pwm_cfg
347  PIOS_LED_ALARM, // led_id
348  NULL, // dsm_cfg
349  0, // dsm_mode
350  NULL); // sbus_cfg
351 
352 #if defined(PIOS_INCLUDE_SERVO) & defined(PIOS_INCLUDE_DMASHOT)
353  PIOS_DMAShot_Init(&dmashot_config);
354 #endif
355 
356 #if defined(PIOS_INCLUDE_TIM) && defined(PIOS_INCLUDE_SERVO)
357 #ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS
359 #else
360  PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels));
361 #endif
362 #endif
363 
364 #ifdef PIOS_INCLUDE_WS2811
365  RGBLEDSettingsInitialize();
366 
367  uint8_t temp;
368 
369  RGBLEDSettingsNumLedsGet(&temp);
370 
371  if (temp > 0) {
373 
374  // Drive default value (off) to strand once at startup
376  }
377 #endif
378 
379 #ifdef PIOS_INCLUDE_DAC
380  PIOS_DAC_init(&pios_dac, &pios_dac_cfg);
381 
382  PIOS_HAL_ConfigureDAC(pios_dac);
383 #endif /* PIOS_INCLUDE_DAC */
384 
385 /* init sensor queue registration */
387 
388  PIOS_WDG_Clear();
389  PIOS_DELAY_WaitmS(200);
390  PIOS_WDG_Clear();
391 
392 #if defined(PIOS_INCLUDE_MPU)
393  pios_mpu_dev_t mpu_dev = NULL;
394  if (PIOS_MPU_SPI_Init(&mpu_dev, pios_spi_internal_id, 0, &pios_mpu_cfg) != 0)
396 
397  HwAQ32GyroRangeOptions hw_gyro_range;
398  HwAQ32GyroRangeGet(&hw_gyro_range);
399  switch(hw_gyro_range) {
400  case HWAQ32_GYRORANGE_250:
402  break;
403  case HWAQ32_GYRORANGE_500:
405  break;
406  case HWAQ32_GYRORANGE_1000:
408  break;
409  case HWAQ32_GYRORANGE_2000:
411  break;
412  }
413 
414  HwAQ32AccelRangeOptions hw_accel_range;
415  HwAQ32AccelRangeGet(&hw_accel_range);
416  switch(hw_accel_range) {
417  case HWAQ32_ACCELRANGE_2G:
419  break;
420  case HWAQ32_ACCELRANGE_4G:
422  break;
423  case HWAQ32_ACCELRANGE_8G:
425  break;
426  case HWAQ32_ACCELRANGE_16G:
428  break;
429  }
430 
431  // the filter has to be set before rate else divisor calculation will fail
432  HwAQ32MPU6000DLPFOptions hw_mpu_dlpf;
433  HwAQ32MPU6000DLPFGet(&hw_mpu_dlpf);
434  uint16_t bandwidth = \
435  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_188) ? 188 : \
436  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_98) ? 98 : \
437  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_42) ? 42 : \
438  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_20) ? 20 : \
439  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_10) ? 10 : \
440  (hw_mpu_dlpf == HWAQ32_MPU6000DLPF_5) ? 5 : \
441  188;
442  PIOS_MPU_SetGyroBandwidth(bandwidth);
443 #endif
444 
445 #if defined(PIOS_INCLUDE_I2C)
446  PIOS_WDG_Clear();
447 
448  uint8_t hw_magnetometer;
449  HwAQ32MagnetometerGet(&hw_magnetometer);
450 
451  switch (hw_magnetometer) {
452  case HWAQ32_MAGNETOMETER_NONE:
453  break;
454 
455  case HWAQ32_MAGNETOMETER_INTERNAL:
456 #if defined(PIOS_INCLUDE_HMC5883)
457  if ((PIOS_HMC5883_Init(pios_i2c_internal_id, &pios_hmc5883_internal_cfg) != 0) ||
458  (PIOS_HMC5883_Test() != 0)) {
460  }
461 #endif /* PIOS_INCLUDE_HMC5883 */
462  break;
463 
464  /* default external mags and handle them in PiOS HAL rather than maintaining list here */
465  default:
466  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_I2C, // port type protocol
467  NULL, // usart_port_cfg
468  NULL, // com_driver
469  &pios_i2c_external_id, // i2c_id
470  &pios_i2c_external_cfg, // i2c_cfg
471  NULL, // ppm_cfg
472  NULL, // pwm_cfg
473  PIOS_LED_ALARM, // led_id
474  NULL, // dsm_cfg
475  0, // dsm_mode
476  NULL); // sbus_cfg
477 
478  uint8_t hw_orientation;
479  HwAQ32ExtMagOrientationGet(&hw_orientation);
480 
481  PIOS_HAL_ConfigureExternalMag(hw_magnetometer, hw_orientation,
482  &pios_i2c_external_id, &pios_i2c_external_cfg);
483 
484  break;
485  }
486 
487 
488  /* I2C is slow, sensor init as well, reset watchdog to prevent reset here */
489  PIOS_WDG_Clear();
490 
491 #if defined(PIOS_INCLUDE_MS5611)
492  if ((PIOS_MS5611_Init(&pios_ms5611_cfg, pios_i2c_internal_id) != 0)
493  || (PIOS_MS5611_Test() != 0))
495 #endif
496 
497  //I2C is slow, sensor init as well, reset watchdog to prevent reset here
498  PIOS_WDG_Clear();
499 
500 #endif /* PIOS_INCLUDE_I2C */
501 
502 #if defined(PIOS_INCLUDE_ADC)
503  /* Configure the adc port(s) */
504  uint8_t hw_adcport;
505 
506  HwAQ32ADCInputsGet(&hw_adcport);
507 
508  switch (hw_adcport) {
509  case HWAQ32_ADCINPUTS_DISABLED:
510  break;
511  case HWAQ32_ADCINPUTS_ENABLED:
512  {
513  uintptr_t internal_adc_id;
514 
515  if (PIOS_INTERNAL_ADC_Init(&internal_adc_id, &pios_adc_cfg) < 0) {
516  PIOS_Assert(0);
518  }
519 
520  if (PIOS_ADC_Init(&pios_internal_adc_id, &pios_internal_adc_driver, internal_adc_id) < 0)
522  }
523  break;
524  }
525 #endif
526 
527  /* Make sure we have at least one telemetry link configured or else fail initialization */
529 }
530 
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)
int32_t PIOS_I2C_CheckClear(pios_i2c_t i2c_id)
int32_t PIOS_HMC5883_Test(void)
#define NELEMENTS(x)
Definition: pios.h:192
#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
const struct pios_board_info pios_board_info_blob
struct pios_mpu_dev * pios_mpu_dev_t
Definition: pios_mpu.h:150
struct max7456_dev_s * max7456_dev_t
Definition: pios_max7456.h:65
int PIOS_WS2811_init(ws2811_dev_t *dev_out, const struct pios_ws2811_cfg *cfg, int max_leds)
Allocate and initialise WS2811 device.
Definition: pios_ws2811.c:64
#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.
int32_t PIOS_MPU_SPI_Init(pios_mpu_dev_t *dev, pios_spi_t spi_id, uint32_t slave_num, const struct pios_mpu_cfg *cfg)
Initialize the MPU-xxxx 6/9-axis sensor on SPI.
void PIOS_DEBUG_Init(const struct pios_tim_channel *channels, uint8_t num_channels)
Definition: pios_debug.c:44
static const struct pios_tim_clock_cfg tim_4_cfg
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
uintptr_t pios_internal_adc_id
Definition: pios_board.c:51
ws2811_dev_t pios_ws2811
Definition: pios_board.c:66
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_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)
int32_t PIOS_HMC5883_Init(pios_i2c_t i2c_id, const struct pios_hmc5883_cfg *cfg)
Includes PiOS and core architecture components.
int32_t AlarmsClear(SystemAlarmsAlarmElem alarm)
Definition: alarms.c:171
void PIOS_WS2811_trigger_update(ws2811_dev_t dev)
Trigger an update of the LED strand.
Definition: pios_ws2811.c:197
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)
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)
static const struct pios_tim_clock_cfg tim_3_cfg
void PIOS_HAL_CriticalError(uint32_t led_id, enum pios_hal_panic code)
Flash a blink code.
Definition: pios_hal.c:291
static const struct pios_tim_clock_cfg tim_2_cfg
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
int PIOS_MAX7456_init(max7456_dev_t *dev_out, pios_spi_t spi_handle, uint32_t slave_idx)
Allocate and initialise MAX7456 device.
int32_t PIOS_DELAY_WaitmS(uint32_t mS)
Definition: pios_delay.c:140
int32_t PIOS_MPU_SetGyroRange(enum pios_mpu_gyro_range range)
int32_t PIOS_USB_BOARD_DATA_Init(void)
SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm)
Definition: alarms.c:129