mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 02:47:35 +08:00
IO compiling
This commit is contained in:
@@ -288,8 +288,8 @@ controls_tick() {
|
||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_OVERRIDE;
|
||||
|
||||
/* mix new RC input control values to servos */
|
||||
if (dsm_updated || sbus_updated || ppm_updated)
|
||||
mixer_tick();
|
||||
//if (dsm_updated || sbus_updated || ppm_updated)
|
||||
// mixer_tick();
|
||||
|
||||
} else {
|
||||
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_OVERRIDE;
|
||||
|
||||
@@ -8,11 +8,12 @@ SRCS = adc.c \
|
||||
registers.c \
|
||||
safety.c \
|
||||
sbus.c \
|
||||
mixer.cpp \
|
||||
../systemlib/mixer/mixer.cpp \
|
||||
../systemlib/mixer/mixer_group.cpp \
|
||||
../systemlib/mixer/mixer_multirotor.cpp \
|
||||
../systemlib/mixer/mixer_simple.cpp \
|
||||
../systemlib/up_cxxinitialize.c \
|
||||
../systemlib/hx_stream.c \
|
||||
../systemlib/perf_counter.c
|
||||
|
||||
# mixer.cpp \
|
||||
# ../systemlib/mixer/mixer.cpp \
|
||||
# ../systemlib/mixer/mixer_group.cpp \
|
||||
# ../systemlib/mixer/mixer_multirotor.cpp \
|
||||
# ../systemlib/mixer/mixer_simple.cpp \
|
||||
@@ -64,8 +64,10 @@ struct sys_state_s system_state;
|
||||
|
||||
static struct hrt_call serial_dma_call;
|
||||
|
||||
#ifdef CONFIG_STM32_I2C1
|
||||
/* store i2c reset count XXX this should be a register, together with other error counters */
|
||||
volatile uint32_t i2c_loop_resets = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* a set of debug buffers to allow us to send debug information from ISRs
|
||||
@@ -133,7 +135,9 @@ user_start(int argc, char *argv[])
|
||||
* Poll at 1ms intervals for received bytes that have not triggered
|
||||
* a DMA event.
|
||||
*/
|
||||
#ifdef CONFIG_ARCH_DMA
|
||||
hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL);
|
||||
#endif
|
||||
|
||||
/* print some startup info */
|
||||
lowsyslog("\nPX4IO: starting\n");
|
||||
@@ -155,8 +159,10 @@ user_start(int argc, char *argv[])
|
||||
/* initialise the control inputs */
|
||||
controls_init();
|
||||
|
||||
#ifdef CONFIG_STM32_I2C1
|
||||
/* start the i2c handler */
|
||||
i2c_init();
|
||||
#endif
|
||||
|
||||
/* add a performance counter for mixing */
|
||||
perf_counter_t mixer_perf = perf_alloc(PC_ELAPSED, "mix");
|
||||
@@ -201,7 +207,7 @@ user_start(int argc, char *argv[])
|
||||
|
||||
/* kick the mixer */
|
||||
perf_begin(mixer_perf);
|
||||
mixer_tick();
|
||||
// mixer_tick();
|
||||
perf_end(mixer_perf);
|
||||
|
||||
/* kick the control inputs */
|
||||
|
||||
@@ -124,10 +124,18 @@ extern struct sys_state_s system_state;
|
||||
#define LED_SAFETY(_s) stm32_gpiowrite(GPIO_LED3, !(_s))
|
||||
|
||||
#define POWER_SERVO(_s) stm32_gpiowrite(GPIO_SERVO_PWR_EN, (_s))
|
||||
#define POWER_ACC1(_s) stm32_gpiowrite(GPIO_ACC1_PWR_EN, (_s))
|
||||
#define POWER_ACC2(_s) stm32_gpiowrite(GPIO_ACC2_PWR_EN, (_s))
|
||||
#define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s))
|
||||
#define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s))
|
||||
#ifdef GPIO_ACC1_PWR_EN
|
||||
#define POWER_ACC1(_s) stm32_gpiowrite(GPIO_ACC1_PWR_EN, (_s))
|
||||
#endif
|
||||
#ifdef GPIO_ACC2_PWR_EN
|
||||
#define POWER_ACC2(_s) stm32_gpiowrite(GPIO_ACC2_PWR_EN, (_s))
|
||||
#endif
|
||||
#ifdef GPIO_RELAY1_EN
|
||||
#define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s))
|
||||
#endif
|
||||
#ifdef GPIO_RELAY2_EN
|
||||
#define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s))
|
||||
#endif
|
||||
|
||||
#define OVERCURRENT_ACC (!stm32_gpioread(GPIO_ACC_OC_DETECT))
|
||||
#define OVERCURRENT_SERVO (!stm32_gpioread(GPIO_SERVO_OC_DETECT))
|
||||
@@ -140,18 +148,20 @@ extern struct sys_state_s system_state;
|
||||
/*
|
||||
* Mixer
|
||||
*/
|
||||
extern void mixer_tick(void);
|
||||
extern void mixer_handle_text(const void *buffer, size_t length);
|
||||
//extern void mixer_tick(void);
|
||||
//extern void mixer_handle_text(const void *buffer, size_t length);
|
||||
|
||||
/**
|
||||
* Safety switch/LED.
|
||||
*/
|
||||
extern void safety_init(void);
|
||||
|
||||
#ifdef CONFIG_STM32_I2C1
|
||||
/**
|
||||
* FMU communications
|
||||
*/
|
||||
extern void i2c_init(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Register space
|
||||
@@ -183,6 +193,7 @@ extern volatile uint8_t debug_level;
|
||||
/* send a debug message to the console */
|
||||
extern void isr_debug(uint8_t level, const char *fmt, ...);
|
||||
|
||||
#ifdef CONFIG_STM32_I2C1
|
||||
void i2c_dump(void);
|
||||
void i2c_reset(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -245,7 +245,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num
|
||||
|
||||
/* handle text going to the mixer parser */
|
||||
case PX4IO_PAGE_MIXERLOAD:
|
||||
mixer_handle_text(values, num_values * sizeof(*values));
|
||||
//mixer_handle_text(values, num_values * sizeof(*values));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user