summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 656e82d..2dda662 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,6 +9,8 @@
#include "usb.h"
#include "i2c.h"
+#include "lsm303dlm.h"
+
static Pin& led_status = PA4;
static Pin& led_error = PC4;
@@ -279,6 +281,9 @@ uint32_t usb_stack[1024];
Thread usb_thread(usb_stack, sizeof(usb_stack), usb_main);
+LSM303DLM_A accel(I2C2);
+LSM303DLM_M magn(I2C2);
+
int main() {
// Initialize system timer.
STK.LOAD = 168000000 / 8 / 1000; // 1000 Hz.
@@ -304,11 +309,22 @@ int main() {
usb_thread.start();
+ accel.init();
+ magn.init();
+
while(1) {
led_error.toggle();
Time::sleep(100);
+ accel.update();
+ magn.update();
int16_t buf[] = {
+ accel.x,
+ accel.y,
+ accel.z,
+ magn.x,
+ magn.y,
+ magn.z,
};
if(usb_ep_ready(1)) {