mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
LP-72 DSM PPM Voltage and Current sensors coded but not tested
This commit is contained in:
parent
534b33d491
commit
3115711049
@ -56,6 +56,21 @@ static const struct pios_gpio pios_leds_v2[] = {
|
|||||||
},
|
},
|
||||||
.active_low = true
|
.active_low = true
|
||||||
},
|
},
|
||||||
|
#if 0
|
||||||
|
// the other LED in the TL code is accessed this way
|
||||||
|
[PIOS_LED_LINK] = {
|
||||||
|
.pin = {
|
||||||
|
.gpio = GPIOB,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_6,
|
||||||
|
.GPIO_Speed = GPIO_Speed_50MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_OUT,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_UP
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#endif
|
||||||
#ifdef PIOS_RFM22B_DEBUG_ON_TELEM
|
#ifdef PIOS_RFM22B_DEBUG_ON_TELEM
|
||||||
[PIOS_LED_D1] = {
|
[PIOS_LED_D1] = {
|
||||||
.pin = {
|
.pin = {
|
||||||
@ -254,7 +269,7 @@ void PIOS_OVERO_irq_handler(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* SPI1 Interface
|
* SPI1 Interface
|
||||||
* Used for MPU6000 gyro and accelerometer
|
* Used for MPU9250 gyro, accelerometer and mag
|
||||||
*/
|
*/
|
||||||
void PIOS_SPI_gyro_irq_handler(void);
|
void PIOS_SPI_gyro_irq_handler(void);
|
||||||
void DMA2_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
|
void DMA2_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
|
||||||
@ -609,7 +624,7 @@ static const struct flashfs_logfs_cfg flashfs_internal_cfg = {
|
|||||||
#ifdef PIOS_INCLUDE_COM_TELEM
|
#ifdef PIOS_INCLUDE_COM_TELEM
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAIN USART
|
* MAIN PORT
|
||||||
*/
|
*/
|
||||||
static const struct pios_usart_cfg pios_usart_main_cfg = {
|
static const struct pios_usart_cfg pios_usart_main_cfg = {
|
||||||
.regs = USART1,
|
.regs = USART1,
|
||||||
@ -722,6 +737,7 @@ static const struct pios_dsm_cfg pios_dsm_main_cfg = {
|
|||||||
*/
|
*/
|
||||||
#include <pios_sbus_priv.h>
|
#include <pios_sbus_priv.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
|
static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
|
||||||
.regs = USART1,
|
.regs = USART1,
|
||||||
.remap = GPIO_AF_USART1,
|
.remap = GPIO_AF_USART1,
|
||||||
@ -762,71 +778,10 @@ static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct pios_usart_cfg pios_usart_sbus_rcvrport_cfg = {
|
|
||||||
.regs = USART6,
|
|
||||||
.remap = GPIO_AF_USART6,
|
|
||||||
.init = {
|
|
||||||
.USART_BaudRate = 100000,
|
|
||||||
.USART_WordLength = USART_WordLength_8b,
|
|
||||||
.USART_Parity = USART_Parity_Even,
|
|
||||||
.USART_StopBits = USART_StopBits_2,
|
|
||||||
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
|
|
||||||
.USART_Mode = USART_Mode_Rx,
|
|
||||||
},
|
|
||||||
.irq = {
|
|
||||||
.init = {
|
|
||||||
.NVIC_IRQChannel = USART6_IRQn,
|
|
||||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
|
||||||
.NVIC_IRQChannelSubPriority = 0,
|
|
||||||
.NVIC_IRQChannelCmd = ENABLE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.rx = {
|
|
||||||
.gpio = GPIOC,
|
|
||||||
.init = {
|
|
||||||
.GPIO_Pin = GPIO_Pin_7,
|
|
||||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
|
||||||
.GPIO_Mode = GPIO_Mode_AF,
|
|
||||||
.GPIO_OType = GPIO_OType_PP,
|
|
||||||
.GPIO_PuPd = GPIO_PuPd_UP
|
|
||||||
},
|
|
||||||
},
|
|
||||||
#if 0
|
|
||||||
.tx = {
|
|
||||||
.gpio = GPIOA,
|
|
||||||
.init = {
|
|
||||||
.GPIO_Pin = GPIO_Pin_9,
|
|
||||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
|
||||||
.GPIO_Mode = GPIO_Mode_OUT,
|
|
||||||
.GPIO_OType = GPIO_OType_PP,
|
|
||||||
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
|
||||||
},
|
|
||||||
},
|
|
||||||
#endif
|
#endif
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PIOS_INCLUDE_SBUS */
|
#endif /* PIOS_INCLUDE_SBUS */
|
||||||
|
|
||||||
// Need this defined regardless to be able to turn it off
|
|
||||||
static const struct pios_sbus_cfg pios_sbus_cfg = {
|
|
||||||
/* Inverter configuration */
|
|
||||||
.inv = {
|
|
||||||
.gpio = GPIOC,
|
|
||||||
.init = {
|
|
||||||
.GPIO_Pin = GPIO_Pin_6, // GPIO_Pin_6 Sparky2 has external inverter on PC6, Revo=PC0
|
|
||||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
|
||||||
.GPIO_Mode = GPIO_Mode_OUT,
|
|
||||||
.GPIO_OType = GPIO_OType_PP,
|
|
||||||
.GPIO_PuPd = GPIO_PuPd_UP
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.gpio_inv_enable = Bit_SET,
|
|
||||||
.gpio_inv_disable = Bit_RESET,
|
|
||||||
.gpio_clk_func = RCC_AHB1PeriphClockCmd,
|
|
||||||
.gpio_clk_periph = RCC_AHB1Periph_GPIOC,
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef PIOS_INCLUDE_COM_FLEXI
|
#ifdef PIOS_INCLUDE_COM_FLEXI
|
||||||
/*
|
/*
|
||||||
* FLEXI PORT
|
* FLEXI PORT
|
||||||
@ -1067,7 +1022,11 @@ static const struct pios_usart_cfg pios_usart_hkosd_flexi_cfg = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct pios_usart_cfg pios_usart_rcvrport_cfg = {
|
|
||||||
|
/*
|
||||||
|
* RCVR PORT
|
||||||
|
*/
|
||||||
|
static const struct pios_usart_cfg pios_usart_rcvr_cfg = {
|
||||||
.regs = USART6,
|
.regs = USART6,
|
||||||
.remap = GPIO_AF_USART6,
|
.remap = GPIO_AF_USART6,
|
||||||
.init = {
|
.init = {
|
||||||
@ -1125,6 +1084,131 @@ static const struct pios_usart_cfg pios_usart_rcvrport_cfg = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const struct pios_usart_cfg pios_usart_sbus_rcvr_cfg = {
|
||||||
|
.regs = USART6,
|
||||||
|
.remap = GPIO_AF_USART6,
|
||||||
|
.init = {
|
||||||
|
.USART_BaudRate = 100000,
|
||||||
|
.USART_WordLength = USART_WordLength_8b,
|
||||||
|
.USART_Parity = USART_Parity_Even,
|
||||||
|
.USART_StopBits = USART_StopBits_2,
|
||||||
|
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
|
||||||
|
.USART_Mode = USART_Mode_Rx,
|
||||||
|
},
|
||||||
|
.irq = {
|
||||||
|
.init = {
|
||||||
|
.NVIC_IRQChannel = USART6_IRQn,
|
||||||
|
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||||
|
.NVIC_IRQChannelSubPriority = 0,
|
||||||
|
.NVIC_IRQChannelCmd = ENABLE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.rx = {
|
||||||
|
.gpio = GPIOC,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_7,
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_AF,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_UP
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#if 0
|
||||||
|
.tx = {
|
||||||
|
.gpio = GPIOA,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_9,
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_OUT,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#else
|
||||||
|
.tx = {
|
||||||
|
.gpio = NULL,
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const struct pios_sbus_cfg pios_sbus_cfg = {
|
||||||
|
/* Inverter configuration */
|
||||||
|
.inv = {
|
||||||
|
.gpio = GPIOC,
|
||||||
|
.init = {
|
||||||
|
// according to TL code, Sparky uses PC6 and Revo uses PC0
|
||||||
|
// according to the schematics, they both use PC0
|
||||||
|
.GPIO_Pin = GPIO_Pin_6, // GPIO_Pin_6 Sparky2 has external inverter connected to PC6, Revo=PC0
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_OUT,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_UP
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.gpio_inv_enable = Bit_SET,
|
||||||
|
.gpio_inv_disable = Bit_RESET,
|
||||||
|
// in TauLabs Revo code these exist
|
||||||
|
// in TauLabs Sparky2 code these do not exist
|
||||||
|
// .gpio_clk_func = RCC_AHB1PeriphClockCmd,
|
||||||
|
// .gpio_clk_periph = RCC_AHB1Periph_GPIOC,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// It looks like TL notes originally came from OP's pios_dsm_main_cfg
|
||||||
|
// (TL note) Because of the inverter on the main port this will not
|
||||||
|
// (TL note) work. Notice the mode is set to IN to maintain API
|
||||||
|
// (TL note) compatibility but protect the pins
|
||||||
|
static const struct pios_dsm_cfg pios_dsm_rcvr_cfg = {
|
||||||
|
.bind = {
|
||||||
|
.gpio = GPIOC,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_7,
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_OUT,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const struct pios_usart_cfg pios_usart_dsm_rcvr_cfg = {
|
||||||
|
.regs = USART6,
|
||||||
|
.remap = GPIO_AF_USART6,
|
||||||
|
.init = {
|
||||||
|
.USART_BaudRate = 115200,
|
||||||
|
.USART_WordLength = USART_WordLength_8b,
|
||||||
|
.USART_Parity = USART_Parity_No,
|
||||||
|
.USART_StopBits = USART_StopBits_1,
|
||||||
|
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
|
||||||
|
.USART_Mode = USART_Mode_Rx,
|
||||||
|
},
|
||||||
|
.irq = {
|
||||||
|
.init = {
|
||||||
|
.NVIC_IRQChannel = USART6_IRQn,
|
||||||
|
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||||
|
.NVIC_IRQChannelSubPriority = 0,
|
||||||
|
.NVIC_IRQChannelCmd = ENABLE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.rx = {
|
||||||
|
.gpio = GPIOC,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_7,
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
.GPIO_Mode = GPIO_Mode_AF,
|
||||||
|
.GPIO_OType = GPIO_OType_PP,
|
||||||
|
.GPIO_PuPd = GPIO_PuPd_UP
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.tx = {
|
||||||
|
.gpio = NULL,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_COM)
|
#if defined(PIOS_INCLUDE_COM)
|
||||||
|
|
||||||
#include <pios_com_priv.h>
|
#include <pios_com_priv.h>
|
||||||
@ -1746,7 +1830,7 @@ const struct pios_servo_cfg pios_servo_cfg_out_in = {
|
|||||||
*/
|
*/
|
||||||
#if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PWM) || defined(PIOS_INCLUDE_PPM)
|
||||||
#include <pios_pwm_priv.h>
|
#include <pios_pwm_priv.h>
|
||||||
static const struct pios_tim_channel pios_tim_rcvrport_all_channels[] = {
|
static const struct pios_tim_channel pios_tim_rcvr_all_channels[] = {
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
.timer = TIM12,
|
.timer = TIM12,
|
||||||
@ -1874,8 +1958,8 @@ const struct pios_pwm_cfg pios_pwm_cfg = {
|
|||||||
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
||||||
.TIM_ICFilter = 0x0,
|
.TIM_ICFilter = 0x0,
|
||||||
},
|
},
|
||||||
.channels = pios_tim_rcvrport_all_channels,
|
.channels = pios_tim_rcvr_all_channels,
|
||||||
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels),
|
.num_channels = NELEMENTS(pios_tim_rcvr_all_channels),
|
||||||
};
|
};
|
||||||
// this configures outputs 2-6 as pwm inputs
|
// this configures outputs 2-6 as pwm inputs
|
||||||
const struct pios_pwm_cfg pios_pwm_ppm_cfg = {
|
const struct pios_pwm_cfg pios_pwm_ppm_cfg = {
|
||||||
@ -1885,8 +1969,8 @@ const struct pios_pwm_cfg pios_pwm_ppm_cfg = {
|
|||||||
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
||||||
.TIM_ICFilter = 0x0,
|
.TIM_ICFilter = 0x0,
|
||||||
},
|
},
|
||||||
.channels = &pios_tim_rcvrport_all_channels[1],
|
.channels = &pios_tim_rcvr_all_channels[1],
|
||||||
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels) - 1,
|
.num_channels = NELEMENTS(pios_tim_rcvr_all_channels) - 1,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1906,7 +1990,7 @@ static const struct pios_ppm_cfg pios_ppm_cfg = {
|
|||||||
.TIM_Channel = TIM_Channel_2,
|
.TIM_Channel = TIM_Channel_2,
|
||||||
},
|
},
|
||||||
/* Use only the first channel for ppm */
|
/* Use only the first channel for ppm */
|
||||||
.channels = &pios_tim_rcvrport_all_channels[0],
|
.channels = &pios_tim_rcvr_all_channels[0],
|
||||||
.num_channels = 1,
|
.num_channels = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -438,6 +438,9 @@ void PIOS_Board_Init(void)
|
|||||||
OPLinkSettingsInitialize();
|
OPLinkSettingsInitialize();
|
||||||
OPLinkStatusInitialize();
|
OPLinkStatusInitialize();
|
||||||
#endif /* PIOS_INCLUDE_RFM22B */
|
#endif /* PIOS_INCLUDE_RFM22B */
|
||||||
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
|
AuxMagSettingsInitialize();
|
||||||
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
|
|
||||||
/* Initialize the alarms library */
|
/* Initialize the alarms library */
|
||||||
AlarmsInitialize();
|
AlarmsInitialize();
|
||||||
@ -477,52 +480,43 @@ void PIOS_Board_Init(void)
|
|||||||
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_TELEM_RF_RX_BUF_LEN, PIOS_COM_TELEM_RF_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_telem_rf_id);
|
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_TELEM_RF_RX_BUF_LEN, PIOS_COM_TELEM_RF_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_telem_rf_id);
|
||||||
break;
|
break;
|
||||||
case HWSETTINGS_RM_FLEXIPORT_I2C:
|
case HWSETTINGS_RM_FLEXIPORT_I2C:
|
||||||
#if 0
|
|
||||||
#if defined(PIOS_INCLUDE_I2C)
|
#if defined(PIOS_INCLUDE_I2C)
|
||||||
{
|
|
||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
|
||||||
#else
|
|
||||||
#if defined(PIOS_INCLUDE_I2C)
|
|
||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
|
||||||
// this is not in a loop, so it is safe
|
|
||||||
// leave this here even if PIOS_INCLUDE_HMC5X83 is undefined
|
|
||||||
// to avoid making something else fail when HMC5X83 is removed
|
|
||||||
PIOS_WDG_Clear();
|
|
||||||
#endif /* PIOS_INCLUDE_WDG */
|
|
||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
// get auxmag type
|
{
|
||||||
AuxMagSettingsTypeOptions option;
|
// get auxmag type
|
||||||
AuxMagSettingsInitialize();
|
AuxMagSettingsTypeOptions option;
|
||||||
AuxMagSettingsTypeGet(&option);
|
AuxMagSettingsTypeGet(&option);
|
||||||
// if the aux mag type is FlexiPort then set it up
|
// the FlexiPort type is I2C, so if the AuxMag type is Flexi(Port) then set it up
|
||||||
if (option == AUXMAGSETTINGS_TYPE_FLEXI) {
|
if (option == AUXMAGSETTINGS_TYPE_FLEXI) {
|
||||||
// attach the 5x83 mag to the previously inited I2C2
|
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||||
flexi_port_mag = PIOS_HMC5x83_Init(&pios_hmc5x83_cfg, pios_i2c_flexiport_adapter_id, 0);
|
PIOS_Assert(0);
|
||||||
|
}
|
||||||
|
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
// this is not in a loop, so it is safe
|
// this is not in a loop, so it is safe
|
||||||
PIOS_WDG_Clear();
|
// leave this here even if PIOS_INCLUDE_HMC5X83 is undefined
|
||||||
|
// to avoid making something else fail when HMC5X83 is removed
|
||||||
|
PIOS_WDG_Clear();
|
||||||
#endif /* PIOS_INCLUDE_WDG */
|
#endif /* PIOS_INCLUDE_WDG */
|
||||||
// add this sensor to the sensor task's list
|
// attach the 5x83 mag to the previously inited I2C2
|
||||||
// be careful that you don't register a slow, unimportant sensor after registering the fastest sensor
|
flexi_port_mag = PIOS_HMC5x83_Init(&pios_hmc5x83_cfg, pios_i2c_flexiport_adapter_id, 0);
|
||||||
// and before registering some other fast and important sensor
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// as that would cause delay and time jitter for the second fast sensor
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
PIOS_HMC5x83_Register(flexi_port_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
// this is not in a loop, so it is safe
|
||||||
// mag alarm is cleared later, so use I2C
|
PIOS_WDG_Clear();
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (flexi_port_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
#endif /* PIOS_INCLUDE_WDG */
|
||||||
|
// add this sensor to the sensor task's list
|
||||||
|
// be careful that you don't register a slow, unimportant sensor after registering the fastest sensor
|
||||||
|
// and before registering some other fast and important sensor
|
||||||
|
// as that would cause delay and time jitter for the second fast sensor
|
||||||
|
PIOS_HMC5x83_Register(flexi_port_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
||||||
|
// mag alarm is cleared later, so use I2C
|
||||||
|
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (flexi_port_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
#endif /* PIOS_INCLUDE_I2C */
|
||||||
#endif /* 0 */
|
|
||||||
break;
|
break;
|
||||||
case HWSETTINGS_RM_FLEXIPORT_GPS:
|
case HWSETTINGS_RM_FLEXIPORT_GPS:
|
||||||
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_GPS_RX_BUF_LEN, PIOS_COM_GPS_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_gps_id);
|
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_GPS_RX_BUF_LEN, PIOS_COM_GPS_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_gps_id);
|
||||||
@ -893,7 +887,7 @@ void PIOS_Board_Init(void)
|
|||||||
#if defined(PIOS_INCLUDE_SBUS)
|
#if defined(PIOS_INCLUDE_SBUS)
|
||||||
{
|
{
|
||||||
uint32_t pios_usart_sbus_id;
|
uint32_t pios_usart_sbus_id;
|
||||||
if (PIOS_USART_Init(&pios_usart_sbus_id, &pios_usart_sbus_rcvrport_cfg)) {
|
if (PIOS_USART_Init(&pios_usart_sbus_id, &pios_usart_sbus_rcvr_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,6 +904,11 @@ void PIOS_Board_Init(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case HWSETTINGS_SPK2_RCVRPORT_DSM:
|
||||||
|
// TODO: Define the various Channelgroup for Revo dsm inputs and handle here
|
||||||
|
PIOS_Board_configure_dsm(&pios_usart_dsm_rcvr_cfg, &pios_dsm_rcvr_cfg,
|
||||||
|
&pios_usart_com_driver, MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMRCVRPORT, &hwsettings_DSMxBind);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1006,11 +1005,12 @@ void PIOS_Board_Init(void)
|
|||||||
#endif /* PIOS_INCLUDE_WDG */
|
#endif /* PIOS_INCLUDE_WDG */
|
||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
// get auxmag type
|
// get auxmag type
|
||||||
|
HwSettingsSPK2_I2CPortOptions i2cOption;
|
||||||
AuxMagSettingsTypeOptions option;
|
AuxMagSettingsTypeOptions option;
|
||||||
AuxMagSettingsInitialize();
|
HwSettingsSPK2_I2CPortGet(&i2cOption);
|
||||||
AuxMagSettingsTypeGet(&option);
|
AuxMagSettingsTypeGet(&option);
|
||||||
// if the aux mag type is FlexiPort then set it up
|
// if the I2CPort type is I2C(Port) and the AuxMag type is I2C(Port) then set it up
|
||||||
if (option == AUXMAGSETTINGS_TYPE_I2C) {
|
if (i2cOption == HWSETTINGS_SPK2_I2CPORT_I2C && option == AUXMAGSETTINGS_TYPE_I2C) {
|
||||||
// attach the 5x83 mag to the previously inited I2C2
|
// attach the 5x83 mag to the previously inited I2C2
|
||||||
i2c_port_mag = PIOS_HMC5x83_Init(&pios_hmc5x83_cfg, pios_i2c_mag_pressure_adapter_id, 0);
|
i2c_port_mag = PIOS_HMC5x83_Init(&pios_hmc5x83_cfg, pios_i2c_mag_pressure_adapter_id, 0);
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
|
@ -289,7 +289,7 @@ extern uint32_t pios_packet_handler;
|
|||||||
// -------------------------
|
// -------------------------
|
||||||
#define PIOS_DMA_PIN_CONFIG \
|
#define PIOS_DMA_PIN_CONFIG \
|
||||||
{ \
|
{ \
|
||||||
{ GPIOC, GPIO_Pin_1, ADC_Channel_11, false }, /* batt/sonar pin 3 */ \
|
{ GPIOC, GPIO_Pin_3, ADC_Channel_13, false }, /* batt/sonar pin 3 */ \
|
||||||
{ GPIOC, GPIO_Pin_2, ADC_Channel_12, false }, /* batt/sonar pin 4 */ \
|
{ GPIOC, GPIO_Pin_2, ADC_Channel_12, false }, /* batt/sonar pin 4 */ \
|
||||||
{ GPIOA, GPIO_Pin_3, ADC_Channel_3, false }, /* Servo pin 3 */ \
|
{ GPIOA, GPIO_Pin_3, ADC_Channel_3, false }, /* Servo pin 3 */ \
|
||||||
{ GPIOA, GPIO_Pin_2, ADC_Channel_2, false }, /* Servo pin 4 */ \
|
{ GPIOA, GPIO_Pin_2, ADC_Channel_2, false }, /* Servo pin 4 */ \
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<description>Settings to indicate how to decode receiver input by @ref ManualControlModule.</description>
|
<description>Settings to indicate how to decode receiver input by @ref ManualControlModule.</description>
|
||||||
<field name="ChannelGroups" units="Channel Group" type="enum"
|
<field name="ChannelGroups" units="Channel Group" type="enum"
|
||||||
elementnames="Throttle,Roll,Pitch,Yaw,FlightMode,Collective,Accessory0,Accessory1,Accessory2,Accessory3"
|
elementnames="Throttle,Roll,Pitch,Yaw,FlightMode,Collective,Accessory0,Accessory1,Accessory2,Accessory3"
|
||||||
options="PWM,PPM,DSM (MainPort),DSM (FlexiPort),S.Bus,EX.Bus,HoTT,SRXL,GCS,OPLink,None" defaultvalue="None"/>
|
options="PWM,PPM,DSM (MainPort),DSM (FlexiPort),DSM (RcvrPort),S.Bus,EX.Bus,HoTT,SRXL,GCS,OPLink,None" defaultvalue="None"/>
|
||||||
<field name="ChannelNumber" units="channel" type="uint8" defaultvalue="0"
|
<field name="ChannelNumber" units="channel" type="uint8" defaultvalue="0"
|
||||||
elementnames="Throttle,Roll,Pitch,Yaw,FlightMode,Collective,Accessory0,Accessory1,Accessory2,Accessory3"/>
|
elementnames="Throttle,Roll,Pitch,Yaw,FlightMode,Collective,Accessory0,Accessory1,Accessory2,Accessory3"/>
|
||||||
<field name="ChannelMin" units="us" type="int16" defaultvalue="1000"
|
<field name="ChannelMin" units="us" type="int16" defaultvalue="1000"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user