42 #include <dacsettings.h> 
   43 #include <manualcontrolsettings.h> 
   45 #if defined(PIOS_INCLUDE_OPENLRS) 
   47 #if defined(PIOS_INCLUDE_OPENLRS_RCVR) 
   52 #if defined(PIOS_INCLUDE_UAVTALKRCVR) 
   56 #ifdef PIOS_INCLUDE_USART 
   76 #if defined(PIOS_INCLUDE_DAC_ANNUNCIATOR) 
   83 #if defined(PIOS_INCLUDE_MAVLINK) 
   87 #if defined(PIOS_INCLUDE_MSP_BRIDGE) 
   91 #if defined(PIOS_INCLUDE_HOTT) 
   95 #if defined(PIOS_INCLUDE_FRSKY_SENSOR_HUB) 
   99 #if defined(PIOS_INCLUDE_FRSKY_SPORT_TELEMETRY) 
  103 #if defined(PIOS_INCLUDE_LIGHTTELEMETRY) 
  107 #if defined(PIOS_INCLUDE_STORM32BGC) 
  111 #if defined(PIOS_INCLUDE_TBSVTXCONFIG) 
  115 #if defined(PIOS_INCLUDE_USB_HID) || defined(PIOS_INCLUDE_USB_CDC) 
  119 #if defined(PIOS_INCLUDE_USB_CDC) 
  123 #if defined(PIOS_INCLUDE_OPENLRS) 
  129 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE) 
  130 #define PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN 40 
  134 #ifndef PIOS_COM_TELEM_RF_RX_BUF_LEN 
  135 #define PIOS_COM_TELEM_RF_RX_BUF_LEN 512 
  138 #ifndef PIOS_COM_TELEM_RF_TX_BUF_LEN 
  139 #define PIOS_COM_TELEM_RF_TX_BUF_LEN 512 
  142 #ifndef PIOS_COM_GPS_RX_BUF_LEN 
  143 #define PIOS_COM_GPS_RX_BUF_LEN 32 
  146 #ifndef PIOS_COM_GPS_TX_BUF_LEN 
  147 #define PIOS_COM_GPS_TX_BUF_LEN 16 
  150 #ifndef PIOS_COM_TELEM_USB_RX_BUF_LEN 
  151 #define PIOS_COM_TELEM_USB_RX_BUF_LEN 129 
  154 #ifndef PIOS_COM_TELEM_USB_TX_BUF_LEN 
  155 #define PIOS_COM_TELEM_USB_TX_BUF_LEN 65 
  158 #ifndef PIOS_COM_BRIDGE_RX_BUF_LEN 
  159 #define PIOS_COM_BRIDGE_RX_BUF_LEN 65 
  162 #ifndef PIOS_COM_BRIDGE_TX_BUF_LEN 
  163 #define PIOS_COM_BRIDGE_TX_BUF_LEN 12 
  166 #ifndef PIOS_COM_MAVLINK_TX_BUF_LEN 
  167 #define PIOS_COM_MAVLINK_TX_BUF_LEN 128 
  170 #ifndef PIOS_COM_MSP_TX_BUF_LEN 
  171 #define PIOS_COM_MSP_TX_BUF_LEN 128 
  174 #ifndef PIOS_COM_MSP_RX_BUF_LEN 
  175 #define PIOS_COM_MSP_RX_BUF_LEN 65 
  178 #ifndef PIOS_COM_HOTT_RX_BUF_LEN 
  179 #define PIOS_COM_HOTT_RX_BUF_LEN 16 
  182 #ifndef PIOS_COM_HOTT_TX_BUF_LEN 
  183 #define PIOS_COM_HOTT_TX_BUF_LEN 16 
  186 #ifndef PIOS_COM_FRSKYSENSORHUB_TX_BUF_LEN 
  187 #define PIOS_COM_FRSKYSENSORHUB_TX_BUF_LEN 128 
  190 #ifndef PIOS_COM_LIGHTTELEMETRY_TX_BUF_LEN 
  191 #define PIOS_COM_LIGHTTELEMETRY_TX_BUF_LEN 22 
  194 #ifndef PIOS_COM_FRSKYSPORT_TX_BUF_LEN 
  195 #define PIOS_COM_FRSKYSPORT_TX_BUF_LEN 16 
  198 #ifndef PIOS_COM_FRSKYSPORT_RX_BUF_LEN 
  199 #define PIOS_COM_FRSKYSPORT_RX_BUF_LEN 16 
  202 #ifndef PIOS_COM_OPENLOG_TX_BUF_LEN 
  203 #define PIOS_COM_OPENLOG_TX_BUF_LEN 768 
  206 #ifndef PIOS_COM_STORM32BGC_RX_BUF_LEN 
  207 #define PIOS_COM_STORM32BGC_RX_BUF_LEN 32 
  210 #ifndef PIOS_COM_STORM32BGC_TX_BUF_LEN 
  211 #define PIOS_COM_STORM32BGC_TX_BUF_LEN 32 
  214 #ifndef PIOS_COM_TBSVTXCONFIG_TX_BUF_LEN 
  215 #define PIOS_COM_TBSVTXCONFIG_TX_BUF_LEN 32 
  218 #ifndef PIOS_COM_TBSVTXCONFIG_RX_BUF_LEN 
  219 #define PIOS_COM_TBSVTXCONFIG_RX_BUF_LEN 32 
  222 #ifdef PIOS_INCLUDE_HMC5883 
  235 #ifdef PIOS_INCLUDE_HMC5983_I2C 
  249 #ifdef PIOS_INCLUDE_BMP280 
  257 #ifdef PIOS_INCLUDE_MS5611 
  262         .temperature_interleaving = 1,
 
  263         .use_0x76_address         = 
