mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Merge branch 'master' of ssh://git.openpilot.org/OpenPilot
This commit is contained in:
commit
eaf08ba6d3
@ -865,7 +865,7 @@ void PIOS_I2C_main_adapter_er_irq_handler(void)
|
|||||||
#if defined(PIOS_INCLUDE_RCVR)
|
#if defined(PIOS_INCLUDE_RCVR)
|
||||||
#include "pios_rcvr_priv.h"
|
#include "pios_rcvr_priv.h"
|
||||||
|
|
||||||
uint32_t pios_rcvr_channel_to_id_map[PIOS_RCVR_MAX_DEVS];
|
struct pios_rcvr_channel_map pios_rcvr_channel_to_id_map[PIOS_RCVR_MAX_CHANNELS];
|
||||||
uint32_t pios_rcvr_max_channel;
|
uint32_t pios_rcvr_max_channel;
|
||||||
#endif /* PIOS_INCLUDE_RCVR */
|
#endif /* PIOS_INCLUDE_RCVR */
|
||||||
|
|
||||||
@ -1040,28 +1040,32 @@ void PIOS_Board_Init(void) {
|
|||||||
case MANUALCONTROLSETTINGS_INPUTMODE_PWM:
|
case MANUALCONTROLSETTINGS_INPUTMODE_PWM:
|
||||||
#if defined(PIOS_INCLUDE_PWM)
|
#if defined(PIOS_INCLUDE_PWM)
|
||||||
PIOS_PWM_Init();
|
PIOS_PWM_Init();
|
||||||
for (uint8_t i = 0; i < PIOS_PWM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_pwm_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, 0)) {
|
||||||
&pios_pwm_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_PWM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_pwm_rcvr_id;
|
||||||
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_PWM */
|
#endif /* PIOS_INCLUDE_PWM */
|
||||||
break;
|
break;
|
||||||
case MANUALCONTROLSETTINGS_INPUTMODE_PPM:
|
case MANUALCONTROLSETTINGS_INPUTMODE_PPM:
|
||||||
#if defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
PIOS_PPM_Init();
|
PIOS_PPM_Init();
|
||||||
for (uint8_t i = 0; i < PIOS_PPM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_ppm_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, 0)) {
|
||||||
&pios_ppm_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_PPM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_ppm_rcvr_id;
|
||||||
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
break;
|
break;
|
||||||
@ -1069,30 +1073,34 @@ void PIOS_Board_Init(void) {
|
|||||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||||
if (hwsettings_cc_mainport == HWSETTINGS_CC_MAINPORT_SPEKTRUM ||
|
if (hwsettings_cc_mainport == HWSETTINGS_CC_MAINPORT_SPEKTRUM ||
|
||||||
hwsettings_cc_flexiport == HWSETTINGS_CC_FLEXIPORT_SPEKTRUM) {
|
hwsettings_cc_flexiport == HWSETTINGS_CC_FLEXIPORT_SPEKTRUM) {
|
||||||
for (uint8_t i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_spektrum_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_spektrum_rcvr_id, &pios_spektrum_rcvr_driver, 0)) {
|
||||||
&pios_spektrum_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_SPEKTRUM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_spektrum_rcvr_id;
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
||||||
break;
|
break;
|
||||||
case MANUALCONTROLSETTINGS_INPUTMODE_SBUS:
|
case MANUALCONTROLSETTINGS_INPUTMODE_SBUS:
|
||||||
#if defined(PIOS_INCLUDE_SBUS)
|
#if defined(PIOS_INCLUDE_SBUS)
|
||||||
if (hwsettings_cc_mainport == HWSETTINGS_CC_MAINPORT_SBUS) {
|
if (hwsettings_cc_mainport == HWSETTINGS_CC_MAINPORT_SBUS) {
|
||||||
for (uint8_t i = 0; i < SBUS_NUMBER_OF_CHANNELS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_sbus_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_sbus_rcvr_id, &pios_sbus_rcvr_driver, 0)) {
|
||||||
&pios_sbus_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < SBUS_NUMBER_OF_CHANNELS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_sbus_rcvr_id;
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_SBUS */
|
#endif /* PIOS_INCLUDE_SBUS */
|
||||||
break;
|
break;
|
||||||
|
@ -166,8 +166,9 @@ static void manualControlTask(void *parameters)
|
|||||||
|
|
||||||
// Read channel values in us
|
// Read channel values in us
|
||||||
for (int n = 0; n < MANUALCONTROLCOMMAND_CHANNEL_NUMELEM; ++n) {
|
for (int n = 0; n < MANUALCONTROLCOMMAND_CHANNEL_NUMELEM; ++n) {
|
||||||
if (pios_rcvr_channel_to_id_map[n]) {
|
if (pios_rcvr_channel_to_id_map[n].id) {
|
||||||
cmd.Channel[n] = PIOS_RCVR_Read(pios_rcvr_channel_to_id_map[n]);
|
cmd.Channel[n] = PIOS_RCVR_Read(pios_rcvr_channel_to_id_map[n].id,
|
||||||
|
pios_rcvr_channel_to_id_map[n].channel);
|
||||||
} else {
|
} else {
|
||||||
cmd.Channel[n] = -1;
|
cmd.Channel[n] = -1;
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,7 @@ static const struct stm32_gpio pios_debug_pins[] = {
|
|||||||
#if defined(PIOS_INCLUDE_RCVR)
|
#if defined(PIOS_INCLUDE_RCVR)
|
||||||
#include "pios_rcvr_priv.h"
|
#include "pios_rcvr_priv.h"
|
||||||
|
|
||||||
uint32_t pios_rcvr_channel_to_id_map[PIOS_RCVR_MAX_DEVS];
|
struct pios_rcvr_channel_map pios_rcvr_channel_to_id_map[PIOS_RCVR_MAX_CHANNELS];
|
||||||
uint32_t pios_rcvr_max_channel;
|
uint32_t pios_rcvr_max_channel;
|
||||||
#endif /* PIOS_INCLUDE_RCVR */
|
#endif /* PIOS_INCLUDE_RCVR */
|
||||||
|
|
||||||
@ -1077,41 +1077,45 @@ void PIOS_Board_Init(void) {
|
|||||||
switch (manualcontrolsettings_inputmode) {
|
switch (manualcontrolsettings_inputmode) {
|
||||||
case MANUALCONTROLSETTINGS_INPUTMODE_PWM:
|
case MANUALCONTROLSETTINGS_INPUTMODE_PWM:
|
||||||
#if defined(PIOS_INCLUDE_PWM)
|
#if defined(PIOS_INCLUDE_PWM)
|
||||||
#if (PIOS_PWM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS)
|
#if (PIOS_PWM_NUM_INPUTS > PIOS_RCVR_MAX_CHANNELS)
|
||||||
#error More receiver inputs than available devices
|
#error More receiver inputs than available devices
|
||||||
#endif
|
#endif
|
||||||
PIOS_PWM_Init();
|
PIOS_PWM_Init();
|
||||||
for (uint8_t i = 0; i < PIOS_PWM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_pwm_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, 0)) {
|
||||||
&pios_pwm_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_PWM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_pwm_rcvr_id;
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
|
}
|
||||||
#endif /* PIOS_INCLUDE_PWM */
|
#endif /* PIOS_INCLUDE_PWM */
|
||||||
break;
|
break;
|
||||||
case MANUALCONTROLSETTINGS_INPUTMODE_PPM:
|
case MANUALCONTROLSETTINGS_INPUTMODE_PPM:
|
||||||
#if defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
#if (PIOS_PPM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS)
|
#if (PIOS_PPM_NUM_INPUTS > PIOS_RCVR_MAX_CHANNELS)
|
||||||
#error More receiver inputs than available devices
|
#error More receiver inputs than available devices
|
||||||
#endif
|
#endif
|
||||||
PIOS_PPM_Init();
|
PIOS_PPM_Init();
|
||||||
for (uint8_t i = 0; i < PIOS_PPM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_ppm_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, 0)) {
|
||||||
&pios_ppm_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_PPM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_ppm_rcvr_id;
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
|
}
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
break;
|
break;
|
||||||
case MANUALCONTROLSETTINGS_INPUTMODE_SPEKTRUM:
|
case MANUALCONTROLSETTINGS_INPUTMODE_SPEKTRUM:
|
||||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||||
#if (PIOS_SPEKTRUM_NUM_INPUTS > PIOS_RCVR_MAX_DEVS)
|
#if (PIOS_SPEKTRUM_NUM_INPUTS > PIOS_RCVR_MAX_CHANNELS)
|
||||||
#error More receiver inputs than available devices
|
#error More receiver inputs than available devices
|
||||||
#endif
|
#endif
|
||||||
/* SPEKTRUM init must come before comms */
|
/* SPEKTRUM init must come before comms */
|
||||||
@ -1121,14 +1125,16 @@ void PIOS_Board_Init(void) {
|
|||||||
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) {
|
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
for (uint8_t i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS && i < PIOS_RCVR_MAX_DEVS; i++) {
|
uint32_t pios_spektrum_rcvr_id;
|
||||||
if (!PIOS_RCVR_Init(&pios_rcvr_channel_to_id_map[pios_rcvr_max_channel],
|
if (PIOS_RCVR_Init(&pios_spektrum_rcvr_id, &pios_spektrum_rcvr_driver, 0)) {
|
||||||
&pios_spektrum_rcvr_driver,
|
PIOS_Assert(0);
|
||||||
i)) {
|
}
|
||||||
pios_rcvr_max_channel++;
|
for (uint8_t i = 0;
|
||||||
} else {
|
i < PIOS_SPEKTRUM_NUM_INPUTS && pios_rcvr_max_channel < NELEMENTS(pios_rcvr_channel_to_id_map);
|
||||||
PIOS_Assert(0);
|
i++) {
|
||||||
}
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].id = pios_spektrum_rcvr_id;
|
||||||
|
pios_rcvr_channel_to_id_map[pios_rcvr_max_channel].channel = i;
|
||||||
|
pios_rcvr_max_channel++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -225,7 +225,8 @@ extern uint32_t pios_com_sbus_id;
|
|||||||
// PIOS_RCVR
|
// PIOS_RCVR
|
||||||
// See also pios_board.c
|
// See also pios_board.c
|
||||||
//------------------------
|
//------------------------
|
||||||
#define PIOS_RCVR_MAX_DEVS 12
|
#define PIOS_RCVR_MAX_DEVS 1
|
||||||
|
#define PIOS_RCVR_MAX_CHANNELS 12
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
// Receiver PPM input
|
// Receiver PPM input
|
||||||
|
@ -198,7 +198,8 @@ extern uint32_t pios_com_sbus_id;
|
|||||||
// PIOS_RCVR
|
// PIOS_RCVR
|
||||||
// See also pios_board.c
|
// See also pios_board.c
|
||||||
//------------------------
|
//------------------------
|
||||||
#define PIOS_RCVR_MAX_DEVS 12
|
#define PIOS_RCVR_MAX_DEVS 1
|
||||||
|
#define PIOS_RCVR_MAX_CHANNELS 12
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
// Receiver PPM input
|
// Receiver PPM input
|
||||||
|
@ -5,6 +5,16 @@
|
|||||||
|
|
||||||
#include <pios_rcvr_priv.h>
|
#include <pios_rcvr_priv.h>
|
||||||
|
|
||||||
|
enum pios_rcvr_dev_magic {
|
||||||
|
PIOS_RCVR_DEV_MAGIC = 0x99aabbcc,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pios_rcvr_dev {
|
||||||
|
enum pios_rcvr_dev_magic magic;
|
||||||
|
uint32_t lower_id;
|
||||||
|
const struct pios_rcvr_driver * driver;
|
||||||
|
};
|
||||||
|
|
||||||
static bool PIOS_RCVR_validate(struct pios_rcvr_dev * rcvr_dev)
|
static bool PIOS_RCVR_validate(struct pios_rcvr_dev * rcvr_dev)
|
||||||
{
|
{
|
||||||
return (rcvr_dev->magic == PIOS_RCVR_DEV_MAGIC);
|
return (rcvr_dev->magic == PIOS_RCVR_DEV_MAGIC);
|
||||||
@ -56,8 +66,8 @@ int32_t PIOS_RCVR_Init(uint32_t * rcvr_id, const struct pios_rcvr_driver * drive
|
|||||||
rcvr_dev = (struct pios_rcvr_dev *) PIOS_RCVR_alloc();
|
rcvr_dev = (struct pios_rcvr_dev *) PIOS_RCVR_alloc();
|
||||||
if (!rcvr_dev) goto out_fail;
|
if (!rcvr_dev) goto out_fail;
|
||||||
|
|
||||||
rcvr_dev->driver = driver;
|
rcvr_dev->driver = driver;
|
||||||
rcvr_dev->id = lower_id;
|
rcvr_dev->lower_id = lower_id;
|
||||||
|
|
||||||
*rcvr_id = (uint32_t)rcvr_dev;
|
*rcvr_id = (uint32_t)rcvr_dev;
|
||||||
return(0);
|
return(0);
|
||||||
@ -66,7 +76,7 @@ out_fail:
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PIOS_RCVR_Read(uint32_t rcvr_id)
|
int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel)
|
||||||
{
|
{
|
||||||
struct pios_rcvr_dev * rcvr_dev = (struct pios_rcvr_dev *)rcvr_id;
|
struct pios_rcvr_dev * rcvr_dev = (struct pios_rcvr_dev *)rcvr_id;
|
||||||
|
|
||||||
@ -77,7 +87,7 @@ int32_t PIOS_RCVR_Read(uint32_t rcvr_id)
|
|||||||
|
|
||||||
PIOS_DEBUG_Assert(rcvr_dev->driver->read);
|
PIOS_DEBUG_Assert(rcvr_dev->driver->read);
|
||||||
|
|
||||||
return rcvr_dev->driver->read(rcvr_dev->id);
|
return rcvr_dev->driver->read(rcvr_dev->lower_id, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
_irq_stack_size = 0x180;
|
_irq_stack_size = 0x180;
|
||||||
/* This is the size of the stack for early init: life span is until scheduler starts */
|
/* This is the size of the stack for early init: life span is until scheduler starts */
|
||||||
_init_stack_size = 0x100;
|
_init_stack_size = 0x100;
|
||||||
/* there is probably a way to get that from the MEMORY section */
|
|
||||||
_eram = ORIGIN(SRAM) + LENGTH(SRAM);
|
|
||||||
|
|
||||||
/* Stub out these functions since we don't use them anyway */
|
/* Stub out these functions since we don't use them anyway */
|
||||||
PROVIDE ( vPortSVCHandler = 0 ) ;
|
PROVIDE ( vPortSVCHandler = 0 ) ;
|
||||||
@ -91,12 +89,11 @@ SECTIONS
|
|||||||
_sbss = . ;
|
_sbss = . ;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4);
|
|
||||||
_ebss = . ;
|
|
||||||
} > SRAM
|
} > SRAM
|
||||||
|
|
||||||
.heap (NOLOAD) :
|
.heap (NOLOAD) :
|
||||||
{
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
_sheap = . ;
|
_sheap = . ;
|
||||||
_sheap_pre_rtos = . ;
|
_sheap_pre_rtos = . ;
|
||||||
*(.heap)
|
*(.heap)
|
||||||
@ -111,13 +108,22 @@ SECTIONS
|
|||||||
_init_stack_top = . - 4 ;
|
_init_stack_top = . - 4 ;
|
||||||
} > SRAM
|
} > SRAM
|
||||||
|
|
||||||
|
|
||||||
|
_free_ram = . ;
|
||||||
|
.free_ram (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ORIGIN(SRAM) + LENGTH(SRAM) - _free_ram ;
|
||||||
|
/* This is used by the startup in order to initialize the .bss section */
|
||||||
|
_ebss = . ;
|
||||||
|
_eram = . ;
|
||||||
|
} > SRAM
|
||||||
|
|
||||||
/* keep the heap section at the end of the SRAM */
|
/* keep the heap section at the end of the SRAM
|
||||||
/* this will allow to claim the remaining bytes not used
|
* this will allow to claim the remaining bytes not used
|
||||||
/* at run time! (done by the reset vector).
|
* at run time! (done by the reset vector).
|
||||||
|
*/
|
||||||
|
|
||||||
. = ALIGN(4);
|
PROVIDE ( _end = _ebss ) ;
|
||||||
_end = . ;
|
|
||||||
|
|
||||||
/* Stabs debugging sections. */
|
/* Stabs debugging sections. */
|
||||||
.stab 0 : { *(.stab) }
|
.stab 0 : { *(.stab) }
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
_irq_stack_size = 0x400;
|
_irq_stack_size = 0x400;
|
||||||
/* This is the size of the stack for early init: life span is until scheduler starts */
|
/* This is the size of the stack for early init: life span is until scheduler starts */
|
||||||
_init_stack_size = 0x400;
|
_init_stack_size = 0x400;
|
||||||
/* there is probably a way to get that from the MEMORY section */
|
|
||||||
_eram = ORIGIN(RAM) + LENGTH(RAM);
|
|
||||||
|
|
||||||
/* Check valid alignment for VTOR */
|
/* Check valid alignment for VTOR */
|
||||||
ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
|
ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
|
||||||
@ -264,19 +262,16 @@ SECTIONS
|
|||||||
.bss :
|
.bss :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
/* This is used by the startup in order to initialize the .bss section */
|
||||||
_sbss = .;
|
_sbss = .;
|
||||||
|
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
|
||||||
_ebss = . ;
|
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
.heap (NOLOAD) :
|
.heap (NOLOAD) :
|
||||||
{
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
_sheap = . ;
|
_sheap = . ;
|
||||||
_sheap_pre_rtos = . ;
|
_sheap_pre_rtos = . ;
|
||||||
*(.heap)
|
*(.heap)
|
||||||
@ -290,10 +285,20 @@ SECTIONS
|
|||||||
_eheap_post_rtos = . ;
|
_eheap_post_rtos = . ;
|
||||||
_init_stack_top = . - 4 ;
|
_init_stack_top = . - 4 ;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
/* keep the heap section at the end of the SRAM */
|
_free_ram = . ;
|
||||||
/* this will allow to claim the remaining bytes not used
|
.free_ram (NOLOAD) :
|
||||||
/* at run time! (done by the reset vector).
|
{
|
||||||
|
. = ORIGIN(RAM) + LENGTH(RAM) - _free_ram ;
|
||||||
|
/* This is used by the startup in order to initialize the .bss section */
|
||||||
|
_ebss = . ;
|
||||||
|
_eram = . ;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* keep the heap section at the end of the SRAM
|
||||||
|
* this will allow to claim the remaining bytes not used
|
||||||
|
* at run time! (done by the reset vector).
|
||||||
|
*/
|
||||||
|
|
||||||
PROVIDE ( end = _ebss );
|
PROVIDE ( end = _ebss );
|
||||||
PROVIDE ( _end = _ebss );
|
PROVIDE ( _end = _ebss );
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#if defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
|
|
||||||
/* Provide a RCVR driver */
|
/* Provide a RCVR driver */
|
||||||
static int32_t PIOS_PPM_Get(uint32_t chan_id);
|
static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel);
|
||||||
|
|
||||||
const struct pios_rcvr_driver pios_ppm_rcvr_driver = {
|
const struct pios_rcvr_driver pios_ppm_rcvr_driver = {
|
||||||
.read = PIOS_PPM_Get,
|
.read = PIOS_PPM_Get,
|
||||||
@ -160,13 +160,13 @@ void PIOS_PPM_Init(void)
|
|||||||
* \output -1 Channel not available
|
* \output -1 Channel not available
|
||||||
* \output >0 Channel value
|
* \output >0 Channel value
|
||||||
*/
|
*/
|
||||||
static int32_t PIOS_PPM_Get(uint32_t chan_id)
|
static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel)
|
||||||
{
|
{
|
||||||
/* Return error if channel not available */
|
/* Return error if channel not available */
|
||||||
if (chan_id >= PIOS_PPM_NUM_INPUTS) {
|
if (channel >= PIOS_PPM_NUM_INPUTS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return CaptureValue[chan_id];
|
return CaptureValue[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#if defined(PIOS_INCLUDE_PWM)
|
#if defined(PIOS_INCLUDE_PWM)
|
||||||
|
|
||||||
/* Provide a RCVR driver */
|
/* Provide a RCVR driver */
|
||||||
static int32_t PIOS_PWM_Get(uint32_t chan_id);
|
static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t chan_id);
|
||||||
|
|
||||||
const struct pios_rcvr_driver pios_pwm_rcvr_driver = {
|
const struct pios_rcvr_driver pios_pwm_rcvr_driver = {
|
||||||
.read = PIOS_PWM_Get,
|
.read = PIOS_PWM_Get,
|
||||||
@ -140,13 +140,13 @@ void PIOS_PWM_Init(void)
|
|||||||
* \output -1 Channel not available
|
* \output -1 Channel not available
|
||||||
* \output >0 Channel value
|
* \output >0 Channel value
|
||||||
*/
|
*/
|
||||||
static int32_t PIOS_PWM_Get(uint32_t chan_id)
|
static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel)
|
||||||
{
|
{
|
||||||
/* Return error if channel not available */
|
/* Return error if channel not available */
|
||||||
if (chan_id >= pios_pwm_cfg.num_channels) {
|
if (channel >= pios_pwm_cfg.num_channels) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return CaptureValue[chan_id];
|
return CaptureValue[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIOS_PWM_irq_handler(TIM_TypeDef * timer)
|
void PIOS_PWM_irq_handler(TIM_TypeDef * timer)
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
/* Global Variables */
|
/* Global Variables */
|
||||||
|
|
||||||
/* Provide a RCVR driver */
|
/* Provide a RCVR driver */
|
||||||
static int32_t PIOS_SBUS_Get(uint32_t chan_id);
|
static int32_t PIOS_SBUS_Get(uint32_t rcvr_id, uint8_t channel);
|
||||||
|
|
||||||
const struct pios_rcvr_driver pios_sbus_rcvr_driver = {
|
const struct pios_rcvr_driver pios_sbus_rcvr_driver = {
|
||||||
.read = PIOS_SBUS_Get,
|
.read = PIOS_SBUS_Get,
|
||||||
@ -155,13 +155,13 @@ void PIOS_SBUS_Init(const struct pios_sbus_cfg *cfg)
|
|||||||
* \output -1 channel not available
|
* \output -1 channel not available
|
||||||
* \output >0 channel value
|
* \output >0 channel value
|
||||||
*/
|
*/
|
||||||
static int32_t PIOS_SBUS_Get(uint32_t chan_id)
|
static int32_t PIOS_SBUS_Get(uint32_t rcvr_id, uint8_t channel)
|
||||||
{
|
{
|
||||||
/* return error if channel is not available */
|
/* return error if channel is not available */
|
||||||
if (chan_id >= SBUS_NUMBER_OF_CHANNELS) {
|
if (channel >= SBUS_NUMBER_OF_CHANNELS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return channel_data[chan_id];
|
return channel_data[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
/* Global Variables */
|
/* Global Variables */
|
||||||
|
|
||||||
/* Provide a RCVR driver */
|
/* Provide a RCVR driver */
|
||||||
static int32_t PIOS_SPEKTRUM_Get(uint32_t chan_id);
|
static int32_t PIOS_SPEKTRUM_Get(uint32_t rcvr_id, uint8_t channel);
|
||||||
|
|
||||||
const struct pios_rcvr_driver pios_spektrum_rcvr_driver = {
|
const struct pios_rcvr_driver pios_spektrum_rcvr_driver = {
|
||||||
.read = PIOS_SPEKTRUM_Get,
|
.read = PIOS_SPEKTRUM_Get,
|
||||||
@ -82,13 +82,13 @@ void PIOS_SPEKTRUM_Init(const struct pios_spektrum_cfg * cfg, bool bind)
|
|||||||
* \output -1 Channel not available
|
* \output -1 Channel not available
|
||||||
* \output >0 Channel value
|
* \output >0 Channel value
|
||||||
*/
|
*/
|
||||||
static int32_t PIOS_SPEKTRUM_Get(uint32_t chan_id)
|
static int32_t PIOS_SPEKTRUM_Get(uint32_t rcvr_id, uint8_t channel)
|
||||||
{
|
{
|
||||||
/* Return error if channel not available */
|
/* Return error if channel not available */
|
||||||
if (chan_id >= PIOS_SPEKTRUM_NUM_INPUTS) {
|
if (channel >= PIOS_SPEKTRUM_NUM_INPUTS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return CaptureValue[chan_id];
|
return CaptureValue[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,15 +31,20 @@
|
|||||||
#ifndef PIOS_RCVR_H
|
#ifndef PIOS_RCVR_H
|
||||||
#define PIOS_RCVR_H
|
#define PIOS_RCVR_H
|
||||||
|
|
||||||
extern uint32_t pios_rcvr_channel_to_id_map[];
|
struct pios_rcvr_channel_map {
|
||||||
|
uint32_t id;
|
||||||
|
uint8_t channel;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct pios_rcvr_channel_map pios_rcvr_channel_to_id_map[];
|
||||||
|
|
||||||
struct pios_rcvr_driver {
|
struct pios_rcvr_driver {
|
||||||
void (*init)(uint32_t id);
|
void (*init)(uint32_t id);
|
||||||
int32_t (*read)(uint32_t id);
|
int32_t (*read)(uint32_t id, uint8_t channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Public Functions */
|
/* Public Functions */
|
||||||
extern int32_t PIOS_RCVR_Read(uint32_t rcvr_id);
|
extern int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel);
|
||||||
|
|
||||||
#endif /* PIOS_RCVR_H */
|
#endif /* PIOS_RCVR_H */
|
||||||
|
|
||||||
|
@ -36,16 +36,6 @@
|
|||||||
|
|
||||||
extern uint32_t pios_rcvr_max_channel;
|
extern uint32_t pios_rcvr_max_channel;
|
||||||
|
|
||||||
enum pios_rcvr_dev_magic {
|
|
||||||
PIOS_RCVR_DEV_MAGIC = 0x99aabbcc,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pios_rcvr_dev {
|
|
||||||
enum pios_rcvr_dev_magic magic;
|
|
||||||
uint32_t id;
|
|
||||||
const struct pios_rcvr_driver * driver;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int32_t PIOS_RCVR_Init(uint32_t * rcvr_id, const struct pios_rcvr_driver * driver, const uint32_t lower_id);
|
extern int32_t PIOS_RCVR_Init(uint32_t * rcvr_id, const struct pios_rcvr_driver * driver, const uint32_t lower_id);
|
||||||
|
|
||||||
extern void PIOS_RCVR_IRQ_Handler(uint32_t rcvr_id);
|
extern void PIOS_RCVR_IRQ_Handler(uint32_t rcvr_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user