aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/px4io.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-13 18:57:27 -0800
committerpx4dev <px4@purgatory.org>2013-01-13 19:05:01 -0800
commit4e38615595abd9d27d0cb000caafb98cc3670abe (patch)
treed2b9719a348501a68821c6759d33779b6a8a325e /apps/px4io/px4io.c
parent8ebe21b27b279b5d941d4829e5ebee28b84b146c (diff)
downloadpx4-firmware-4e38615595abd9d27d0cb000caafb98cc3670abe.tar.gz
px4-firmware-4e38615595abd9d27d0cb000caafb98cc3670abe.tar.bz2
px4-firmware-4e38615595abd9d27d0cb000caafb98cc3670abe.zip
Major workover of the PX4IO firmware for I2C operation.
Diffstat (limited to 'apps/px4io/px4io.c')
-rw-r--r--apps/px4io/px4io.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/px4io/px4io.c b/apps/px4io/px4io.c
index e51c1c73c..13f46939a 100644
--- a/apps/px4io/px4io.c
+++ b/apps/px4io/px4io.c
@@ -37,22 +37,22 @@
*/
#include <nuttx/config.h>
-#include <stdio.h>
+
+#include <stdio.h> // required for task_create
#include <stdbool.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <debug.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-
-#include <nuttx/clock.h>
+#include <poll.h>
#include <drivers/drv_pwm_output.h>
#include <drivers/drv_hrt.h>
+#include <systemlib/perf_counter.h>
+
#include <stm32_uart.h>
+#define DEBUG
#include "px4io.h"
__EXPORT int user_start(int argc, char *argv[]);
@@ -70,8 +70,6 @@ int user_start(int argc, char *argv[])
/* reset all to zero */
memset(&system_state, 0, sizeof(system_state));
- /* default to 50 Hz PWM outputs */
- system_state.servo_rate = 50;
/* configure the high-resolution time/callout interface */
hrt_init();
@@ -83,7 +81,7 @@ int user_start(int argc, char *argv[])
hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL);
/* print some startup info */
- lib_lowprintf("\nPX4IO: starting\n");
+ debug("\nPX4IO: starting\n");
/* default all the LEDs to off while we start */
LED_AMBER(false);
@@ -108,11 +106,19 @@ int user_start(int argc, char *argv[])
struct mallinfo minfo = mallinfo();
- lib_lowprintf("free %u largest %u\n", minfo.mxordblk, minfo.fordblks);
+ debug("free %u largest %u\n", minfo.mxordblk, minfo.fordblks);
- /* start the i2c test code */
+ /* start the i2c handler */
i2c_init();
- /* we're done here, go run the communications loop */
- comms_main();
+ /* add a performance counter for mixing */
+ perf_counter_t mixer_perf = perf_alloc(PC_ELAPSED, "mix");
+
+ /* run the mixer at 100Hz (for now...) */
+ for (;;) {
+ poll(NULL, 0, 10);
+ perf_begin(mixer_perf);
+ mixer_tick();
+ perf_end(mixer_perf);
+ }
} \ No newline at end of file