false,
 
  267 #ifdef PIOS_INCLUDE_WS2811 
  273 #ifdef PIOS_INCLUDE_WS2811 
  292 #if defined(PIOS_TOLERATE_MISSING_SENSORS) 
  304 #if defined(PIOS_INCLUDE_ANNUNC) 
  305         for (
int cnt = 0; cnt < 3; cnt++) {
 
  306                 for (int32_t 
i = 0; 
i < code; 
i++) {
 
  323 #endif // PIOS_INCLUDE_ANNUNC 
  338 #ifndef PIOS_NO_ALARMS 
  348 #ifdef PIOS_INCLUDE_RCVR 
  357         (void) receiver_type;
 
  371         if (receiver_type < 0) {
 
  373         } 
else if (receiver_type >= MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE) {
 
  383 #endif // PIOS_INCLUDE_RCVR 
  385 #if defined(PIOS_INCLUDE_USART) && defined(PIOS_INCLUDE_COM) 
  395 void PIOS_HAL_ConfigureCom(
const struct pios_usart_cfg *usart_port_cfg,
 
  409                         rx_buf_len, tx_buf_len)) {
 
  415 #ifdef PIOS_INCLUDE_DSM 
  424 static void PIOS_HAL_ConfigureDSM(
const struct pios_usart_cfg *usart_dsm_cfg,
 
  428                                   HwSharedDSMxModeOptions 
mode)
 
  430         uintptr_t usart_dsm_id;
 
  431         if (
PIOS_USART_Init(&usart_dsm_id, usart_dsm_cfg, usart_port_params)) {
 
  437                                 usart_dsm_id, mode)) {
 
  441         uintptr_t dsm_rcvr_id;
 
  450 #ifdef PIOS_INCLUDE_HSUM 
  458 static void PIOS_HAL_ConfigureHSUM(
const struct pios_usart_cfg *usart_hsum_cfg,
 
  463         uintptr_t usart_hsum_id;
 
  464         if (
PIOS_USART_Init(&usart_hsum_id, usart_hsum_cfg, usart_port_params)) {
 
  470                                 usart_hsum_id, *proto)) {
 
  474         uintptr_t hsum_rcvr_id;
 
  484 #ifdef PIOS_INCLUDE_SRXL 
  491 static void PIOS_HAL_ConfigureSRXL(
const struct pios_usart_cfg *usart_srxl_cfg,
 
  495         uintptr_t usart_srxl_id;
 
  496         if (
PIOS_USART_Init(&usart_srxl_id, usart_srxl_cfg, usart_port_params)) {
 
  505         uintptr_t srxl_rcvr_id;
 
  512 #endif // PIOS_INCLUDE_SRXL 
  514 #ifdef PIOS_INCLUDE_IBUS 
  522 static void PIOS_HAL_ConfigureIBus(
const struct pios_usart_cfg *usart_ibus_cfg,
 
  526         uintptr_t usart_ibus_id;
 
  527         if (
PIOS_USART_Init(&usart_ibus_id, usart_ibus_cfg, usart_port_params))
 
  534         uintptr_t ibus_rcvr_id;
 
  543 #ifdef PIOS_INCLUDE_CROSSFIRE 
  551 static void PIOS_HAL_ConfigureTbsCrossfire(
const struct pios_usart_cfg *usart_crsf_cfg,
 
  555         uintptr_t usart_crsf_id;
 
  556         if (
PIOS_USART_Init(&usart_crsf_id, usart_crsf_cfg, usart_port_params))
 
  563         uintptr_t crsf_rcvr_id;
 
  570 #endif // PIOS_INCLUDE_CROSSFIRE 
  594 #ifdef PIOS_INCLUDE_USART 
  595 void PIOS_HAL_ConfigurePort(HwSharedPortTypesOptions port_type,
 
  605                 HwSharedDSMxModeOptions dsm_mode,
 
  608         uintptr_t port_driver_id;
 
  609         uintptr_t *target = NULL, *target2 = NULL;
 
  613         usart_port_params.
init.USART_BaudRate            = 57600;
 
  614         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  615         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  616         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  617         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  618         usart_port_params.
init.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;
 
  626         if (sbus_cfg != NULL) {
 
  632                 GPIO_Init(sbus_cfg->
inv.
gpio, (GPIO_InitTypeDef*)&sbus_cfg->
inv.
init);
 
  635                 if (port_type == HWSHARED_PORTTYPES_SBUS)
 
  643         case HWSHARED_PORTTYPES_DISABLED:
 
  646         case HWSHARED_PORTTYPES_COMBRIDGE:
 
  652         case HWSHARED_PORTTYPES_DEBUGCONSOLE:
 
  653 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE) 
  654                 PIOS_HAL_ConfigureCom(usart_port_cfg, &usart_port_params, 0, PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN, com_driver, &port_driver_id);
 
  659         case HWSHARED_PORTTYPES_DSM:
 
  660 #if defined(PIOS_INCLUDE_DSM) 
  661                 if (dsm_cfg && usart_port_cfg) {
 
  662                         usart_port_params.
init.USART_BaudRate            = 115200;
 
  663                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  664                         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  665                         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  666                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  667                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx;
 
  669                         PIOS_HAL_ConfigureDSM(usart_port_cfg, &usart_port_params, dsm_cfg, com_driver, dsm_mode);
 
  674         case HWSHARED_PORTTYPES_FRSKYSENSORHUB:
 
  675 #if defined(PIOS_INCLUDE_FRSKY_SENSOR_HUB) 
  676                 usart_port_params.
init.USART_BaudRate            = 57600;
 
  677                 usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  678                 usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  679                 usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  680                 usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  681                 usart_port_params.
init.USART_Mode                = USART_Mode_Tx;
 
  693         case HWSHARED_PORTTYPES_FRSKYSPORTNONINVERTED:
 
  694 #if defined(PIOS_INCLUDE_FRSKY_SPORT_TELEMETRY) 
  703         case HWSHARED_PORTTYPES_FRSKYSPORTTELEMETRY:
 
  704 #if defined(PIOS_INCLUDE_FRSKY_SPORT_TELEMETRY) 
  705 #if defined(STM32F30X) || defined(STM32F0XX) 
  712 #if defined(USE_STM32F4xx_BRAINFPVRE1) 
  714 #endif // USE_STM32F4xx_BRAINFPVRE1 
  722         case HWSHARED_PORTTYPES_GPS:
 
  728         case HWSHARED_PORTTYPES_HOTTSUMD:
 
  729         case HWSHARED_PORTTYPES_HOTTSUMH:
 
  730 #if defined(PIOS_INCLUDE_HSUM) 
  731                 if (usart_port_cfg) {
 
  732                         usart_port_params.
init.USART_BaudRate            = 115200;
 
  733                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  734                         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  735                         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  736                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  737                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx;
 
  741                         case HWSHARED_PORTTYPES_HOTTSUMD:
 
  744                         case HWSHARED_PORTTYPES_HOTTSUMH:
 
  751                         PIOS_HAL_ConfigureHSUM(usart_port_cfg, &usart_port_params, com_driver, &proto);
 
  756         case HWSHARED_PORTTYPES_HOTTTELEMETRY:
 
  757 #if defined(PIOS_INCLUDE_HOTT) 
  764         case HWSHARED_PORTTYPES_I2C:
 
  765 #if defined(PIOS_INCLUDE_I2C) 
  766                 if (i2c_id && i2c_cfg) {
 
  769                                 AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_CRITICAL);
 
  772                                 AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_CRITICAL);
 
  774                         if (
AlarmsGet(SYSTEMALARMS_ALARM_I2C) == SYSTEMALARMS_ALARM_UNINITIALISED)
 
  775                                 AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_OK);
 
  780         case HWSHARED_PORTTYPES_LIGHTTELEMETRYTX:
 
  781 #if defined(PIOS_INCLUDE_LIGHTTELEMETRY) 
  788         case HWSHARED_PORTTYPES_MAVLINKTX:
 
  789 #if defined(PIOS_INCLUDE_MAVLINK) 
  796         case HWSHARED_PORTTYPES_MAVLINKTX_GPS_RX:
 
  797 #if defined(PIOS_INCLUDE_MAVLINK) 
  806         case HWSHARED_PORTTYPES_MSP:
 
  807 #if defined(PIOS_INCLUDE_MSP_BRIDGE) 
  814         case HWSHARED_PORTTYPES_OPENLOG:
 
  815 #if defined(PIOS_INCLUDE_OPENLOG) 
  821         case HWSHARED_PORTTYPES_VTXCONFIGTBSSMARTAUDIO:
 
  822 #if defined(PIOS_INCLUDE_TBSVTXCONFIG) 
  823                 if (usart_port_cfg) {
 
  824                         usart_port_params.
init.USART_BaudRate = 5000;
 
  825                         usart_port_params.
init.USART_StopBits = USART_StopBits_2;
 
  826                         usart_port_params.
init.USART_Parity   = USART_Parity_No;
 
  835         case HWSHARED_PORTTYPES_PPM:
 
  836 #if defined(PIOS_INCLUDE_PPM) 
  841                         uintptr_t ppm_rcvr_id;
 
  851         case HWSHARED_PORTTYPES_PWM:
 
  852 #if defined(PIOS_INCLUDE_PWM) 
  857                         uintptr_t pwm_rcvr_id;
 
  867         case HWSHARED_PORTTYPES_SBUS:
 
  868         case HWSHARED_PORTTYPES_SBUSNONINVERTED:
 
  869 #if defined(PIOS_INCLUDE_SBUS) && defined(PIOS_INCLUDE_USART) 
  870                 if (usart_port_cfg) {
 
  871                         usart_port_params.
init.USART_BaudRate            = 100000;
 
  872                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  873                         usart_port_params.
init.USART_Parity              = USART_Parity_Even;
 
  874                         usart_port_params.
init.USART_StopBits            = USART_StopBits_2;
 
  875                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  876                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx;
 
  878                         if (port_type == HWSHARED_PORTTYPES_SBUS)
 
  881                         uintptr_t usart_sbus_id;
 
  882                         if (
PIOS_USART_Init(&usart_sbus_id, usart_port_cfg, &usart_port_params)) {
 
  889                         uintptr_t sbus_rcvr_id;
 
  898         case HWSHARED_PORTTYPES_STORM32BGC:
 
  899 #if defined(PIOS_INCLUDE_STORM32BGC) 
  900                 usart_port_params.
init.USART_BaudRate = 115200;
 
  908         case HWSHARED_PORTTYPES_TELEMETRY:
 
  913         case HWSHARED_PORTTYPES_SRXL:
 
  914 #if defined(PIOS_INCLUDE_SRXL) 
  915                 if (usart_port_cfg) {
 
  916                         usart_port_params.
init.USART_BaudRate            = 115200;
 
  917                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  918                         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  919                         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  920                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  921                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx;
 
  923                         PIOS_HAL_ConfigureSRXL(usart_port_cfg, &usart_port_params, com_driver);
 
  928         case HWSHARED_PORTTYPES_IBUS:
 
  929 #if defined(PIOS_INCLUDE_IBUS) 
  930                 if (usart_port_cfg) {
 
  931                         usart_port_params.
init.USART_BaudRate            = 115200;
 
  932                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  933                         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  934                         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  935                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  936                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx;
 
  938                         PIOS_HAL_ConfigureIBus(usart_port_cfg, &usart_port_params, com_driver);
 
  943         case HWSHARED_PORTTYPES_TBSCROSSFIRE:
 
  944 #if defined(PIOS_INCLUDE_CROSSFIRE) 
  945                 if (usart_port_cfg) {
 
  946                         usart_port_params.
init.USART_BaudRate            = 420000;
 
  947                         usart_port_params.
init.USART_WordLength          = USART_WordLength_8b;
 
  948                         usart_port_params.
init.USART_Parity              = USART_Parity_No;
 
  949                         usart_port_params.
init.USART_StopBits            = USART_StopBits_1;
 
  950                         usart_port_params.
init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
  951                         usart_port_params.
init.USART_Mode                = USART_Mode_Rx|USART_Mode_Tx;
 
  953                         PIOS_HAL_ConfigureTbsCrossfire(usart_port_cfg, &usart_port_params, com_driver);
 
  965 #if defined(PIOS_INCLUDE_USB_CDC) 
  976         uintptr_t pios_usb_cdc_id;
 
  978         if (port_type != HWSHARED_USB_VCPPORT_DISABLED) {
 
  985         case HWSHARED_USB_VCPPORT_DISABLED:
 
  987         case HWSHARED_USB_VCPPORT_USBTELEMETRY:
 
  996         case HWSHARED_USB_VCPPORT_COMBRIDGE:
 
 1006         case HWSHARED_USB_VCPPORT_MSP:
 
 1007 #if defined(PIOS_INCLUDE_MSP_BRIDGE) 
 1018         case HWSHARED_USB_VCPPORT_DEBUGCONSOLE:
 
 1019 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE) 
 1024                                         PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN)) {
 
 1034 #if defined(PIOS_INCLUDE_USB_HID) 
 1044         uintptr_t pios_usb_hid_id;
 
 1049         switch (port_type) {
 
 1050         case HWSHARED_USB_HIDPORT_DISABLED:
 
 1052         case HWSHARED_USB_HIDPORT_USBTELEMETRY:
 
 1067 #if defined(PIOS_INCLUDE_OPENLRS) 
 1075 void PIOS_HAL_ConfigureRFM22B(
pios_spi_t spi_dev,
 
 1077                 HwSharedRfBandOptions rf_band,
 
 1078                 HwSharedMaxRfPowerOptions rf_power,
 
 1079                 const struct pios_openlrs_cfg *openlrs_cfg,
 
 1080                 pios_openlrs_t *handle)
 
 1082         OpenLRSInitialize();
 
 1084         pios_openlrs_t openlrs_id;
 
 1086         if (PIOS_OpenLRS_Init(&openlrs_id, spi_dev, 0, openlrs_cfg, rf_band,
 
 1091         *handle = openlrs_id;
 
 1093         PIOS_OpenLRS_Start(openlrs_id);
 
 1095 #if defined(PIOS_INCLUDE_OPENLRS_RCVR) 
 1096         uintptr_t rfm22brcvr_id;
 
 1097         uintptr_t rfm22brcvr_rcvr_id;
 
 1111 #define BT_COMMAND_DELAY 1100 
 1113 #define BT_COMMAND_QDELAY 350 
 1116                 HwSharedSpeedBpsOptions 
speed) {
 
 1118                 case HWSHARED_SPEEDBPS_1200:
 
 1121                 case HWSHARED_SPEEDBPS_2400:
 
 1124                 case HWSHARED_SPEEDBPS_4800:
 
 1127                 case HWSHARED_SPEEDBPS_9600:
 
 1130                 case HWSHARED_SPEEDBPS_19200:
 
 1133                 case HWSHARED_SPEEDBPS_38400:
 
 1136                 case HWSHARED_SPEEDBPS_57600:
 
 1139                 case HWSHARED_SPEEDBPS_INITHM10:
 
 1158                 case HWSHARED_SPEEDBPS_INITHC06:
 
 1178                 case HWSHARED_SPEEDBPS_INITHC05:
 
 1200                 case HWSHARED_SPEEDBPS_115200:
 
 1204                 case HWSHARED_SPEEDBPS_230400:
 
 1211 #ifdef PIOS_INCLUDE_I2C 
 1212 static int PIOS_HAL_ConfigureI2C(
pios_i2c_t *
id,
 
 1214 #ifndef FLIGHT_POSIX 
 1219                         AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_CRITICAL);
 
 1226                 AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_CRITICAL);
 
 1230         if (
AlarmsGet(SYSTEMALARMS_ALARM_I2C) ==
 
 1231                         SYSTEMALARMS_ALARM_UNINITIALISED) {
 
 1232                 AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_OK);
 
 1240 #endif // PIOS_INCLUDE_I2C 
 1246 #if !defined(PIOS_INCLUDE_I2C) 
 1249         if (baro == HWSHARED_EXTBARO_NONE) {
 
 1253         int ret = PIOS_HAL_ConfigureI2C(i2c_id, i2c_cfg);
 
 1258 #if defined(PIOS_INCLUDE_BMP280) 
 1259         case HWSHARED_EXTBARO_BMP280:
 
 1264                 ret = PIOS_BMP280_Test();
 
 1269 #endif // PIOS_INCLUDE_BMP280 
 1271 #if defined(PIOS_INCLUDE_MS5611) 
 1272         case HWSHARED_EXTBARO_MS5611:
 
 1277                 ret = PIOS_MS5611_Test();
 
 1282 #endif // PIOS_INCLUDE_MS5611 
 1299                 HwSharedMagOrientationOptions orientation,
 
 1303 #if !defined(PIOS_INCLUDE_I2C) 
 1306         if (!HwSharedMagOrientationIsValid(orientation)) {
 
 1311         if (mag == HWSHARED_MAG_NONE || mag == HWSHARED_MAG_INTERNAL) {
 
 1315         if (PIOS_HAL_ConfigureI2C(i2c_id, i2c_cfg))
 
 1319 #ifdef PIOS_INCLUDE_HMC5883 
 1320         case HWSHARED_MAG_EXTERNALHMC5883:
 
 1346 #ifdef PIOS_INCLUDE_HMC5983_I2C 
 1347         case HWSHARED_MAG_EXTERNALHMC5983:
 
 1348                 if (PIOS_HMC5983_I2C_Init(*i2c_id, &external_hmc5983_cfg))
 
 1351                 if (PIOS_HMC5983_Test())
 
 1369                 PIOS_HMC5983_SetOrientation(hmc5983_orientation);
 
 1385 #ifdef PIOS_INCLUDE_DAC 
 1386 int PIOS_HAL_ConfigureDAC(
dac_dev_t dac)
 
 1388         DACSettingsInitialize();
 
 1392         DACSettingsGet(&settings);
 
 1394         switch (settings.DACPrimaryUse) {
 
 1395 #ifdef PIOS_INCLUDE_DAC_FSK 
 1396         case DACSETTINGS_DACPRIMARYUSE_FSK1200:
 
 1409                                         (uintptr_t) fskdac, 0,
 
 1416 #endif // PIOS_INCLUDE_DAC_FSK 
 1418 #ifdef PIOS_INCLUDE_DAC_ANNUNCIATOR 
 1419         case DACSETTINGS_DACPRIMARYUSE_ANNUNCIATORS:
 
 1425         case DACSETTINGS_DACPRIMARYUSE_DISABLED:
 
 1437 #if defined(PIOS_INCLUDE_UAVTALKRCVR) 
 1438         UAVTalkReceiverInitialize();
 
 1439         uintptr_t pios_uavtalk_id;
 
 1445         uintptr_t pios_uavtalk_rcvr_id;
 
 1453                         pios_uavtalk_rcvr_id);
 
#define PIOS_COM_GPS_RX_BUF_LEN
 
#define PIOS_COM_TELEM_USB_RX_BUF_LEN
 
const struct pios_rcvr_driver pios_hsum_rcvr_driver
 
#define BT_COMMAND_DELAY
Configure a [flexi/main/rcvr/etc] port. 
 
uintptr_t pios_com_frsky_sport_id
 
int32_t PIOS_COM_SendString(uintptr_t com_id, const char *str)
 
#define PIOS_COM_FRSKYSPORT_TX_BUF_LEN
 
const struct pios_exti_cfg * exti_cfg
 
int32_t PIOS_PWM_Init(uintptr_t *pwm_id, const struct pios_pwm_cfg *cfg)
 
const struct pios_rcvr_driver pios_pwm_rcvr_driver
 
void PIOS_HAL_ConfigureCDC(HwSharedUSB_VCPPortOptions port_type, uintptr_t usb_id, const struct pios_usb_cdc_cfg *cdc_cfg)
 
uintptr_t pios_com_frsky_sensor_hub_id
 
void PIOS_HAL_InitUAVTalkReceiver()
 
int32_t PIOS_HMC5883_SetOrientation(enum pios_hmc5883_orientation orientation)
 
int32_t PIOS_DSM_Init(uintptr_t *dsm_id, const struct pios_dsm_cfg *cfg, const struct pios_com_driver *driver, uintptr_t lower_id, HwSharedDSMxModeOptions mode)
 
#define PIOS_HMC5883_ODR_75
 
Main PiOS header to include all the compiled in PiOS options. 
 
#define PIOS_COM_MSP_TX_BUF_LEN
 
const struct pios_com_driver pios_usb_cdc_com_driver
 
#define PIOS_COM_MAVLINK_TX_BUF_LEN
 
int PIOS_IBus_Init(uintptr_t *ibus_id, const struct pios_com_driver *driver, uintptr_t uart_id)
Initialises the IBus Rx driver with a serial port. 
 
int32_t PIOS_I2C_CheckClear(pios_i2c_t i2c_id)
 
int32_t PIOS_ANNUNCDAC_Init(annuncdac_dev_t *annuncdac_id, dac_dev_t dac)
Allocate and initialise ANNUNCDAC device. 
 
int32_t PIOS_HMC5883_Test(void)
 
int PIOS_HAL_ConfigureExternalBaro(HwSharedExtBaroOptions baro, pios_i2c_t *i2c_id, const struct pios_i2c_adapter_cfg *i2c_cfg)
 
HMC5983 functions header. 
 
#define PIOS_COM_STORM32BGC_RX_BUF_LEN
 
void(* gpio_clk_func)(uint32_t periph, FunctionalState state)
 
int32_t PIOS_SBus_Init(uintptr_t *sbus_id, const struct pios_com_driver *driver, uintptr_t lower_id)
 
uintptr_t pios_com_tbsvtxconfig_id
 
uintptr_t pios_com_debug_id
 
#define PIOS_DEBUG_Assert(test)
 
#define BT_COMMAND_QDELAY
 
void PIOS_Modules_Enable(enum pios_modules module)
 
int PIOS_HAL_ConfigureExternalMag(HwSharedMagOptions mag, HwSharedMagOrientationOptions orientation, pios_i2c_t *i2c_id, const struct pios_i2c_adapter_cfg *i2c_cfg)
 
int32_t PIOS_USB_HID_Init(uintptr_t *usbhid_id, const struct pios_usb_hid_cfg *cfg, uintptr_t lower_id)
 
const struct pios_rcvr_driver pios_sbus_rcvr_driver
 
#define PIOS_COM_TELEM_RF_TX_BUF_LEN
 
int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity)
 
#define PIOS_COM_TBSVTXCONFIG_RX_BUF_LEN
 
Configuration structure for the BMP280 driver. 
 
int32_t PIOS_SRXL_Init(uintptr_t *serial_id, const struct pios_com_driver *driver, uintptr_t lower_id)
Initialize a new SRXL device. 
 
uintptr_t pios_com_gps_id
 
uintptr_t pios_com_hott_id
 
static void PIOS_HAL_Err2811(bool on)
 
void PIOS_ANNUNC_Off(uint32_t annunc_id)
 
void set_config_error(SystemAlarmsConfigErrorOptions error_code)
 
#define PIOS_COM_HOTT_RX_BUF_LEN
 
uintptr_t pios_com_mavlink_id
 
Utilities to validate a flight configuration. 
 
const struct pios_rcvr_driver pios_openlrs_rcvr_driver
 
void PIOS_HAL_ConfigureSerialSpeed(uintptr_t com_id, HwSharedSpeedBpsOptions speed)
 
struct fskdac_dev_s * fskdac_dev_t
 
Configuration structure for the MS5611 driver. 
 
#define PIOS_COM_GPS_TX_BUF_LEN
 
USART private definitions. 
 
int32_t PIOS_I2C_Init(pios_i2c_t *i2c_id, const char *path)
 
void PIOS_WDG_Clear(void)
Clear the watchdog timer. 
 
static struct flyingpicmd_cfg_fa cfg
 
Spektrum/JR DSMx satellite receiver private structures. 
 
int32_t PIOS_FSKDAC_Init(fskdac_dev_t *fskdac_id, dac_dev_t dac)
Allocate and initialise FSKDAC device. 
 
enum pios_ms5611_osr oversampling
 
const struct pios_rcvr_driver pios_ibus_rcvr_driver
 
enum pios_hmc5983_orientation Orientation
 
uintptr_t pios_com_telem_serial_id
 
#define PIOS_COM_FRSKYSENSORHUB_TX_BUF_LEN
 
const struct pios_com_driver pios_usb_hid_com_driver
 
#define PIOS_COM_MSP_RX_BUF_LEN
 
#define PIOS_HMC5983_MEASCONF_NORMAL
 
void PIOS_WS2811_set_all(ws2811_dev_t dev, uint8_t r, uint8_t g, uint8_t b)
Sets all LEDs to a color value. 
 
uintptr_t pios_com_lighttelemetry_id
 
const struct pios_exti_cfg * exti_cfg
 
#define PIOS_COM_TBSVTXCONFIG_TX_BUF_LEN
 
int32_t PIOS_RCVR_Init(uintptr_t *rcvr_id, const struct pios_rcvr_driver *driver, const uintptr_t lower_id)
 
struct pios_i2c_adapter * pios_i2c_t
 
static volatile FlightStatsSettingsData settings
 
void PIOS_ANNUNC_On(uint32_t annunc_id)
 
#define PIOS_HMC5883_GAIN_1_9
 
#define PIOS_HMC5983_ODR_75
 
#define PIOS_HMC5983_MODE_SINGLE
 
#define PIOS_COM_LIGHTTELEMETRY_TX_BUF_LEN
 
#define PIOS_COM_TELEM_RF_RX_BUF_LEN
 
int32_t PIOS_SYS_Reset(void)
 
#define PIOS_COM_STORM32BGC_TX_BUF_LEN
 
USB COM HID private definitions. 
 
uintptr_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE]
 
void PIOS_HAL_ConfigureHID(HwSharedUSB_HIDPortOptions port_type, uintptr_t usb_id, const struct pios_usb_hid_cfg *hid_cfg)
 
#define PIOS_HMC5983_GAIN_1_9
 
#define PIOS_COM_BRIDGE_TX_BUF_LEN
 
void PIOS_Thread_Sleep(uint32_t time_ms)
 
uintptr_t pios_com_openlog_logging_id
 
int32_t PIOS_USART_Init(uintptr_t *usart_id, const struct pios_usart_cfg *cfg, struct pios_usart_params *params)
 
uintptr_t pios_com_telem_usb_id
 
static void PIOS_HAL_SetTarget(uintptr_t *target, uintptr_t value)
Bind a device instance to a role. 
 
const struct pios_com_driver pios_fskdac_com_driver
 
#define PIOS_COM_HOTT_TX_BUF_LEN
 
int32_t PIOS_BMP280_Init(const struct pios_bmp280_cfg *cfg, pios_i2c_t i2c_device)
 
int32_t PIOS_UAVTALKRCVR_Init(uintptr_t *gcsrcvr_id)
 
GCS receiver private functions. 
 
int PIOS_Crossfire_Init(uintptr_t *crsf_id, const struct pios_com_driver *driver, uintptr_t uart_id)
Initialises the TBS Crossfire Rx driver with a serial port. 
 
uintptr_t PIOS_HAL_GetReceiver(int receiver_type)
 
const struct pios_rcvr_driver pios_dsm_rcvr_driver
 
#define PIOS_HMC5883_MODE_SINGLE
 
const struct pios_rcvr_driver pios_crossfire_rcvr_driver
 
int32_t PIOS_COM_Init(uintptr_t *com_id, const struct pios_com_driver *driver, uintptr_t lower_id, uint16_t rx_buffer_len, uint16_t tx_buffer_len)
 
int32_t PIOS_HMC5883_Init(pios_i2c_t i2c_id, const struct pios_hmc5883_cfg *cfg)
 
#define PIOS_HMC5883_MEASCONF_NORMAL
 
Futaba S.Bus Private structures. 
 
int32_t PIOS_PPM_Init(uintptr_t *ppm_id, const struct pios_ppm_cfg *cfg)
 
#define PIOS_COM_FRSKYSPORT_RX_BUF_LEN
 
Includes PiOS and core architecture components. 
 
struct dac_dev_s * dac_dev_t
 
uintptr_t pios_com_storm32bgc_id
 
void PIOS_WS2811_trigger_update(ws2811_dev_t dev)
Trigger an update of the LED strand. 
 
#define PIOS_COM_TELEM_USB_TX_BUF_LEN
 
uintptr_t pios_com_msp_id
 
int32_t PIOS_MS5611_Init(const struct pios_ms5611_cfg *cfg, pios_i2c_t i2c_device)
 
enum pios_hmc5883_orientation Default_Orientation
 
int32_t PIOS_USB_CDC_Init(uintptr_t *usbcdc_id, const struct pios_usb_cdc_cfg *cfg, uintptr_t lower_id)
 
BitAction gpio_inv_disable
 
void PIOS_HAL_CriticalError(uint32_t led_id, enum pios_hal_panic code)
Flash a blink code. 
 
USB COM CDC private definitions. 
 
BitAction gpio_inv_enable
 
void PIOS_HAL_SetReceiver(int receiver_type, uintptr_t value)
 
const struct pios_rcvr_driver pios_ppm_rcvr_driver
 
uintptr_t pios_com_bridge_id
 
struct annuncdac_dev_s * annuncdac_dev_t
 
#define PIOS_Assert(test)
 
const struct pios_rcvr_driver pios_uavtalk_rcvr_driver
 
int32_t PIOS_DELAY_WaitmS(uint32_t mS)
 
const struct pios_rcvr_driver pios_srxl_rcvr_driver
 
uintptr_t pios_com_vcp_id
 
#define BMP280_HIGH_RESOLUTION
 
#define PIOS_COM_OPENLOG_TX_BUF_LEN
 
int32_t PIOS_COM_ChangeBaud(uintptr_t com_id, uint32_t baud)
 
USART private definitions. 
 
SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm)
 
void PIOS_SENSORS_SetMissing(enum pios_sensor_type type)
Assert that an optional (non-accel/gyro), but expected sensor is missing. 
 
int32_t PIOS_OpenLRS_Rcvr_Init(uintptr_t *openlrs_rcvr_id, pios_openlrs_t openlrs_id)
 
int32_t PIOS_HSUM_Init(uintptr_t *hsum_id, const struct pios_com_driver *driver, uintptr_t lower_id, enum pios_hsum_proto proto)
 
#define PIOS_HMC5983_AVERAGING_1
 
#define PIOS_COM_BRIDGE_RX_BUF_LEN