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 
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  * Additional note on redistribution: The copyright and license notices above
31  * must be maintained in each individual source file that is a derivative work
32  * of this source file; otherwise redistribution is prohibited.
33  */
34 
35 /* Pull in the board-specific static HW definitions.
36  * Including .c files is a bit ugly but this allows all of
37  * the HW definitions to be const and static to limit their
38  * scope.
39  *
40  * NOTE: THIS IS THE ONLY PLACE THAT SHOULD EVER INCLUDE THIS FILE
41  */
42 #include "board_hw_defs.c"
43 
44 #include <pios.h>
45 #include <pios_hal.h>
46 #include <openpilot.h>
47 #include <uavobjectsinit.h>
48 #include "hwrevolution.h"
49 #include "manualcontrolsettings.h"
50 #include "modulesettings.h"
51 #include <pios_max7456.h>
52 #include <pios_openlrs_rcvr_priv.h>
53 
54 #if defined(PIOS_INCLUDE_WS2811)
55 #include "rgbledsettings.h"
56 #endif
57 
58 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
59 #define PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN 40
60 uintptr_t pios_com_debug_id;
61 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
62 
63 uintptr_t pios_internal_adc_id = 0;
66 
67 #ifdef PIOS_INCLUDE_MAX7456
68 max7456_dev_t pios_max7456_id;
69 #endif
70 
77 #include <pios_board_info.h>
78 
79 void PIOS_Board_Init(void) {
80  bool use_rxport_usart = false;
81 
82  /* some clone boards omit components, we will ignore that if running on a clone */
83  bool is_modified_clone = false;
84 
85  const struct pios_board_info * bdinfo = &pios_board_info_blob;
86 
87 #if defined(PIOS_INCLUDE_ANNUNC)
88  const struct pios_annunc_cfg * led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
89  PIOS_Assert(led_cfg);
90  PIOS_ANNUNC_Init(led_cfg);
91 #endif /* PIOS_INCLUDE_ANNUNC */
92 
93  pios_spi_t pios_spi_gyro_id;
94  /* Set up the SPI interface to the gyro/acelerometer */
95  if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {
97  }
98 
99  /* Set up the SPI interface to the flash and rfm22b */
100  if (PIOS_SPI_Init(&pios_spi_telem_flash_id, &pios_spi_telem_flash_cfg)) {
102  }
103 
104 #if defined(PIOS_INCLUDE_FLASH)
105  /* Inititialize all flash drivers */
106  bool flash_chip_ok = false;
107  for (int i = 0; i < NELEMENTS(flash_chip_cfgs); i++) {
108  if (PIOS_Flash_Jedec_Init(&pios_external_flash_id, pios_spi_telem_flash_id,
109  1, &flash_chip_cfgs[i]) == 0) {
110  flash_chip_ok = true;
111  is_modified_clone = i > 0;
112  break;
113  }
114  }
115 
116  if (!flash_chip_ok) {
117  /* Cope with clones with no flash, too. */
118 
119  is_modified_clone = true;
120 
121  /* Override LED configuration for Omnibus things */
122  PIOS_ANNUNC_Init(&pios_annunc_omnibus_cfg);
123 
124  pios_external_flash_id = 0;
125  }
126 
127  PIOS_Flash_Internal_Init(&pios_internal_flash_id, &flash_internal_cfg);
128 
129  /* Register the partition table */
130  const struct pios_flash_partition * flash_partition_table;
131  uint32_t num_partitions;
132 
133  flash_partition_table = PIOS_BOARD_HW_DEFS_GetPartitionTable(bdinfo->board_rev, &num_partitions);
134  PIOS_FLASH_register_partition_table(flash_partition_table, num_partitions);
135 
136  /* Mount all filesystems */
139 #endif /* PIOS_INCLUDE_FLASH */
140 
141  PIOS_RESET_Clear(); // Clear the RCC reset flags after use.
142 
143  /* Initialize the hardware UAVOs */
144  HwRevolutionInitialize();
145  ModuleSettingsInitialize();
146 
147 #if defined(PIOS_INCLUDE_RTC)
148  PIOS_RTC_Init(&pios_rtc_main_cfg);
149 #endif
150 
151  /* Initialize watchdog as early as possible to catch faults during init
152  * but do it only if there is no debugger connected
153  */
154  if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == 0) {
155  PIOS_WDG_Init();
156  }
157 
158  /* Set up pulse timers */
168  /* IAP System Setup */
169  PIOS_IAP_Init();
170  uint16_t boot_count = PIOS_IAP_ReadBootCount();
171  if (boot_count < 3) {
172  PIOS_IAP_WriteBootCount(++boot_count);
173  AlarmsClear(SYSTEMALARMS_ALARM_BOOTFAULT);
174  } else {
175  /* Too many failed boot attempts, force hw config to defaults */
176  HwRevolutionSetDefaults(HwRevolutionHandle(), 0);
177  ModuleSettingsSetDefaults(ModuleSettingsHandle(),0);
178  AlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_CRITICAL);
179  }
180 
181 
182  //PIOS_IAP_Init();
183 
184 #if defined(PIOS_INCLUDE_USB)
185  /* Initialize board specific USB data */
187 
188  /* Flags to determine if various USB interfaces are advertised */
189  bool usb_hid_present = false;
190  bool usb_cdc_present = false;
191 
192 #if defined(PIOS_INCLUDE_USB_CDC)
194  PIOS_Assert(0);
195  }
196  usb_hid_present = true;
197  usb_cdc_present = true;
198 #else
200  PIOS_Assert(0);
201  }
202  usb_hid_present = true;
203 #endif
204 
205  uintptr_t pios_usb_id;
206  PIOS_USB_Init(&pios_usb_id, PIOS_BOARD_HW_DEFS_GetUsbCfg(bdinfo->board_rev));
207 
208 #if defined(PIOS_INCLUDE_USB_CDC)
209  uint8_t hw_usb_vcpport;
210  /* Configure the USB VCP port */
211  HwRevolutionUSB_VCPPortGet(&hw_usb_vcpport);
212 
213  PIOS_HAL_ConfigureCDC(hw_usb_vcpport,
214  pios_usb_id, &pios_usb_cdc_cfg);
215 #endif /* PIOS_INCLUDE_USB_CDC */
216 
217 #if defined(PIOS_INCLUDE_USB_HID)
218  /* Configure the usb HID port */
219  uint8_t hw_usb_hidport;
220  HwRevolutionUSB_HIDPortGet(&hw_usb_hidport);
221 
222  if (!usb_hid_present) {
223  /* Force HID port function to disabled if we haven't advertised HID in our USB descriptor */
224  hw_usb_hidport = HWREVOLUTION_USB_HIDPORT_DISABLED;
225  }
226 
227  PIOS_HAL_ConfigureHID(hw_usb_hidport, pios_usb_id, &pios_usb_hid_cfg);
228 #endif /* PIOS_INCLUDE_USB_HID */
229 
230  if (usb_hid_present || usb_cdc_present) {
232  }
233 #endif /* PIOS_INCLUDE_USB */
234 
235  /* Configure IO ports */
236 
237 #if defined(PIOS_INCLUDE_I2C)
238  if (PIOS_I2C_Init(&pios_i2c_mag_pressure_adapter_id, &pios_i2c_mag_pressure_adapter_cfg)) {
239  if (!is_modified_clone) {
241  }
242  } else {
243  if (AlarmsGet(SYSTEMALARMS_ALARM_I2C) == SYSTEMALARMS_ALARM_UNINITIALISED) {
244  AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_OK);
245  }
246  }
247 #endif // PIOS_INCLUDE_I2C
248 
249  HwRevolutionDSMxModeOptions hw_DSMxMode;
250  HwRevolutionDSMxModeGet(&hw_DSMxMode);
251 
252  /* Configure main USART port */
253 
254  uint8_t hw_mainport;
255  HwRevolutionMainPortGet(&hw_mainport);
256 
257  PIOS_HAL_ConfigurePort(hw_mainport, // port type protocol
258  &pios_usart_main_cfg, // usart_port_cfg
259  &pios_usart_com_driver, // com_driver
260  NULL, // i2c_id
261  NULL, // i2c_cfg
262  NULL, // ppm_cfg
263  NULL, // pwm_cfg
264  PIOS_LED_HEARTBEAT, // led_id
265  &pios_dsm_main_cfg, // dsm_cfg
266  hw_DSMxMode >= HWREVOLUTION_DSMXMODE_BIND3PULSES ? HWREVOLUTION_DSMXMODE_AUTODETECT : hw_DSMxMode /* No bind on main port */,
267  &pios_sbus_cfg); // sbus_cfg
268 
269  /* Configure FlexiPort */
270  uint8_t hw_flexiport;
271  HwRevolutionFlexiPortGet(&hw_flexiport);
272 
273  PIOS_HAL_ConfigurePort(hw_flexiport, // port type protocol
274  &pios_usart_flexi_cfg, // usart_port_cfg
275  &pios_usart_com_driver, // com_driver
276  &pios_i2c_flexiport_adapter_id, // i2c_id
277  &pios_i2c_flexiport_adapter_cfg, // i2c_cfg
278  NULL, // ppm_cfg
279  NULL, // pwm_cfg
280  PIOS_LED_HEARTBEAT, // led_id
281  &pios_dsm_flexi_cfg, // dsm_cfg
282  hw_DSMxMode, // dsm_mode
283  NULL); // sbus_cfg
284 
285  /* Configure the receiver port*/
286  uint8_t hw_rxport;
287  HwRevolutionRxPortGet(&hw_rxport);
288 
289  switch (hw_rxport) {
290  case HWREVOLUTION_RXPORT_DISABLED:
291  break;
292 
293  case HWREVOLUTION_RXPORT_PWM:
294  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PWM, // port type protocol
295  NULL, // usart_port_cfg
296  NULL, // com_driver
297  NULL, // i2c_id
298  NULL, // i2c_cfg
299  NULL, // ppm_cfg
300  &pios_pwm_cfg, // pwm_cfg
301  PIOS_LED_HEARTBEAT, // led_id
302  NULL, // dsm_cfg
303  0, // dsm_mode
304  NULL); // sbus_cfg
305  break;
306 
307  case HWREVOLUTION_RXPORT_PPM:
308  case HWREVOLUTION_RXPORT_PPMOUTPUTS:
309  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PPM, // port type protocol
310  NULL, // usart_port_cfg
311  NULL, // com_driver
312  NULL, // i2c_id
313  NULL, // i2c_cfg
314  &pios_ppm_cfg, // ppm_cfg
315  NULL, // pwm_cfg
316  PIOS_LED_HEARTBEAT, // led_id
317  NULL, // dsm_cfg
318  0, // dsm_mode
319  NULL); // sbus_cfg
320  break;
321 
322  case HWREVOLUTION_RXPORT_UART:
323  use_rxport_usart = true;
324  break;
325 
326  case HWREVOLUTION_RXPORT_PPMUART:
327  use_rxport_usart = true;
328 
329  PIOS_HAL_ConfigurePort(HWSHARED_PORTTYPES_PPM, // port type protocol
330  NULL, // usart_port_cfg
331  NULL, // com_driver
332  NULL, // i2c_id
333  NULL, // i2c_cfg
334  &pios_ppm_cfg, // ppm_cfg
335  NULL, // pwm_cfg
336  PIOS_LED_HEARTBEAT, // led_id
337  NULL, // dsm_cfg
338  0, // dsm_mode
339  NULL); // sbus_cfg
340  break;
341  }
342 
343  /* Configure the RxPort USART */
344  if (use_rxport_usart) {
345  uint8_t hw_rxportusart;
346  HwRevolutionRxPortUsartGet(&hw_rxportusart);
347 
348  PIOS_HAL_ConfigurePort(hw_rxportusart, // port type protocol
349  &pios_rxportusart_cfg, // usart_port_cfg
350  &pios_usart_com_driver, // com_driver
351  NULL, // i2c_id
352  NULL, // i2c_cfg
353  NULL, // ppm_cfg
354  NULL, // pwm_cfg
355  PIOS_LED_HEARTBEAT, // led_id
356  &pios_rxportusart_dsm_aux_cfg, // dsm_cfg
357  hw_DSMxMode, // dsm_mode
358  NULL); // sbus_cfg
359  }
360 
361 #ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS
362  switch (hw_rxport) {
363  case HWREVOLUTION_RXPORT_DISABLED:
364  case HWREVOLUTION_RXPORT_PWM:
365  case HWREVOLUTION_RXPORT_PPM:
366  case HWREVOLUTION_RXPORT_UART:
367  case HWREVOLUTION_RXPORT_PPMUART:
368  /* Set up the servo outputs */
369 #ifdef PIOS_INCLUDE_SERVO
371 #endif
372  break;
373  case HWREVOLUTION_RXPORT_PPMOUTPUTS:
374 #ifdef PIOS_INCLUDE_SERVO
375  PIOS_Servo_Init(&pios_servo_rcvr_ppm_cfg);
376 #endif
377  break;
378  case HWREVOLUTION_RXPORT_OUTPUTS:
379 #ifdef PIOS_INCLUDE_SERVO
380  PIOS_Servo_Init(&pios_servo_rcvr_all_cfg);
381 #endif
382  break;
383  }
384 #else
385  PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels));
386 #endif
387 
388  HwRevolutionData hwRevoMini;
389  HwRevolutionGet(&hwRevoMini);
390 
391  uint8_t hw_spiperiph;
392 
393  HwRevolutionSPIPeripheralGet(&hw_spiperiph);
394 
395  switch (hw_spiperiph) {
396  default:
397  PIOS_Assert(0);
398  break;
399  case HWREVOLUTION_SPIPERIPHERAL_DISABLED:
400  break;
401 
402 #ifdef PIOS_INCLUDE_MAX7456
403  case HWREVOLUTION_SPIPERIPHERAL_MAX7456OSD:
404  if (!PIOS_MAX7456_init(&pios_max7456_id, pios_spi_telem_flash_id,
405  0)) {
406  // XXX do something?
407  }
408  break;
409 #endif
410 
411 #ifdef PIOS_INCLUDE_OPENLRS
412  case HWREVOLUTION_SPIPERIPHERAL_RADIO:
413  (void) 0;
414  const struct pios_openlrs_cfg *openlrs_cfg =PIOS_BOARD_HW_DEFS_GetOpenLRSCfg(bdinfo->board_rev);
415 
416  PIOS_HAL_ConfigureRFM22B(pios_spi_telem_flash_id,
417  bdinfo->board_type, bdinfo->board_rev,
418  hwRevoMini.RfBand,
419  hwRevoMini.MaxRfPower,
420  openlrs_cfg,
421  &openlrs_handle);
422  break;
423 #endif /* PIOS_INCLUDE_OPENLRS */
424  }
425 
426 #ifdef PIOS_INCLUDE_WS2811
427  uint8_t num_leds;
428 
429  RGBLEDSettingsInitialize();
430 
431  RGBLEDSettingsNumLedsGet(&num_leds);
432 
433  if (num_leds > 0) {
434  switch (hwRevoMini.WS2811Pin) {
435  default:
436  case HWREVOLUTION_WS2811PIN_DISABLED:
437  break;
438 
439  case HWREVOLUTION_WS2811PIN_PB12INPORTPIN3:
441  &pios_ws2811_cfg_pb12,
442  num_leds);
444  break;
445 
446  case HWREVOLUTION_WS2811PIN_PD2OMNIBUSF4LEDPORT:
447  if (hw_spiperiph == HWREVOLUTION_SPIPERIPHERAL_RADIO) {
448  // Not compatible with radio use.
449  break;
450  }
451 
453  &pios_ws2811_cfg_pd2,
454  num_leds);
456  break;
457 
458  case HWREVOLUTION_WS2811PIN_PB6OMNIBUSF4V2LEDPORT:
460  &pios_ws2811_cfg_pb6,
461  num_leds);
463  break;
464 
465  case HWREVOLUTION_WS2811PIN_PA0SERVOOUT6:
466  /* 0 indexed */
469  &pios_ws2811_cfg_pa0,
470  num_leds);
472  break;
473  }
474  }
475 #endif /* PIOS_INCLUDE_WS2811 */
476 
477  /* init sensor queue registration */
479 
480  PIOS_WDG_Clear();
481  PIOS_DELAY_WaitmS(200);
482  PIOS_WDG_Clear();
483 
484 #if defined(PIOS_INCLUDE_MPU)
485  pios_mpu_dev_t mpu_dev = NULL;
486  if (PIOS_MPU_SPI_Init(&mpu_dev, pios_spi_gyro_id, 0, &pios_mpu_cfg) != 0)
488 
489  HwRevolutionGyroRangeOptions hw_gyro_range;
490  HwRevolutionGyroRangeGet(&hw_gyro_range);
491  switch(hw_gyro_range) {
492  case HWREVOLUTION_GYRORANGE_250:
494  break;
495  case HWREVOLUTION_GYRORANGE_500:
497  break;
498  case HWREVOLUTION_GYRORANGE_1000:
500  break;
501  case HWREVOLUTION_GYRORANGE_2000:
503  break;
504  }
505 
506  HwRevolutionAccelRangeOptions hw_accel_range;
507  HwRevolutionAccelRangeGet(&hw_accel_range);
508  switch(hw_accel_range) {
509  case HWREVOLUTION_ACCELRANGE_2G:
511  break;
512  case HWREVOLUTION_ACCELRANGE_4G:
514  break;
515  case HWREVOLUTION_ACCELRANGE_8G:
517  break;
518  case HWREVOLUTION_ACCELRANGE_16G:
520  break;
521  }
522 
523  // the filter has to be set before rate else divisor calculation will fail
524  HwRevolutionMPU6000DLPFOptions hw_mpu_dlpf;
525  HwRevolutionMPU6000DLPFGet(&hw_mpu_dlpf);
526  uint16_t bandwidth = \
527  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_188) ? 188 : \
528  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_98) ? 98 : \
529  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_42) ? 42 : \
530  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_20) ? 20 : \
531  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_10) ? 10 : \
532  (hw_mpu_dlpf == HWREVOLUTION_MPU6000DLPF_5) ? 5 : \
533  188;
534  PIOS_MPU_SetGyroBandwidth(bandwidth);
535 #endif
536 
537 #if defined(PIOS_INCLUDE_I2C)
538  PIOS_WDG_Clear();
539 
540  uint8_t hw_magnetometer;
541  HwRevolutionMagnetometerGet(&hw_magnetometer);
542 
543  if (!pios_i2c_mag_pressure_adapter_id) {
544  hw_magnetometer = HWREVOLUTION_MAGNETOMETER_NONE;
545  }
546 
547  switch (hw_magnetometer) {
548  case HWREVOLUTION_MAGNETOMETER_NONE:
549  break;
550 
551  case HWREVOLUTION_MAGNETOMETER_INTERNAL:
552 #if defined(PIOS_INCLUDE_HMC5883)
553  if ((PIOS_HMC5883_Init(pios_i2c_mag_pressure_adapter_id, &pios_hmc5883_cfg) != 0) ||
554  (PIOS_HMC5883_Test() != 0)) {
555  if (!is_modified_clone) {
557  }
558  }
559 #endif /* PIOS_INCLUDE_HMC5883 */
560  break;
561 
562  /* default external mags and handle them in PiOS HAL rather than maintaining list here */
563  default:
564  if (hw_flexiport == HWSHARED_PORTTYPES_I2C) {
565  uint8_t hw_orientation;
566  HwRevolutionExtMagOrientationGet(&hw_orientation);
567 
568  PIOS_HAL_ConfigureExternalMag(hw_magnetometer, hw_orientation,
569  &pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg);
570  } else {
572  }
573  break;
574  }
575 
576  /* I2C is slow, sensor init as well, reset watchdog to prevent reset here */
577  PIOS_WDG_Clear();
578 
579 #if defined(PIOS_INCLUDE_MS5611)
580  if ((!pios_i2c_mag_pressure_adapter_id) || (PIOS_MS5611_Init(&pios_ms5611_cfg, pios_i2c_mag_pressure_adapter_id) != 0) || (PIOS_MS5611_Test() != 0)) {
581  if (!is_modified_clone) {
583  }
584  }
585 #endif
586 
587  //I2C is slow, sensor init as well, reset watchdog to prevent reset here
588  PIOS_WDG_Clear();
589 
590 #if defined(PIOS_INCLUDE_BMP280) && !defined(PIOS_EXCLUDE_BMP280_I2C)
591  /* BMP280 I2C onboard support on clones */
592  if (is_modified_clone &&
593  (pios_i2c_mag_pressure_adapter_id) &&
596  pios_i2c_mag_pressure_adapter_id);
597  }
598 #endif /* defined(PIOS_INCLUDE_BMP280) && !defined(PIOS_EXCLUDE_BMP280_I2C) */
599 
600 #endif /* PIOS_INCLUDE_I2C */
601 
602 #ifdef PIOS_INCLUDE_SPI
603 #ifdef PIOS_INCLUDE_BMP280_SPI
604  // BMP280 support
605  if ((!flash_chip_ok) &&
607  /* Best effort */
609  pios_spi_telem_flash_id, 1);
610  }
611 #endif /* PIOS_INCLUDE_BMP280_SPI */
612 #endif
613 
614 #if defined(PIOS_INCLUDE_ADC)
615  uintptr_t internal_adc_id;
616  PIOS_INTERNAL_ADC_Init(&internal_adc_id, &pios_adc_cfg);
618 
619  // configure the pullup for PA8 (inhibit pullups from current/sonar shared pin)
620  GPIO_Init(pios_current_sonar_pin.gpio, &pios_current_sonar_pin.init);
621 #endif
622 }
623 
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_HMC5883_Test(void)
#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)
uintptr_t pios_com_debug_id
Definition: pios_board.c:76
#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
static const struct pios_usart_cfg pios_usart_main_cfg
int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity)
Definition: alarms.c:97
uintptr_t pios_uavo_settings_fs_id
Definition: pios_board.c:50
Configuration structure for the BMP280 driver.
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
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
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
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)
void PIOS_Servo_DisableChannel(int channel)
Definition: pios_servo.c:158
const struct pios_adc_driver pios_internal_adc_driver
bool PIOS_SENSORS_IsRegistered(enum pios_sensor_type type)
Checks if a sensor type is registered with the PIOS_SENSORS interface.
Definition: pios_sensors.c:88
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)
uint8_t i
Definition: msp_messages.h:97
static const struct pios_tim_clock_cfg tim_1_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_BMP280_SPI_Init(const struct pios_bmp280_cfg *cfg, pios_spi_t spi_device, uint32_t spi_slave)
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...
static const struct pios_usart_cfg pios_usart_flexi_cfg
uintptr_t pios_com_openlog_logging_id
Definition: pios_board.c:49
int32_t PIOS_BMP280_Init(const struct pios_bmp280_cfg *cfg, pios_i2c_t i2c_device)
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)
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_9_cfg
static const struct pios_tim_clock_cfg tim_10_cfg
#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)
static const struct pios_tim_clock_cfg tim_11_cfg
SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm)
Definition: alarms.c:129
void PIOS_RESET_Clear(void)
PIOS_RESET_Clear Does nothing on POSIX systems.
Definition: pios_reset.c:38
#define PIOS_LED_HEARTBEAT
Definition: pios_board.h:85
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