added buzzer, updated calibration, survey, and scripts
[openmag.git] / src / data / dataquaternions_funcs.h
blob5d345695be3e49bb7e86331ff52500fe723cbe6a
1 /* Copyright (C) 2008 Sean D'Epagnier <sean@depagnier.com>
3 * This Program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public
5 * License as published by the Free Software Foundation; either
6 * version 3 of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 * For more information on the GPL, please go to:
18 * http://www.gnu.org/copyleft/gpl.html
21 #include <math.h>
22 #include <linalg/quaternion.h>
23 #include <linalg/rotate.h>
25 #define MAKE_QUATERNION_GETS(mem) \
26 void data_get_quaternion_##mem(float quat[4]) \
27 { \
28 float q[4]; \
29 get_bytes_##mem(q, quat, sizeof q);\
30 data_show_quaternion(q); \
33 void data_show_quaternion(float q[4])
35 DATA_OUTPUT("<%f %f %f %f> %f degrees\n",
36 q[0], q[1], q[2], q[3], rad2deg(quatangle(q)));
39 MAKE_QUATERNION_GETS(sram)
40 MAKE_QUATERNION_GETS(eeprom)
41 MAKE_QUATERNION_GETS(flash)