1 /* 2 * Copyright (c) 2008 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #include <app.h> 9 #include <lk/debug.h> 10 #include <stdio.h> 11 #include <dev/accelerometer.h> 12 #include <lk/compiler.h> 13 #include <lk/console_cmd.h> 14 15 void read_xyz(void); 16 17 STATIC_COMMAND_START 18 STATIC_COMMAND("read_xyz", "read xyz vectors", (console_cmd_func)&read_xyz) 19 STATIC_COMMAND_END(accelerometer); 20 read_xyz(void)21void read_xyz(void) { 22 position_vector_t pos_vector; 23 acc_read_xyz(&pos_vector); 24 printf("X value = %f\n",pos_vector.x); 25 printf("Y value = %f\n",pos_vector.y); 26 printf("Z value = %f\n",pos_vector.z); 27 28 } 29 30 APP_START(accelerometer) 31 .flags = 0, 32 APP_END 33 34