Fix PWM channel zero output; pin configuration was being overwritten by USART2 setup.

This commit is contained in:
px4dev 2012-11-04 16:44:36 -08:00
parent 06e17eae5d
commit 7fbad5adea
3 changed files with 18 additions and 9 deletions

View File

@ -96,7 +96,7 @@ struct mixer {
} mixers[IO_SERVO_COUNT]; } mixers[IO_SERVO_COUNT];
int int
mixer_init(const char *mq_name) mixer_init(void)
{ {
/* look for control data at 50Hz */ /* look for control data at 50Hz */
hrt_call_every(&mixer_input_call, 1000, 20000, mixer_tick, NULL); hrt_call_every(&mixer_input_call, 1000, 20000, mixer_tick, NULL);

View File

@ -59,8 +59,6 @@ int gpio_fd;
static const char cursor[] = {'|', '/', '-', '\\'}; static const char cursor[] = {'|', '/', '-', '\\'};
static const char *rc_input_mq_name = "rc_input";
static struct hrt_call timer_tick_call; static struct hrt_call timer_tick_call;
volatile int timers[TIMER_NUM_TIMERS]; volatile int timers[TIMER_NUM_TIMERS];
static void timer_tick(void *arg); static void timer_tick(void *arg);
@ -74,7 +72,11 @@ int user_start(int argc, char *argv[])
/* configure the high-resolution time/callout interface */ /* configure the high-resolution time/callout interface */
hrt_init(); hrt_init();
/* configure the PWM outputs */ /* init the FMU link */
comms_init();
/* configure the first 8 PWM outputs (i.e. all of them) */
/* note, must do this after comms init to steal back PA0, which is CTS otherwise */
up_pwm_servo_init(0xff); up_pwm_servo_init(0xff);
/* print some startup info */ /* print some startup info */
@ -94,14 +96,11 @@ int user_start(int argc, char *argv[])
POWER_SERVO(true); POWER_SERVO(true);
/* start the mixer */ /* start the mixer */
mixer_init(rc_input_mq_name); mixer_init();
/* start the safety switch handler */ /* start the safety switch handler */
safety_init(); safety_init();
/* init the FMU link */
comms_init();
/* set up some timers for the main loop */ /* set up some timers for the main loop */
timers[TIMER_BLINK_AMBER] = 250; /* heartbeat blink @ 2Hz */ timers[TIMER_BLINK_AMBER] = 250; /* heartbeat blink @ 2Hz */
timers[TIMER_STATUS_PRINT] = 1000; /* print status message @ 1Hz */ timers[TIMER_STATUS_PRINT] = 1000; /* print status message @ 1Hz */

View File

@ -52,6 +52,16 @@
#define MAX_CONTROL_CHANNELS 12 #define MAX_CONTROL_CHANNELS 12
#define IO_SERVO_COUNT 8 #define IO_SERVO_COUNT 8
/*
* Debug logging
*/
#if 1
# define debug(fmt, ...) lib_lowprintf(fmt "\n", ##args)
#else
# define debug(fmt, ...) do {} while(0)
#endif
/* /*
* System state structure. * System state structure.
*/ */
@ -130,7 +140,7 @@ extern volatile int timers[TIMER_NUM_TIMERS];
/* /*
* Mixer * Mixer
*/ */
extern int mixer_init(const char *mq_name); extern int mixer_init(void);
/* /*
* Safety switch/LED. * Safety switch/LED.