diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-04-22 23:15:02 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-04-22 23:15:02 +0200 |
commit | f3b6264feb44628f837552e78102e82d8c986bd0 (patch) | |
tree | 7dcb26f7381a373615248f2d9506109975ba8277 | |
parent | 5cfc464eb5da978b0e839327d655f94df26983f5 (diff) |
Enabled accelerometer and magnetometer. Outputting data over usb.
-rw-r--r-- | main.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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)) { |