Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1992 → Rev 1993

/branches/V0.82b-Arthur-P/DebugUtils/.bzr/README
0,0 → 1,3
This is a Bazaar control directory.
Do not change any files in this directory.
See http://bazaar.canonical.com/ for more information about Bazaar.
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/branch/branch.conf
0,0 → 1,0
push_location = sftp://varesano@varesano.net/~/repository/DebugUtils/
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/branch/format
0,0 → 1,0
Bazaar Branch Format 7 (needs bzr 1.6)
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/branch/last-revision
0,0 → 1,0
1 fvaresano@yahoo.it-20110517153302-i4h4fsjdif98b4rr
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/branch/tags
--- DebugUtils/.bzr/branch-format (nonexistent)
+++ DebugUtils/.bzr/branch-format (revision 1993)
@@ -0,0 +1 @@
+Bazaar-NG meta directory, format 1
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/checkout/conflicts
0,0 → 1,0
BZR conflict list format 1
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/checkout/dirstate
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/checkout/format
0,0 → 1,0
Bazaar Working Tree Format 6 (bzr 1.14)
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/checkout/views
--- DebugUtils/.bzr/repository/format (nonexistent)
+++ DebugUtils/.bzr/repository/format (revision 1993)
@@ -0,0 +1 @@
+Bazaar repository format 2a (needs bzr 1.16 or later)
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/indices/8efda933b90a389ea14dc385a334afeb.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/indices/8efda933b90a389ea14dc385a334afeb.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/indices/8efda933b90a389ea14dc385a334afeb.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/indices/8efda933b90a389ea14dc385a334afeb.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/indices/8efda933b90a389ea14dc385a334afeb.tix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=2
row_lengths=1
+2ƪ’ÈZ­™`@¢«s´öCø(‘›¥¶äm]îÕÑÿ»ièÒqõÉíCt
\ No newline at end of file
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/pack-names
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/.bzr/repository/packs/8efda933b90a389ea14dc385a334afeb.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/DebugUtils/DebugUtils.h
0,0 → 1,49
/*
DebugUtils.h - Simple debugging utilities.
Copyright (C) 2011 Fabio Varesano <fabio at varesano dot net>
 
Ideas taken from:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1271517197
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
#ifndef DEBUGUTILS_H
#define DEBUGUTILS_H
 
#ifdef DEBUG_V
#include <WProgram.h>
#define DEBUG_PRINT(str) \
Serial.print(millis()); \
Serial.print(": "); \
Serial.print(__PRETTY_FUNCTION__); \
Serial.print(' '); \
Serial.print(__FILE__); \
Serial.print(':'); \
Serial.print(__LINE__); \
Serial.print(' '); \
Serial.println(str);
#endif
#ifdef DEBUG
#define DEBUG_PRINT(str) \
Serial.println(str);
#endif
 
#ifndef DEBUG_PRINT
#define DEBUG_PRINT(str)
#endif
 
 
#endif //DEBUGUTILS_H
/branches/V0.82b-Arthur-P/FreeIMU/CommunicationUtils.cpp
0,0 → 1,25
#include "WProgram.h"
#include "CommunicationUtils.h"
 
void serialPrintFloatArr(float * arr, int length) {
for(int i=0; i<length; i++) {
serialFloatPrint(arr[i]);
Serial.print(",");
}
}
 
 
void serialFloatPrint(float f) {
byte * b = (byte *) &f;
for(int i=0; i<4; i++) {
byte b1 = (b[i] >> 4) & 0x0f;
byte b2 = (b[i] & 0x0f);
char c1 = (b1 < 10) ? ('0' + b1) : 'A' + b1 - 10;
char c2 = (b2 < 10) ? ('0' + b2) : 'A' + b2 - 10;
Serial.print(c1);
Serial.print(c2);
}
}
/branches/V0.82b-Arthur-P/FreeIMU/CommunicationUtils.h
0,0 → 1,7
#ifndef CommunitationUtils_h
#define CommunitationUtils_h
 
void serialPrintFloatArr(float * arr, int length);
void serialFloatPrint(float f);
 
#endif // CommunitationUtils_h
/branches/V0.82b-Arthur-P/FreeIMU/FreeIMU.cpp
0,0 → 1,327
/*
FreeIMU.cpp - A libre and easy to use orientation sensing library for Arduino
Copyright (C) 2011 Fabio Varesano <fabio at varesano dot net>
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
#include <inttypes.h>
//#define DEBUG
#include "WProgram.h"
#include "FreeIMU.h"
// #include "WireUtils.h"
#include "DebugUtils.h"
 
//----------------------------------------------------------------------------------------------------
// Definitions
 
#define Kp 2.0f // proportional gain governs rate of convergence to accelerometer/magnetometer
#define Ki 0.005f // integral gain governs rate of convergence of gyroscope biases
//#define halfT 0.02f // half the sample period
 
 
FreeIMU::FreeIMU() {
#if FREEIMU_VER <= 3
acc = ADXL345();
#else
acc = BMA180();
#endif
gyro = ITG3200();
magn = HMC58X3();
// initialize quaternion
q0 = 1.0;
q1 = 0.0;
q2 = 0.0;
q3 = 0.0;
exInt = 0.0;
eyInt = 0.0;
ezInt = 0.0;
lastUpdate = 0;
now = 0;
}
 
void FreeIMU::init() {
init(FIMU_ACC_ADDR, FIMU_ITG3200_DEF_ADDR, false);
}
 
void FreeIMU::init(bool fastmode) {
init(FIMU_ACC_ADDR, FIMU_ITG3200_DEF_ADDR, fastmode);
}
 
void FreeIMU::init(int acc_addr, int gyro_addr, bool fastmode) {
delay(5);
// disable internal pullups of the ATMEGA which Wire enable by default
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
// deactivate internal pull-ups for twi
// as per note from atmega8 manual pg167
cbi(PORTC, 4);
cbi(PORTC, 5);
#else
// deactivate internal pull-ups for twi
// as per note from atmega128 manual pg204
cbi(PORTD, 0);
cbi(PORTD, 1);
#endif
if(fastmode) { // switch to 400KHz I2C - eheheh
TWBR = ((16000000L / 400000L) - 16) / 2; // see twi_init in Wire/utility/twi.c
// TODO: make the above usable also for 8MHz arduinos..
}
#if FREEIMU_VER <= 3
// init ADXL345
acc.init(acc_addr);
#else
// init BMA180
acc.setAddress(acc_addr);
acc.SoftReset();
acc.enableWrite();
acc.SetFilter(acc.F10HZ);
acc.setGSensitivty(acc.G15);
acc.SetSMPSkip();
acc.SetISRMode();
acc.disableWrite();
#endif
 
// init ITG3200
gyro.init(gyro_addr);
// calibrate the ITG3200
gyro.zeroCalibrate(64,5);
// init HMC5843
magn.init(false); // Don't set mode yet, we'll do that later on.
// Calibrate HMC using self test, not recommended to change the gain after calibration.
magn.calibrate(1); // Use gain 1=default, valid 0-7, 7 not recommended.
// Single mode conversion was used in calibration, now set continuous mode
magn.setMode(0);
delay(10);
magn.setDOR(B110);
}
 
 
void FreeIMU::getRawValues(int * raw_values) {
acc.readAccel(&raw_values[0], &raw_values[1], &raw_values[2]);
gyro.readGyroRaw(&raw_values[3], &raw_values[4], &raw_values[5]);
magn.getValues(&raw_values[6], &raw_values[7], &raw_values[8]);
}
 
 
void FreeIMU::getValues(float * values) {
int accval[3];
acc.readAccel(&accval[0], &accval[1], &accval[2]);
values[0] = ((float) accval[0]);
values[1] = ((float) accval[1]);
values[2] = ((float) accval[2]);
gyro.readGyro(&values[3]);
magn.getValues(&values[6]);
}
 
 
 
//=====================================================================================================
// AHRS.c
// S.O.H. Madgwick
// 25th August 2010
//=====================================================================================================
// Description:
//
// Quaternion implementation of the 'DCM filter' [Mayhony et al]. Incorporates the magnetic distortion
// compensation algorithms from my filter [Madgwick] which eliminates the need for a reference
// direction of flux (bx bz) to be predefined and limits the effect of magnetic distortions to yaw
// axis only.
//
// User must define 'halfT' as the (sample period / 2), and the filter gains 'Kp' and 'Ki'.
//
// Global variables 'q0', 'q1', 'q2', 'q3' are the quaternion elements representing the estimated
// orientation. See my report for an overview of the use of quaternions in this application.
//
// User must call 'AHRSupdate()' every sample period and parse calibrated gyroscope ('gx', 'gy', 'gz'),
// accelerometer ('ax', 'ay', 'ay') and magnetometer ('mx', 'my', 'mz') data. Gyroscope units are
// radians/second, accelerometer and magnetometer units are irrelevant as the vector is normalised.
//
//=====================================================================================================
void FreeIMU::AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz) {
float norm;
float hx, hy, hz, bx, bz;
float vx, vy, vz, wx, wy, wz;
float ex, ey, ez;
 
// auxiliary variables to reduce number of repeated operations
float q0q0 = q0*q0;
float q0q1 = q0*q1;
float q0q2 = q0*q2;
float q0q3 = q0*q3;
float q1q1 = q1*q1;
float q1q2 = q1*q2;
float q1q3 = q1*q3;
float q2q2 = q2*q2;
float q2q3 = q2*q3;
float q3q3 = q3*q3;
// normalise the measurements
now = millis();
halfT = (now - lastUpdate) / 2000.0;
lastUpdate = now;
norm = sqrt(ax*ax + ay*ay + az*az);
ax = ax / norm;
ay = ay / norm;
az = az / norm;
/*
norm = invSqrt(ax*ax + ay*ay + az*az);
ax = ax * norm;
ay = ay * norm;
az = az * norm;
*/
norm = sqrt(mx*mx + my*my + mz*mz);
mx = mx / norm;
my = my / norm;
mz = mz / norm;
/*
norm = invSqrt(mx*mx + my*my + mz*mz);
mx = mx * norm;
my = my * norm;
mz = mz * norm;
*/
// compute reference direction of flux
hx = 2*mx*(0.5 - q2q2 - q3q3) + 2*my*(q1q2 - q0q3) + 2*mz*(q1q3 + q0q2);
hy = 2*mx*(q1q2 + q0q3) + 2*my*(0.5 - q1q1 - q3q3) + 2*mz*(q2q3 - q0q1);
hz = 2*mx*(q1q3 - q0q2) + 2*my*(q2q3 + q0q1) + 2*mz*(0.5 - q1q1 - q2q2);
bx = sqrt((hx*hx) + (hy*hy));
bz = hz;
// estimated direction of gravity and flux (v and w)
vx = 2*(q1q3 - q0q2);
vy = 2*(q0q1 + q2q3);
vz = q0q0 - q1q1 - q2q2 + q3q3;
wx = 2*bx*(0.5 - q2q2 - q3q3) + 2*bz*(q1q3 - q0q2);
wy = 2*bx*(q1q2 - q0q3) + 2*bz*(q0q1 + q2q3);
wz = 2*bx*(q0q2 + q1q3) + 2*bz*(0.5 - q1q1 - q2q2);
// error is sum of cross product between reference direction of fields and direction measured by sensors
ex = (ay*vz - az*vy) + (my*wz - mz*wy);
ey = (az*vx - ax*vz) + (mz*wx - mx*wz);
ez = (ax*vy - ay*vx) + (mx*wy - my*wx);
// integral error scaled integral gain
exInt = exInt + ex*Ki;
eyInt = eyInt + ey*Ki;
ezInt = ezInt + ez*Ki;
// adjusted gyroscope measurements
gx = gx + Kp*ex + exInt;
gy = gy + Kp*ey + eyInt;
gz = gz + Kp*ez + ezInt;
// integrate quaternion rate and normalise
iq0 = (-q1*gx - q2*gy - q3*gz)*halfT;
iq1 = (q0*gx + q2*gz - q3*gy)*halfT;
iq2 = (q0*gy - q1*gz + q3*gx)*halfT;
iq3 = (q0*gz + q1*gy - q2*gx)*halfT;
q0 += iq0;
q1 += iq1;
q2 += iq2;
q3 += iq3;
// normalise quaternion
norm = sqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
q0 = q0 / norm;
q1 = q1 / norm;
q2 = q2 / norm;
q3 = q3 / norm;
/*
norm = invSqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
q0 = q0 * norm;
q1 = q1 * norm;
q2 = q2 * norm;
q3 = q3 * norm;
*/
}
 
void FreeIMU::getQ(float * q) {
float val[9];
getValues(val);
DEBUG_PRINT(val[3] * M_PI/180);
DEBUG_PRINT(val[4] * M_PI/180);
DEBUG_PRINT(val[5] * M_PI/180);
DEBUG_PRINT(val[0]);
DEBUG_PRINT(val[1]);
DEBUG_PRINT(val[2]);
DEBUG_PRINT(val[6]);
DEBUG_PRINT(val[7]);
DEBUG_PRINT(val[8]);
// gyro values are expressed in deg/sec, the * M_PI/180 will convert it to radians/sec
AHRSupdate(val[3] * M_PI/180, val[4] * M_PI/180, val[5] * M_PI/180, val[0], val[1], val[2], val[6], val[7], val[8]);
q[0] = q0;
q[1] = q1;
q[2] = q2;
q[3] = q3;
}
 
// Returns the Euler angles in radians defined with the Aerospace sequence.
// See Sebastian O.H. Madwick report
// "An efficient orientation filter for inertial and intertial/magnetic sensor arrays" Chapter 2 Quaternion representation
void FreeIMU::getEuler(float * angles) {
float q[4]; // quaternion
getQ(q);
angles[0] = atan2(2 * q[1] * q[2] - 2 * q[0] * q[3], 2 * q[0]*q[0] + 2 * q[1] * q[1] - 1) * 180/M_PI; // psi
angles[1] = -asin(2 * q[1] * q[3] + 2 * q[0] * q[2]) * 180/M_PI; // theta
angles[2] = atan2(2 * q[2] * q[3] - 2 * q[0] * q[1], 2 * q[0] * q[0] + 2 * q[3] * q[3] - 1) * 180/M_PI; // phi
}
 
 
 
void FreeIMU::getYawPitchRoll(float * ypr) {
float q[4]; // quaternion
float gx, gy, gz; // estimated gravity direction
getQ(q);
gx = 2 * (q[1]*q[3] - q[0]*q[2]);
gy = 2 * (q[0]*q[1] + q[2]*q[3]);
gz = q[0]*q[0] - q[1]*q[1] - q[2]*q[2] + q[3]*q[3];
ypr[0] = atan2(2 * q[1] * q[2] - 2 * q[0] * q[3], 2 * q[0]*q[0] + 2 * q[1] * q[1] - 1) * 180/M_PI;
ypr[1] = atan(gx / sqrt(gy*gy + gz*gz)) * 180/M_PI;
ypr[2] = atan(gy / sqrt(gx*gx + gz*gz)) * 180/M_PI;
}
 
 
float invSqrt(float number) {
volatile long i;
volatile float x, y;
volatile const float f = 1.5F;
 
x = number * 0.5F;
y = number;
i = * ( long * ) &y;
i = 0x5f375a86 - ( i >> 1 );
y = * ( float * ) &i;
y = y * ( f - ( x * y * y ) );
return y;
}
/branches/V0.82b-Arthur-P/FreeIMU/FreeIMU.h
0,0 → 1,103
/*
FreeIMU.h - A libre and easy to use orientation sensing library for Arduino
Copyright (C) 2011 Fabio Varesano <fabio at varesano dot net>
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
 
// Uncomment the appropriated version of FreeIMU you are using
// #define FREEIMU_VER 1 // For FreeIMU v0.1
// #define FREEIMU_VER 2 // For FreeIMU v0.2
//#define FREEIMU_VER 3 // For FreeIMU v0.3 and v0.3.1
#define FREEIMU_VER 4 // For FreeIMU v0.3.5
// #define FREEIMU_VER 5 // For FreeIMU v0.3.5_MS
// #define FREEIMU_VER 6 // For FreeIMU v0.3.5_BMP
 
 
#include <Wire.h>
#include "WProgram.h"
 
#if FREEIMU_VER <= 3
#include <ADXL345.h>
// default I2C 7-bit addresses of the sensors
#define FIMU_ACC_ADDR ADXL345_ADDR_ALT_LOW // SDO connected to GND
//#define FIMU_ADXL345_DEF_ADDR ADXL345_ADDR_ALT_HIGH // SDO connected to GND
#else
#include <bma180.h>
#define FIMU_ACC_ADDR BMA180_ADDRESS_SDO_LOW
//#define FIMU_ACC_ADDR BMA180_ADDRESS_SDO_HIGH
#endif
#include <HMC58X3.h>
#include <ITG3200.h>
 
 
#ifndef FreeIMU_h
#define FreeIMU_h
 
 
#define FIMU_BMA180_DEF_ADDR BMA180_ADDRESS_SDO_LOW
#define FIMU_ITG3200_DEF_ADDR ITG3200_ADDR_AD0_LOW // AD0 connected to GND
// HMC5843 address is fixed so don't bother to define it
 
/*
// ITG3200 constants
#define FIMU_ITG3200_SMPLRT_DIV 0x15
#define FIMU_ITG3200_DLPF_FS 0x16
#define FIMU_ITG3200_INT_CFG 0x17
#define FIMU_ITG3200_PWR_MGM 0x3E
 
*/
 
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
 
class FreeIMU
{
public:
FreeIMU();
void init();
void init(bool fastmode);
void init(int acc_addr, int gyro_addr, bool fastmode);
void getRawValues(int * raw_values);
void getValues(float * values);
void getQ(float * q);
void getEuler(float * angles);
void getYawPitchRoll(float * ypr);
// we make them public so that users can interact directly with device classes
#if FREEIMU_VER <= 3
ADXL345 acc;
#else
BMA180 acc;
#endif
HMC58X3 magn;
ITG3200 gyro;
private:
int* raw_acc, raw_gyro, raw_magn;
void AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);
float q0, q1, q2, q3; // quaternion elements representing the estimated orientation
float iq0, iq1, iq2, iq3;
float exInt, eyInt, ezInt; // scaled integral error
int lastUpdate, now; // sample period expressed in milliseconds
float halfT; // half the sample period expressed in seconds
int startLoopTime;
};
 
float invSqrt(float number);
 
#endif // FreeIMU_h
 
/branches/V0.82b-Arthur-P/FreeIMU/LICENSE.txt
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/V0.82b-Arthur-P/FreeIMU/examples/FreeIMU_quaternion/FreeIMU_quaternion.pde
0,0 → 1,37
#include <ADXL345.h>
#include <HMC58X3.h>
#include <ITG3200.h>
#include <bma180.h>
 
#define DEBUG
#ifdef DEBUG
#include "DebugUtils.h"
#endif
 
#include "CommunicationUtils.h"
#include "FreeIMU.h"
#include <Wire.h>
 
 
float q[4];
 
// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();
 
void setup() {
Serial.begin(115200);
Wire.begin();
delay(5);
my3IMU.init();
delay(5);
}
 
 
void loop() {
my3IMU.getQ(q);
serialPrintFloatArr(q, 4);
Serial.println("");
delay(10);
}
 
/branches/V0.82b-Arthur-P/FreeIMU/examples/FreeIMU_raw/FreeIMU_raw.pde
0,0 → 1,43
#include <ADXL345.h>
#include <bma180.h>
#include <HMC58X3.h>
#include <ITG3200.h>
 
//#define DEBUG
#include "DebugUtils.h"
 
 
#include "FreeIMU.h"
#include <Wire.h>
 
int raw_values[9];
char str[512];
float val[9];
 
 
// Set the default object
FreeIMU my3IMU = FreeIMU();
 
void setup() {
Serial.begin(115200);
Wire.begin();
delay(500);
my3IMU.init(true); // the parameter enable or disable fast mode
delay(500);
}
 
void loop() {
my3IMU.getRawValues(raw_values);
sprintf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,", raw_values[0], raw_values[1], raw_values[2], raw_values[3], raw_values[4], raw_values[5], raw_values[6], raw_values[7], raw_values[8]);
Serial.print(str);
Serial.print(10, BYTE);
/*
my3IMU.getValues(val);
sprintf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d", int(val[0]), int(val[1]), int(val[2]), int(val[3]), int(val[4]), int(val[5]), int(val[6]), int(val[7]), int(val[8]));
Serial.print(str);
Serial.print(10, BYTE);
*/
}
 
/branches/V0.82b-Arthur-P/FreeIMU/examples/FreeIMU_speedtest/FreeIMU_speedtest.pde
0,0 → 1,71
#include <ADXL345.h>
#include <HMC5843.h>
#include <ITG3200.h>
 
//#define DEBUG
#include "DebugUtils.h"
 
#include "FreeIMU.h"
#include <Wire.h>
 
int raw_values[9];
char str[512];
float val[9], q[4];
 
unsigned long start, stop;
 
// Set the default object
FreeIMU my3IMU = FreeIMU();
 
void setup() {
Serial.begin(115200);
Wire.begin();
delay(500);
my3IMU.init(true); // the parameter enable or disable fast mode
delay(500);
}
 
void loop() {
Serial.println("Testing raw reading speed (average on 1024 samples):");
start = micros();
for(int i=0; i<1024; i++) {
my3IMU.getRawValues(raw_values);
}
stop = micros();
Serial.print("--> result: ");
Serial.print((stop - start) / 1024);
Serial.print(" microseconds .... ");
Serial.print(((stop - start) / 1024) / 1000);
Serial.println(" milliseconds");
Serial.println("Testing calibrated reading speed (average on 1024 samples):");
start = micros();
for(int i=0; i<1024; i++) {
my3IMU.getValues(val);
}
stop = micros();
Serial.print("--> result: ");
Serial.print((stop - start) / 1024);
Serial.print(" microseconds .... ");
Serial.print(((stop - start) / 1024) / 1000);
Serial.println(" milliseconds");
Serial.println("Testing sensor fusion speed (average on 1024 samples):");
start = micros();
for(int i=0; i<1024; i++) {
my3IMU.getQ(q);
}
stop = micros();
Serial.print("--> result: ");
Serial.print((stop - start) / 1024);
Serial.print(" microseconds .... ");
Serial.print(((stop - start) / 1024) / 1000);
Serial.println(" milliseconds");
Serial.println("Looping again..");
Serial.println("----");
}
/branches/V0.82b-Arthur-P/FreeIMU/examples/FreeIMU_yaw_pitch_roll/FreeIMU_yaw_pitch_roll.pde
0,0 → 1,44
#include <ADXL345.h>
#include <HMC58X3.h>
#include <ITG3200.h>
 
//#define DEBUG
#include "DebugUtils.h"
 
#include "FreeIMU.h"
#include "CommunicationUtils.h"
#include <Wire.h>
 
int raw_values[9];
//char str[512];
float ypr[3]; // yaw pitch roll
float val[9];
 
// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();
 
void setup() {
Serial.begin(115200);
Wire.begin();
delay(5);
my3IMU.init(); // the parameter enable or disable fast mode
delay(5);
}
 
void loop() {
my3IMU.getYawPitchRoll(ypr);
Serial.print("Yaw: ");
Serial.print(ypr[0]);
Serial.print(" Pitch: ");
Serial.print(ypr[1]);
Serial.print(" Roll: ");
Serial.print(ypr[2]);
Serial.println("");
delay(10);
}
 
 
 
/branches/V0.82b-Arthur-P/HMC/HMC.cpp
0,0 → 1,108
/*
* HMC.cpp - Interface a Honeywell HMC5843 magnetometer to an AVR via i2c
* Version 0.1 - http://www.timzaman.com/
* Copyright (c) 2011 Tim Zaman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "HMC.h"
#include "WProgram.h"
#include <Wire.h>
 
/* PUBLIC METHODS */
 
HMC5843::HMC5843()
{
}
 
void HMC5843::init()
{
}
 
// This can be called at 100ms intervals to get new data
void HMC5843::getValues(int *x, int *y, int *z)
{
Wire.begin(); //Initiate the Wire library and join the I2C bus as a master
int regb=0x01;
int regbdata=0x40;
int outputData[6];
int i;
double angle;
 
Wire.beginTransmission(HMC5883_WriteAddress);
Wire.send(regb);
Wire.send(regbdata);
Wire.endTransmission();
delay(1000);
Wire.beginTransmission(HMC5883_WriteAddress); //Initiate a transmission with HMC5883 (Write address).
Wire.send(HMC5883_ModeRegisterAddress); //Place the Mode Register Address in send-buffer.
Wire.send(HMC5883_ContinuousModeCommand); //Place the command for Continuous operation Mode in send-buffer.
Wire.endTransmission(); //Send the send-buffer to HMC5883 and end the I2C transmission.
delay(100);
Wire.beginTransmission(HMC5883_WriteAddress); //Initiate a transmission with HMC5883 (Write address).
Wire.requestFrom(HMC5883_WriteAddress,6); //Request 6 bytes of data from the address specified.
delay(500);
//Read the value of magnetic components X,Y and Z
if(6 <= Wire.available()) // If the number of bytes available for reading be <=6.
{
for(i=0;i<6;i++)
{
outputData[i]=Wire.receive(); //Store the data in outputData buffer
}
}
*x=outputData[0] << 8 | outputData[1]; //Combine MSB and LSB of X Data output register
*z=outputData[2] << 8 | outputData[3]; //Combine MSB and LSB of Z Data output register
*y=outputData[4] << 8 | outputData[5]; //Combine MSB and LSB of Y Data output register
}
 
void HMC5843::getAngle(int *a)
{
int fx,fy,fz;
getValues(&fx,&fy,&fz);
*a= atan((double)fy/(double)fx)*(360/PI); // angle in degrees
}
 
 
 
// Set the default object
HMC5843 HMC = HMC5843();
 
 
 
 
 
 
 
 
 
 
/branches/V0.82b-Arthur-P/HMC/HMC.h
0,0 → 1,51
/*
* HMC.cpp - Interface a Honeywell HMC5843 magnetometer to an AVR via i2c
* Version 0.1 - http://www.timzaman.com/
* Copyright (c) 2011 Tim Zaman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
 
#include "WProgram.h"
 
#ifndef HMC_h
#define HMC_h
 
#define HMC5883_WriteAddress 0x1E // i.e 0x3C >> 1
#define HMC5883_ModeRegisterAddress 0x02
#define HMC5883_ContinuousModeCommand 0x00
#define HMC5883_DataOutputXMSBAddress 0x03
 
class HMC5843
{
public:
HMC5843();
void init();
void getValues(int *x, int *y, int *z);
void getAngle(int *a);
private:
};
 
extern HMC5843 HMC;
 
#endif // HMC_h
/branches/V0.82b-Arthur-P/HMC/HMC_test/HMC_test.pde
0,0 → 1,24
#include <Wire.h>
#include <HMC.h>
int a;
 
void setup()
{
Serial.begin(9600);
}
 
void loop()
{
int x,y,z;
delay(100); // There will be new values every 100ms
HMC.getValues(&x,&y,&z);
Serial.print("x:");
Serial.print(x);
Serial.print(" y:");
Serial.print(y);
Serial.print(" z:");
Serial.println(z);
HMC.getAngle(&a);
Serial.println(a);
}
/branches/V0.82b-Arthur-P/HMC/keywords.txt
0,0 → 1,26
#######################################
# Syntax Coloring Map For HMC
#######################################
 
#######################################
# Datatypes (KEYWORD1)
#######################################
 
#######################################
# Methods and Functions (KEYWORD2)
#######################################
 
init KEYWORD2
getValues KEYWORD2
 
#######################################
# Instances (KEYWORD2)
#######################################
 
HMC KEYWORD2
 
#######################################
# Constants (LITERAL1)
#######################################
 
 
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/README
0,0 → 1,3
This is a Bazaar control directory.
Do not change any files in this directory.
See http://bazaar-vcs.org/ for more information about Bazaar.
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/branch/branch.conf
0,0 → 1,0
push_location = bzr+ssh://bazaar.launchpad.net/%2Bbranch/hmc58x3/
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/branch/format
0,0 → 1,0
Bazaar Branch Format 7 (needs bzr 1.6)
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/branch/last-revision
0,0 → 1,0
3 fvaresano@yahoo.it-20110427135834-srsvpieyo0qnmijx
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/branch/tags
0,0 → 1,0
d3:0.250:fvaresano@yahoo.it-20110426220136-1zamk9owxu52ilmz3:0.350:fvaresano@yahoo.it-20110427135834-srsvpieyo0qnmijx4:v0.150:fvaresano@yahoo.it-20110122162824-672zp5uhbqfot2ofe
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/branch-format
0,0 → 1,0
Bazaar-NG meta directory, format 1
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/checkout/conflicts
0,0 → 1,0
BZR conflict list format 1
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/checkout/dirstate
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/checkout/format
0,0 → 1,0
Bazaar Working Tree Format 6 (bzr 1.14)
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/checkout/views
--- HMC58X3/.bzr/repository/format (nonexistent)
+++ HMC58X3/.bzr/repository/format (revision 1993)
@@ -0,0 +1 @@
+Bazaar repository format 2a (needs bzr 1.16 or later)
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/596bd1a93273ed77e909ef16a2b196c4.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/596bd1a93273ed77e909ef16a2b196c4.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/596bd1a93273ed77e909ef16a2b196c4.rix
0,0 → 1,6
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
xœuÌAƒ Faמ‚ `˜Ų0éUÆ¢Q;¶¢UN_/ÐÝÛ|/]kèæÀ±ŒÂÆ/y^<ˆTcÒ0D¦†ÃÖiʼL^¾çÞ`œ—\ü#Ãµv-òÚìCÿŽ’ ±hÊ(ë}ùl &¥
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/596bd1a93273ed77e909ef16a2b196c4.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/596bd1a93273ed77e909ef16a2b196c4.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/de99a66b1f6127fc4f923ed90a4eeb03.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/de99a66b1f6127fc4f923ed90a4eeb03.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/de99a66b1f6127fc4f923ed90a4eeb03.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/de99a66b1f6127fc4f923ed90a4eeb03.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/de99a66b1f6127fc4f923ed90a4eeb03.tix
0,0 → 1,9
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=2
row_lengths=1
+Á/‰?únµùnFá6„b°Úø{Hs}J ÷¸6ZëPZÞ" þÒUqÊv~G·?IæÜ-çº>ž£(AM•á¿m_Š|”¶ZÈÍH´û)o‰t
\ No newline at end of file
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/f7816f4e08b3ca09e31bfadaaa72e828.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/f7816f4e08b3ca09e31bfadaaa72e828.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/f7816f4e08b3ca09e31bfadaaa72e828.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/f7816f4e08b3ca09e31bfadaaa72e828.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/indices/f7816f4e08b3ca09e31bfadaaa72e828.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/pack-names
0,0 → 1,6
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=3
row_lengths=1
xœ5;! ·æÛàO‘ð«)Òäöa#¥xÒ+f4ïÏ+Ïð,Ãxnp#Š-Ö,Øq‚ñê×Jõ騂玲Ã̙'$J®ž†Ç¶æ=b6º¥›„ŠÌ?i@IQàìÑtÒòS!˜éÛÝCQ4ôR‰ú¿ôK_(ä
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/packs/596bd1a93273ed77e909ef16a2b196c4.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/packs/de99a66b1f6127fc4f923ed90a4eeb03.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/.bzr/repository/packs/f7816f4e08b3ca09e31bfadaaa72e828.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/HMC58X3/HMC58X3.cpp
0,0 → 1,167
/*
HMC58X3.cpp - Interface a Honeywell HMC58X3 or HMC5883L magnetometer to an Arduino via i2c
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Based on:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274748346
Modification/extension of the following by E.J.Muller
http://eclecti.cc/hardware/hmc5843-magnetometer-library-for-arduino
Copyright (c) 2009 Nirav Patel,
 
The above were based on:
http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC58X3-v11.c
http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
 
#include "WProgram.h"
#include <HMC58X3.h>
 
 
/* PUBLIC METHODS */
 
HMC58X3::HMC58X3() {
x_scale=1;
y_scale=1;
z_scale=1;
}
 
 
void HMC58X3::init(bool setmode) {
// note that we don't initialize Wire here.
// You'll have to do that in setup() in your Arduino program
delay(5); // you need to wait at least 5ms after power on to initialize
if (setmode) {
setMode(0);
}
writeReg(HMC58X3_R_CONFA, 0x70);
writeReg(HMC58X3_R_CONFB, 0xA0);
writeReg(HMC58X3_R_MODE, 0x00);
}
 
 
void HMC58X3::setMode(unsigned char mode) {
if (mode > 2) {
return;
}
writeReg(HMC58X3_R_MODE, mode);
delay(100);
}
 
 
void HMC58X3::calibrate(unsigned char gain) {
x_scale=1; // get actual values
y_scale=1;
z_scale=1;
writeReg(HMC58X3_R_CONFA, 0x010 + HMC_POS_BIAS); // Reg A DOR=0x010 + MS1,MS0 set to pos bias
setGain(gain);
float x, y, z, mx=0, my=0, mz=0, t=10;
for (int i=0; i<(int)t; i++) {
setMode(1);
getValues(&x,&y,&z);
if (x>mx) mx=x;
if (y>my) my=y;
if (z>mz) mz=z;
}
float max=0;
if (mx>max) max=mx;
if (my>max) max=my;
if (mz>max) max=mz;
x_max=mx;
y_max=my;
z_max=mz;
x_scale=max/mx; // calc scales
y_scale=max/my;
z_scale=max/mz;
writeReg(HMC58X3_R_CONFA, 0x010); // set RegA/DOR back to default
}
 
 
// set data output rate
// 0-6, 4 default, normal operation assumed
void HMC58X3::setDOR(unsigned char DOR) {
if (DOR>6) return;
writeReg(HMC58X3_R_CONFA,DOR<<2);
}
 
 
void HMC58X3::setGain(unsigned char gain) {
// 0-7, 1 default
if (gain > 7) return;
writeReg(HMC58X3_R_CONFB, gain << 5);
}
 
 
void HMC58X3::writeReg(unsigned char reg, unsigned char val) {
Wire.beginTransmission(HMC58X3_ADDR);
Wire.send(reg); // send register address
Wire.send(val); // send value to write
Wire.endTransmission(); //end transmission
}
 
 
void HMC58X3::getValues(int *x,int *y,int *z) {
float fx,fy,fz;
getValues(&fx,&fy,&fz);
*x= (int) (fx + 0.5);
*y= (int) (fy + 0.5);
*z= (int) (fz + 0.5);
}
 
 
void HMC58X3::getValues(float *x,float *y,float *z) {
int xr,yr,zr;
getRaw(&xr, &yr, &zr);
*x= ((float) xr) / x_scale;
*y = ((float) yr) / y_scale;
*z = ((float) zr) / z_scale;
}
 
 
void HMC58X3::getRaw(int *x,int *y,int *z) {
Wire.beginTransmission(HMC58X3_ADDR);
Wire.send(HMC58X3_R_XM); // will start from DATA X MSB and fetch all the others
Wire.endTransmission();
Wire.beginTransmission(HMC58X3_ADDR);
Wire.requestFrom(HMC58X3_ADDR, 6);
if(6 == Wire.available()) {
// read out the 3 values, 2 bytes each.
*x = (Wire.receive() << 8) | Wire.receive();
#ifdef ISHMC5843
*y = (Wire.receive() << 8) | Wire.receive();
*z = (Wire.receive() << 8) | Wire.receive();
#else // the Z registers comes before the Y registers in the HMC5883L
*z = (Wire.receive() << 8) | Wire.receive();
*y = (Wire.receive() << 8) | Wire.receive();
#endif
// the HMC58X3 will automatically wrap around on the next request
}
Wire.endTransmission();
}
 
 
void HMC58X3::getValues(float *xyz) {
getValues(&xyz[0], &xyz[1], &xyz[2]);
}
 
/branches/V0.82b-Arthur-P/HMC58X3/HMC58X3.h
0,0 → 1,87
/*
HMC58X3.cpp - Interface a Honeywell HMC58X3 magnetometer to an Arduino via i2c
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Based on:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274748346
Modification/extension of the following by E.J.Muller
http://eclecti.cc/hardware/hmc5843-magnetometer-library-for-arduino
Copyright (c) 2009 Nirav Patel,
 
The above were based on:
http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC58X3-v11.c
http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
//uncomment the following line if you are using this library with the HMC5843
//#define ISHMC5843
 
#include "WProgram.h"
#include <Wire.h>
 
#ifndef HMC58X3_h
#define HMC58X3_h
 
#define HMC58X3_ADDR 0x1E // 7 bit address of the HMC58X3 used with the Wire library
#define HMC_POS_BIAS 1
#define HMC_NEG_BIAS 2
 
// HMC58X3 register map. For details see HMC58X3 datasheet
#define HMC58X3_R_CONFA 0
#define HMC58X3_R_CONFB 1
#define HMC58X3_R_MODE 2
#define HMC58X3_R_XM 3
#define HMC58X3_R_XL 4
 
#ifdef ISHMC5843
#define HMC58X3_R_YM 5
#define HMC58X3_R_YL 6
#define HMC58X3_R_ZM 7
#define HMC58X3_R_ZL 8
#else // HMC5883L
#define HMC58X3_R_YM 7
#define HMC58X3_R_YL 8
#define HMC58X3_R_ZM 5
#define HMC58X3_R_ZL 6
#endif
 
#define HMC58X3_R_STATUS 9
#define HMC58X3_R_IDA 10
#define HMC58X3_R_IDB 11
#define HMC58X3_R_IDC 12
 
 
class HMC58X3
{
public:
HMC58X3();
void init(bool setmode);
void init(int address, bool setmode);
void getValues(int *x,int *y,int *z);
void getValues(float *x,float *y,float *z);
void getValues(float *xyz);
void getRaw(int *x,int *y,int *z);
void calibrate(unsigned char gain);
void setMode(unsigned char mode);
void setDOR(unsigned char DOR);
void setGain(unsigned char gain);
private:
void writeReg(unsigned char reg, unsigned char val);
float x_scale,y_scale,z_scale,x_max,y_max,z_max;
};
 
#endif // HMC58X3_h
/branches/V0.82b-Arthur-P/HMC58X3/INSTALL.txt
0,0 → 1,6
Copy the whole directory which contain this file into the folder "libraries" inside the Arduino sketchbook folder.
You can understand the location of your sketchbook folder from the Arduino IDE clicking on File -> Preferences: the "sketchbook location" is what you are looking for.
In case you don't have an "libraries" folder there just create an empty one.
 
For more informations see:
http://www.arduino.cc/en/Reference/Libraries
/branches/V0.82b-Arthur-P/HMC58X3/LICENSE.txt
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/V0.82b-Arthur-P/HMC58X3/examples/HMC58X3_basic/HMC58X3_basic.pde
0,0 → 1,75
/*
HMC5843_basic.pde - Basic reading example for the HMC5843 library
Copyright (C) 2011 Fabio Varesano <fabio at varesano dot net>
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
#include <Wire.h>
#include <HMC58X3.h>
 
HMC58X3 magn;
 
void setup(void) {
Serial.begin(9600);
Wire.begin();
// no delay needed as we have already a delay(5) in HMC5843::init()
magn.init(false); // Dont set mode yet, we'll do that later on.
// Calibrate HMC using self test, not recommended to change the gain after calibration.
magn.calibrate(1); // Use gain 1=default, valid 0-7, 7 not recommended.
// Single mode conversion was used in calibration, now set continuous mode
magn.setMode(0);
}
 
void loop() {
int ix,iy,iz;
float fx,fy,fz;
delay(10);
// Get values, as ints and floats.
magn.getValues(&ix,&iy,&iz);
magn.getValues(&fx,&fy,&fz);
// also available HMC5843::getValues(float *xyz) you can pass to it an array of 3 floats
// Print int values
Serial.print("Ints x:");
Serial.print(ix);
Serial.print(",");
Serial.print(iy);
Serial.print(",");
Serial.print(iz);
Serial.print(",");
// Print float values
Serial.print(" Floats x:");
Serial.print(fx);
Serial.print(" y:");
Serial.print(fy);
Serial.print(" z:");
Serial.print(fz);
// a simple heading, assuming it's close to horizontal. See:
// M.J. Caruso. Applications of magnetic sensors for low cost compass systems.
// In Position Location and Navigation Symposium, IEEE, 2000. Available from:
// http://hnc.ru/lib/a%26c%20%28automatic%20%26%20controls%29/sensors/DataSheet/Magnit/Honeywell/lowcost.pdf
 
Serial.print(" Heading: ");
float heading = atan2(fy, fx);
if(heading < 0) {
heading += 2 * M_PI;
}
Serial.println(heading * 180/M_PI);
// x and y axis are swapped above with respect to the above paper as our Z axis points to the sky while in the paper it points to the bottom
}
/branches/V0.82b-Arthur-P/HMC58X3/examples/HMC58X3_raw/HMC58X3_raw.pde
0,0 → 1,47
/*
HMC58X3_basic.pde - Basic reading example for the HMC58X3 library
Copyright (C) 2011 Fabio Varesano <fabio at varesano dot net>
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
// Uncomment the following line if you are using the HMC5843
 
#include <Wire.h>
#include <HMC58X3.h>
 
HMC58X3 magn;
 
void setup(void) {
Serial.begin(9600);
Wire.begin();
// no delay needed as we have already a delay(5) in HMC58X3::init()
magn.init(true); // Dont set mode yet, we'll do that later on.
}
 
void loop() {
int ix,iy,iz;
delay(10);
// Get values, as ints and floats.
magn.getRaw(&ix,&iy,&iz);
Serial.print(ix);
Serial.print(",");
Serial.print(iy);
Serial.print(",");
Serial.print(iz);
Serial.println(",");
}
/branches/V0.82b-Arthur-P/HMC58X3/examples/HMC58X3_registers_scan/HMC58X3_registers_scan.pde
0,0 → 1,80
/*HMC5883LRegisterScanner.pde
**A sketch that attempts to read every register from a slave device
**Written by Wayne Truchsess http://dsscircuits.com
*/
 
#include "Wire.h"
#define I2C 0x1E
 
byte x;
 
void setup() {
Wire.begin();
Serial.begin(9600);
delay(1000);
Wire.beginTransmission(I2C); // start transmission to device
Wire.send(0); // send register address
Wire.send(0x70); // send value to write
Wire.endTransmission(); // end transmission
delay(10);
Wire.beginTransmission(I2C); // start transmission to device
Wire.send(1); // send register address
Wire.send(B11000000); // send value to write
Wire.endTransmission(); // end transmission
delay(10);
Wire.beginTransmission(I2C); // start transmission to device
Wire.send(2); // send register address
Wire.send(0x00); // send value to write
Wire.endTransmission(); // end transmission
delay(100);
baselineRegisters();
}
 
void loop() {
int x,y,z;
Wire.beginTransmission(I2C);
Wire.send(3); // will start from DATA X MSB and fetch all the others
Wire.endTransmission();
Wire.beginTransmission(I2C);
Wire.requestFrom(I2C, 6);
if(6 == Wire.available()) {
// read out the 3 values, 2 bytes each.
x = (Wire.receive() << 8) + Wire.receive();
y = (Wire.receive() << 8) + Wire.receive();
z = (Wire.receive() << 8) + Wire.receive();
// the HMC5843 will automatically wrap around on the next request
}
Wire.endTransmission();
Serial.print(x);
Serial.print(" ");
Serial.print(y);
Serial.print(" ");
Serial.println(z);
delay(100);
return;
}
 
void baselineRegisters() {
for(int l = 0x00; l < 0x12; l++){
Wire.beginTransmission(I2C);
Wire.send(l);
Wire.endTransmission();
//delay(100);
Wire.beginTransmission(I2C);
Wire.requestFrom(I2C,1);
x = Wire.receive();
Serial.print("Register Address ");
Serial.print(l,DEC);
Serial.print(" = ");
Serial.print(x,BIN);
Serial.print(" = ");
Serial.print(x,DEC);
Serial.println(" ");
Wire.endTransmission();
}
}
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/README
0,0 → 1,3
This is a Bazaar control directory.
Do not change any files in this directory.
See http://bazaar.canonical.com/ for more information about Bazaar.
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/branch/branch.conf
0,0 → 1,0
push_location = sftp://varesano@varesano.net/~/repository/MS561101BA/
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/branch/format
0,0 → 1,0
Bazaar Branch Format 7 (needs bzr 1.6)
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/branch/last-revision
0,0 → 1,0
11 fvaresano@yahoo.it-20110716111241-tsuf4c5qgsr09w5j
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/branch/tags
--- MS561101BA/.bzr/branch-format (nonexistent)
+++ MS561101BA/.bzr/branch-format (revision 1993)
@@ -0,0 +1 @@
+Bazaar-NG meta directory, format 1
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/checkout/conflicts
0,0 → 1,0
BZR conflict list format 1
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/checkout/dirstate
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/checkout/format
0,0 → 1,0
Bazaar Working Tree Format 6 (bzr 1.14)
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/checkout/views
--- MS561101BA/.bzr/repository/format (nonexistent)
+++ MS561101BA/.bzr/repository/format (revision 1993)
@@ -0,0 +1 @@
+Bazaar repository format 2a (needs bzr 1.16 or later)
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/583b77052c0f2776d214fbc51f58a718.cix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=14
row_lengths=1
xœU“=®1 „]¿Søü§ ‡¡$)RHšÜ>òÚìf¡-øq8Cþùû«¾ÿ¬ì¯ß?¿!Ã*ó͛÷XʉÈ&±Ö9ÓÛÝÖíÆÁrW¤;jÄMƓ@L¾xi7¯Î¤Ê¦)ÚsšŸ.Üz»)œÂ!w¡€»(Ë„‘‡àЉ sLæGÌƚE¢ï"Nÿ;:è“ÀÜçÁfPÅ\
+r"¸É!ås’êì½ï176>Tœ«¸¤|ý|å^
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/583b77052c0f2776d214fbc51f58a718.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/583b77052c0f2776d214fbc51f58a718.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/583b77052c0f2776d214fbc51f58a718.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/583b77052c0f2776d214fbc51f58a718.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/aa13626422837ebb40c3076a7cb28a06.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/aa13626422837ebb40c3076a7cb28a06.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/aa13626422837ebb40c3076a7cb28a06.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/aa13626422837ebb40c3076a7cb28a06.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/indices/aa13626422837ebb40c3076a7cb28a06.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.iix
0,0 → 1,9
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
+Á,¦õ¾Ä ÕÌGõR`¥~ʕrâ<Ñ@
+WF¥:«…T-PßCõ&v
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/008b692ff30f62ec95fdb7a876a2cc96.tix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=5
row_lengths=1
xœ­ÒKnà €aÖ9ÀšóZTêM*\“˜ÄÔoçôu•ÜEÉÎrèã×L¿$ÿV{w>5Tˆ€…Ë>SbÖAÂ\"6NùXq¸˜Ùº¡¹2$çѵ¾s÷ø¾¸*Æ,ô¿ €´ Á܌a‰µ’W?…ä`<LèXÔ׃Ö@¸@IQJE
eÍ6¬zJòƒYDŽ£rN‘#¬I<7b“ôQú&f©ôO]u¬ìEX®VhNSòS…R=O@„ÑHÒk!æ·…MÝè[wùó[,Þ
ãt¸¹PV}ÛÛ}7Ir- åb•a»ëfr¹.ÔŒÖÈÓ7œøe
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/0e5b85399fc8bd3747d173467ee86734.tix
0,0 → 1,6
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=1
row_lengths=1
xœµÍM‚0@a֜‚ ”Ì C™‰71chCÃOj<½.½€Û—|yé|¸ËâÔ×ëÑ[DÀ»ÞtI!½Fׂo² È Ðˁós–¼g&p†*Ÿuw‡nñzêcÒ/Bd¶¹x™·²C§Å–ê/'@11¿×ÞÓ(¼J˜*¦I†âës8Eµ
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.iix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
+‰°aÓíÄ&o
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/28141448b4dbd26b945f63b7ac9a97e7.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.cix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=2
row_lengths=1
xœ%Ë1Â0 ÐÎ=E`ç'±ƒÄaìÄ,ܞVìï}¾¯¸?Ãr?Œo@ªx§jm6òÚ«$ÕUL¼Å¬ŽÜ¶Â$”:¸ñï«ø¤àY„†á
‹ìyšæÊÂýꌳ+]UiÿÍ"÷
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5135d8dec2609d9069cccb8f3ca8a8cb.tix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=2
row_lengths=1
xœÍM
Â0@á®{Š\ efš¿Ð›ÈHl¶1POo¶‚ ¸}ðøÊq÷§Åsè×]DÀ Ÿy)©<g/ Z1àP)€Q•T}\]Ý*Ù^b*o~ç[žŽ9©|Lèd®¯Uš§À.Å®S$h à›9üDé/ÔhÔdh¶µý¹ÜFï
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/5230f19d71ec667e5b9516a054b6b3d1.tix
0,0 → 1,10
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=2
row_lengths=1
+
+k~&é&ën¹œõ`N©ý¹º|ý4Fâ"½I$ÑÄ/`
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.cix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=2
row_lengths=1
+rãνú.Y¤„‘šS’Ž;Z  (þ}tK5³j“VpÔÖ!Üg¨kg‘Öøç›ð(Òëö{‡çdO#Æ
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/8dad72563405e9bf1cb7b957f94663d9.tix
0,0 → 1,9
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=10
row_lengths=1
xœÒ[nÂ0P¾³
+24:y$dáÛÆõ£û—ˆY¢@"Š)$H(ºQª”‚½­šWïšÙTs` éqY¡4¾ªçU3¯+ajÊe‘´~wׅU”2_*åπ~‰U<¸UUå©é²À 7É‚7zp§±±ýª,s',ê?
+?Õj}P:ÏM?eô]Ø ÓàÜná-  ÊÃuO\+¿íL}î~åÃzÖüÆPNà
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.cix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=1
row_lengths=1
xœÁA€ @μ‚'°eÛ ‰)¤Äƒ½ø{gÞïŽã
_ù9»N5Æ0çC›âl¤ˆ…(çæ)Q ¥ K-½æ#Ä
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.iix
0,0 → 1,6
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
xœuËAƒ Pמ‚ `þ8 tѤW™&u0Ԗèé=oÿöc‹Ï%JjÓ_JüŠæ×!Ÿœ»i·=ˆ0qpl„ӏåüå÷ªeÓæ® ä‘³“Î5…YkKjãÁÓ{Ú x®&ç
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b7c14c16442d5d5517de0a73966b74ec.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.cix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=1
row_lengths=1
+ïy¯¹Ó<އъêK(F§á #¸—&‚ÿf;±ï! %M9qÕ?!÷m
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/b9e15ff90a1843cc73701de3fc796af5.tix
0,0 → 1,8
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=2
row_lengths=1
+Í  E¤lÅA|˜¯ÁY}Ò¤‰RòOWgõcqë
+S†ý "àÃDù8J‚s$ b$nW®sv«Ò#3[ßJ Jgæb1ƒ½{S[5ëû¤‘XHýl¦n|]TÁ1lÄȱ–GÕ¤z¦Öû,/[ؤD Ôq,@(Dþ„Õ?“t‘u­ð¥H $bÐá wv€é
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.cix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.iix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.rix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/ba4a951ce21a260fb2fa0c3bad1b9d3c.tix
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.cix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=1
row_lengths=1
+Ê1€ PfNÁJ ò5ñ0-…88˜èâíõÍïy¯±ŸCg¼ÍÛTb‘…Ô2µ†¢(£™q­6Ý!t‡"„?Iª+'J\8ÇS;
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.iix
0,0 → 1,10
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
+ÕSïþYr?ç4¶ã™¶¼§_}KúÖڕC! ’õ¬q½Ê.°
+ó¹lŸR&Ékh±WƱ‚²@{;O&
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.rix
0,0 → 1,7
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
+‚ÆÓåC ¼ .ïQý/L®µdtôšïuç<IÚ¸r?ÊÚ  ›ú ;G&
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.six
0,0 → 1,5
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/obsolete_packs/c6efa1d661e6663ca066b4e8e19f89f7.tix
0,0 → 1,11
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=3
row_lengths=1
xœ­Ï=ŽÂ0†áÔ{
+)ÌûöÆn«]rg?¹¿°ÎîBÝ_ž#‹&` ÿm?eÈæ”a¶ª/6£I2c7¤xÞ÷ý1û“© ÔZ aó
+;|LÒBÖ²Â[”"QžÙB"eù…´éüêØù]³LöÐ[ µ „e.BlŠðð”ÂV
\ No newline at end of file
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/pack-names
0,0 → 1,6
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=2
row_lengths=1
xœË+1 Àê=EŽ¼æg8LÒmáöÀøy^ûñÜu.ËÙlX|á7DO/“cY!9†ò$ePzR€Ìøª’éprÆîV^“Ã+V#‹} I!I&(ÿ“üÒ©zÖ
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/packs/583b77052c0f2776d214fbc51f58a718.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/.bzr/repository/packs/aa13626422837ebb40c3076a7cb28a06.pack
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/V0.82b-Arthur-P/MS561101BA/INSTALL.txt
0,0 → 1,6
Copy the whole directory which contain this file into the folder "libraries" inside the Arduino sketchbook folder.
You can understand the location of your sketchbook folder from the Arduino IDE clicking on File -> Preferences: the "sketchbook location" is what you are looking for.
In case you don't have an "libraries" folder there just create an empty one.
 
For more informations see:
http://www.arduino.cc/en/Reference/Libraries
/branches/V0.82b-Arthur-P/MS561101BA/LICENSE.txt
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/V0.82b-Arthur-P/MS561101BA/MS561101BA.cpp
0,0 → 1,143
/*
MS5611-01BA.cpp - Interfaces a Measurement Specialities MS5611-01BA with Arduino
See http://www.meas-spec.com/downloads/MS5611-01BA01.pdf for the device datasheet
 
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Development of this code has been supported by the Department of Computer Science,
Universita' degli Studi di Torino, Italy within the Piemonte Project
http://www.piemonte.di.unito.it/
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
#include "MS561101BA.h"
#define EXTRA_PRECISION 5 // trick to add more precision to the pressure and temp readings
 
MS561101BA::MS561101BA() {
;
}
 
void MS561101BA::init(uint8_t address) {
_addr = address;
// disable internal pullups of the ATMEGA which Wire enable by default
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
// deactivate internal pull-ups for twi
// as per note from atmega8 manual pg167
cbi(PORTC, 4);
cbi(PORTC, 5);
#else
// deactivate internal pull-ups for twi
// as per note from atmega128 manual pg204
cbi(PORTD, 0);
cbi(PORTD, 1);
#endif
reset(); // reset the device to populate its internal PROM registers
delay(1000); // some safety time
readPROM(); // reads the PROM into object variables for later use
}
 
float MS561101BA::getPressure(uint8_t OSR) {
// see datasheet page 7 for formulas
int64_t dT = getDeltaTemp(OSR);
int64_t off = (((int64_t)_C[1]) << 16) + ((_C[3] * dT) >> 7);
int64_t sens = (((int64_t)_C[0]) << 15) + ((_C[2] * dT) >> 8);
return ((((rawPressure(OSR) * sens) >> 21) - off) >> (15-EXTRA_PRECISION)) / ((1<<EXTRA_PRECISION) * 100.0);
}
 
float MS561101BA::getTemperature(uint8_t OSR) {
// see datasheet page 7 for formulas
return ((1<<EXTRA_PRECISION)*2000l + ((getDeltaTemp(OSR) * _C[5]) >> (23-EXTRA_PRECISION))) / ((1<<EXTRA_PRECISION) * 100.0);
}
 
int64_t MS561101BA::getDeltaTemp(uint8_t OSR) {
return rawTemperature(OSR) - (((int32_t)_C[4]) << 8);
}
 
int32_t MS561101BA::rawPressure(uint8_t OSR) {
return doConversion(MS561101BA_D1 + OSR);
}
 
int32_t MS561101BA::rawTemperature(uint8_t OSR) {
return doConversion(MS561101BA_D2 + OSR);
}
 
 
unsigned long MS561101BA::doConversion(uint8_t command) {
unsigned long conversion = 0;
// see page 11 of the datasheet
// initialize pressure conversion
Wire.beginTransmission(_addr);
Wire.send(command);
Wire.endTransmission();
delay(10); // the conversion will take a time <= 9.04 ms to have the output ready
// TODO: make the delay dependant on the OSR requested in the command
// start read sequence
Wire.beginTransmission(_addr);
Wire.send(0);
Wire.endTransmission();
Wire.beginTransmission(_addr);
Wire.requestFrom(_addr, (uint8_t) MS561101BA_D1D2_SIZE);
if(Wire.available()) {
conversion = Wire.receive() * 65536 + Wire.receive() * 256 + Wire.receive();
}
else {
conversion = -1;
}
return conversion;
}
 
 
/**
* Reads factory calibration and store it into object variables.
*/
int MS561101BA::readPROM() {
for (int i=0;i<MS561101BA_PROM_REG_COUNT;i++) {
Wire.beginTransmission(_addr);
Wire.send(MS561101BA_PROM_BASE_ADDR + (i * MS561101BA_PROM_REG_SIZE));
Wire.endTransmission();
Wire.beginTransmission(_addr);
Wire.requestFrom(_addr, (uint8_t) MS561101BA_PROM_REG_SIZE);
if(Wire.available()) {
_C[i] = Wire.receive() << 8 | Wire.receive();
//DEBUG_PRINT(_C[i]);
}
else {
return -1; // error reading the PROM or communicating with the device
}
}
return 0;
}
 
 
/**
* Send a reset command to the device. With the reset command the device
* populates its internal registers with the values read from the PROM.
*/
void MS561101BA::reset() {
Wire.beginTransmission(_addr);
Wire.send(MS561101BA_RESET);
Wire.endTransmission();
}
/branches/V0.82b-Arthur-P/MS561101BA/MS561101BA.h
0,0 → 1,83
/*
MS5611-01BA.h - Interfaces a Measurement Specialities MS5611-01BA with Arduino
See http://www.meas-spec.com/downloads/MS5611-01BA01.pdf for the device datasheet
 
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Development of this code has been supported by the Department of Computer Science, Universita' degli Studi di Torino, Italy within the Piemonte Project http://www.piemonte.di.unito.it/
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
 
 
#ifndef MS561101BA_h
#define MS561101BA_h
 
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
 
#include "WProgram.h"
#include <Wire.h>
 
//#define DEBUG_V
//#define DEBUG
//#include <DebugUtils.h>
 
// addresses of the device
#define MS561101BA_ADDR_CSB_HIGH 0x76 //CBR=1 0x76 I2C address when CSB is connected to HIGH (VCC)
#define MS561101BA_ADDR_CSB_LOW 0x77 //CBR=0 0x77 I2C address when CSB is connected to LOW (GND)
 
// registers of the device
#define MS561101BA_D1 0x40
#define MS561101BA_D2 0x50
#define MS561101BA_RESET 0x1E
 
// D1 and D2 result size (bytes)
#define MS561101BA_D1D2_SIZE 3
 
// OSR (Over Sampling Ratio) constants
#define MS561101BA_OSR_256 0x00
#define MS561101BA_OSR_512 0x02
#define MS561101BA_OSR_1024 0x04
#define MS561101BA_OSR_2048 0x06
#define MS561101BA_OSR_4096 0x08
 
#define MS561101BA_PROM_BASE_ADDR 0xA2 // by adding ints from 0 to 6 we can read all the prom configuration values.
// C1 will be at 0xA2 and all the subsequent are multiples of 2
#define MS561101BA_PROM_REG_COUNT 6 // number of registers in the PROM
#define MS561101BA_PROM_REG_SIZE 2 // size in bytes of a prom registry.
 
 
 
class MS561101BA {
public:
MS561101BA();
void init(uint8_t addr);
float getPressure(uint8_t OSR);
float getTemperature(uint8_t OSR);
int64_t getDeltaTemp(uint8_t OSR);
int32_t rawPressure(uint8_t OSR);
int32_t rawTemperature(uint8_t OSR);
int readPROM();
void reset();
private:
unsigned long doConversion(uint8_t command);
uint8_t _addr;
uint16_t _C[MS561101BA_PROM_REG_COUNT];
};
 
#endif // MS561101BA_h
/branches/V0.82b-Arthur-P/MS561101BA/examples/MS561101BA_altitude/MS561101BA_altitude.pde
0,0 → 1,90
/*
MS561101BA_altitude.pde - Computes altitude from sea level using pressure readings from the sensor.
The algorithm uses the Hypsometric formula as explained in http://keisan.casio.com/has10/SpecExec.cgi?path=06000000.Science%2F02100100.Earth%20science%2F12000300.Altitude%20from%20atmospheric%20pressure%2Fdefault.xml&charset=utf-8
TODO: The results are not that good. Suggestions on improvements welcome.
 
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Development of this code has been supported by the Department of Computer Science,
Universita' degli Studi di Torino, Italy within the Piemonte Project
http://www.piemonte.di.unito.it/
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
 
//#define DEBUG_V
 
#include <Wire.h>
//#include <DebugUtils.h>
#include <MS561101BA.h>
 
 
#define MOVAVG_SIZE 32
 
MS561101BA baro = MS561101BA();
 
float movavg_buff[MOVAVG_SIZE];
int movavg_i=0;
 
const float sea_press = 1013.25;
float press, temp;
 
void setup() {
Wire.begin();
Serial.begin(115200);
delay(1000);
 
// Suppose that the CSB pin is connected to GND.
// You'll have to check this on your breakout schematics
baro.init(MS561101BA_ADDR_CSB_LOW);
delay(100);
// populate movavg_buff before starting loop
for(int i=0; i<MOVAVG_SIZE; i++) {
movavg_buff[i] = baro.getPressure(MS561101BA_OSR_4096);
}
}
 
void loop() {
Serial.print(" temp: ");
temp = baro.getTemperature(MS561101BA_OSR_4096);
Serial.print(temp);
Serial.print(" degC pres: ");
pushAvg(baro.getPressure(MS561101BA_OSR_4096));
press = getAvg(movavg_buff, MOVAVG_SIZE);
Serial.print(press);
Serial.print(" mbar altitude: ");
Serial.print(getAltitude(press, temp));
Serial.println(" m");
delay(100);
}
 
float getAltitude(float press, float temp) {
return ((pow((sea_press / press), 1/5.257) - 1.0) * (temp + 273.15)) / 0.0065;
}
 
void pushAvg(float val) {
movavg_buff[movavg_i] = val;
movavg_i = (movavg_i + 1) % MOVAVG_SIZE;
}
 
float getAvg(float * buff, int size) {
float sum = 0.0;
for(int i=0; i<size; i++) {
sum += buff[i];
}
return sum / size;
}
/branches/V0.82b-Arthur-P/MS561101BA/examples/MS561101BA_movaverage/MS561101BA_movaverage.pde
0,0 → 1,77
/*
MS561101BA_movaverage.pde - Reads from the sensors and outputs a moving averaged pressure reading
 
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Development of this code has been supported by the Department of Computer Science,
Universita' degli Studi di Torino, Italy within the Piemonte Project
http://www.piemonte.di.unito.it/
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
 
//#define DEBUG_V
 
#include <Wire.h>
//#include <DebugUtils.h>
#include <MS561101BA.h>
 
 
#define MOVAVG_SIZE 32
 
MS561101BA baro = MS561101BA();
 
float movavg_buff[MOVAVG_SIZE];
int movavg_i=0;
 
 
void setup() {
Wire.begin();
Serial.begin(9600);
delay(1000);
 
// Suppose that the CSB pin is connected to GND.
// You'll have to check this on your breakout schematics
baro.init(MS561101BA_ADDR_CSB_LOW);
delay(100);
// populate movavg_buff before starting loop
for(int i=0; i<MOVAVG_SIZE; i++) {
movavg_buff[i] = baro.getPressure(MS561101BA_OSR_4096);
}
}
 
void loop() {
Serial.print(" temp: ");
Serial.print(baro.getTemperature(MS561101BA_OSR_4096));
Serial.print(" degC pres: ");
pushAvg(baro.getPressure(MS561101BA_OSR_4096));
Serial.print(getAvg(movavg_buff, MOVAVG_SIZE));
Serial.println(" mbar");
}
 
void pushAvg(float val) {
movavg_buff[movavg_i] = val;
movavg_i = (movavg_i + 1) % MOVAVG_SIZE;
}
 
float getAvg(float * buff, int size) {
float sum = 0.0;
for(int i=0; i<size; i++) {
sum += buff[i];
}
return sum / size;
}
/branches/V0.82b-Arthur-P/MS561101BA/examples/MS561101BA_regscan/MS561101BA_regscan.pde
0,0 → 1,41
/*HMC5883LRegisterScanner.pde
**A sketch that attempts to read every register from a slave device
**Written by Wayne Truchsess http://dsscircuits.com
*/
 
#include "Wire.h"
#define I2C 0x77
 
byte x;
 
void setup() {
Wire.begin();
Serial.begin(9600);
delay(1000);
}
 
void loop() {
readRegisters();
}
 
void readRegisters() {
for(int l = 0x00; l < 256; l++){
Wire.beginTransmission(I2C);
Wire.send(l);
Wire.endTransmission();
//delay(100);
Wire.beginTransmission(I2C);
Wire.requestFrom(I2C,1);
x = Wire.receive();
Serial.print("Register Address ");
Serial.print(l,DEC);
Serial.print("_");
Serial.print(l,HEX);
Serial.print(" = ");
Serial.print(x,BIN);
Serial.print(" = ");
Serial.print(x,DEC);
Serial.println(" ");
Wire.endTransmission();
}
}
/branches/V0.82b-Arthur-P/MS561101BA/examples/MS561101BA_simple/MS561101BA_simple.pde
0,0 → 1,51
/*
MS561101BA_demo.pde - Example code for using the MS561101BA library.
Displays temperature and pression readings from the sensor
 
Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it>
 
Development of this code has been supported by the Department of Computer Science,
Universita' degli Studi di Torino, Italy within the Piemonte Project
http://www.piemonte.di.unito.it/
 
 
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
*/
 
 
//#define DEBUG_V
 
#include <Wire.h>
//#include <DebugUtils.h>
#include <MS561101BA.h>
 
MS561101BA baro = MS561101BA();
 
void setup() {
Wire.begin();
Serial.begin(115200);
delay(1000);
 
// Suppose that the CSB pin is connected to GND.
// You'll have to check this on your breakout schematics
baro.init(MS561101BA_ADDR_CSB_LOW);
}
 
void loop() {
Serial.print(" temp: ");
Serial.print(baro.getTemperature(MS561101BA_OSR_4096));
Serial.print(" degC pres: ");
Serial.print(baro.getPressure(MS561101BA_OSR_4096));
Serial.println(" mbar");
}
/branches/V0.82b-Arthur-P/adxl345driver/ADXL345.cpp
0,0 → 1,608
/**************************************************************************
* *
* ADXL345 Driver for Arduino *
* *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU License. *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU License V2 for more details. *
* *
***************************************************************************/
 
#include "WProgram.h"
#include "ADXL345.h"
#include <Wire.h>
 
#define TO_READ (6) // num of bytes we are going to read each time (two bytes for each axis)
 
ADXL345::ADXL345() {
status = ADXL345_OK;
error_code = ADXL345_NO_ERROR;
 
gains[0] = 0.00376390;
gains[1] = 0.00376009;
gains[2] = 0.00349265;
}
 
void ADXL345::init(int address) {
_dev_address = address;
powerOn();
}
 
void ADXL345::powerOn() {
//Turning on the ADXL345
//writeTo(ADXL345_POWER_CTL, 0);
//writeTo(ADXL345_POWER_CTL, 16);
writeTo(ADXL345_POWER_CTL, 8);
}
 
// Reads the acceleration into an array of three places
void ADXL345::readAccel(int *xyz){
readAccel(xyz, xyz + 1, xyz + 2);
}
 
// Reads the acceleration into three variable x, y and z
void ADXL345::readAccel(int *x, int *y, int *z) {
readFrom(ADXL345_DATAX0, TO_READ, _buff); //read the acceleration data from the ADXL345
 
// each axis reading comes in 10 bit resolution, ie 2 bytes. Least Significat Byte first!!
// thus we are converting both bytes in to one int
*x = (((int)_buff[1]) << 8) | _buff[0];
*y = (((int)_buff[3]) << 8) | _buff[2];
*z = (((int)_buff[5]) << 8) | _buff[4];
}
 
void ADXL345::get_Gxyz(float *xyz){
int i;
int xyz_int[3];
readAccel(xyz_int);
for(i=0; i<3; i++){
xyz[i] = xyz_int[i] * gains[i];
}
}
 
// Writes val to address register on device
void ADXL345::writeTo(byte address, byte val) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(address); // send register address
Wire.send(val); // send value to write
Wire.endTransmission(); // end transmission
}
 
// Reads num bytes starting from address register on device in to _buff array
void ADXL345::readFrom(byte address, int num, byte _buff[]) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(address); // sends address to read from
Wire.endTransmission(); // end transmission
 
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.requestFrom(_dev_address, num); // request 6 bytes from device
 
int i = 0;
while(Wire.available()) // device may send less than requested (abnormal)
{
_buff[i] = Wire.receive(); // receive a byte
i++;
}
if(i != num){
status = ADXL345_ERROR;
error_code = ADXL345_READ_ERROR;
}
Wire.endTransmission(); // end transmission
}
 
// Gets the range setting and return it into rangeSetting
// it can be 2, 4, 8 or 16
void ADXL345::getRangeSetting(byte* rangeSetting) {
byte _b;
readFrom(ADXL345_DATA_FORMAT, 1, &_b);
*rangeSetting = _b & B00000011;
}
 
// Sets the range setting, possible values are: 2, 4, 8, 16
void ADXL345::setRangeSetting(int val) {
byte _s;
byte _b;
 
switch (val) {
case 2:
_s = B00000000;
break;
case 4:
_s = B00000001;
break;
case 8:
_s = B00000010;
break;
case 16:
_s = B00000011;
break;
default:
_s = B00000000;
}
readFrom(ADXL345_DATA_FORMAT, 1, &_b);
_s |= (_b & B11101100);
writeTo(ADXL345_DATA_FORMAT, _s);
}
// gets the state of the SELF_TEST bit
bool ADXL345::getSelfTestBit() {
return getRegisterBit(ADXL345_DATA_FORMAT, 7);
}
 
// Sets the SELF-TEST bit
// if set to 1 it applies a self-test force to the sensor causing a shift in the output data
// if set to 0 it disables the self-test force
void ADXL345::setSelfTestBit(bool selfTestBit) {
setRegisterBit(ADXL345_DATA_FORMAT, 7, selfTestBit);
}
 
// Gets the state of the SPI bit
bool ADXL345::getSpiBit() {
return getRegisterBit(ADXL345_DATA_FORMAT, 6);
}
 
// Sets the SPI bit
// if set to 1 it sets the device to 3-wire mode
// if set to 0 it sets the device to 4-wire SPI mode
void ADXL345::setSpiBit(bool spiBit) {
setRegisterBit(ADXL345_DATA_FORMAT, 6, spiBit);
}
 
// Gets the state of the INT_INVERT bit
bool ADXL345::getInterruptLevelBit() {
return getRegisterBit(ADXL345_DATA_FORMAT, 5);
}
 
// Sets the INT_INVERT bit
// if set to 0 sets the interrupts to active high
// if set to 1 sets the interrupts to active low
void ADXL345::setInterruptLevelBit(bool interruptLevelBit) {
setRegisterBit(ADXL345_DATA_FORMAT, 5, interruptLevelBit);
}
 
// Gets the state of the FULL_RES bit
bool ADXL345::getFullResBit() {
return getRegisterBit(ADXL345_DATA_FORMAT, 3);
}
 
// Sets the FULL_RES bit
// if set to 1, the device is in full resolution mode, where the output resolution increases with the
// g range set by the range bits to maintain a 4mg/LSB scal factor
// if set to 0, the device is in 10-bit mode, and the range buts determine the maximum g range
// and scale factor
void ADXL345::setFullResBit(bool fullResBit) {
setRegisterBit(ADXL345_DATA_FORMAT, 3, fullResBit);
}
 
// Gets the state of the justify bit
bool ADXL345::getJustifyBit() {
return getRegisterBit(ADXL345_DATA_FORMAT, 2);
}
 
// Sets the JUSTIFY bit
// if sets to 1 selects the left justified mode
// if sets to 0 selects right justified mode with sign extension
void ADXL345::setJustifyBit(bool justifyBit) {
setRegisterBit(ADXL345_DATA_FORMAT, 2, justifyBit);
}
 
// Sets the THRESH_TAP byte value
// it should be between 0 and 255
// the scale factor is 62.5 mg/LSB
// A value of 0 may result in undesirable behavior
void ADXL345::setTapThreshold(int tapThreshold) {
tapThreshold = min(max(tapThreshold,0),255);
byte _b = byte (tapThreshold);
writeTo(ADXL345_THRESH_TAP, _b);
}
 
// Gets the THRESH_TAP byte value
// return value is comprised between 0 and 255
// the scale factor is 62.5 mg/LSB
int ADXL345::getTapThreshold() {
byte _b;
readFrom(ADXL345_THRESH_TAP, 1, &_b);
return int (_b);
}
 
// set/get the gain for each axis in Gs / count
void ADXL345::setAxisGains(float *_gains){
int i;
for(i = 0; i < 3; i++){
gains[i] = _gains[i];
}
}
void ADXL345::getAxisGains(float *_gains){
int i;
for(i = 0; i < 3; i++){
_gains[i] = gains[i];
}
}
 
// Sets the OFSX, OFSY and OFSZ bytes
// OFSX, OFSY and OFSZ are user offset adjustments in twos complement format with
// a scale factor of 15,6mg/LSB
// OFSX, OFSY and OFSZ should be comprised between
void ADXL345::setAxisOffset(int x, int y, int z) {
writeTo(ADXL345_OFSX, byte (x));
writeTo(ADXL345_OFSY, byte (y));
writeTo(ADXL345_OFSZ, byte (z));
}
 
// Gets the OFSX, OFSY and OFSZ bytes
void ADXL345::getAxisOffset(int* x, int* y, int*z) {
byte _b;
readFrom(ADXL345_OFSX, 1, &_b);
*x = int (_b);
readFrom(ADXL345_OFSY, 1, &_b);
*y = int (_b);
readFrom(ADXL345_OFSZ, 1, &_b);
*z = int (_b);
}
 
// Sets the DUR byte
// The DUR byte contains an unsigned time value representing the maximum time
// that an event must be above THRESH_TAP threshold to qualify as a tap event
// The scale factor is 625µs/LSB
// A value of 0 disables the tap/float tap funcitons. Max value is 255.
void ADXL345::setTapDuration(int tapDuration) {
tapDuration = min(max(tapDuration,0),255);
byte _b = byte (tapDuration);
writeTo(ADXL345_DUR, _b);
}
 
// Gets the DUR byte
int ADXL345::getTapDuration() {
byte _b;
readFrom(ADXL345_DUR, 1, &_b);
return int (_b);
}
 
// Sets the latency (latent register) which contains an unsigned time value
// representing the wait time from the detection of a tap event to the start
// of the time window, during which a possible second tap can be detected.
// The scale factor is 1.25ms/LSB. A value of 0 disables the float tap function.
// It accepts a maximum value of 255.
void ADXL345::setDoubleTapLatency(int floatTapLatency) {
byte _b = byte (floatTapLatency);
writeTo(ADXL345_LATENT, _b);
}
 
// Gets the Latent value
int ADXL345::getDoubleTapLatency() {
byte _b;
readFrom(ADXL345_LATENT, 1, &_b);
return int (_b);
}
 
// Sets the Window register, which contains an unsigned time value representing
// the amount of time after the expiration of the latency time (Latent register)
// during which a second valud tap can begin. The scale factor is 1.25ms/LSB. A
// value of 0 disables the float tap function. The maximum value is 255.
void ADXL345::setDoubleTapWindow(int floatTapWindow) {
floatTapWindow = min(max(floatTapWindow,0),255);
byte _b = byte (floatTapWindow);
writeTo(ADXL345_WINDOW, _b);
}
 
// Gets the Window register
int ADXL345::getDoubleTapWindow() {
byte _b;
readFrom(ADXL345_WINDOW, 1, &_b);
return int (_b);
}
 
// Sets the THRESH_ACT byte which holds the threshold value for detecting activity.
// The data format is unsigned, so the magnitude of the activity event is compared
// with the value is compared with the value in the THRESH_ACT register. The scale
// factor is 62.5mg/LSB. A value of 0 may result in undesirable behavior if the
// activity interrupt is enabled. The maximum value is 255.
void ADXL345::setActivityThreshold(int activityThreshold) {
activityThreshold = min(max(activityThreshold,0),255);
byte _b = byte (activityThreshold);
writeTo(ADXL345_THRESH_ACT, _b);
}
 
// Gets the THRESH_ACT byte
int ADXL345::getActivityThreshold() {
byte _b;
readFrom(ADXL345_THRESH_ACT, 1, &_b);
return int (_b);
}
 
// Sets the THRESH_INACT byte which holds the threshold value for detecting inactivity.
// The data format is unsigned, so the magnitude of the inactivity event is compared
// with the value is compared with the value in the THRESH_INACT register. The scale
// factor is 62.5mg/LSB. A value of 0 may result in undesirable behavior if the
// inactivity interrupt is enabled. The maximum value is 255.
void ADXL345::setInactivityThreshold(int inactivityThreshold) {
inactivityThreshold = min(max(inactivityThreshold,0),255);
byte _b = byte (inactivityThreshold);
writeTo(ADXL345_THRESH_INACT, _b);
}
 
// Gets the THRESH_INACT byte
int ADXL345::getInactivityThreshold() {
byte _b;
readFrom(ADXL345_THRESH_INACT, 1, &_b);
return int (_b);
}
 
// Sets the TIME_INACT register, which contains an unsigned time value representing the
// amount of time that acceleration must be less thant the value in the THRESH_INACT
// register for inactivity to be declared. The scale factor is 1sec/LSB. The value must
// be between 0 and 255.
void ADXL345::setTimeInactivity(int timeInactivity) {
timeInactivity = min(max(timeInactivity,0),255);
byte _b = byte (timeInactivity);
writeTo(ADXL345_TIME_INACT, _b);
}
 
// Gets the TIME_INACT register
int ADXL345::getTimeInactivity() {
byte _b;
readFrom(ADXL345_TIME_INACT, 1, &_b);
return int (_b);
}
 
// Sets the THRESH_FF register which holds the threshold value, in an unsigned format, for
// free-fall detection. The root-sum-square (RSS) value of all axes is calculated and
// compared whith the value in THRESH_FF to determine if a free-fall event occured. The
// scale factor is 62.5mg/LSB. A value of 0 may result in undesirable behavior if the free-fall
// interrupt is enabled. The maximum value is 255.
void ADXL345::setFreeFallThreshold(int freeFallThreshold) {
freeFallThreshold = min(max(freeFallThreshold,0),255);
byte _b = byte (freeFallThreshold);
writeTo(ADXL345_THRESH_FF, _b);
}
 
// Gets the THRESH_FF register.
int ADXL345::getFreeFallThreshold() {
byte _b;
readFrom(ADXL345_THRESH_FF, 1, &_b);
return int (_b);
}
 
// Sets the TIME_FF register, which holds an unsigned time value representing the minimum
// time that the RSS value of all axes must be less than THRESH_FF to generate a free-fall
// interrupt. The scale factor is 5ms/LSB. A value of 0 may result in undesirable behavior if
// the free-fall interrupt is enabled. The maximum value is 255.
void ADXL345::setFreeFallDuration(int freeFallDuration) {
freeFallDuration = min(max(freeFallDuration,0),255);
byte _b = byte (freeFallDuration);
writeTo(ADXL345_TIME_FF, _b);
}
 
// Gets the TIME_FF register.
int ADXL345::getFreeFallDuration() {
byte _b;
readFrom(ADXL345_TIME_FF, 1, &_b);
return int (_b);
}
 
bool ADXL345::isActivityXEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 6);
}
bool ADXL345::isActivityYEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 5);
}
bool ADXL345::isActivityZEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 4);
}
bool ADXL345::isInactivityXEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 2);
}
bool ADXL345::isInactivityYEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 1);
}
bool ADXL345::isInactivityZEnabled() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 0);
}
 
void ADXL345::setActivityX(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 6, state);
}
void ADXL345::setActivityY(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 5, state);
}
void ADXL345::setActivityZ(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 4, state);
}
void ADXL345::setInactivityX(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 2, state);
}
void ADXL345::setInactivityY(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 1, state);
}
void ADXL345::setInactivityZ(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 0, state);
}
 
bool ADXL345::isActivityAc() {
return getRegisterBit(ADXL345_ACT_INACT_CTL, 7);
}
bool ADXL345::isInactivityAc(){
return getRegisterBit(ADXL345_ACT_INACT_CTL, 3);
}
 
void ADXL345::setActivityAc(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 7, state);
}
void ADXL345::setInactivityAc(bool state) {
setRegisterBit(ADXL345_ACT_INACT_CTL, 3, state);
}
 
bool ADXL345::getSuppressBit(){
return getRegisterBit(ADXL345_TAP_AXES, 3);
}
void ADXL345::setSuppressBit(bool state) {
setRegisterBit(ADXL345_TAP_AXES, 3, state);
}
 
bool ADXL345::isTapDetectionOnX(){
return getRegisterBit(ADXL345_TAP_AXES, 2);
}
void ADXL345::setTapDetectionOnX(bool state) {
setRegisterBit(ADXL345_TAP_AXES, 2, state);
}
bool ADXL345::isTapDetectionOnY(){
return getRegisterBit(ADXL345_TAP_AXES, 1);
}
void ADXL345::setTapDetectionOnY(bool state) {
setRegisterBit(ADXL345_TAP_AXES, 1, state);
}
bool ADXL345::isTapDetectionOnZ(){
return getRegisterBit(ADXL345_TAP_AXES, 0);
}
void ADXL345::setTapDetectionOnZ(bool state) {
setRegisterBit(ADXL345_TAP_AXES, 0, state);
}
 
bool ADXL345::isActivitySourceOnX(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 6);
}
bool ADXL345::isActivitySourceOnY(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 5);
}
bool ADXL345::isActivitySourceOnZ(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 4);
}
 
bool ADXL345::isTapSourceOnX(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 2);
}
bool ADXL345::isTapSourceOnY(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 1);
}
bool ADXL345::isTapSourceOnZ(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 0);
}
 
bool ADXL345::isAsleep(){
return getRegisterBit(ADXL345_ACT_TAP_STATUS, 3);
}
 
bool ADXL345::isLowPower(){
return getRegisterBit(ADXL345_BW_RATE, 4);
}
void ADXL345::setLowPower(bool state) {
setRegisterBit(ADXL345_BW_RATE, 4, state);
}
 
float ADXL345::getRate(){
byte _b;
readFrom(ADXL345_BW_RATE, 1, &_b);
_b &= B00001111;
return (pow(2,((int) _b)-6)) * 6.25;
}
 
void ADXL345::setRate(float rate){
byte _b,_s;
int v = (int) (rate / 6.25);
int r = 0;
while (v >>= 1)
{
r++;
}
if (r <= 9) {
readFrom(ADXL345_BW_RATE, 1, &_b);
_s = (byte) (r + 6) | (_b & B11110000);
writeTo(ADXL345_BW_RATE, _s);
}
}
 
void ADXL345::set_bw(byte bw_code){
if((bw_code < ADXL345_BW_3) || (bw_code > ADXL345_BW_1600)){
status = false;
error_code = ADXL345_BAD_ARG;
}
else{
writeTo(ADXL345_BW_RATE, bw_code);
}
}
 
byte ADXL345::get_bw_code(){
byte bw_code;
readFrom(ADXL345_BW_RATE, 1, &bw_code);
return bw_code;
}
 
byte ADXL345::getInterruptSource() {
byte _b;
readFrom(ADXL345_INT_SOURCE, 1, &_b);
return _b;
}
 
bool ADXL345::getInterruptSource(byte interruptBit) {
return getRegisterBit(ADXL345_INT_SOURCE,interruptBit);
}
 
bool ADXL345::getInterruptMapping(byte interruptBit) {
return getRegisterBit(ADXL345_INT_MAP,interruptBit);
}
 
// Set the mapping of an interrupt to pin1 or pin2
// eg: setInterruptMapping(ADXL345_INT_DOUBLE_TAP_BIT,ADXL345_INT2_PIN);
void ADXL345::setInterruptMapping(byte interruptBit, bool interruptPin) {
setRegisterBit(ADXL345_INT_MAP, interruptBit, interruptPin);
}
 
bool ADXL345::isInterruptEnabled(byte interruptBit) {
return getRegisterBit(ADXL345_INT_ENABLE,interruptBit);
}
 
void ADXL345::setInterrupt(byte interruptBit, bool state) {
setRegisterBit(ADXL345_INT_ENABLE, interruptBit, state);
}
 
void ADXL345::setRegisterBit(byte regAdress, int bitPos, bool state) {
byte _b;
readFrom(regAdress, 1, &_b);
if (state) {
_b |= (1 << bitPos); // forces nth bit of _b to be 1. all other bits left alone.
}
else {
_b &= ~(1 << bitPos); // forces nth bit of _b to be 0. all other bits left alone.
}
writeTo(regAdress, _b);
}
 
bool ADXL345::getRegisterBit(byte regAdress, int bitPos) {
byte _b;
readFrom(regAdress, 1, &_b);
return ((_b >> bitPos) & 1);
}
 
// print all register value to the serial ouptut, which requires it to be setup
// this can be used to manually to check the current configuration of the device
void ADXL345::printAllRegister() {
byte _b;
Serial.print("0x00: ");
readFrom(0x00, 1, &_b);
print_byte(_b);
Serial.println("");
int i;
for (i=29;i<=57;i++){
Serial.print("0x");
Serial.print(i, HEX);
Serial.print(": ");
readFrom(i, 1, &_b);
print_byte(_b);
Serial.println("");
}
}
 
void print_byte(byte val){
int i;
Serial.print("B");
for(i=7; i>=0; i--){
Serial.print(val >> i & 1, BIN);
}
}
 
 
/branches/V0.82b-Arthur-P/adxl345driver/ADXL345.h
0,0 → 1,206
/**************************************************************************
* *
* ADXL345 Driver for Arduino *
* *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU License. *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU License V2 for more details. *
* *
***************************************************************************/
#include "WProgram.h"
 
#ifndef ADXL345_h
#define ADXL345_h
 
/* -- ADXL345 addresses --*/
#define ADXL345_ADDR_ALT_HIGH 0x1D // ADXL345 address when ALT is connected to HIGH
#define ADXL345_ADDR_ALT_LOW 0x53 // ADXL345 address when ALT is connected to LOW
 
/* ------- Register names ------- */
#define ADXL345_DEVID 0x00
#define ADXL345_RESERVED1 0x01
#define ADXL345_THRESH_TAP 0x1d
#define ADXL345_OFSX 0x1e
#define ADXL345_OFSY 0x1f
#define ADXL345_OFSZ 0x20
#define ADXL345_DUR 0x21
#define ADXL345_LATENT 0x22
#define ADXL345_WINDOW 0x23
#define ADXL345_THRESH_ACT 0x24
#define ADXL345_THRESH_INACT 0x25
#define ADXL345_TIME_INACT 0x26
#define ADXL345_ACT_INACT_CTL 0x27
#define ADXL345_THRESH_FF 0x28
#define ADXL345_TIME_FF 0x29
#define ADXL345_TAP_AXES 0x2a
#define ADXL345_ACT_TAP_STATUS 0x2b
#define ADXL345_BW_RATE 0x2c
#define ADXL345_POWER_CTL 0x2d
#define ADXL345_INT_ENABLE 0x2e
#define ADXL345_INT_MAP 0x2f
#define ADXL345_INT_SOURCE 0x30
#define ADXL345_DATA_FORMAT 0x31
#define ADXL345_DATAX0 0x32
#define ADXL345_DATAX1 0x33
#define ADXL345_DATAY0 0x34
#define ADXL345_DATAY1 0x35
#define ADXL345_DATAZ0 0x36
#define ADXL345_DATAZ1 0x37
#define ADXL345_FIFO_CTL 0x38
#define ADXL345_FIFO_STATUS 0x39
 
#define ADXL345_BW_1600 0xF // 1111
#define ADXL345_BW_800 0xE // 1110
#define ADXL345_BW_400 0xD // 1101
#define ADXL345_BW_200 0xC // 1100
#define ADXL345_BW_100 0xB // 1011
#define ADXL345_BW_50 0xA // 1010
#define ADXL345_BW_25 0x9 // 1001
#define ADXL345_BW_12 0x8 // 1000
#define ADXL345_BW_6 0x7 // 0111
#define ADXL345_BW_3 0x6 // 0110
 
 
/*
Interrupt PINs
INT1: 0
INT2: 1
*/
#define ADXL345_INT1_PIN 0x00
#define ADXL345_INT2_PIN 0x01
 
/*
Interrupt bit position
*/
#define ADXL345_INT_DATA_READY_BIT 0x07
#define ADXL345_INT_SINGLE_TAP_BIT 0x06
#define ADXL345_INT_DOUBLE_TAP_BIT 0x05
#define ADXL345_INT_ACTIVITY_BIT 0x04
#define ADXL345_INT_INACTIVITY_BIT 0x03
#define ADXL345_INT_FREE_FALL_BIT 0x02
#define ADXL345_INT_WATERMARK_BIT 0x01
#define ADXL345_INT_OVERRUNY_BIT 0x00
 
#define ADXL345_OK 1 // no error
#define ADXL345_ERROR 0 // indicates error is predent
 
#define ADXL345_NO_ERROR 0 // initial state
#define ADXL345_READ_ERROR 1 // problem reading accel
#define ADXL345_BAD_ARG 2 // bad method argument
 
class ADXL345
{
public:
bool status; // set when error occurs
// see error code for details
byte error_code; // Initial state
float gains[3]; // counts to Gs
 
ADXL345();
void init(int address);
void powerOn();
void readAccel(int* xyx);
void readAccel(int* x, int* y, int* z);
void get_Gxyz(float *xyz);
 
void setTapThreshold(int tapThreshold);
int getTapThreshold();
void setAxisGains(float *_gains);
void getAxisGains(float *_gains);
void setAxisOffset(int x, int y, int z);
void getAxisOffset(int* x, int* y, int*z);
void setTapDuration(int tapDuration);
int getTapDuration();
void setDoubleTapLatency(int floatTapLatency);
int getDoubleTapLatency();
void setDoubleTapWindow(int floatTapWindow);
int getDoubleTapWindow();
void setActivityThreshold(int activityThreshold);
int getActivityThreshold();
void setInactivityThreshold(int inactivityThreshold);
int getInactivityThreshold();
void setTimeInactivity(int timeInactivity);
int getTimeInactivity();
void setFreeFallThreshold(int freeFallthreshold);
int getFreeFallThreshold();
void setFreeFallDuration(int freeFallDuration);
int getFreeFallDuration();
 
bool isActivityXEnabled();
bool isActivityYEnabled();
bool isActivityZEnabled();
bool isInactivityXEnabled();
bool isInactivityYEnabled();
bool isInactivityZEnabled();
bool isActivityAc();
bool isInactivityAc();
void setActivityAc(bool state);
void setInactivityAc(bool state);
 
bool getSuppressBit();
void setSuppressBit(bool state);
bool isTapDetectionOnX();
void setTapDetectionOnX(bool state);
bool isTapDetectionOnY();
void setTapDetectionOnY(bool state);
bool isTapDetectionOnZ();
void setTapDetectionOnZ(bool state);
 
void setActivityX(bool state);
void setActivityY(bool state);
void setActivityZ(bool state);
void setInactivityX(bool state);
void setInactivityY(bool state);
void setInactivityZ(bool state);
 
bool isActivitySourceOnX();
bool isActivitySourceOnY();
bool isActivitySourceOnZ();
bool isTapSourceOnX();
bool isTapSourceOnY();
bool isTapSourceOnZ();
bool isAsleep();
 
bool isLowPower();
void setLowPower(bool state);
float getRate();
void setRate(float rate);
void set_bw(byte bw_code);
byte get_bw_code();
 
byte getInterruptSource();
bool getInterruptSource(byte interruptBit);
bool getInterruptMapping(byte interruptBit);
void setInterruptMapping(byte interruptBit, bool interruptPin);
bool isInterruptEnabled(byte interruptBit);
void setInterrupt(byte interruptBit, bool state);
 
void getRangeSetting(byte* rangeSetting);
void setRangeSetting(int val);
bool getSelfTestBit();
void setSelfTestBit(bool selfTestBit);
bool getSpiBit();
void setSpiBit(bool spiBit);
bool getInterruptLevelBit();
void setInterruptLevelBit(bool interruptLevelBit);
bool getFullResBit();
void setFullResBit(bool fullResBit);
bool getJustifyBit();
void setJustifyBit(bool justifyBit);
void printAllRegister();
void writeTo(byte address, byte val);
 
private:
void readFrom(byte address, int num, byte buff[]);
void setRegisterBit(byte regAdress, int bitPos, bool state);
bool getRegisterBit(byte regAdress, int bitPos);
byte _buff[6] ; //6 bytes buffer for saving data read from the device
int _dev_address;
};
void print_byte(byte val);
#endif
/branches/V0.82b-Arthur-P/adxl345driver/accel_cal.py
0,0 → 1,40
import scipy.optimize
from pylab import *
from numpy import *
from mpl_toolkits.mplot3d import Axes3
 
cal = open('cal.dat')
fig = figure(1); clf()
az = Axis3D(fig)
 
for f in [cal]:
data = array([map(float, l.split()) for l in f.readlines()])
 
N = len(data[0])
 
x = data[:,0]
y = data[:,1]
z = data[:,2]
ax.scater(x, y, z)
here
 
A = array([[cx + r * cos(theta),
cy + r * sin(theta)] for theta in arange(0, 2 * pi, 1 * pi/180)])
# plot(A[:,0], A[:,1], 'g-')
xy = data[:,1:3]
 
def cost(params):
cx, cy, r = params
xy_ = xy - [cx, cy]
thetas = arctan2(xy_[:,1], xy_[:,0])
resids = xy_ - transpose([r * cos(thetas), r * sin(thetas)])
return sum(ravel(resids ** 2))
 
cx, cy, r = scipy.optimize.fmin(cost, [cx, cy, r], disp=False)
print f.name, cx, cy, r
## acc_cal_lights_on.dat 550.150958354 507.218838209 249.831129791
## acc_cal_lights_off.dat 563.391868993 518.281081432 251.367556713
 
A = array([[cx + r * cos(theta),
cy + r * sin(theta)] for theta in arange(0, 2 * pi, 1 * pi/180)])
plot(A[:,0], A[:,1])
/branches/V0.82b-Arthur-P/adxl345driver/examples/ADXL345_run/ADXL345_run.pde
0,0 → 1,59
/**************************************************************************
* *
* ADXL345 Driver for Arduino *
* *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the MIT License. *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* MIT License for more details. *
* *
***************************************************************************
*
* Revision History
*
* Date By What
* 20100515 TJS Initial Creation
* 20100524 TJS Modified to run with Kevin Stevenard's driver
*/
#include "Wire.h"
#include "ADXL345.h"
 
ADXL345 Accel;
 
void setup(){
Serial.begin(9600);
delay(1);
Wire.begin();
delay(1);
Serial.println("Here");
Accel.init(ADXL345_ADDR_ALT_LOW);
Accel.set_bw(ADXL345_BW_12);
Serial.print("BW_OK? ");
Serial.println(Accel.status, DEC);
delay(1000);
}
 
void loop(){
int i;
float acc_data[3];
Accel.get_Gxyz(acc_data);
if(Accel.status){
float length = 0.;
for(i = 0; i < 3; i++){
length += (float)acc_data[i] * (float)acc_data[i];
Serial.print(acc_data[i]);
Serial.print(" ");
}
length = sqrt(length);
Serial.print(length);
Serial.println("");
delay(40);
}
else{
Serial.println("ERROR: ADXL345 data read error");
}
}
/branches/V0.82b-Arthur-P/adxl345driver/examples/ADXL345_run/accel_cal.py
0,0 → 1,52
import scipy.optimize
from pylab import *
from numpy import *
 
cal = open('cal1.dat')
 
for f in [cal]:
data = array([map(float, l.split()) for l in f.readlines()])
 
N = len(data[0])
 
x = data[:,0]
y = data[:,1]
z = data[:,2]
data = data[:,:3]
 
def cost(args):
rs = diag(1. / array(args[0:3])) ** 2
c = array(args[3:6])
m = data - array(c)
out = 0
for p in m:
out += abs(dot(dot(p, rs), p) - 1)
return out
guess = array([250, 250, 250, 0, 0, 0])
print cost(guess)
best = scipy.optimize.fmin(cost, guess)
print cost(best)
print best
print 1/best[:3]
 
here
A = array([[cx + r * cos(theta),
cy + r * sin(theta)] for theta in arange(0, 2 * pi, 1 * pi/180)])
# plot(A[:,0], A[:,1], 'g-')
xy = data[:,1:3]
 
def cost(params):
cx, cy, r = params
xy_ = xy - [cx, cy]
thetas = arctan2(xy_[:,1], xy_[:,0])
resids = xy_ - transpose([r * cos(thetas), r * sin(thetas)])
return sum(ravel(resids ** 2))
 
cx, cy, r = scipy.optimize.fmin(cost, [cx, cy, r], disp=False)
print f.name, cx, cy, r
## acc_cal_lights_on.dat 550.150958354 507.218838209 249.831129791
## acc_cal_lights_off.dat 563.391868993 518.281081432 251.367556713
 
A = array([[cx + r * cos(theta),
cy + r * sin(theta)] for theta in arange(0, 2 * pi, 1 * pi/180)])
plot(A[:,0], A[:,1])
/branches/V0.82b-Arthur-P/adxl345driver/examples/ADXL345_run/cal.dat
0,0 → 1,1579
-261 33 -39 265.95
-262 34 -40 267.21
-262 34 -41 267.36
-262 35 -39 267.19
-261 33 -40 266.10
-262 33 -39 266.93
-263 35 -40 268.32
-263 33 -39 267.92
-262 34 -41 267.36
-260 34 -40 265.25
-262 34 -40 267.21
-262 35 -39 267.19
-263 34 -41 268.34
-262 33 -39 266.93
-262 35 -40 267.34
-262 34 -39 267.06
-262 34 -39 267.06
-262 34 -40 267.21
-262 34 -39 267.06
-263 34 -40 268.19
-262 34 -39 267.06
-261 33 -39 265.95
-262 34 -38 266.92
-261 33 -38 265.81
-261 34 -41 266.38
-262 34 -41 267.36
-262 33 -38 266.79
-261 32 -38 265.69
-263 34 -39 268.04
-261 34 -40 266.23
-262 35 -39 267.19
-262 34 -40 267.21
-262 34 -41 267.36
-262 35 -41 267.49
-263 35 -41 268.47
-262 34 -40 267.21
-262 34 -38 266.92
-261 33 -38 265.81
-263 34 -40 268.19
-262 35 -40 267.34
-261 33 -39 265.95
-262 35 -41 267.49
-262 34 -39 267.06
-262 34 -39 267.06
-261 33 -41 266.25
-262 35 -40 267.34
-261 35 -40 266.36
-262 33 -39 266.93
-262 34 -42 267.51
-263 34 -40 268.19
-263 34 -40 268.19
-260 35 -40 265.38
-262 34 -40 267.21
-263 33 -39 267.92
-261 35 -39 266.21
-261 34 -39 266.08
-261 33 -41 266.25
-262 34 -39 267.06
-262 34 -40 267.21
-262 33 -39 266.93
-263 33 -40 268.06
-262 34 -39 267.06
-262 34 -38 266.92
-260 33 -40 265.12
-261 34 -40 266.23
-262 34 -40 267.21
-262 34 -41 267.36
-262 34 -40 267.21
-262 34 -41 267.36
-262 34 -40 267.21
-261 34 -40 266.23
-261 34 -39 266.08
-262 34 -40 267.21
-262 34 -40 267.21
-260 33 -41 265.27
-262 35 -39 267.19
-263 35 -40 268.32
-261 34 -39 266.08
-261 33 -38 265.81
-262 33 -39 266.93
-262 35 -38 267.04
-263 34 -39 268.04
-261 33 -40 266.10
-262 33 -41 267.23
-262 34 -39 267.06
-261 33 -40 266.10
-262 34 -41 267.36
-261 33 -41 266.25
-262 34 -40 267.21
-262 34 -40 267.21
-262 35 -39 267.19
-261 33 -40 266.10
-261 33 -37 265.67
-261 33 -39 265.95
-262 34 -40 267.21
-261 34 -41 266.38
-260 33 -41 265.27
-262 34 -38 266.92
-261 33 -41 266.25
-262 32 -40 266.96
-261 34 -40 266.23
-261 32 -40 265.98
-262 33 -39 266.93
-261 33 -39 265.95
-262 34 -40 267.21
-262 34 -40 267.21
-260 34 -39 265.10
-261 34 -39 266.08
-260 32 -41 265.15
-262 35 -40 267.34
-261 34 -39 266.08
-260 33 -39 264.97
-261 33 -42 266.41
-261 34 -40 266.23
-261 34 -41 266.38
-262 34 -40 267.21
-261 35 -42 266.66
-263 34 -39 268.04
-262 35 -40 267.34
-261 33 -40 266.10
-262 35 -40 267.34
-260 33 -38 264.83
-261 33 -41 266.25
-262 34 -39 267.06
-263 34 -40 268.19
-261 33 -39 265.95
-262 34 -40 267.21
-262 34 -40 267.21
-262 34 -40 267.21
-260 33 -41 265.27
-263 35 -38 268.03
-262 34 -40 267.21
-262 35 -39 267.19
-263 34 -39 268.04
-261 34 -39 266.08
-262 34 -41 267.36
-262 34 -40 267.21
-261 32 -40 265.98
-262 35 -40 267.34
-261 33 -39 265.95
-261 33 -38 265.81
-262 35 -39 267.19
-261 35 -41 266.51
-263 34 -38 267.90
-261 34 -39 266.08
-261 34 -39 266.08
-262 33 -41 267.23
-262 34 -41 267.36
-261 33 -39 265.95
-263 34 -41 268.34
-262 34 -38 266.92
-262 32 -40 266.96
-263 34 -40 268.19
-261 33 -39 265.95
-261 33 -41 266.25
-261 34 -38 265.93
-261 33 -39 265.95
-261 34 -39 266.08
-261 34 -40 266.23
-263 35 -38 268.03
-261 33 -38 265.81
-261 34 -39 266.08
-262 34 -38 266.92
-262 34 -41 267.36
-263 34 -41 268.34
-262 35 -41 267.49
-261 34 -41 266.38
-262 34 -42 267.51
-261 33 -40 266.10
-262 33 -40 267.08
-262 34 -41 267.36
-262 34 -37 266.78
-261 33 -41 266.25
-262 34 -40 267.21
-261 34 -39 266.08
-261 34 -39 266.08
-262 35 -39 267.19
-260 33 -41 265.27
-262 34 -42 267.51
-262 34 -40 267.21
-261 33 -41 266.25
-262 35 -39 267.19
-262 34 -40 267.21
-262 35 -40 267.34
-261 34 -39 266.08
-260 34 -38 264.95
-262 34 -39 267.06
-263 34 -40 268.19
-262 34 -40 267.21
-262 34 -40 267.21
-261 32 -41 266.13
-261 33 -40 266.10
-261 33 -38 265.81
-261 34 -41 266.38
-261 34 -40 266.23
-260 33 -40 265.12
-261 34 -38 265.93
-261 34 -39 266.08
-261 35 -37 265.92
-262 34 -39 267.06
-262 34 -40 267.21
-261 34 -40 266.23
-262 33 -39 266.93
-262 35 -41 267.49
-262 34 -40 267.21
-262 34 -40 267.21
-261 34 -38 265.93
-261 34 -40 266.23
-262 34 -40 267.21
-262 35 -41 267.49
-261 34 -40 266.23
-262 34 -40 267.21
-261 34 -40 266.23
-262 34 -40 267.21
-261 34 -41 266.38
-262 32 -39 266.81
-263 34 -39 268.04
-261 34 -40 266.23
-262 34 -38 266.92
-262 33 -40 267.08
-260 33 -40 265.12
-261 34 -39 266.08
-261 33 -39 265.95
-262 34 -39 267.06
-262 35 -40 267.34
-262 34 -39 267.06
-261 34 -39 266.08
-262 34 -39 267.06
-261 34 -40 266.23
-262 35 -40 267.34
-261 33 -38 265.81
-262 34 -39 267.06
-263 34 -39 268.04
-261 34 -40 266.23
-262 34 -40 267.21
-262 34 -41 267.36
-261 33 -39 265.95
-261 34 -41 266.38
-261 35 -39 266.21
-261 33 -37 265.67
-261 33 -40 266.10
-260 33 -39 264.97
-262 33 -39 266.93
-260 33 -39 264.97
-261 34 -40 266.23
-262 34 -41 267.36
-262 34 -39 267.06
-261 33 -40 266.10
-261 33 -40 266.10
-262 33 -40 267.08
-262 33 -40 267.08
-261 33 -40 266.10
-262 34 -39 267.06
-262 34 -42 267.51
-261 34 -41 266.38
-263 33 -39 267.92
-260 34 -39 265.10
-261 34 -39 266.08
-261 33 -41 266.25
-263 34 -39 268.04
-262 34 -40 267.21
-260 33 -39 264.97
-262 33 -38 266.79
-261 34 -39 266.08
-260 33 -40 265.12
-262 33 -39 266.93
-260 34 -40 265.25
-260 34 -40 265.25
-261 35 -40 266.36
-261 35 -41 266.51
-261 33 -39 265.95
-262 33 -39 266.93
-262 34 -40 267.21
-260 33 -40 265.12
-261 34 -39 266.08
-261 33 -40 266.10
-262 33 -38 266.79
-261 34 -40 266.23
-262 33 -40 267.08
-262 34 -41 267.36
-262 34 -40 267.21
-261 34 -39 266.08
-262 33 -39 266.93
-261 34 -40 266.23
-262 33 -38 266.79
-261 33 -39 265.95
-261 34 -41 266.38
-262 34 -41 267.36
-262 34 -39 267.06
-261 34 -40 266.23
-261 35 -39 266.21
-261 33 -40 266.10
-261 33 -41 266.25
-262 34 -40 267.21
-262 33 -42 267.39
-261 34 -39 266.08
-262 34 -40 267.21
-261 33 -39 265.95
-262 35 -41 267.49
-262 35 -40 267.34
-261 34 -39 266.08
-261 33 -37 265.67
-261 33 -40 266.10
-263 35 -41 268.47
-262 34 -40 267.21
-261 33 -42 266.41
-261 33 -40 266.10
-262 33 -39 266.93
-261 33 -39 265.95
-263 35 -38 268.03
-263 35 -40 268.32
-260 34 -40 265.25
-261 33 -40 266.10
-262 34 -40 267.21
-261 32 -39 265.83
-262 34 -39 267.06
-261 33 -39 265.95
-262 33 -38 266.79
-262 34 -40 267.21
-263 35 -39 268.17
-262 34 -40 267.21
-262 34 -39 267.06
-262 34 -41 267.36
-261 34 -39 266.08
-262 33 -40 267.08
-261 33 -40 266.10
-261 33 -40 266.10
-261 34 -39 266.08
-261 33 -41 266.25
-262 34 -40 267.21
-262 33 -39 266.93
-261 33 -39 265.95
-261 33 -37 265.67
-261 33 -39 265.95
-261 32 -40 265.98
-261 34 -40 266.23
-262 34 -41 267.36
-262 35 -39 267.19
-262 34 -39 267.06
-263 34 -40 268.19
-261 34 -39 266.08
-262 34 -39 267.06
-262 33 -39 266.93
-261 34 -39 266.08
-261 33 -39 265.95
-261 32 -41 266.13
-262 34 -40 267.21
-261 34 -40 266.23
-261 34 -39 266.08
-262 34 -40 267.21
-262 33 -40 267.08
-263 34 -38 267.90
-261 35 -40 266.36
-262 34 -39 267.06
-262 35 -38 267.04
-261 35 -38 266.06
-262 35 -40 267.34
-261 33 -41 266.25
-261 34 -39 266.08
-262 35 -40 267.34
-261 34 -40 266.23
-261 33 -39 265.95
-261 34 -41 266.38
-262 34 -41 267.36
-262 33 -40 267.08
-261 35 -40 266.36
-260 34 -42 265.56
-260 33 -39 264.97
-263 42 -48 270.62
-267 24 -33 270.10
-258 23 -46 263.08
-264 29 -21 266.42
-271 47 -53 280.11
-282 22 -24 283.87
-275 25 -32 277.98
-252 16 -37 255.20
-270 34 -16 272.60
-274 19 -32 276.52
-269 40 -27 273.29
-275 31 -26 277.96
-249 75 -14 260.43
-253 33 -50 260.00
-275 79 -18 286.69
-223 87 -28 241.00
-240 87 -39 258.24
-242 101 -34 264.43
-256 93 -44 275.90
-232 124 -25 264.24
-238 105 -48 264.52
-229 137 -33 268.88
-217 143 -33 261.97
-219 144 -32 264.05
-200 150 -33 252.17
-200 159 -36 258.03
-188 180 -24 261.38
-175 197 -12 263.78
-175 193 -27 261.92
-167 194 -26 257.30
-160 213 -17 266.94
-134 222 -20 260.08
-133 225 -14 261.74
-142 229 -10 269.64
-114 225 -22 253.19
-104 232 -12 254.53
-94 241 -12 258.96
-93 241 -18 258.95
-82 249 -10 262.35
-76 249 -9 260.50
-58 250 -8 256.76
-47 255 -6 259.36
-30 257 -8 258.87
-18 256 -6 256.70
-11 254 -9 254.40
-7 259 5 259.14
2 256 -2 256.02
1 253 -1 253.00
8 252 -1 252.13
22 253 -6 254.03
42 255 -1 258.44
45 250 -1 254.02
49 255 6 259.73
51 246 7 251.33
58 243 7 249.92
71 243 15 253.60
69 240 15 250.17
76 236 16 248.45
88 231 11 247.44
91 221 14 239.41
102 227 15 249.32
118 231 27 260.79
126 228 33 262.58
125 219 33 254.31
130 207 23 245.52
130 204 27 243.40
139 198 21 242.83
148 195 26 246.18
156 191 21 247.50
163 194 32 255.40
173 183 20 252.62
173 181 24 251.53
177 172 25 248.07
179 168 19 246.22
184 157 12 242.18
182 160 22 243.33
194 149 20 245.43
203 148 21 252.10
213 149 24 261.05
211 132 18 249.54
210 133 14 248.97
207 121 12 240.07
213 114 13 241.94
212 110 16 239.37
218 101 22 241.27
234 86 11 249.55
235 89 22 252.25
242 85 19 257.20
242 80 29 256.52
241 80 20 254.72
243 72 16 253.95
234 66 19 243.87
229 66 23 239.43
242 58 19 249.58
247 55 28 254.59
248 56 20 255.03
244 53 20 250.49
235 47 19 240.41
246 44 18 250.55
240 44 14 244.40
240 50 16 245.67
259 46 2 263.06
250 35 -3 252.46
257 34 -3 259.26
251 31 -5 252.96
243 34 0 245.37
248 35 -6 250.53
252 35 -5 254.47
253 32 -7 255.11
253 29 -15 255.10
255 34 -9 257.41
248 27 -18 250.11
253 33 -19 255.85
251 43 -10 254.85
254 47 -17 258.87
264 63 -11 271.64
258 57 -20 264.98
245 61 -22 253.44
235 62 -34 245.41
240 93 -24 258.51
234 98 -33 255.83
222 106 -22 246.99
226 121 -31 258.22
220 130 -22 256.48
219 132 -28 257.23
203 142 -30 249.55
202 144 -24 249.23
183 167 -15 248.20
192 188 -19 269.39
166 189 -19 252.27
159 196 -17 252.95
154 192 -27 247.61
148 214 -19 260.89
155 213 -29 265.02
126 225 -6 257.95
132 218 -24 255.98
101 235 -8 255.91
109 224 -31 251.03
75 246 2 257.19
88 243 -14 258.82
56 252 -4 258.18
62 249 -22 257.54
51 256 -17 261.58
32 248 -19 250.78
25 251 -20 253.03
4 263 -7 263.12
8 258 -19 258.82
9 260 -19 260.85
-8 260 -12 260.40
-31 258 -8 259.98
-26 253 -23 255.37
-44 254 -18 258.41
-58 254 -9 260.69
-82 248 -13 261.53
-77 251 -21 263.38
-77 244 -26 257.18
-98 254 -7 272.34
-112 239 -18 264.55
-113 233 -21 259.81
-114 231 -17 258.16
-132 230 -12 265.46
-145 217 -19 261.68
-144 209 -26 255.13
-159 200 -20 256.28
-163 189 -16 250.09
-187 193 1 268.74
-187 190 -5 266.63
-186 179 -15 258.58
-198 172 -15 262.70
-209 162 -12 264.71
-212 151 -18 260.90
-226 153 -11 273.14
-224 135 -19 262.23
-220 139 -22 261.16
-229 129 -27 264.22
-232 104 -37 256.92
-242 104 -33 265.46
-247 92 -36 266.02
-251 91 -35 269.27
-256 82 -39 271.63
-251 78 -43 266.33
-257 73 -39 270.00
-256 59 -40 265.74
-257 53 -34 264.60
-258 49 -36 265.07
-261 42 -39 267.22
-261 45 -43 268.32
-261 41 -45 268.01
-266 33 -40 271.01
-259 24 -44 263.80
-263 18 -44 267.26
-262 17 -49 267.08
-263 9 -49 267.68
-262 6 -62 269.30
-261 10 -56 267.13
-265 6 -52 270.12
-265 13 -45 269.11
-265 8 -40 268.12
-269 17 -30 271.20
-256 11 -38 259.04
-252 21 -32 254.89
-270 15 -18 271.01
-259 19 -18 260.32
-256 20 -11 257.02
-249 16 -4 249.55
-264 20 12 265.03
-247 33 8 249.32
-254 14 18 255.02
-245 25 33 248.47
-263 25 57 270.26
-227 27 42 232.43
-261 4 64 268.76
-220 25 69 231.92
-253 19 100 272.71
-221 24 87 238.72
-234 20 102 256.05
-207 29 100 231.71
-220 31 129 256.91
-170 30 107 203.10
-216 23 141 258.97
-170 19 131 215.46
-168 24 159 232.55
-168 22 169 239.31
-158 18 173 234.98
-139 7 171 220.48
-128 11 176 217.90
-132 21 193 234.76
-124 15 195 231.57
-105 9 194 220.78
-101 15 200 224.56
-86 11 194 212.49
-92 22 209 229.41
-72 24 201 214.85
-61 27 203 213.68
-45 28 210 216.58
-52 29 230 237.58
-26 42 209 214.76
-54 43 211 222.00
-17 44 195 200.62
-43 35 236 242.43
-17 46 237 242.02
-2 27 207 208.76
-14 33 228 230.80
29 48 194 201.94
19 39 211 215.41
39 39 213 220.02
47 33 219 226.40
61 18 199 208.92
63 37 229 240.37
89 36 198 220.05
92 39 196 220.00
128 28 166 211.48
110 48 201 234.10
125 45 177 221.31
131 36 174 220.76
144 40 160 218.94
155 47 158 226.27
152 41 158 223.04
163 32 146 221.15
166 41 154 230.12
174 40 145 230.00
174 33 155 235.35
181 54 150 241.20
178 29 150 234.57
184 39 154 243.09
180 43 148 236.97
152 51 181 241.80
161 19 140 214.20
129 59 204 248.47
154 25 162 224.91
145 26 158 216.02
123 47 203 241.96
127 34 180 222.90
89 39 216 236.85
114 26 205 236.00
88 39 209 230.10
66 19 189 201.09
36 24 207 211.47
21 32 234 237.11
27 41 221 226.39
15 20 196 197.59
-39 53 233 242.11
-18 29 207 209.80
-52 40 202 212.39
-73 52 200 219.16
-82 43 208 227.68
-84 50 175 200.45
-132 57 202 247.95
-148 65 182 243.42
-164 60 183 252.95
-150 51 139 210.77
-182 48 145 237.60
-173 61 123 220.86
-210 68 114 248.44
-196 85 105 238.05
-217 62 82 240.12
-237 77 86 263.62
-230 72 34 243.39
-236 63 4 244.30
-232 92 1 249.58
-250 91 8 266.17
-247 51 -43 255.85
-252 63 -47 263.97
-243 61 -72 260.68
-256 59 -68 271.37
-248 63 -104 276.20
-245 72 -105 276.11
-231 61 -138 275.91
-243 61 -126 280.44
-218 36 -171 279.39
-228 43 -160 281.84
-209 48 -181 280.62
-206 57 -182 280.73
-192 57 -200 283.04
-166 54 -224 283.99
-169 38 -224 283.16
-150 36 -244 288.67
-158 30 -237 286.41
-151 44 -241 287.78
-128 51 -246 281.96
-100 44 -268 289.41
-89 43 -268 285.65
-84 21 -274 287.36
-76 26 -271 282.65
-66 33 -274 283.76
-66 34 -271 280.99
-61 34 -275 283.73
-29 23 -286 288.39
-21 12 -282 283.04
-4 20 -301 301.69
-15 30 -287 288.95
-17 19 -290 291.12
-22 12 -278 279.13
-13 6 -292 292.35
-7 7 -285 285.17
-3 18 -284 284.59
10 3 -294 294.19
2 1 -289 289.01
-8 -10 -295 295.28
-7 -2 -296 296.09
-11 2 -289 289.22
-7 5 -289 289.13
-2 4 -286 286.03
-2 -3 -288 288.02
-6 -2 -285 285.07
-6 3 -282 282.08
-6 -1 -287 287.06
-6 1 -288 288.06
-5 4 -291 291.07
-14 1 -291 291.34
-22 2 -285 285.85
-9 6 -290 290.20
-5 8 -293 293.15
-34 -2 -282 284.05
-11 15 -296 296.58
-28 7 -284 285.46
-28 -18 -297 298.86
-41 -8 -284 287.06
-51 0 -282 286.57
-51 5 -283 287.60
-64 5 -276 283.37
-85 -4 -262 275.47
-64 -1 -290 296.98
-84 0 -267 279.90
-80 -3 -277 288.34
-95 3 -273 289.07
-112 7 -254 277.69
-100 1 -277 294.50
-97 -1 -273 289.72
-100 -3 -278 295.45
-112 5 -266 288.66
-117 3 -261 286.04
-145 3 -236 277.00
-133 8 -254 286.83
-147 3 -254 293.49
-162 2 -235 285.43
-161 4 -239 288.20
-151 9 -251 293.06
-158 -1 -249 294.90
-204 -5 -190 278.82
-173 2 -233 290.21
-199 6 -197 280.08
-201 7 -196 280.83
-201 -2 -201 284.26
-184 -1 -220 286.80
-225 -3 -174 284.45
-221 1 -181 285.66
-225 2 -181 288.77
-216 7 -187 285.79
-239 3 -159 287.07
-239 7 -147 280.68
-221 11 -162 274.24
-221 8 -165 275.92
-241 4 -146 281.80
-246 -1 -140 283.05
-247 6 -134 281.07
-267 2 -112 289.55
-257 10 -113 280.92
-263 7 -104 282.90
-246 16 -119 273.74
-260 3 -102 279.31
-256 5 -102 275.62
-256 18 -83 269.72
-240 18 -96 259.11
-272 20 -55 278.22
-253 11 -69 262.47
-270 13 -37 272.83
-250 23 -48 255.60
-278 18 -19 279.23
-260 21 -31 262.68
-271 18 -8 271.71
-250 7 -29 251.77
-267 11 -4 267.26
-257 13 -5 257.38
-263 27 20 265.14
-240 22 1 241.01
-269 22 34 272.03
-251 39 28 255.55
-280 36 75 292.10
-230 32 38 235.30
-238 15 48 243.26
-246 23 67 256.00
-221 32 61 231.49
-222 28 75 235.99
-224 21 92 243.07
-227 36 120 259.28
-196 28 107 225.05
-203 41 146 253.39
-162 33 121 204.88
-207 15 155 259.03
-174 43 147 231.81
-188 42 177 261.60
-142 42 146 207.95
-153 41 161 225.86
-160 37 186 248.12
-130 27 177 221.26
-136 32 190 235.84
-116 34 183 219.32
-124 54 202 243.10
-112 33 189 222.16
-106 34 195 224.54
-98 33 199 224.26
-93 40 196 220.60
-92 37 197 220.55
-69 43 219 233.60
-69 37 217 230.69
-56 43 196 208.33
-60 38 205 216.95
-45 54 201 212.94
-42 46 198 207.57
-46 45 213 222.51
-35 58 214 224.47
-29 53 222 230.07
-17 37 199 203.12
-32 40 224 229.78
-21 58 218 226.56
-33 44 229 235.51
-9 63 220 229.02
-2 46 207 212.06
-18 48 226 231.74
-12 58 230 237.50
-23 43 213 218.51
-14 58 218 226.02
-18 49 220 226.11
-21 42 205 210.31
-31 55 213 222.16
-23 39 194 199.21
-40 39 208 215.37
-41 51 219 228.57
-47 44 213 222.52
-43 49 216 225.62
-41 48 214 223.12
-50 51 215 226.55
-54 46 207 218.82
-62 47 214 227.70
-63 48 207 221.63
-82 47 218 237.61
-85 46 197 219.43
-92 50 205 230.19
-92 38 191 215.38
-113 45 190 225.60
-114 59 193 231.79
-125 48 174 219.56
-144 56 185 241.03
-140 61 164 224.09
-149 62 169 233.68
-151 46 152 219.14
-169 52 146 229.31
-179 62 148 240.39
-169 55 125 217.28
-178 61 118 222.10
-198 58 121 239.18
-204 64 126 248.17
-197 67 106 233.53
-213 69 101 245.62
-210 65 83 234.98
-223 69 86 248.77
-215 65 71 235.57
-224 58 65 240.34
-223 73 69 244.58
-237 60 67 253.49
-240 68 68 258.55
-235 59 57 248.91
-237 49 39 245.13
-255 41 46 262.34
-253 39 45 259.91
-241 41 29 246.18
-262 33 40 267.08
-236 28 13 238.01
-256 12 25 257.50
-257 13 25 258.54
-258 -4 18 258.66
-265 -19 20 266.43
-258 -23 14 259.40
-252 -39 2 255.01
-255 -46 1 259.12
-259 -41 0 262.23
-258 -62 -6 265.41
-258 -64 -4 265.85
-247 -68 -14 256.57
-240 -70 -19 250.72
-249 -95 -17 267.05
-245 -89 -12 260.94
-248 -113 -16 273.00
-247 -116 -17 273.41
-240 -124 -24 271.20
-242 -128 -21 274.57
-236 -135 -17 272.42
-223 -135 -21 261.52
-229 -133 -14 265.19
-222 -145 -30 266.85
-221 -143 -34 265.42
-225 -146 -16 268.70
-214 -149 -31 262.60
-201 -181 -40 273.43
-197 -172 -48 265.89
-203 -168 -34 265.69
-188 -187 -46 269.13
-186 -188 -43 267.93
-183 -199 -47 274.41
-170 -206 -61 273.97
-167 -222 -54 283.00
-160 -224 -55 280.72
-150 -222 -64 275.46
-143 -216 -66 267.32
-145 -223 -60 272.68
-130 -233 -67 275.10
-124 -233 -68 272.56
-108 -251 -80 284.72
-108 -249 -81 283.24
-112 -253 -70 285.40
-105 -255 -77 286.32
-98 -240 -74 269.59
-82 -246 -89 274.16
-83 -253 -82 278.61
-68 -248 -87 271.47
-75 -251 -75 272.49
-63 -249 -93 273.16
-64 -254 -87 276.01
-68 -256 -81 276.99
-58 -256 -80 274.41
-52 -262 -78 278.27
-47 -264 -84 281.00
-38 -254 -93 273.15
-47 -260 -79 275.77
-49 -261 -78 276.78
-31 -263 -91 280.02
-34 -257 -87 273.45
-16 -267 -101 285.91
-25 -261 -93 278.20
-26 -263 -87 278.23
-29 -260 -97 279.02
-18 -255 -82 268.46
-10 -260 -97 277.69
-11 -264 -94 280.45
-16 -257 -88 272.12
-3 -257 -96 274.36
4 -256 -97 273.79
-6 -257 -87 271.39
-8 -265 -90 279.98
7 -257 -102 276.59
3 -260 -95 276.83
8 -264 -99 282.07
10 -260 -97 277.69
20 -254 -109 277.12
12 -253 -99 271.94
13 -264 -101 282.96
18 -254 -103 274.68
15 -257 -100 276.18
31 -255 -106 277.89
23 -256 -101 276.16
24 -258 -106 279.96
32 -250 -102 271.90
31 -253 -106 276.05
40 -254 -106 278.12
41 -253 -113 280.11
47 -250 -115 279.17
49 -255 -118 285.22
49 -255 -114 283.59
44 -256 -109 281.70
44 -249 -112 276.55
39 -251 -105 274.86
41 -242 -102 265.80
39 -247 -105 271.21
46 -254 -113 281.78
47 -246 -115 275.59
37 -251 -113 277.74
28 -249 -105 271.68
38 -256 -108 280.44
18 -266 -95 283.03
32 -264 -109 287.40
20 -255 -101 275.00
8 -276 -97 292.66
-6 -257 -87 271.39
-12 -297 -93 311.45
-1 -259 -94 275.53
-13 -264 -96 281.21
-29 -284 -92 299.94
-67 -250 -80 270.90
-87 -254 -67 276.72
-98 -234 -58 260.24
-114 -239 -51 269.66
-123 -235 -57 271.30
-139 -229 -54 273.27
-151 -217 -47 268.51
-179 -211 -43 280.02
-183 -195 -47 271.52
-192 -166 -33 255.95
-196 -176 -41 266.60
-209 -152 -33 260.53
-219 -154 -32 269.63
-219 -146 -41 266.38
-245 -130 -28 278.76
-242 -119 -35 271.94
-239 -104 -39 263.55
-251 -97 -32 270.99
-245 -73 -36 258.17
-252 -63 -32 261.72
-254 -63 -38 264.44
-258 -57 -35 266.53
-256 -47 -43 263.81
-266 -42 -33 271.31
-267 -36 -37 271.94
-265 -36 -39 270.26
-257 -30 -45 262.63
-256 -15 -39 259.39
-255 -20 -42 259.21
-258 -3 -34 260.25
-259 -17 -40 262.62
-258 -16 -47 262.73
-272 -10 -34 274.30
-264 -11 -41 267.39
-267 -18 -43 271.04
-272 0 -27 273.34
-274 -11 -27 275.55
-262 -13 -38 265.06
-259 7 -32 261.06
-253 20 -36 256.33
-271 14 -34 273.48
-273 10 -39 275.95
-270 32 -46 275.75
-260 37 -63 270.07
-256 31 -60 264.76
-256 -1 -67 264.62
-239 1 -78 251.41
-268 6 -47 272.16
-256 16 -55 262.33
-272 1 -42 275.23
-251 56 -42 260.58
-242 -14 -56 248.79
-279 -10 -33 281.12
-273 8 -79 284.31
-279 -45 -41 285.56
-279 14 -43 282.64
-272 -28 -48 277.62
-269 -27 -51 275.12
-268 -14 -57 274.35
-285 -31 -48 290.67
-300 1 -36 302.15
-266 4 -35 268.32
-246 -21 -59 253.85
-248 -15 -42 251.98
-294 0 -51 298.39
-254 0 -65 262.19
-257 -13 -64 265.17
-254 9 -57 260.47
-260 7 -59 266.70
-256 42 -17 259.98
-261 40 -34 266.23
-258 56 -40 267.02
-256 64 -43 267.36
-264 18 -45 268.41
-259 28 -21 261.35
-266 29 -34 269.73
-264 34 -36 268.60
-262 32 -36 266.39
-261 32 -37 265.54
-262 35 -40 267.34
-261 37 -37 266.19
-261 32 -38 265.69
-261 35 -38 266.06
-262 37 -38 267.31
-262 35 -38 267.04
-261 34 -39 266.08
-262 35 -39 267.19
-262 34 -38 266.92
-262 35 -38 267.04
-262 36 -39 267.32
-263 35 -40 268.32
-261 34 -37 265.79
-261 35 -38 266.06
-262 37 -37 267.17
-262 35 -39 267.19
-263 36 -39 268.30
-262 35 -40 267.34
-262 34 -37 266.78
-261 34 -39 266.08
-262 35 -39 267.19
-260 33 -36 264.55
-261 35 -38 266.06
-262 35 -37 266.90
-261 34 -38 265.93
-260 35 -38 265.08
-262 36 -39 267.32
-260 35 -38 265.08
-262 34 -38 266.92
-261 35 -39 266.21
-262 34 -37 266.78
-262 35 -39 267.19
-261 34 -39 266.08
-263 36 -40 268.45
-262 35 -38 267.04
-262 35 -39 267.19
-263 35 -38 268.03
-261 35 -40 266.36
-261 35 -38 266.06
-261 35 -38 266.06
-262 34 -38 266.92
-262 34 -38 266.92
-261 34 -40 266.23
-262 35 -39 267.19
-262 35 -40 267.34
-261 35 -39 266.21
-262 35 -38 267.04
-262 36 -37 267.04
-262 35 -37 266.90
-262 36 -39 267.32
-262 35 -38 267.04
-263 35 -39 268.17
-261 36 -38 266.20
-263 36 -38 268.16
-262 36 -39 267.32
-261 34 -40 266.23
-261 34 -38 265.93
-262 35 -38 267.04
-260 34 -39 265.10
-261 34 -39 266.08
-262 35 -39 267.19
-262 35 -39 267.19
-261 34 -37 265.79
-261 34 -38 265.93
-260 34 -39 265.10
-261 33 -38 265.81
-261 35 -39 266.21
-262 34 -38 266.92
-262 35 -38 267.04
-262 36 -38 267.18
-261 35 -39 266.21
-262 35 -40 267.34
-262 33 -38 266.79
-261 34 -37 265.79
-259 32 -37 263.58
-261 34 -40 266.23
-260 34 -37 264.81
-261 35 -38 266.06
-262 34 -39 267.06
-263 36 -39 268.30
-261 35 -39 266.21
-262 35 -38 267.04
-261 34 -38 265.93
-262 35 -40 267.34
-262 35 -41 267.49
-262 35 -38 267.04
-261 35 -37 265.92
-261 34 -37 265.79
-262 35 -39 267.19
-260 33 -39 264.97
-262 35 -38 267.04
-261 34 -37 265.79
-261 35 -39 266.21
-262 34 -37 266.78
-261 35 -39 266.21
-261 35 -38 266.06
-262 35 -38 267.04
-261 35 -41 266.51
-261 34 -40 266.23
-261 34 -36 265.66
-262 34 -41 267.36
-262 34 -37 266.78
-262 36 -38 267.18
-262 36 -39 267.32
-262 35 -39 267.19
-262 34 -39 267.06
-260 34 -39 265.10
-261 34 -38 265.93
-262 35 -38 267.04
-260 34 -39 265.10
-261 34 -37 265.79
-261 35 -38 266.06
-261 35 -40 266.36
-261 35 -39 266.21
-263 34 -41 268.34
-262 36 -39 267.32
-262 35 -38 267.04
-261 34 -39 266.08
-261 34 -38 265.93
-261 35 -37 265.92
-261 33 -39 265.95
-261 34 -40 266.23
-261 34 -38 265.93
-263 35 -38 268.03
-262 33 -38 266.79
-263 37 -39 268.44
-262 35 -38 267.04
-261 35 -39 266.21
-262 36 -40 267.47
-261 34 -38 265.93
-262 35 -38 267.04
-262 35 -38 267.04
-262 34 -38 266.92
-261 34 -39 266.08
-262 34 -38 266.92
-262 36 -39 267.32
-261 34 -40 266.23
-261 34 -37 265.79
-263 34 -39 268.04
-261 34 -37 265.79
-260 35 -39 265.23
-261 34 -39 266.08
-262 34 -38 266.92
-262 34 -38 266.92
-261 33 -39 265.95
-261 34 -39 266.08
-262 35 -38 267.04
-262 35 -38 267.04
-261 35 -38 266.06
-262 36 -39 267.32
-261 34 -38 265.93
-261 34 -37 265.79
-262 35 -38 267.04
-261 35 -39 266.21
-262 35 -39 267.19
-262 35 -38 267.04
-261 35 -37 265.92
-261 34 -38 265.93
-261 35 -37 265.92
-262 34 -38 266.92
-262 35 -37 266.90
-261 34 -37 265.79
-262 35 -39 267.19
-262 36 -37 267.04
-262 34 -40 267.21
-262 35 -39 267.19
-261 34 -39 266.08
-261 33 -39 265.95
-262 34 -38 266.92
-261 34 -37 265.79
-262 35 -37 266.90
-260 34 -39 265.10
-262 34 -40 267.21
-261 34 -39 266.08
-262 34 -39 267.06
-262 36 -40 267.47
-261 34 -39 266.08
-261 34 -37 265.79
-262 35 -38 267.04
-261 34 -39 266.08
-261 35 -36 265.79
-263 35 -38 268.03
-262 34 -37 266.78
-261 34 -39 266.08
-262 34 -39 267.06
-261 35 -38 266.06
-262 35 -39 267.19
-263 37 -39 268.44
-261 35 -39 266.21
-261 35 -39 266.21
-261 35 -36 265.79
-262 34 -40 267.21
-261 35 -38 266.06
-261 34 -39 266.08
-261 35 -40 266.36
-262 35 -39 267.19
-261 34 -38 265.93
-263 35 -39 268.17
-262 35 -38 267.04
-261 34 -39 266.08
-262 35 -39 267.19
-262 35 -38 267.04
-262 33 -38 266.79
-262 35 -37 266.90
-262 36 -39 267.32
-261 36 -36 265.92
-263 36 -37 268.02
-262 35 -37 266.90
-261 34 -38 265.93
-261 35 -38 266.06
-262 35 -38 267.04
-261 34 -38 265.93
-262 35 -37 266.90
-262 35 -38 267.04
-262 35 -38 267.04
-262 35 -41 267.49
-261 36 -37 266.06
-259 33 -39 263.99
-261 34 -38 265.93
-261 35 -39 266.21
-262 33 -38 266.79
-262 35 -38 267.04
-262 35 -38 267.04
-262 35 -39 267.19
-262 34 -37 266.78
-263 36 -39 268.30
-261 34 -36 265.66
-262 34 -37 266.78
-262 36 -38 267.18
-262 34 -39 267.06
-260 34 -38 264.95
-262 35 -37 266.90
-263 35 -37 267.89
-262 35 -39 267.19
-261 35 -36 265.79
-261 34 -40 266.23
-262 35 -38 267.04
-261 34 -38 265.93
-262 34 -38 266.92
-262 35 -38 267.04
-262 35 -37 266.90
-261 35 -38 266.06
-261 34 -38 265.93
-261 35 -38 266.06
-261 34 -40 266.23
-262 34 -37 266.78
-261 34 -40 266.23
-262 35 -38 267.04
-261 34 -40 266.23
-261 35 -40 266.36
-262 34 -40 267.21
-263 35 -38 268.03
-261 34 -39 266.08
-262 35 -39 267.19
-261 34 -38 265.93
-261 35 -39 266.21
-261 35 -39 266.21
-262 34 -38 266.92
-261 34 -38 265.93
-261 35 -38 266.06
-261 35 -39 266.21
-262 36 -38 267.18
-262 33 -38 266.79
-263 35 -37 267.89
-261 35 -39 266.21
-261 33 -38 265.81
-261 33 -39 265.95
-262 34 -40 267.21
-261 34 -38 265.93
-262 36 -39 267.32
-262 36 -40 267.47
-261 34 -39 266.08
-262 34 -38 266.92
-261 34 -38 265.93
-260 34 -38 264.95
-261 35 -39 266.21
-261 35 -39 266.21
-262 35 -36 266.77
-262 34 -36 266.64
-263 36 -38 268.16
-260 34 -39 265.10
-262 36 -37 267.04
-261 34 -39 266.08
-261 34 -39 266.08
-261 35 -39 266.21
-261 33 -38 265.81
-262 35 -39 267.19
-262 35 -37 266.90
-261 35 -40 266.36
-263 35 -37 267.89
-262 35 -40 267.34
-262 35 -38 267.04
-262 37 -37 267.17
-262 34 -39 267.06
-262 34 -37 266.78
-261 34 -39 266.08
-261 35 -37 265.92
-261 34 -36 265.66
-261 35 -39 266.21
-261 34 -37 265.79
-261 35 -39 266.21
-262 35 -39 267.19
-261 34 -39 266.08
-260 33 -38 264.83
-262 35 -38 267.04
-261 35 -37 265.92
-261 34 -38 265.93
-262 34 -39 267.06
-260 34 -39 265.10
-261 35 -39 266.21
-262 35 -38 267.04
-261 34 -39 266.08
-262 34 -39 267.06
-261 34 -38 265.93
-261 35 -39 266.21
-261 33 -38 265.81
-261 34 -39 266.08
-261 34 -38 265.93
-261 35 -37 265.92
-261 34 -38 265.93
-260 34 -37 264.81
-262 34 -38 266.92
-261 34 -38 265.93
-261 36 -38 266.20
-261 34 -40 266.23
-261 34 -36 265.66
-262 34 -39 267.06
-261 33 -41 266.25
-261 33 -37 265.67
-262 36 -40 267.47
-262 34 -39 267.06
-261 34 -37 265.79
-261 35 -37 265.92
-260 35 -40 265.38
-262 36 -40 267.47
-260 35 -38 265.08
-261 35 -37 265.92
-262 34 -39 267.06
-261 34 -39 266.08
-262 34 -39 267.06
-262 34 -38 266.92
-262 34 -39 267.06
-261 35 -39 266.21
-262 35 -39 267.19
-261 35 -38 266.06
-263 36 -39 268.30
-262 34 -39 267.06
-260 34 -39 265.10
-262 36 -37 267.04
-262 34 -38 266.92
-261 34 -37 265.79
-263 35 -39 268.17
-262 35 -38 267.04
-263 34 -40 268.19
-262 33 -38 266.79
-262 35 -39 267.19
-263 36 -40 268.45
-261 35 -36 265.79
-262 34 -39 267.06
-263 36 -39 268.30
-261 34 -38 265.93
-262 34 -40 267.21
-262 35 -38 267.04
-263 36 -39 268.30
-262 34 -38 266.92
-263 36 -38 268.16
-262 35 -40 267.34
-261 35 -39 266.21
-262 35 -38 267.04
-261 33 -38 265.81
-261 34 -37 265.79
-260 35 -39 265.23
-261 35 -37 265.92
-262 34 -39 267.06
-262 35 -37 266.90
-262 35 -36 266.77
-261 35 -38 266.06
-261 34 -37 265.79
-261 34 -39 266.08
-262 36 -38 267.18
-262 35 -39 267.19
-262 34 -38 266.92
-263 36 -40 268.45
-261 34 -40 266.23
-261 34 -38 265.93
-262 34 -38 266.92
-261 35 -37 265.92
-262 35 -38 267.04
-262 35 -38 267.04
-262 34 -38 266.92
-261 34 -38 265.93
-261 35 -38 266.06
-263 35 -38 268.03
-261 34 -39 266.08
-262 36 -37 267.04
-260 34 -37 264.81
-262 35 -39 267.19
-262 33 -38 266.79
-261 36 -38 266.20
-261 35 -38 266.06
-261 35 -39 266.21
-261 35 -38 266.06
-260 34 -38 264.95
-262 36 -38 267.18
-261 34 -39 266.08
-261 34 -39 266.08
-262 34 -39 267.06
-263 35 -38 268.03
-261 35 -39 266.21
-261 35 -38 266.06
-262 35 -39 267.19
-262 35 -38 267.04
-261 35 -38 266.06
-262 35 -37 266.90
-261 35 -38 266.06
-261 34 -38 265.93
-262 34 -37 266.78
-262 35 -38 267.04
-260 34 -39 265.10
-262 34 -39 267.06
-261 34 -39 266.08
-262 34 -40 267.21
-261 34 -38 265.93
-262 34 -38 266.92
-261 34 -39 266.08
-262 35 -38 267.04
-260 33 -40 265.12
-262 34 -39 267.06
-262 35 -38 267.04
-262 35 -38 267.04
-262 35 -38 267.04
-261 34 -38 265.93
-263 36 -38 268.16
-262 34 -39 267.06
-261 34 -39 266.08
-262 35 -39 267.19
-261 34 -39 266.08
-261 35 -39 266.21
-262 35 -38 267.04
-262 34 -37 266.78
-262 34 -38 266.92
-262 34 -39 267.06
-261 33 -38 265.81
-261 35 -38 266.06
-262 35 -37 266.90
-261 34 -39 266.08
-261 34 -37 265.79
-261 34 -38 265.93
-261 35 -38 266.06
-263 35 -39 268.17
-261 34 -39 266.08
-262 35 -38 267.04
-262 34 -39 267.06
-261 35 -39 266.21
-263 36 -38 268.16
-261 34 -37 265.79
-262 34 -38 266.92
-262 35 -40 267.34
-262 35 -40 267.34
-263 35 -39 268.17
-261 34 -39 266.08
-262 36 -37 267.04
-261 35 -38 266.06
-262 35 -38 267.04
-261 34 -37 265.79
-262 35 -40 267.34
-261 34 -38 265.93
-262 35 -40 267.34
-261 35 -38 266.06
-262 34 -38 266.92
-261 35 -38 266.06
-262 36 -39 267.32
-262 34 -37 266.78
-262 33 -38 266.79
-264 35 -38 269.01
-261 34 -38 265.93
-261 34 -41 266.38
-261 35 -37 265.92
-262 35 -38 267.04
-261 34 -38 265.93
-261 34 -38 265.93
-262 34 -39 267.06
-262 34 -38 266.92
-261 34 -38 265.93
-262 35 -37 266.90
-262 35 -40 267.34
-262 35 -39 267.19
-261 35 -38 266.06
-261 34 -37 265.79
-262 36 -38 267.18
-261 33 -38 265.81
-261 35 -38 266.06
-261 34 -39 266.08
-261 33 -38 265.81
-263 34 -38 267.90
-260 35 -37 264.94
-262 35 -38 267.04
-261 34 -38 265.93
-261 35 -37 265.92
-262 36 -36 266.90
-262 36 -38 267.18
-262 35 -37 266.90
-262 34 -38 266.92
-262 36 -38 267.18
-262 34 -38 266.92
-261 35 -39 266.21
-261 35 -38 266.06
-261 35 -38 266.06
-261 34 -38 265.93
-260 34 -39 265.10
-261 34 -36 265.66
-262 36 -38 267.18
-262 34 -39 267.06
-261 35 -39 266.21
/branches/V0.82b-Arthur-P/adxl345driver/examples/ADXL345_run/cal1.dat
0,0 → 1,885
-262 34 -40 267.21
-262 33 -39 266.93
-261 33 -40 266.10
-261 34 -40 266.23
-261 35 -39 266.21
-262 32 -39 266.81
-261 34 -41 266.38
-262 34 -38 266.92
-256 27 -34 259.66
-268 82 -45 283.85
-271 24 -38 274.70
-265 24 -30 267.77
-267 40 -28 271.43
-294 46 -10 297.74
-288 39 -21 291.39
-279 53 -17 284.50
-284 54 -12 289.34
-254 47 -37 260.95
-252 86 -26 267.54
-256 85 -37 272.27
-225 80 -63 246.97
-218 104 -67 250.66
-197 138 -72 251.07
-224 136 -62 269.29
-196 156 -65 258.80
-194 168 -63 264.25
-184 168 -56 255.37
-184 183 -47 263.73
-162 215 -51 273.99
-160 208 -44 266.08
-142 225 -44 269.68
-140 212 -40 257.18
-135 217 -26 256.89
-122 226 -25 258.04
-130 241 -13 274.14
-110 249 -16 272.68
-104 244 -21 266.07
-100 238 -22 259.09
-94 236 -33 256.17
-92 234 -40 254.60
-95 242 -30 261.70
-94 247 -30 265.98
-85 251 -23 266.00
-79 252 -17 264.64
-73 250 -20 261.21
-56 242 -27 249.86
-63 253 -14 261.10
-29 257 -20 259.40
-38 263 -9 265.88
-11 255 -23 256.27
-14 260 -12 260.65
4 253 -17 253.60
-3 256 -4 256.05
12 255 -7 255.38
28 250 -5 251.61
36 251 0 253.57
49 243 -6 247.96
25 256 8 257.34
48 244 -2 248.68
50 247 0 252.01
67 251 4 259.82
61 249 9 256.52
69 239 12 249.05
84 249 12 263.06
100 231 14 252.11
108 225 15 250.03
116 213 13 242.89
121 219 13 250.54
126 219 20 253.45
132 207 15 245.96
139 202 12 245.50
148 202 12 250.70
154 196 17 249.84
158 196 20 252.55
149 189 31 242.66
159 185 32 246.03
176 187 36 259.31
182 161 33 245.22
187 169 40 255.21
191 150 34 245.23
199 150 30 251.00
204 132 25 244.26
201 143 33 248.88
204 131 28 244.05
207 125 25 243.10
206 129 32 245.16
214 127 26 250.20
223 124 22 256.10
217 122 24 250.10
215 115 17 244.42
220 107 12 244.93
221 109 11 246.66
225 115 11 252.92
218 105 4 242.00
226 105 -4 249.23
222 109 1 247.32
230 112 -4 255.85
241 119 -6 268.85
227 95 -10 246.28
224 84 -16 239.77
225 91 -9 242.87
230 87 -12 246.20
241 83 -11 255.13
244 72 -17 254.97
241 71 -15 251.69
233 81 -14 247.07
241 83 -8 255.02
246 86 -12 260.88
258 73 -26 269.39
232 75 -20 244.64
242 65 -32 252.61
233 69 -17 243.60
248 66 -31 258.50
243 70 -20 253.67
244 66 -21 253.64
246 61 -20 254.24
245 65 -19 254.19
247 64 -27 256.58
238 62 -24 247.11
247 64 -21 256.02
250 63 -20 258.59
250 62 -21 258.43
252 50 -22 257.85
249 42 -21 253.39
249 29 -24 251.83
251 38 -18 254.50
251 27 -24 253.59
252 21 -24 254.01
248 16 -23 249.58
248 25 -13 249.60
253 19 -18 254.35
259 9 -22 260.09
255 9 -14 255.54
255 1 -18 255.64
245 3 -10 245.22
251 1 -12 251.29
263 0 -12 263.27
254 -12 -11 254.52
247 -6 -3 247.09
256 -13 -9 256.49
263 -12 -5 263.32
256 -19 -10 256.90
249 -11 0 249.24
249 -13 -7 249.44
245 -10 -6 245.28
252 -15 -6 252.52
251 -22 -9 252.12
250 -21 -5 250.93
256 -18 -1 256.63
262 -13 1 262.32
259 -4 -1 259.03
262 -4 -5 262.08
245 0 -5 245.05
241 4 -9 241.20
248 35 3 250.48
252 35 5 254.47
251 32 -4 253.06
254 61 7 261.32
239 61 2 246.67
254 77 -2 265.42
223 90 0 240.48
223 96 -6 242.86
212 130 -10 248.89
210 144 0 254.63
215 139 -5 256.07
190 185 17 265.73
180 186 0 258.84
154 191 7 245.45
132 204 9 243.15
141 205 -8 248.94
107 222 1 246.44
91 232 2 249.22
64 238 11 246.70
67 245 6 254.07
15 251 19 252.16
14 255 9 255.54
-1 257 10 257.20
-12 261 10 261.47
-44 256 6 259.82
-55 234 1 240.38
-65 244 5 252.56
-80 256 11 268.43
-86 237 -8 252.25
-113 237 5 262.61
-121 214 -9 246.00
-146 216 -5 260.76
-160 214 -3 267.22
-166 191 -13 253.39
-183 199 -11 270.58
-179 177 -19 252.45
-210 161 -16 265.10
-217 154 -19 266.77
-211 135 -30 252.28
-228 129 -23 262.97
-239 114 -21 265.63
-240 109 -27 264.97
-251 106 -21 273.27
-248 74 -30 260.54
-254 78 -28 267.18
-251 65 -39 262.20
-259 40 -36 264.53
-258 49 -33 264.68
-257 12 -38 260.07
-260 1 -38 262.76
-266 0 -33 268.04
-269 -26 -42 273.50
-260 -55 -44 269.37
-265 -43 -42 271.73
-252 -60 -47 263.27
-255 -84 -52 273.47
-243 -101 -51 268.05
-237 -126 -49 272.85
-233 -132 -46 271.71
-216 -127 -54 256.32
-209 -162 -49 268.93
-215 -157 -48 270.51
-211 -163 -46 270.57
-185 -190 -59 271.67
-185 -191 -54 271.33
-183 -212 -57 285.80
-162 -215 -56 274.96
-132 -219 -65 263.84
-134 -228 -61 271.41
-123 -231 -65 269.66
-118 -244 -66 278.96
-88 -251 -75 276.35
-85 -253 -74 276.97
-71 -246 -71 265.70
-51 -251 -83 269.24
-53 -252 -75 268.21
-38 -271 -84 286.25
-38 -273 -82 287.57
-34 -268 -82 282.32
-4 -263 -90 278.00
13 -260 -97 277.81
19 -259 -94 276.18
18 -255 -94 272.37
25 -272 -95 289.20
28 -264 -97 282.65
40 -255 -106 279.04
51 -249 -109 276.56
67 -238 -118 273.97
73 -241 -120 278.94
79 -247 -122 286.59
90 -230 -128 278.18
101 -224 -131 278.46
94 -222 -133 275.33
97 -217 -134 272.86
105 -204 -135 266.21
100 -215 -132 271.38
112 -206 -135 270.56
123 -207 -137 277.03
126 -197 -141 273.07
126 -191 -138 267.21
139 -196 -144 280.13
152 -194 -143 284.94
156 -183 -143 279.77
161 -176 -141 277.09
150 -173 -141 268.91
167 -168 -141 275.67
170 -166 -136 273.77
171 -169 -137 276.71
181 -157 -144 279.55
179 -146 -140 270.11
188 -138 -138 270.98
184 -130 -140 265.25
195 -125 -141 271.17
196 -121 -140 269.55
192 -129 -137 268.84
214 -108 -137 276.10
197 -110 -131 260.90
208 -99 -140 269.56
220 -89 -135 273.03
221 -104 -130 276.69
235 -95 -133 286.25
221 -96 -132 274.74
221 -77 -128 266.75
222 -79 -128 268.16
214 -85 -128 263.45
219 -69 -131 264.35
220 -87 -120 265.27
218 -79 -120 261.08
239 -62 -125 276.75
237 -71 -113 271.99
242 -62 -114 274.60
227 -71 -105 259.99
244 -70 -111 277.05
238 -39 -105 263.04
241 -62 -100 268.19
236 -66 -102 265.44
241 -55 -101 267.03
241 -69 -96 268.44
252 -47 -106 277.40
237 -56 -96 261.77
242 -54 -101 267.73
224 -59 -91 248.87
235 -56 -95 259.59
234 -46 -80 251.54
250 -51 -84 268.62
250 -59 -76 267.87
244 -63 -77 263.50
247 -62 -78 266.34
245 -58 -78 263.58
247 -57 -77 264.93
248 -55 -77 265.44
244 -54 -72 260.07
246 -64 -79 266.18
247 -62 -77 266.05
247 -52 -74 263.04
243 -63 -74 261.71
248 -62 -80 267.86
242 -60 -73 259.79
249 -54 -75 265.60
248 -63 -77 267.21
242 -60 -73 259.79
245 -61 -75 263.38
245 -63 -76 264.14
246 -51 -72 261.34
245 -67 -76 265.12
239 -64 -74 258.25
236 -80 -78 261.11
243 -58 -81 262.63
228 -89 -76 256.28
243 -66 -80 264.21
222 -102 -75 255.56
232 -83 -79 258.75
239 -101 -87 273.66
229 -99 -84 263.25
220 -138 -88 274.20
212 -97 -78 245.84
221 -145 -88 278.59
203 -148 -93 267.88
190 -154 -92 261.30
196 -158 -96 269.44
186 -149 -87 253.70
191 -174 -89 273.27
190 -196 -98 290.03
167 -192 -98 272.68
143 -225 -87 280.43
157 -230 -102 296.57
137 -220 -96 276.38
129 -221 -102 275.47
88 -219 -105 258.32
107 -244 -121 292.62
80 -232 -107 267.72
69 -264 -119 297.69
57 -250 -108 278.23
55 -246 -121 279.61
41 -247 -124 279.40
-1 -251 -112 274.86
-2 -255 -116 280.15
6 -244 -123 273.31
-21 -256 -108 278.64
-35 -249 -118 277.76
-49 -248 -114 277.31
-47 -241 -122 274.18
-72 -248 -120 284.76
-89 -230 -109 269.63
-106 -241 -109 284.95
-105 -232 -112 278.20
-122 -220 -113 275.78
-133 -225 -103 280.93
-141 -209 -100 271.22
-164 -198 -97 274.79
-163 -196 -96 272.40
-175 -193 -90 275.63
-179 -201 -91 284.12
-183 -189 -91 278.37
-194 -182 -84 278.96
-191 -179 -89 276.48
-205 -165 -81 275.34
-209 -163 -80 276.86
-208 -153 -81 270.62
-219 -153 -75 277.48
-219 -145 -78 273.99
-233 -133 -71 277.52
-229 -139 -75 278.19
-231 -116 -74 268.87
-242 -110 -68 274.39
-240 -107 -70 271.94
-245 -102 -68 273.96
-246 -95 -66 271.84
-250 -91 -64 273.64
-250 -87 -67 273.05
-253 -85 -62 274.00
-259 -74 -57 275.33
-257 -68 -59 272.31
-257 -62 -60 271.10
-257 -62 -56 270.24
-263 -50 -55 273.30
-256 -51 -57 267.18
-262 -48 -54 271.78
-258 -42 -55 267.12
-261 -18 -57 267.76
-270 -27 -49 275.74
-261 -15 -54 266.95
-266 -17 -50 271.19
-263 -7 -51 267.99
-265 -18 -45 269.40
-264 -14 -44 268.01
-272 -18 -36 274.96
-258 -13 -41 261.56
-266 -21 -29 268.40
-262 -24 -29 264.69
-259 -22 -23 260.95
-279 -28 -10 280.58
-264 -8 -7 264.21
-255 -19 -7 255.80
-268 -13 -1 268.32
-259 -11 4 259.26
-264 -6 19 264.75
-252 -5 24 253.19
-268 -15 42 271.69
-244 -4 31 245.99
-235 -22 29 237.80
-244 -4 53 249.72
-243 -8 65 251.67
-240 -4 79 252.70
-255 -6 92 271.15
-227 -15 100 248.50
-217 -7 115 245.69
-201 -12 118 233.39
-206 -12 128 242.83
-183 -1 130 224.48
-172 -4 143 223.72
-190 5 150 242.13
-162 11 156 225.17
-165 11 171 237.88
-146 9 178 230.39
-144 12 190 238.70
-127 2 186 225.23
-106 1 185 213.22
-120 -4 194 228.15
-94 -8 200 221.13
-104 2 202 227.21
-77 6 209 222.81
-75 2 214 226.77
-61 1 207 215.80
-51 6 205 211.33
-62 12 214 223.12
-41 5 210 214.02
-43 0 216 220.24
-27 2 210 211.74
-23 12 213 214.57
-18 6 217 217.83
-8 4 212 212.19
-6 7 214 214.20
-6 1 218 218.08
-10 -1 221 221.23
8 -2 213 213.16
10 -8 213 213.38
3 2 217 217.03
18 8 221 221.88
14 6 218 218.53
34 2 208 210.77
36 3 208 211.11
51 -2 204 210.29
51 -6 207 213.27
60 1 212 220.33
57 -1 211 218.57
78 1 206 220.27
82 1 199 215.23
87 3 198 216.29
102 -4 186 212.17
101 0 189 214.29
121 2 191 226.11
119 -2 186 220.82
137 -4 176 223.07
138 -3 181 227.63
139 -4 181 228.25
153 0 177 233.96
162 -5 157 225.65
169 -11 147 224.26
161 -11 148 218.97
175 -8 135 221.17
192 -11 142 239.06
174 -9 142 224.77
206 -11 111 234.26
198 -17 120 232.15
198 -23 116 230.63
217 -28 109 244.45
212 -27 104 237.67
226 -27 85 242.96
232 -17 88 248.71
212 -21 94 232.85
246 -27 70 257.19
234 -29 65 244.59
238 -24 50 244.38
250 -16 49 255.26
205 -32 65 217.43
251 -33 44 256.96
256 -27 33 259.53
226 -26 39 230.81
245 -38 33 250.12
233 -30 38 237.98
253 -20 22 254.74
255 -23 12 256.32
252 -29 2 253.67
248 -31 5 249.98
242 -27 9 243.67
248 -24 4 249.19
257 -24 -10 258.31
250 -25 1 251.25
255 -29 2 256.65
245 -34 2 247.36
260 -31 -2 261.85
256 -24 -8 257.25
249 -25 -8 250.38
246 -26 -3 247.39
253 -28 -7 254.64
244 -28 1 245.60
260 -36 10 262.67
243 -37 22 246.78
253 -28 11 254.78
250 -22 21 251.84
242 -41 24 246.62
240 -39 42 246.75
236 -34 63 246.62
217 -25 64 227.62
204 -30 79 220.81
224 -42 91 245.40
250 -46 103 274.27
174 -40 129 220.27
211 -38 124 247.67
127 -7 152 198.20
230 -30 159 281.21
172 -38 144 227.52
172 -36 146 228.46
129 -29 184 226.58
74 -26 204 218.56
77 -17 197 212.20
73 -7 201 213.96
72 -13 210 222.38
34 -7 213 215.81
30 -23 208 211.41
-17 -9 238 238.78
-8 -24 232 233.38
-23 -19 224 225.98
-40 -2 222 225.58
-61 -12 208 217.09
-83 0 213 228.60
-90 0 204 222.97
-93 -5 197 217.91
-122 -5 190 225.85
-122 -4 186 222.48
-167 3 193 255.24
-131 -15 170 215.14
-174 -2 166 240.49
-147 -19 136 201.16
-193 -8 149 243.95
-207 16 144 252.67
-231 6 120 260.38
-211 1 106 236.13
-220 -1 107 244.64
-235 -2 106 257.81
-253 16 84 267.06
-236 13 64 244.87
-212 -13 38 215.77
-243 1 42 246.60
-237 0 19 237.76
-275 4 37 277.51
-249 4 16 249.55
-236 -17 -2 236.62
-276 -2 13 276.31
-255 -8 -15 255.57
-281 5 -8 281.16
-256 -5 -28 257.58
-262 -6 -31 263.90
-253 -9 -41 256.46
-268 0 -38 270.68
-259 -8 -49 263.72
-277 5 -42 280.21
-257 -9 -69 266.25
-250 -2 -80 262.50
-260 -11 -81 272.55
-269 3 -74 279.01
-259 -3 -93 275.21
-257 36 -88 274.02
-247 3 -105 268.41
-262 10 -104 282.06
-238 7 -131 271.76
-237 13 -129 270.15
-225 2 -148 269.32
-237 22 -137 274.63
-238 18 -141 277.22
-250 18 -141 287.58
-241 24 -146 282.79
-244 26 -150 287.60
-225 12 -174 284.68
-233 21 -170 289.19
-231 27 -166 285.74
-231 39 -167 287.70
-220 26 -178 284.18
-199 16 -199 281.88
-207 32 -187 280.79
-191 29 -201 278.79
-187 31 -203 277.74
-203 57 -196 287.88
-200 42 -206 290.17
-190 23 -225 295.39
-190 27 -214 287.45
-185 32 -215 285.44
-179 42 -217 284.42
-173 42 -221 283.79
-168 34 -236 291.68
-166 30 -231 286.04
-171 38 -240 297.13
-167 38 -230 286.76
-153 28 -241 286.83
-146 23 -252 292.15
-130 2 -257 288.02
-108 49 -251 277.61
-108 31 -280 301.70
-82 29 -257 271.32
-95 4 -277 292.87
-78 33 -278 290.61
-57 31 -292 299.12
-51 13 -285 289.82
-36 40 -272 277.27
-26 42 -288 292.21
-29 6 -290 291.51
-11 9 -284 284.36
-2 20 -299 299.67
12 37 -292 294.58
23 22 -267 268.89
41 25 -263 267.35
41 23 -288 291.81
61 26 -279 286.77
63 27 -268 276.63
92 17 -266 281.97
88 26 -264 279.49
91 31 -265 281.90
110 11 -257 279.77
118 18 -263 288.82
127 30 -248 280.24
127 21 -257 287.44
138 11 -228 266.74
144 23 -240 280.83
158 21 -231 280.65
165 11 -220 275.22
169 26 -246 299.59
193 7 -188 269.52
190 20 -202 278.04
183 14 -223 288.81
198 22 -187 273.23
200 23 -209 290.19
215 13 -168 273.16
211 23 -184 280.90
224 17 -153 271.80
227 23 -159 278.10
232 13 -134 268.23
230 13 -139 269.05
234 14 -120 263.35
241 20 -125 272.22
240 9 -115 266.28
238 18 -107 261.57
247 8 -94 264.40
244 18 -106 266.64
251 20 -79 263.90
254 16 -90 269.95
252 7 -68 261.11
245 16 -97 263.99
249 21 -90 265.60
252 19 -95 269.98
252 6 -89 267.32
253 18 -109 276.07
245 14 -97 263.87
241 15 -98 260.60
236 22 -115 263.45
240 16 -105 262.45
251 6 -101 270.63
228 19 -119 257.89
243 14 -134 277.85
229 19 -113 256.07
243 16 -148 284.97
226 13 -122 257.16
221 27 -161 274.76
213 9 -162 267.76
203 26 -171 266.69
196 24 -198 279.64
206 25 -174 270.81
188 19 -202 276.60
192 19 -199 277.18
180 17 -218 283.22
162 29 -239 290.18
173 18 -213 274.99
155 30 -225 274.86
134 14 -258 291.06
125 34 -268 297.67
126 33 -251 282.78
108 29 -253 276.61
90 28 -273 288.81
88 40 -260 277.39
73 36 -272 283.92
60 30 -283 290.84
53 32 -281 287.74
29 46 -295 299.97
20 35 -285 287.84
4 46 -275 278.85
-17 38 -278 281.10
-44 46 -282 289.10
-54 56 -281 291.57
-73 45 -271 284.24
-76 55 -263 279.23
-111 54 -265 292.34
-121 43 -258 288.19
-122 67 -255 290.51
-141 50 -246 287.92
-157 73 -225 283.91
-170 67 -234 296.89
-177 62 -212 283.05
-198 79 -204 295.06
-199 62 -187 280.02
-210 58 -180 282.60
-195 88 -190 286.13
-236 66 -139 281.73
-227 74 -152 283.04
-229 70 -122 268.75
-244 58 -115 275.91
-245 72 -120 282.15
-262 10 -64 269.89
-261 25 -73 272.17
-259 20 -45 263.64
-252 36 -66 262.98
-256 24 -58 263.58
-259 10 -53 264.56
-257 21 -51 262.85
-285 -17 -35 287.64
-266 4 -34 268.19
-246 36 -55 254.63
-261 -2 -69 269.97
-237 2 -53 242.86
-255 -5 -63 262.71
-255 -22 -84 269.38
-270 -64 -42 280.64
-259 -38 -34 263.97
-284 -71 -69 300.76
-280 -4 -77 290.42
-242 6 -53 247.81
-282 -3 -29 283.50
-252 9 -74 262.79
-251 -36 -75 264.43
-268 -41 -82 283.25
-248 -33 -98 268.70
-281 -20 -35 283.88
-250 -26 -96 269.06
-305 -3 -4 305.04
-259 -11 -27 260.64
-270 -9 -32 272.04
-268 -25 -35 271.43
-271 -12 0 271.27
-263 25 2 264.19
-287 4 -5 287.07
-267 24 -29 269.64
-261 33 -20 263.84
-265 17 -12 265.82
-262 23 -19 263.69
-263 3 -22 263.94
-268 -5 -21 268.87
-265 16 -20 266.23
-264 14 -37 266.95
-264 6 -41 267.23
-262 11 -38 264.97
-264 12 -17 264.82
-281 8 -109 301.51
-209 97 -78 243.26
-280 -7 -46 283.84
-265 30 -52 271.71
-261 40 -35 266.36
-261 31 -41 266.01
-262 34 -43 267.67
-261 32 -39 265.83
-261 33 -38 265.81
-262 37 -41 267.76
-262 33 -41 267.23
-261 29 -41 265.79
-262 36 -39 267.32
-261 35 -43 266.82
-262 32 -37 266.53
-262 33 -38 266.79
-262 36 -41 267.62
-261 34 -39 266.08
-261 33 -39 265.95
-261 34 -42 266.54
-262 37 -41 267.76
-262 36 -40 267.47
-261 35 -41 266.51
-262 36 -40 267.47
-262 35 -41 267.49
-261 33 -42 266.41
-261 36 -39 266.34
-262 35 -41 267.49
-262 35 -43 267.80
-263 35 -42 268.62
-262 34 -38 266.92
-260 34 -39 265.10
-262 35 -41 267.49
-261 34 -40 266.23
-261 34 -40 266.23
-262 35 -40 267.34
-262 35 -39 267.19
-261 35 -43 266.82
-263 35 -42 268.62
-261 34 -42 266.54
-262 35 -40 267.34
-261 33 -41 266.25
-262 35 -39 267.19
-262 35 -40 267.34
-263 35 -40 268.32
-261 34 -41 266.38
-261 34 -40 266.23
-261 34 -40 266.23
-262 36 -40 267.47
-262 34 -41 267.36
-261 34 -39 266.08
-261 34 -41 266.38
-261 34 -40 266.23
-261 34 -39 266.08
-262 35 -40 267.34
-262 36 -40 267.47
-261 35 -38 266.06
-262 34 -42 267.51
-262 35 -41 267.49
-263 35 -39 268.17
-262 34 -41 267.36
-262 34 -40 267.21
-262 35 -41 267.49
-261 35 -42 266.66
-261 35 -40 266.36
-261 35 -40 266.36
-261 35 -39 266.21
-262 35 -39 267.19
-262 34 -40 267.21
-262 34 -41 267.36
-261 33 -40 266.10
-261 33 -40 266.10
-261 34 -39 266.08
-261 35 -42 266.66
-262 34 -41 267.36
-262 33 -39 266.93
-262 34 -40 267.21
-262 36 -40 267.47
-262 35 -41 267.49
-261 35 -40 266.36
-262 35 -39 267.19
-262 35 -40 267.34
-260 34 -40 265.25
-262 34 -40 267.21
-262 35 -40 267.34
-262 35 -40 267.34
-262 35 -40 267.34
-262 36 -39 267.32
-262 36 -39 267.32
-262 34 -39 267.06
-262 34 -41 267.36
-262 34 -40 267.21
-261 34 -41 266.38
-262 34 -40 267.21
-261 34 -40 266.23
-261 34 -41 266.38
-261 34 -40 266.23
-261 34 -39 266.08
-262 35 -42 267.64
-262 35 -37 266.90
-262 33 -40 267.08
-262 35 -41 267.49
-262 35 -38 267.04
-263 35 -41 268.47
-261 35 -39 266.21
-261 34 -41 266.38
-261 35 -39 266.21
-261 34 -39 266.08
-261 33 -40 266.10
-263 36 -41 268.60
-261 34 -40 266.23
-262 36 -40 267.47
-261 34 -42 266.54
-261 35 -40 266.36
-262 35 -38 267.04
-261 35 -41 266.51
-261 34 -41 266.38
-262 35 -37 266.90
-261 34 -39 266.08
-261 33 -41 266.25
-261 34 -40 266.23
/branches/V0.82b-Arthur-P/adxl345driver/examples/ADXL345_test/ADXL345_test.pde
0,0 → 1,234
#include "Wire.h"
#include "ADXL345.h"
 
ADXL345 accel;
 
void setup(void){
int x, y, z, i;
double xyz[3], gains[3], gains_orig[3];
 
Serial.begin(9600);
accel.init(ADXL345_ADDR_ALT_LOW);
accel.powerOn();
Serial.println("Arduino driver for ADXL345 3-axes accelerometer");
Serial.println("Version 2.0");
Serial.println("");
Serial.println("This program is free software; you can redistribute it and/or modify");
Serial.println("it under the terms of the GNU License V2.");
Serial.println("This program is distributed in the hope that it will be useful,");
Serial.println("but WITHOUT ANY WARRANTY; without even the implied warranty of");
Serial.println("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ");
Serial.println("GNU General Public License, version 2 for more details");
 
Serial.println("");
Serial.println("Original development: Kevin Stevenard");
Serial.println("Modified by Justin Shaw May 2010");
Serial.println("");
Serial.println("");
accel.getAxisGains(gains_orig);
Serial.println("gains_orig[]:");
for(i = 0; i < 3; i++){
Serial.print(gains_orig[i], 6);
Serial.print(" ");
}
Serial.println("");
 
gains[0] = .1;
gains[1] = 1.1;
gains[2] = 2.1;
accel.setAxisGains(gains);
accel.getAxisGains(gains);
Serial.println("set gains[]:");
for(i = 0; i < 3; i++){
Serial.print(gains[i]);
Serial.print(" ");
}
Serial.println("");
 
accel.setAxisGains(gains_orig);
accel.getAxisGains(gains);
Serial.println("original gains?");
for(i = 0; i < 3; i++){
Serial.print(gains[i], 6);
Serial.print(" ");
}
Serial.println("");
accel.readAccel(&x, &y, &z);
Serial.print("XYZ COUNTS: ");
Serial.print(x, DEC);
Serial.print(" ");
Serial.print(y, DEC);
Serial.print(" ");
Serial.print(z, DEC);
Serial.println("");
 
accel.get_Gxyz(xyz);
Serial.print("XYZ Gs: ");
for(i = 0; i<3; i++){
Serial.print(xyz[i], DEC);
Serial.print(" ");
}
Serial.println("");
 
accel.setTapThreshold(1);
Serial.print("getTapThreshold(): ");
Serial.println(accel.getTapThreshold(), DEC);
accel.setAxisOffset(2, 3, 4);
Serial.print("getAxisOffset(&x, &y, &z): ");
accel.getAxisOffset(&x, &y, &z);
Serial.print(x);
Serial.print(" ");
Serial.print(y);
Serial.print(" ");
Serial.print(z);
Serial.println("");
 
accel.setTapDuration(5);
Serial.print("getTapDuration(): ");
Serial.println(accel.getTapDuration(), DEC);
 
accel.setDoubleTapLatency(6);
Serial.print("getDoubleTapLatency(): ");
Serial.println(accel.getDoubleTapLatency(), DEC);
 
accel.setDoubleTapWindow(7);
Serial.print("getDoubleTapWindow() ");
Serial.println(accel.getDoubleTapWindow());
 
accel.setActivityThreshold(8);
Serial.print("getActivityThreshold() ");
Serial.println(accel.getActivityThreshold(), DEC);
 
accel.setInactivityThreshold(9);
Serial.print("getInactivityThreshold() ");
Serial.println(accel.getInactivityThreshold(), DEC);
 
accel.setTimeInactivity(10);
Serial.print("getTimeInactivity(): ");
Serial.println(accel.getTimeInactivity());
 
accel.setFreeFallThreshold(11);
Serial.print("getFreeFallThreshold(): ");
Serial.println(accel.getFreeFallThreshold());
 
accel.setFreeFallDuration(12);
Serial.print("getFreeFallDuration(): ");
Serial.println(accel.getFreeFallDuration(), DEC);
 
Serial.print("isActivityXEnabled(): ");
Serial.println(accel.isActivityXEnabled(), DEC);
 
Serial.print("isActivityYEnabled(): ");
Serial.println(accel.isActivityYEnabled(), DEC);
 
Serial.print("isActivityZEnabled(): ");
Serial.println(accel.isActivityZEnabled(), DEC);
 
Serial.print("isInactivityXEnabled(): ");
Serial.println(accel.isInactivityXEnabled(), DEC);
 
Serial.print("isInactivityYEnabled(): ");
Serial.println(accel.isInactivityYEnabled(), DEC);
 
Serial.print("isInactivityZEnabled(): ");
Serial.println(accel.isInactivityZEnabled(), DEC);
 
Serial.print("isActivityAc(): ");
Serial.println(accel.isInactivityAc(), DEC);
 
accel.setActivityAc(true);
accel.setInactivityAc(true);
 
accel.setSuppressBit(true);
Serial.print("getSuppressBit(); true? ");
Serial.println(accel.getSuppressBit());
 
accel.setSuppressBit(false);
Serial.print("getSuppressBit(); false? ");
Serial.println(accel.getSuppressBit());
accel.setTapDetectionOnX(true);
Serial.print("isTapDetectionOnX(); true? ");
Serial.println(accel.isTapDetectionOnX(), DEC);
accel.setTapDetectionOnX(false);
Serial.print("isTapDetectionOnX(); false? ");
Serial.println(accel.isTapDetectionOnX(), DEC);
 
accel.setTapDetectionOnY(true);
Serial.print("isTapDetectionOnY(); true? ");
Serial.println(accel.isTapDetectionOnY(), DEC);
accel.setTapDetectionOnY(false);
Serial.print("isTapDetectionOnY(); false? ");
Serial.println(accel.isTapDetectionOnY(), DEC);
 
accel.setTapDetectionOnZ(true);
Serial.print("isTapDetectionOnZ(); true? ");
Serial.println(accel.isTapDetectionOnZ(), DEC);
accel.setTapDetectionOnZ(false);
Serial.print("isTapDetectionOnZ(); false? ");
Serial.println(accel.isTapDetectionOnZ(), DEC);
 
accel.setActivityX(true);
accel.setActivityY(true);
accel.setActivityZ(true);
 
accel.setInactivityX(false);
accel.setInactivityY(false);
accel.setInactivityZ(false);
 
Serial.print("isActivitySourceOnX(): ");
Serial.println(accel.isActivitySourceOnX(), DEC);
 
Serial.print("accel.isActivitySourceOnY(): ");
Serial.println(accel.isActivitySourceOnY(), DEC);
 
Serial.print("accel.isActivitySourceOnZ(): ");
Serial.println(accel.isActivitySourceOnZ(), DEC);
 
Serial.print("accel.isTapSourceOnX(): ");
Serial.println(accel.isTapSourceOnX(), DEC);
 
Serial.print("accel.isTapSourceOnY(): ");
Serial.println(accel.isTapSourceOnY(), DEC);
 
Serial.print("accel.isTapSourceOnZ(): ");
Serial.println(accel.isTapSourceOnZ(), DEC);
 
Serial.print("accel.isAsleep(): ");
Serial.println(accel.isAsleep(), DEC);
 
Serial.print("accel.isLowPower(): ");
Serial.println(accel.isLowPower(), DEC);
 
accel.setLowPower(false);
accel.setRate(3.14159);
Serial.print("getRate(): 3.14159?");
Serial.println(accel.getRate());
 
Serial.print("getInterruptSource(): ");
Serial.println(accel.getInterruptSource(), DEC);
 
Serial.print("getInterruptSource(1): ");
Serial.println(accel.getInterruptSource(1), DEC);
Serial.print("getInterruptMapping(1): ");
Serial.println(accel.getInterruptMapping(1), DEC);
 
accel.setInterruptMapping(1, true);
Serial.print("isInterruptEnabled(1): ");
Serial.println(accel.isInterruptEnabled(1));
accel.setInterrupt(1, true);
 
accel.setSelfTestBit(false);
Serial.print("getSelfTestBit(): ");
Serial.println(accel.getSelfTestBit(), DEC);
 
accel.printAllRegister();
}
void loop(void){
}
/branches/V0.82b-Arthur-P/bma180/bma180.cpp
0,0 → 1,171
 
#include <avr/pgmspace.h>
#include <wiring.h>
 
#include "bma180.h"
 
BMA180::BMA180()
{
gSense=G2;
}
 
void BMA180::setAddress(int adr)
{
address=(unsigned char) adr;
}
 
int temp;
 
void BMA180::readAccel(int * x, int * y, int * z)
{
unsigned int result;
 
Wire.beginTransmission(address);
Wire.send(0x02);
Wire.endTransmission();
Wire.requestFrom((int)address, 7);
if(Wire.available()==7)
{
int lsb = Wire.receive()>>2;
int msb = Wire.receive();
*x=(msb<<6)+lsb;
if ((*x)&0x2000) (*x)|=0xc000; // set full 2 complement for neg values
lsb = Wire.receive()>>2;
msb = Wire.receive();
*y=(msb<<6)+lsb;
if ((*y)&0x2000) (*y)|=0xc000;
lsb = Wire.receive()>>2;
msb = Wire.receive();
*z=(msb<<6)+lsb;
if ((*z)&0x2000) (*z)|=0xc000;
temp = Wire.receive();
if (temp&0x80) temp|=0xff00;
}
result = Wire.endTransmission();
}
 
float BMA180::getGSense()
{
switch(gSense)
{
case G1: return 1.0;
case G15: return 1.5;
case G2: return 2.0;
case G3: return 3.0;
case G4: return 4.0;
case G8: return 8.0;
case G16: return 16.0;
}
}
 
float BMA180::getXValFloat()
{
// normalize (if x is maximum (8191) and GSENSE=1.0 then 1.0
return (float)x/8191.0*getGSense();
}
float BMA180::getYValFloat()
{
// normalize (if x is maximum (8191) and GSENSE=1.0 then 1.0
return (float)y/8191.0*getGSense();
}
float BMA180::getZValFloat()
{
// normalize (if x is maximum (8191) and GSENSE=1.0 then 1.0
return (float)z/8191.0*getGSense();
}
 
int BMA180::getRegValue(int adr)
{
int val;
Wire.beginTransmission(address);
Wire.send(adr);
Wire.endTransmission();
Wire.requestFrom((int)address, 1);
if (Wire.available()==1)
{
val = Wire.receive();
}
else val=-1;
int result = Wire.endTransmission();
checkResult(result);
return val;
}
 
void BMA180::setRegValue(int regAdr, int val, int maskPreserve)
{
int preserve=getRegValue(regAdr);
int orgval=preserve & maskPreserve;
Wire.beginTransmission(address);
Wire.send(regAdr);
Wire.send(orgval|val);
int result = Wire.endTransmission();
checkResult(result);
}
 
void BMA180::setGSensitivty(GSENSITIVITY maxg) //1, 1.5 2 3 4 8 16
{
setRegValue(0x35,maxg<<1,0xF1);
}
 
void BMA180::SetFilter(FILTER f) // 10,20,40,75,150,300,600,1200, HP 1HZ,BP 0.2-300, higher values not authorized
{
setRegValue(0x20,f<<4,0x0F);
}
 
void BMA180::SetISRMode() // you must provide a ISR function on the pin selected (pin 2 or 3,. so INT0 or INT1)
{
setRegValue(0x21,2,0xFD);
}
 
void BMA180::SoftReset() // all values will be default
{
setRegValue(0x10,0xB6,0);
delay(100);
}
 
void BMA180::SetSMPSkip()
{
setRegValue(0x35, 1, 0xFE);
}
 
int BMA180::getIDs(int *id, int *version)
{
Wire.beginTransmission(address);
Wire.send(0x0);
Wire.endTransmission();
Wire.requestFrom((int)address, 2);
if (Wire.available()==2)
{
*id = Wire.receive();
*version= Wire.receive();
}
else *id=-1;
int result = Wire.endTransmission();
checkResult(result);
return *id!=-1;
}
 
 
void BMA180::enableWrite()
{
//ctrl_reg1 register set ee_w bit to enable writing to regs.
setRegValue(0x0D,0x10,~0x10);
delay(10);
}
 
 
void BMA180::disableWrite()
{
setRegValue(0x0D,0x0,~0x10);
delay(10);
}
 
bool BMA180::checkResult(int result)
{
if(result >= 1)
return false;
return true;
}
 
 
/branches/V0.82b-Arthur-P/bma180/bma180.h
0,0 → 1,52
 
#ifndef _BMA180_h
#define _BMA180_h
 
#include <Wire.h>
/*
extern "C" {
#include <../Wire/Wire.h>
 
}
*/
 
#define BMA180_ADDRESS_SDO_LOW 0x40
#define BMA180_ADDRESS_SDO_HIGH 0x41
 
class BMA180
{
public:
typedef enum {F10HZ=0,F20HZ=1,F40HZ, F75HZ,F15HZ0,F300HZ,F600HZ,F1200HZ,HIGHPASS,BANDPASS} FILTER;
typedef enum {G1=0,G15=1,G2,G3,G4,G8,G16}GSENSITIVITY;
private:
unsigned char address;
GSENSITIVITY gSense;
public:
 
int x,y,z; // yes, public, what the heck
int temp;
 
BMA180();
void setAddress(int val);
void readAccel(int * x, int * y, int * z);
 
float getGSense();
float getXValFloat();
float getYValFloat();
float getZValFloat();
void setRegValue(int regAdr, int val, int maskPreserve);
int getRegValue(int adr);
void setGSensitivty(GSENSITIVITY maxg);
void SetFilter(FILTER f);
void SetISRMode();
void SoftReset();
void SetSMPSkip();
int getIDs(int *id, int *version);
void enableWrite();
void disableWrite();
virtual bool checkResult(int result);
};
 
 
#endif //_BMA180_h
/branches/V0.82b-Arthur-P/bma180/examples/BMA180_simple/BMA180_simple.pde
0,0 → 1,32
#include <Wire.h>
#include <bma180.h>
 
BMA180 bma180 = BMA180(BMA180_ADDRESS_SDO_LOW);
 
void setup()
{
Wire.begin();
Serial.begin(115200);
bma180.SoftReset();
bma180.enableWrite();
bma180.SetFilter(bma180.F10HZ);
bma180.setGSensitivty(bma180.G15);
bma180.SetSMPSkip();
bma180.SetISRMode();
bma180.disableWrite();
delay(100);
}
 
void loop()
{
bma180.readAccel();
Serial.print(bma180.x,DEC);
Serial.print(",");
Serial.print(bma180.y,DEC);
Serial.print(",");
Serial.println(bma180.z,DEC);
delay(20);
}
 
 
 
/branches/V0.82b-Arthur-P/bma180/examples/isr_read/isr_read.pde
0,0 → 1,99
#include <Wire.h>
#include <bma180.h>
#define DEBUGOFF
 
BMA180 bma180 = BMA180(BMA180_ADDRESS_SDO_LOW);
 
 
volatile byte newData=0;
volatile unsigned int countISR=0;
unsigned int served=0;
 
void BMAISR(void)
{
countISR++;
//bma180.readAccel();
newData=1;
}
 
void setup()
{
Wire.begin();
Serial.begin(115200);
bma180.SoftReset();
bma180.enableWrite();
int sversion;
int id;
bma180.getIDs(&id,&sversion);
Serial.print("Id = ");
Serial.print(id,DEC);
Serial.print(" v.");
Serial.println(sversion,HEX);
bma180.SetFilter(bma180.F10HZ);
bma180.setGSensitivty(bma180.G15);
attachInterrupt(0, BMAISR, RISING);
bma180.SetSMPSkip();
bma180.SetISRMode();
bma180.disableWrite();
delay(2000);
}
 
void loop()
{
if (newData)
{
newData=0;
bma180.readAccel();
Serial.print("[");
Serial.print(bma180.x,DEC);
Serial.print(" ");
Serial.print(bma180.y,DEC);
Serial.print(" ");
Serial.print(bma180.z,DEC);
Serial.println("]");
}
#ifdef DEBUGON
if (millis() > tAlive)
{
bma180.readAccel();
Serial.print("ISR's=");
Serial.print(countISR);
Serial.print(" served=");
Serial.println(served);
Serial.print("t=");
Serial.print(bma180.temp);
Serial.print("[");
Serial.print(bma180.x,DEC);
Serial.print(" ");
Serial.print(bma180.y,DEC);
Serial.print(" ");
Serial.print(bma180.z,DEC);
Serial.println("]");
 
tAlive=millis()+5000;
Serial.print("filter reg=");
Serial.println(bma180.getRegValue(0x20),BIN);
Serial.print("status_reg1=");
Serial.println(bma180.getRegValue(0x09),BIN);
Serial.print("status_reg2=");
Serial.println(bma180.getRegValue(0x0A),BIN);
Serial.print("status_reg3=");
Serial.println(bma180.getRegValue(0x0B),BIN);
Serial.print("status_reg4=");
Serial.println(bma180.getRegValue(0x0C),BIN);
Serial.print("ctrl_reg0=");
Serial.println(bma180.getRegValue(0x0d),BIN);
Serial.print("ctrl_reg1=");
Serial.println(bma180.getRegValue(0x0e),BIN);
Serial.print("ctrl_reg2=");
Serial.println(bma180.getRegValue(0x0f),BIN);
Serial.print("ctrl_reg3=");
Serial.println(bma180.getRegValue(0x21),BIN);
Serial.print("ctrl_reg4=");
Serial.println(bma180.getRegValue(0x22),BIN);
}
#endif
}
 
 
 
/branches/V0.82b-Arthur-P/bma180/keywords.txt
0,0 → 1,50
#######################################
# Syntax Coloring Map for BMA180
#######################################
 
#######################################
# Datatypes (KEYWORD1)
#######################################
 
BMA180 KEYWORD1
GSENSITIVITY KEYWORD1
FILTER KEYWORD1
 
#######################################
# Methods and Functions (KEYWORD2)
#######################################
 
setAddress KEYWORD2
readAccel KEYWORD2
getGSense KEYWORD2
getXValFloat KEYWORD2
getYValFloat KEYWORD2
getZValFloat KEYWORD2
setRegValue KEYWORD2
getRegValue KEYWORD2
setGSensitivity KEYWORD2
setFilter KEYWORD2
setISRMode KEYWORD2
softReset KEYWORD2
setSMPSkip KEYWORD2
getIDs KEYWORD2
enableWrite KEYWORD2
disableWrite KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
checkResult KEYWORD3
F10HZ KEYWORD3
F20HZ KEYWORD3
F75HZ KEYWORD3
F15HZ0 KEYWORD3
F300HZ KEYWORD3
F600HZ KEYWORD3
F1200HZ KEYWORD3
G1 KEYWORD3
G15 KEYWORD3
G2 KEYWORD3
G3 KEYWORD3
G4 KEYWORD3
G8 KEYWORD3
G16 KEYWORD3
/branches/V0.82b-Arthur-P/bmp085driver/BMP085.cpp
0,0 → 1,247
/****************************************************************************
* BMP085.cpp - BMP085/I2C (Digital Pressure Sensor) library for Arduino *
* Copyright 2010-2011 Filipe Vieira & various contributors *
* *
* This file is part of BMP085 Arduino library. *
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/
/****************************************************************************
* Tested on Arduino Mega with BMP085 Breakout *
* SDA -> pin 20 (no pull up resistors) *
* SCL -> pin 21 (no pull up resistors) *
* XCLR -> not connected *
* EOC -> not connected *
* GND -> pin GND *
* VCC -> pin 3.3V *
* NOTE: SCL and SDA needs pull-up resistors for each I2C bus. *
* 2.2kOhm..10kOhm, typ. 4.7kOhm *
*****************************************************************************/
#include <Wire.h>
#include <BMP085.h>
 
BMP085::BMP085() {
_dev_address = BMP085_ADDR;
_pressure_waittime[0] = 5; // These are maximum convertion times.
_pressure_waittime[1] = 8; // It is possible to use pin EOC (End Of Conversion)
_pressure_waittime[2] = 14;// to check if conversion is finished (logic 1)
_pressure_waittime[3] = 26;// or running (logic 0) insted of waiting for convertion times.
_cm_Offset = 0;
_Pa_Offset = 0; // 1hPa = 100Pa = 1mbar
oldEMA = 0;
}
 
void BMP085::init() {
init(MODE_STANDARD, 0, true);
}
 
void BMP085::init(byte _BMPMode, int32_t _initVal, bool _Unitmeters){
getCalData(); // initialize cal data
calcTrueTemperature(); // initialize b5
setMode(_BMPMode);
_Unitmeters ? setLocalAbsAlt(_initVal) : setLocalPressure(_initVal);
}
 
byte BMP085::getDevAddr() {
return _dev_address;
}
 
byte BMP085::getMode(){
return _oss;
}
 
void BMP085::setMode(byte _BMPMode){
_oss = _BMPMode;
}
 
void BMP085::setLocalPressure(int32_t _Pa){
int32_t tmp_alt;
_param_datum = _Pa;
getAltitude(&tmp_alt); // calc altitude based on current pressure
_param_centimeters = tmp_alt;
}
 
void BMP085::setLocalAbsAlt(int32_t _centimeters){
int32_t tmp_Pa;
_param_centimeters = _centimeters;
getPressure(&tmp_Pa); // calc pressure based on current altitude
_param_datum = tmp_Pa;
}
 
void BMP085::setAltOffset(int32_t _centimeters){
_cm_Offset = _centimeters;
}
 
void BMP085::sethPaOffset(int32_t _Pa){
_Pa_Offset = _Pa;
}
 
void BMP085::zeroCal(int32_t _Pa, int32_t _centimeters){
setAltOffset(_centimeters - _param_centimeters);
sethPaOffset(_Pa - _param_datum);
}
 
void BMP085::getPressure(int32_t *_Pa){
long TruePressure;
 
calcTruePressure(&TruePressure);
*_Pa = TruePressure / pow((1 - (float)_param_centimeters / 4433000), 5.255) + _Pa_Offset;
// converting from float to int32_t truncates toward zero, 1010.999985 becomes 1010 resulting in 1 Pa error (max).
// Note that BMP085 abs accuracy from 700...1100hPa and 0..+65ºC is +-100Pa (typ.)
}
 
void BMP085::getAltitude(int32_t *_centimeters){
long TruePressure;
 
calcTruePressure(&TruePressure);
*_centimeters = 4433000 * (1 - pow((TruePressure / (float)_param_datum), 0.1903)) + _cm_Offset;
// converting from float to int32_t truncates toward zero, 100.999985 becomes 100 resulting in 1 cm error (max).
}
 
void BMP085::getTemperature(int32_t *_Temperature) {
calcTrueTemperature(); // force b5 update
*_Temperature = ((b5 + 8) >> 4);
}
 
void BMP085::calcTrueTemperature(){
long ut,x1,x2;
 
//read Raw Temperature
writemem(CONTROL, READ_TEMPERATURE);
delayMicroseconds(4500); // min. 4.5ms read Temp delay
readmem(CONTROL_OUTPUT, 2, _buff);
ut = ((long)_buff[0] << 8 | ((long)_buff[1])); // uncompensated temperature value
// calculate temperature
x1 = ((long)ut - ac6) * ac5 >> 15;
x2 = ((long)mc << 11) / (x1 + md);
b5 = x1 + x2;
}
 
void BMP085::calcTruePressure(long *_TruePressure) {
long up,x1,x2,x3,b3,b6,p;
unsigned long b4,b7;
int32_t tmp;
 
#if AUTO_UPDATE_TEMPERATURE
calcTrueTemperature(); // b5 update
#endif
//read Raw Pressure
writemem(CONTROL, READ_PRESSURE+(_oss << 6));
delay(_pressure_waittime[_oss]);
readmem(CONTROL_OUTPUT, 3, _buff);
up = ((((long)_buff[0] <<16) | ((long)_buff[1] <<8) | ((long)_buff[2])) >> (8-_oss)); // uncompensated pressure value
// calculate true pressure
b6 = b5 - 4000; // b5 is updated by calcTrueTemperature().
x1 = (b2* (b6 * b6 >> 12)) >> 11;
x2 = ac2 * b6 >> 11;
x3 = x1 + x2;
tmp = ac1;
tmp = (tmp * 4 + x3) << _oss;
b3 = (tmp + 2) >> 2;
x1 = ac3 * b6 >> 13;
x2 = (b1 * (b6 * b6 >> 12)) >> 16;
x3 = ((x1 + x2) + 2) >> 2;
b4 = (ac4 * (uint32_t) (x3 + 32768)) >> 15;
b7 = ((uint32_t)up - b3) * (50000 >> _oss);
p = b7 < 0x80000000 ? (b7 << 1) / b4 : (b7 / b4) << 1;
x1 = (p >> 8) * (p >> 8);
x1 = (x1 * 3038) >> 16;
x2 = (-7357 * p) >> 16;
*_TruePressure = p + ((x1 + x2 + 3791) >> 4);
}
 
void BMP085::dumpCalData() {
Serial.println("---cal data start---");
Serial.print("ac1:");
Serial.println(ac1,DEC);
Serial.print("ac2:");
Serial.println(ac2,DEC);
Serial.print("ac3:");
Serial.println(ac3,DEC);
Serial.print("ac4:");
Serial.println(ac4,DEC);
Serial.print("ac5:");
Serial.println(ac5,DEC);
Serial.print("ac6:");
Serial.println(ac6,DEC);
Serial.print("b1:");
Serial.println(b1,DEC);
Serial.print("b2:");
Serial.println(b2,DEC);
Serial.print("mb:");
Serial.println(mb,DEC);
Serial.print("mc:");
Serial.println(mc,DEC);
Serial.print("md:");
Serial.println(md,DEC);
Serial.println("---cal data end---");
}
 
//PRIVATE methods
 
void BMP085::getCalData() {
readmem(CAL_AC1, 2, _buff);
ac1 = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_AC2, 2, _buff);
ac2 = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_AC3, 2, _buff);
ac3 = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_AC4, 2, _buff);
ac4 = ((unsigned int)_buff[0] <<8 | ((unsigned int)_buff[1]));
readmem(CAL_AC5, 2, _buff);
ac5 = ((unsigned int)_buff[0] <<8 | ((unsigned int)_buff[1]));
readmem(CAL_AC6, 2, _buff);
ac6 = ((unsigned int)_buff[0] <<8 | ((unsigned int)_buff[1]));
readmem(CAL_B1, 2, _buff);
b1 = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_B2, 2, _buff);
b2 = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_MB, 2, _buff);
mb = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_MC, 2, _buff);
mc = ((int)_buff[0] <<8 | ((int)_buff[1]));
readmem(CAL_MD, 2, _buff);
md = ((int)_buff[0] <<8 | ((int)_buff[1]));
}
 
 
void BMP085::writemem(uint8_t _addr, uint8_t _val) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(_addr); // send register address
Wire.send(_val); // send value to write
Wire.endTransmission(); // end transmission
}
 
void BMP085::readmem(uint8_t _addr, uint8_t _nbytes, uint8_t __buff[]) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(_addr); // sends register address to read from
Wire.endTransmission(); // end transmission
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.requestFrom(_dev_address, _nbytes);// send data n-bytes read
uint8_t i = 0;
while (Wire.available()) {
__buff[i] = Wire.receive(); // receive DATA
i++;
}
Wire.endTransmission(); // end transmission
}
 
 
/branches/V0.82b-Arthur-P/bmp085driver/BMP085.h
0,0 → 1,138
/****************************************************************************
* BMP085.h - BMP085/I2C (Digital Pressure Sensor) library for Arduino *
* Copyright 2010-2011 Filipe Vieira & various contributors *
* *
* This file is part of BMP085 Arduino library. *
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/
/****************************************************************************
* Tested on Arduino Mega with BMP085 Breakout *
* SDA -> pin 20 (no pull up resistors) *
* SCL -> pin 21 (no pull up resistors) *
* XCLR -> not connected *
* EOC -> not connected *
* GND -> pin GND *
* VCC -> pin 3.3V *
* NOTE: SCL and SDA needs pull-up resistors for each I2C bus. *
* 2.2kOhm..10kOhm, typ. 4.7kOhm *
*****************************************************************************/
#ifndef BMP085_h
#define BMP085_h
 
#include "WProgram.h"
 
#define BMP085_ADDR 0x77 //0x77 default I2C address
#define BUFFER_SIZE 3
 
#define AUTO_UPDATE_TEMPERATURE true //default is true
// when true, temperature is measured everytime pressure is measured (Auto).
// when false, user chooses when to measure temperature (just call calcTrueTemperature()).
// used for dynamic measurement to increase sample rate (see BMP085 modes below).
/* ---- Registers ---- */
#define CAL_AC1 0xAA // R Calibration data (16 bits)
#define CAL_AC2 0xAC // R Calibration data (16 bits)
#define CAL_AC3 0xAE // R Calibration data (16 bits)
#define CAL_AC4 0xB0 // R Calibration data (16 bits)
#define CAL_AC5 0xB2 // R Calibration data (16 bits)
#define CAL_AC6 0xB4 // R Calibration data (16 bits)
#define CAL_B1 0xB6 // R Calibration data (16 bits)
#define CAL_B2 0xB8 // R Calibration data (16 bits)
#define CAL_MB 0xBA // R Calibration data (16 bits)
#define CAL_MC 0xBC // R Calibration data (16 bits)
#define CAL_MD 0xBE // R Calibration data (16 bits)
#define CONTROL 0xF4 // W Control register
#define CONTROL_OUTPUT 0xF6 // R Output registers 0xF6=MSB, 0xF7=LSB, 0xF8=XLSB
 
// unused registers
#define SOFTRESET 0xE0
#define VERSION 0xD1 // ML_VERSION pos=0 len=4 msk=0F AL_VERSION pos=4 len=4 msk=f0
#define CHIPID 0xD0 // pos=0 mask=FF len=8
// BMP085_CHIP_ID=0x55
 
/************************************/
/* REGISTERS PARAMETERS */
/************************************/
// BMP085 Modes
#define MODE_ULTRA_LOW_POWER 0 //oversampling=0, internalsamples=1, maxconvtimepressure=4.5ms, avgcurrent=3uA, RMSnoise_hPA=0.06, RMSnoise_m=0.5
#define MODE_STANDARD 1 //oversampling=1, internalsamples=2, maxconvtimepressure=7.5ms, avgcurrent=5uA, RMSnoise_hPA=0.05, RMSnoise_m=0.4
#define MODE_HIGHRES 2 //oversampling=2, internalsamples=4, maxconvtimepressure=13.5ms, avgcurrent=7uA, RMSnoise_hPA=0.04, RMSnoise_m=0.3
#define MODE_ULTRA_HIGHRES 3 //oversampling=3, internalsamples=8, maxconvtimepressure=25.5ms, avgcurrent=12uA, RMSnoise_hPA=0.03, RMSnoise_m=0.25
// "Sampling rate can be increased to 128 samples per second (standard mode) for
// dynamic measurement.In this case it is sufficient to measure temperature only
// once per second and to use this value for all pressure measurements during period."
// (from BMP085 datasheet Rev1.2 page 10).
// To use dynamic measurement set AUTO_UPDATE_TEMPERATURE to false and
// call calcTrueTemperature() from your code.
// Control register
#define READ_TEMPERATURE 0x2E
#define READ_PRESSURE 0x34
//Other
#define MSLP 101325 // Mean Sea Level Pressure = 1013.25 hPA (1hPa = 100Pa = 1mbar)
 
 
 
class BMP085 {
public:
BMP085();
// BMP initialization
void init(); // sets current elevation above ground level to 0 meters
void init(byte _BMPMode, int32_t _initVal, bool _centimeters); // sets a reference datum
// if _centimeters=false _initVal is Pa
// Who Am I
byte getDevAddr();
// BMP mode
byte getMode();
void setMode(byte _BMPMode); // BMP085 mode
// initialization
void setLocalPressure(int32_t _Pa); // set known barometric pressure as reference Ex. QNH
void setLocalAbsAlt(int32_t _centimeters); // set known altitude as reference
void setAltOffset(int32_t _centimeters); // altitude offset
void sethPaOffset(int32_t _Pa); // pressure offset
void zeroCal(int32_t _Pa, int32_t _centimeters);// zero Calibrate output to a specific Pa/altitude
// BMP Sensors
void getPressure(int32_t *_Pa); // pressure in Pa + offset
void getAltitude(int32_t *_centimeters); // altitude in centimeters + offset
void getTemperature(int32_t *_Temperature); // temperature in Cº
void calcTrueTemperature(); // calc temperature data b5 (only needed if AUTO_UPDATE_TEMPERATURE is false)
void calcTruePressure(long *_TruePressure); // calc Pressure in Pa
// dummy stuff
void dumpCalData(); // debug only
 
void writemem(uint8_t _addr, uint8_t _val);
void readmem(uint8_t _addr, uint8_t _nbytes, uint8_t __buff[]);
private:
int ac1,ac2,ac3,b1,b2,mb,mc,md; // cal data
unsigned int ac4,ac5,ac6; // cal data
long b5, oldEMA; // temperature data
uint8_t _dev_address;
byte _buff[BUFFER_SIZE]; // buffer MSB LSB XLSB
int _oss; // OverSamplingSetting
int _pressure_waittime[4]; // Max. Conversion Time Pressure is ms for each mode
int32_t _cm_Offset, _Pa_Offset;
int32_t _param_datum, _param_centimeters;
 
void getCalData();
 
};
 
#endif
/branches/V0.82b-Arthur-P/bmp085driver/COPYING
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/V0.82b-Arthur-P/bmp085driver/COPYING.LESSER
0,0 → 1,165
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
 
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
 
0. Additional Definitions.
 
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
 
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
 
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
 
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
 
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
 
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
 
1. Exception to Section 3 of the GNU GPL.
 
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
 
2. Conveying Modified Versions.
 
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
 
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
 
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
 
3. Object Code Incorporating Material from Library Header Files.
 
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
 
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the object code with a copy of the GNU GPL and this license
document.
 
4. Combined Works.
 
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
 
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
 
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
 
d) Do one of the following:
 
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
 
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
 
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
 
5. Combined Libraries.
 
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
 
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
 
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
 
6. Revised Versions of the GNU Lesser General Public License.
 
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
 
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
/branches/V0.82b-Arthur-P/bmp085driver/INSTALL.txt
0,0 → 1,9
Copy the whole directory which contain this file into the folder "libraries" inside the Arduino sketchbook folder.
 
You can understand the location of your sketchbook folder from the Arduino IDE clicking on File -> Preferences: the "sketchbook location" is what you are looking for.
 
In case you don't have an "libraries" folder there just create an empty one.
 
 
For more informations see:
http://www.arduino.cc/en/Reference/Libraries
/branches/V0.82b-Arthur-P/bmp085driver/examples/BMP085_output/BMP085_output.pde
0,0 → 1,99
// BMP085_output
// by Filipe Vieira
// Simple example of library usage with almost every BMP085 and lib features being used.
 
#include <Wire.h>
#include <BMP085.h>
 
BMP085 dps = BMP085();
long Temperature = 0, Pressure = 0, Altitude = 0;
 
void setup(void) {
Serial.begin(9600);
Wire.begin();
delay(1000);
dps.init();
showall();
Serial.println("Registers dump");
Serial.println("==========================================================");
dumpRegisters();
Serial.println("Calibration data");
Serial.println("==========================================================");
dps.dumpCalData();
delay(5000);
}
 
void loop(void) {
dps.getTemperature(&Temperature);
dps.getPressure(&Pressure);
dps.getAltitude(&Altitude);
Serial.print("Temp(C):");
Serial.print(Temperature);
Serial.print(" Alt(cm):");
Serial.print(Altitude);
Serial.print(" Pressure(Pa):");
Serial.println(Pressure);
}
 
void showall(void) {
Serial.println("Current BMP085 settings");
Serial.println("==========================================================");
Serial.print("device address = 0x");
Serial.println(dps.getDevAddr(), HEX);
Serial.print("Mode = ");
switch (dps.getMode()) {
case MODE_ULTRA_LOW_POWER:
Serial.println("MODE_ULTRA_LOW_POWER");
break;
case MODE_STANDARD:
Serial.println("MODE_STANDARD");
break;
case MODE_HIGHRES:
Serial.println("MODE_HIGHRES");
break;
case MODE_ULTRA_HIGHRES:
Serial.println("MODE_ULTRA_HIGHRES");
break;
}
}
 
void dumpRegisters() {
byte ValidRegisterAddr[]={0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xF6,0xF7,0xF8,0xF9};
byte _b, i, totregisters = sizeof(ValidRegisterAddr);
Serial.println("---dump start---");
Serial.println("Register address|Register data");
Serial.println("Reg.address(hex,dec) Reg.data(bin,hex,dec)");
for (i=0;i<totregisters;i++){
Serial.print("0x");
Serial.print(ValidRegisterAddr[i], HEX);
Serial.print(",");
Serial.print(ValidRegisterAddr[i], DEC);
Serial.print(",");
dps.readmem(ValidRegisterAddr[i], 1, &_b);
Serial.print("b");
print_bits(_b);
Serial.print(",0x");
Serial.print(_b,HEX);
Serial.print(",");
Serial.println(_b,DEC);
}
Serial.println("---dump end---");
}
 
void print_bits(byte val){
int i;
for(i=7; i>=0; i--)
Serial.print(val >> i & 1, BIN);
}
/* void print_unit16(uint16_t val){
int i;
for(i=15; i>=0; i--)
Serial.print(val >> i & 1, BIN);
}
*/
/branches/V0.82b-Arthur-P/bmp085driver/examples/BMP085_test1/BMP085_test1.pde
0,0 → 1,44
// BMP085_test1
// by Filipe Vieira
// Simple test of BMP085 output using default settings.
// This example requires AUTO_UPDATE_TEMPERATURE to be true in bmp085.h otherwise temperature will not update.
// IMPORTANT!! To get correct values you MUST CHANGE init() parameters, in
// this example I've set 250m based on GPS data for my location.
 
#include <Wire.h>
#include <BMP085.h>
 
BMP085 dps = BMP085(); // Digital Pressure Sensor
 
long Temperature = 0, Pressure = 0, Altitude = 0;
 
void setup(void) {
Serial.begin(9600);
Wire.begin();
delay(1000);
// uncomment for different initialization settings
//dps.init(); // QFE (Field Elevation above ground level) is set to 0 meters.
// same as init(MODE_STANDARD, 0, true);
//dps.init(MODE_STANDARD, 101850, false); // 101850Pa = 1018.50hPa, false = using Pa units
// this initialization is useful for normalizing pressure to specific datum.
// OR setting current local hPa information from a weather station/local airport (QNH).
dps.init(MODE_ULTRA_HIGHRES, 25000, true); // 250 meters, true = using meter units
// this initialization is useful if current altitude is known,
// pressure will be calculated based on TruePressure and known altitude.
 
// note: use zeroCal only after initialization.
// dps.zeroCal(101800, 0); // set zero point
}
 
void loop(void) {
dps.getPressure(&Pressure);
dps.getAltitude(&Altitude);
Serial.print(" Alt(cm):");
Serial.print(Altitude);
Serial.print(" Pressure(Pa):");
Serial.println(Pressure);
}
/branches/V0.82b-Arthur-P/bmp085driver/examples/BMP085_test2/BMP085_test2.pde
0,0 → 1,53
// BMP085_test2
// by Filipe Vieira
// Simple test of BMP085 output using default settings using dynamic update.
// In order to take full advantage of dynamic measurement, automatic temperature updates must be disabled.
// To disable automatic updates set AUTO_UPDATE_TEMPERATURE to false in bmp085.h.
// IMPORTANT!! To get correct values you MUST CHANGE init() parameters, in
// this example I've set 250m based on GPS data for my location.
 
#include <Wire.h>
#include <BMP085.h>
 
BMP085 dps = BMP085(); // Digital Pressure Sensor
 
long Pressure = 0, Altitude = 0;
unsigned long time1=0;
 
void setup(void) {
Serial.begin(9600);
Wire.begin();
delay(1000);
// uncomment for different initialization settings
//dps.init(); // QFE (Field Elevation above ground level) is set to 0 meters.
// same as init(MODE_STANDARD, 0, true);
//dps.init(MODE_STANDARD, 101850, false); // 101850Pa = 1018.50hPa, false = using Pa units
// this initialization is useful for normalizing pressure to specific datum.
// OR setting current local hPa information from a weather station/local airport (QNH).
dps.init(MODE_STANDARD, 25000, true); // 250 meters, true = using meter units
// this initialization is useful if current altitude is known,
// pressure will be calculated based on TruePressure and known altitude.
 
// note: use zeroCal only after initialization.
// dps.zeroCal(101800, 0); // set zero point
}
 
void loop(void) {
// calculate temperature every 1 sec (dynamic measurement)
// NOTE: in order to take full advantage of dynamic measurement set AUTO_UPDATE_TEMPERATURE to false in bmp085.h
if (((millis() - time1)/1000.0) >= 1.0) {
dps.calcTrueTemperature();
time1 = millis();
}
dps.getPressure(&Pressure);
dps.getAltitude(&Altitude);
 
Serial.print(" Alt(cm):");
Serial.print(Altitude);
Serial.print(" Pressure(Pa):");
Serial.println(Pressure);
}
/branches/V0.82b-Arthur-P/bmp085driver/keywords.txt
0,0 → 1,18
BMP085 KEYWORD1
init KEYWORD2
getDevAddr KEYWORD2
getMode KEYWORD2
setMode KEYWORD2
setLocalPressure KEYWORD2
setLocalAbsAlt KEYWORD2
setAltOffset KEYWORD2
sethPaOffset KEYWORD2
zeroCal KEYWORD2
getPressure KEYWORD2
getAltitude KEYWORD2
getTemperature KEYWORD2
calcTrueTemperature KEYWORD2
calcTruePressure KEYWORD2
dumpCalData KEYWORD2
writemem KEYWORD2
readmem KEYWORD2
/branches/V0.82b-Arthur-P/itg3200filv05/COPYING
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/V0.82b-Arthur-P/itg3200filv05/COPYING.LESSER
0,0 → 1,165
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
 
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
 
0. Additional Definitions.
 
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
 
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
 
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
 
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
 
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
 
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
 
1. Exception to Section 3 of the GNU GPL.
 
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
 
2. Conveying Modified Versions.
 
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
 
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
 
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
 
3. Object Code Incorporating Material from Library Header Files.
 
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
 
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the object code with a copy of the GNU GPL and this license
document.
 
4. Combined Works.
 
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
 
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
 
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
 
d) Do one of the following:
 
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
 
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
 
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
 
5. Combined Libraries.
 
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
 
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
 
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
 
6. Revised Versions of the GNU Lesser General Public License.
 
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
 
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
/branches/V0.82b-Arthur-P/itg3200filv05/INSTALL.txt
0,0 → 1,9
Copy the whole directory which contain this file into the folder "libraries" inside the Arduino sketchbook folder.
 
You can understand the location of your sketchbook folder from the Arduino IDE clicking on File -> Preferences: the "sketchbook location" is what you are looking for.
 
In case you don't have an "libraries" folder there just create an empty one.
 
 
For more informations see:
http://www.arduino.cc/en/Reference/Libraries
/branches/V0.82b-Arthur-P/itg3200filv05/ITG3200.cpp
0,0 → 1,328
/****************************************************************************
* ITG3200.h - ITG-3200/I2C library v0.5 for Arduino *
* Copyright 2010-2011 Filipe Vieira & various contributors *
* http://code.google.com/p/itg-3200driver *
* This file is part of ITG-3200 Arduino library. *
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/
/****************************************************************************
* Tested on Arduino Mega with ITG-3200 Breakout *
* SCL -> pin 21 (no pull up resistors) *
* SDA -> pin 20 (no pull up resistors) *
* CLK & GND -> pin GND *
* INT -> not connected (but can be used) *
* VIO & VDD -> pin 3.3V *
*****************************************************************************/
#include "ITG3200.h"
#include <Wire.h>
 
 
ITG3200::ITG3200() {
setGains(1.0,1.0,1.0);
setOffsets(0.0,0.0,0.0);
setRevPolarity(0,0,0);
//Wire.begin(); //Normally this code is called from setup() at user code
//but some people reported that joining I2C bus earlier
//apparently solved problems with master/slave conditions.
//Uncomment if needed.
}
 
void ITG3200::init(unsigned int address) {
// Uncomment or change your default ITG3200 initialization
// fast sample rate - divisor = 0 filter = 0 clocksrc = 0, 1, 2, or 3 (raw values)
init(address, NOSRDIVIDER, RANGE2000, BW256_SR8, PLL_XGYRO_REF, true, true);
// slow sample rate - divisor = 0 filter = 1,2,3,4,5, or 6 clocksrc = 0, 1, 2, or 3 (raw values)
//init(NOSRDIVIDER, RANGE2000, BW010_SR1, INTERNALOSC, true, true);
// fast sample rate 32Khz external clock - divisor = 0 filter = 0 clocksrc = 4 (raw values)
//init(NOSRDIVIDER, RANGE2000, BW256_SR8, PLL_EXTERNAL32, true, true);
// slow sample rate 32Khz external clock - divisor = 0 filter = 1,2,3,4,5, or 6 clocksrc = 4 (raw values)
//init(NOSRDIVIDER, RANGE2000, BW010_SR1, PLL_EXTERNAL32, true, true);
}
 
void ITG3200::init(unsigned int address, byte _SRateDiv, byte _Range, byte _filterBW, byte _ClockSrc, bool _ITGReady, bool _INTRawDataReady) {
_dev_address = address;
setSampleRateDiv(_SRateDiv);
setFSRange(_Range);
setFilterBW(_filterBW);
setClockSource(_ClockSrc);
setITGReady(_ITGReady);
setRawDataReady(_INTRawDataReady);
delay(GYROSTART_UP_DELAY); // startup
}
 
byte ITG3200::getDevAddr() {
/*readmem(WHO_AM_I, 1, &_buff[0]);
return _buff[0]; */
return _dev_address;
}
 
void ITG3200::setDevAddr(unsigned int _addr) {
writemem(WHO_AM_I, _addr);
_dev_address = _addr;
}
 
byte ITG3200::getSampleRateDiv() {
readmem(SMPLRT_DIV, 1, &_buff[0]);
return _buff[0];
}
 
void ITG3200::setSampleRateDiv(byte _SampleRate) {
writemem(SMPLRT_DIV, _SampleRate);
}
 
byte ITG3200::getFSRange() {
readmem(DLPF_FS, 1, &_buff[0]);
return ((_buff[0] & DLPFFS_FS_SEL) >> 3);
}
 
void ITG3200::setFSRange(byte _Range) {
readmem(DLPF_FS, 1, &_buff[0]);
writemem(DLPF_FS, ((_buff[0] & ~DLPFFS_FS_SEL) | (_Range << 3)) );
}
 
byte ITG3200::getFilterBW() {
readmem(DLPF_FS, 1, &_buff[0]);
return (_buff[0] & DLPFFS_DLPF_CFG);
}
 
void ITG3200::setFilterBW(byte _BW) {
readmem(DLPF_FS, 1, &_buff[0]);
writemem(DLPF_FS, ((_buff[0] & ~DLPFFS_DLPF_CFG) | _BW));
}
 
bool ITG3200::isINTActiveOnLow() {
readmem(INT_CFG, 1, &_buff[0]);
return ((_buff[0] & INTCFG_ACTL) >> 7);
}
 
void ITG3200::setINTLogiclvl(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_ACTL) | (_State << 7)));
}
 
bool ITG3200::isINTOpenDrain() {
readmem(INT_CFG, 1, &_buff[0]);
return ((_buff[0] & INTCFG_OPEN) >> 6);
}
 
void ITG3200::setINTDriveType(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_OPEN) | _State << 6));
}
 
bool ITG3200::isLatchUntilCleared() {
readmem(INT_CFG, 1, &_buff[0]);
return ((_buff[0] & INTCFG_LATCH_INT_EN) >> 5);
}
 
void ITG3200::setLatchMode(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_LATCH_INT_EN) | _State << 5));
}
 
bool ITG3200::isAnyRegClrMode() {
readmem(INT_CFG, 1, &_buff[0]);
return ((_buff[0] & INTCFG_INT_ANYRD_2CLEAR) >> 4);
}
 
void ITG3200::setLatchClearMode(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_INT_ANYRD_2CLEAR) | _State << 4));
}
 
bool ITG3200::isITGReadyOn() {
readmem(INT_CFG, 1, &_buff[0]);
return ((_buff[0] & INTCFG_ITG_RDY_EN) >> 2);
}
 
void ITG3200::setITGReady(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_ITG_RDY_EN) | _State << 2));
}
 
bool ITG3200::isRawDataReadyOn() {
readmem(INT_CFG, 1, &_buff[0]);
return (_buff[0] & INTCFG_RAW_RDY_EN);
}
 
void ITG3200::setRawDataReady(bool _State) {
readmem(INT_CFG, 1, &_buff[0]);
writemem(INT_CFG, ((_buff[0] & ~INTCFG_RAW_RDY_EN) | _State));
}
 
bool ITG3200::isITGReady() {
readmem(INT_STATUS, 1, &_buff[0]);
return ((_buff[0] & INTSTATUS_ITG_RDY) >> 2);
}
 
bool ITG3200::isRawDataReady() {
readmem(INT_STATUS, 1, &_buff[0]);
return (_buff[0] & INTSTATUS_RAW_DATA_RDY);
}
 
void ITG3200::readTemp(float *_Temp) {
readmem(TEMP_OUT,2,_buff);
*_Temp = 35 + (((_buff[0] << 8) | _buff[1]) + 13200) / 280.0; // F=C*9/5+32
}
 
void ITG3200::readGyroRaw(int *_GyroX, int *_GyroY, int *_GyroZ){
readmem(GYRO_XOUT, 6, _buff);
*_GyroX = ((_buff[0] << 8) | _buff[1]);
*_GyroY = ((_buff[2] << 8) | _buff[3]);
*_GyroZ = ((_buff[4] << 8) | _buff[5]);
}
 
void ITG3200::readGyroRaw(int *_GyroXYZ){
readGyroRaw(_GyroXYZ, _GyroXYZ+1, _GyroXYZ+2);
}
 
void ITG3200::setRevPolarity(bool _Xpol, bool _Ypol, bool _Zpol) {
polarities[0] = _Xpol ? -1 : 1;
polarities[1] = _Ypol ? -1 : 1;
polarities[2] = _Zpol ? -1 : 1;
}
 
void ITG3200::setGains(float _Xgain, float _Ygain, float _Zgain) {
gains[0] = _Xgain;
gains[1] = _Ygain;
gains[2] = _Zgain;
}
 
void ITG3200::setOffsets(int _Xoffset, int _Yoffset, int _Zoffset) {
offsets[0] = _Xoffset;
offsets[1] = _Yoffset;
offsets[2] = _Zoffset;
}
 
void ITG3200::zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS) {
int xyz[3];
float tmpOffsets[] = {0,0,0};
 
for (int i = 0;i < totSamples;i++){
delay(sampleDelayMS);
readGyroRaw(xyz);
tmpOffsets[0] += xyz[0];
tmpOffsets[1] += xyz[1];
tmpOffsets[2] += xyz[2];
}
setOffsets(-tmpOffsets[0] / totSamples, -tmpOffsets[1] / totSamples, -tmpOffsets[2] / totSamples);
}
 
void ITG3200::readGyroRawCal(int *_GyroX, int *_GyroY, int *_GyroZ) {
readGyroRaw(_GyroX, _GyroY, _GyroZ);
*_GyroX += offsets[0];
*_GyroY += offsets[1];
*_GyroZ += offsets[2];
}
 
void ITG3200::readGyroRawCal(int *_GyroXYZ) {
readGyroRawCal(_GyroXYZ, _GyroXYZ+1, _GyroXYZ+2);
}
 
void ITG3200::readGyro(float *_GyroX, float *_GyroY, float *_GyroZ){
int x, y, z;
readGyroRawCal(&x, &y, &z); // x,y,z will contain calibrated integer values from the sensor
*_GyroX = x / 14.375 * polarities[0] * gains[0];
*_GyroY = y / 14.375 * polarities[1] * gains[1];
*_GyroZ = z / 14.375 * polarities[2] * gains[2];
}
 
void ITG3200::readGyro(float *_GyroXYZ){
readGyro(_GyroXYZ, _GyroXYZ+1, _GyroXYZ+2);
}
 
void ITG3200::reset() {
writemem(PWR_MGM, PWRMGM_HRESET);
delay(GYROSTART_UP_DELAY); //gyro startup
}
 
bool ITG3200::isLowPower() {
readmem(PWR_MGM, 1, &_buff[0]);
return (_buff[0] & PWRMGM_SLEEP) >> 6;
}
void ITG3200::setPowerMode(bool _State) {
readmem(PWR_MGM, 1, &_buff[0]);
writemem(PWR_MGM, ((_buff[0] & ~PWRMGM_SLEEP) | _State << 6));
}
 
bool ITG3200::isXgyroStandby() {
readmem(PWR_MGM, 1, &_buff[0]);
return (_buff[0] & PWRMGM_STBY_XG) >> 5;
}
 
bool ITG3200::isYgyroStandby() {
readmem(PWR_MGM, 1, &_buff[0]);
return (_buff[0] & PWRMGM_STBY_YG) >> 4;
}
 
bool ITG3200::isZgyroStandby() {
readmem(PWR_MGM, 1, &_buff[0]);
return (_buff[0] & PWRMGM_STBY_ZG) >> 3;
}
 
void ITG3200::setXgyroStandby(bool _Status) {
readmem(PWR_MGM, 1, &_buff[0]);
writemem(PWR_MGM, ((_buff[0] & PWRMGM_STBY_XG) | _Status << 5));
}
 
void ITG3200::setYgyroStandby(bool _Status) {
readmem(PWR_MGM, 1, &_buff[0]);
writemem(PWR_MGM, ((_buff[0] & PWRMGM_STBY_YG) | _Status << 4));
}
 
void ITG3200::setZgyroStandby(bool _Status) {
readmem(PWR_MGM, 1, &_buff[0]);
writemem(PWR_MGM, ((_buff[0] & PWRMGM_STBY_ZG) | _Status << 3));
}
 
byte ITG3200::getClockSource() {
readmem(PWR_MGM, 1, &_buff[0]);
return (_buff[0] & PWRMGM_CLK_SEL);
}
 
void ITG3200::setClockSource(byte _CLKsource) {
readmem(PWR_MGM, 1, &_buff[0]);
writemem(PWR_MGM, ((_buff[0] & ~PWRMGM_CLK_SEL) | _CLKsource));
}
 
void ITG3200::writemem(uint8_t _addr, uint8_t _val) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(_addr); // send register address
Wire.send(_val); // send value to write
Wire.endTransmission(); // end transmission
}
 
void ITG3200::readmem(uint8_t _addr, uint8_t _nbytes, uint8_t __buff[]) {
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.send(_addr); // sends register address to read from
Wire.endTransmission(); // end transmission
Wire.beginTransmission(_dev_address); // start transmission to device
Wire.requestFrom(_dev_address, _nbytes);// send data n-bytes read
uint8_t i = 0;
while (Wire.available()) {
__buff[i] = Wire.receive(); // receive DATA
i++;
}
Wire.endTransmission(); // end transmission
}
 
 
/branches/V0.82b-Arthur-P/itg3200filv05/ITG3200.h
0,0 → 1,189
/****************************************************************************
* ITG3200.h - ITG-3200/I2C library v0.5 for Arduino *
* Copyright 2010-2011 Filipe Vieira & various contributors *
* http://code.google.com/p/itg-3200driver *
* This file is part of ITG-3200 Arduino library. *
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/
/****************************************************************************
* Tested on Arduino Mega with ITG-3200 Breakout *
* SCL -> pin 21 (no pull up resistors) *
* SDA -> pin 20 (no pull up resistors) *
* CLK & GND -> pin GND *
* INT -> not connected (but can be used) *
* VIO & VDD -> pin 3.3V *
*****************************************************************************/
#ifndef ITG3200_h
#define ITG3200_h
 
#include "WProgram.h"
 
#define ITG3200_ADDR_AD0_HIGH 0x69 //AD0=1 0x69 I2C address when AD0 is connected to HIGH (VCC) - default for sparkfun breakout
#define ITG3200_ADDR_AD0_LOW 0x68 //AD0=0 0x68 I2C address when AD0 is connected to LOW (GND)
// "The LSB bit of the 7 bit address is determined by the logic level on pin 9.
// This allows two ITG-3200 devices to be connected to the same I2C bus.
// One device should have pin9 (or bit0) LOW and the other should be HIGH." source: ITG3200 datasheet
// Note that pin9 (AD0 - I2C Slave Address LSB) may not be available on some breakout boards so check
// the schematics of your breakout board for the correct address to use.
 
 
#define GYROSTART_UP_DELAY 70 // 50ms from gyro startup + 20ms register r/w startup
 
/* ---- Registers ---- */
#define WHO_AM_I 0x00 // RW SETUP: I2C address
#define SMPLRT_DIV 0x15 // RW SETUP: Sample Rate Divider
#define DLPF_FS 0x16 // RW SETUP: Digital Low Pass Filter/ Full Scale range
#define INT_CFG 0x17 // RW Interrupt: Configuration
#define INT_STATUS 0x1A // R Interrupt: Status
#define TEMP_OUT 0x1B // R SENSOR: Temperature 2bytes
#define GYRO_XOUT 0x1D // R SENSOR: Gyro X 2bytes
#define GYRO_YOUT 0x1F // R SENSOR: Gyro Y 2bytes
#define GYRO_ZOUT 0x21 // R SENSOR: Gyro Z 2bytes
#define PWR_MGM 0x3E // RW Power Management
 
/* ---- bit maps ---- */
#define DLPFFS_FS_SEL 0x18 // 00011000
#define DLPFFS_DLPF_CFG 0x07 // 00000111
#define INTCFG_ACTL 0x80 // 10000000
#define INTCFG_OPEN 0x40 // 01000000
#define INTCFG_LATCH_INT_EN 0x20 // 00100000
#define INTCFG_INT_ANYRD_2CLEAR 0x10 // 00010000
#define INTCFG_ITG_RDY_EN 0x04 // 00000100
#define INTCFG_RAW_RDY_EN 0x01 // 00000001
#define INTSTATUS_ITG_RDY 0x04 // 00000100
#define INTSTATUS_RAW_DATA_RDY 0x01 // 00000001
#define PWRMGM_HRESET 0x80 // 10000000
#define PWRMGM_SLEEP 0x40 // 01000000
#define PWRMGM_STBY_XG 0x20 // 00100000
#define PWRMGM_STBY_YG 0x10 // 00010000
#define PWRMGM_STBY_ZG 0x08 // 00001000
#define PWRMGM_CLK_SEL 0x07 // 00000111
 
/************************************/
/* REGISTERS PARAMETERS */
/************************************/
// Sample Rate Divider
#define NOSRDIVIDER 0 // default FsampleHz=SampleRateHz/(divider+1)
// Gyro Full Scale Range
#define RANGE2000 3 // default
// Digital Low Pass Filter BandWidth and SampleRate
#define BW256_SR8 0 // default 256Khz BW and 8Khz SR
#define BW188_SR1 1
#define BW098_SR1 2
#define BW042_SR1 3
#define BW020_SR1 4
#define BW010_SR1 5
#define BW005_SR1 6
// Interrupt Active logic lvl
#define ACTIVE_ONHIGH 0 // default
#define ACTIVE_ONLOW 1
// Interrupt drive type
#define PUSH_PULL 0 // default
#define OPEN_DRAIN 1
// Interrupt Latch mode
#define PULSE_50US 0 // default
#define UNTIL_INT_CLEARED 1
// Interrupt Latch clear method
#define READ_STATUSREG 0 // default
#define READ_ANYREG 1
// Power management
#define NORMAL 0 // default
#define STANDBY 1
// Clock Source - user parameters
#define INTERNALOSC 0 // default
#define PLL_XGYRO_REF 1
#define PLL_YGYRO_REF 2
#define PLL_ZGYRO_REF 3
#define PLL_EXTERNAL32 4 // 32.768 kHz
#define PLL_EXTERNAL19 5 // 19.2 Mhz
 
class ITG3200 {
 
public:
float gains[3];
int offsets[3];
float polarities[3];
 
ITG3200();
// Gyro initialization
void init(unsigned int address);
void init(unsigned int address, byte _SRateDiv, byte _Range, byte _filterBW, byte _ClockSrc, bool _ITGReady, bool _INTRawDataReady);
// Who Am I
byte getDevAddr();
void setDevAddr(unsigned int _addr);
// Sample Rate Divider
byte getSampleRateDiv();
void setSampleRateDiv(byte _SampleRate);
// Digital Low Pass Filter BandWidth and SampleRate
byte getFSRange();
void setFSRange(byte _Range); // RANGE2000
byte getFilterBW();
void setFilterBW(byte _BW); // see register parameters above
// Interrupt Configuration
bool isINTActiveOnLow();
void setINTLogiclvl(bool _State); //ACTIVE_ONHIGH, ACTIVE_ONLOW
// Interrupt drive type
bool isINTOpenDrain();
void setINTDriveType(bool _State); //OPEN_DRAIN, PUSH_PULL
// Interrupt Latch mode
bool isLatchUntilCleared();
void setLatchMode(bool _State); //UNTIL_INT_CLEARED, PULSE_50US
// Interrupt Latch clear method
bool isAnyRegClrMode();
void setLatchClearMode(bool _State); //READ_ANYREG, READ_STATUSREG
// INT pin triggers
bool isITGReadyOn();
void setITGReady(bool _State);
bool isRawDataReadyOn();
void setRawDataReady(bool _State);
// Trigger Status
bool isITGReady();
bool isRawDataReady();
// Gyro Sensors
void readTemp(float *_Temp);
void readGyroRaw(int *_GyroXYZ);
void readGyroRaw(int *_GyroX, int *_GyroY, int *_GyroZ);
void setRevPolarity(bool _Xpol, bool _Ypol, bool _Zpol); // true = Reversed false = default
void setGains(float _Xgain, float _Ygain, float _Zgain);
void setOffsets(int _Xoffset, int _Yoffset, int _Zoffset);
void zeroCalibrate(unsigned int totSamples, unsigned int sampleDelayMS); // assuming gyroscope is stationary (updates XYZ offsets for zero)
void readGyroRawCal(int *_GyroX, int *_GyroY, int *_GyroZ);
void readGyroRawCal(int *_GyroXYZ);
void readGyro(float *_GyroXYZ); // includes gain and offset
void readGyro(float *_GyroX, float *_GyroY, float *_GyroZ); // includes gain and offset
// Power management
void reset(); // after reset all registers have default values
bool isLowPower();
void setPowerMode(bool _State); // NORMAL, STANDBY
bool isXgyroStandby();
bool isYgyroStandby();
bool isZgyroStandby();
void setXgyroStandby(bool _Status); // NORMAL, STANDBY
void setYgyroStandby(bool _Status);
void setZgyroStandby(bool _Status);
byte getClockSource();
void setClockSource(byte _CLKsource); // see register parameters above
void writemem(uint8_t _addr, uint8_t _val);
void readmem(uint8_t _addr, uint8_t _nbytes, uint8_t __buff[]);
private:
 
uint8_t _dev_address;
uint8_t _buff[6];
};
#endif
/branches/V0.82b-Arthur-P/itg3200filv05/examples/ITG3200_output/ITG3200_output.pde
0,0 → 1,216
// ITG-3200_output
// Copyright 2010-2011 Filipe Vieira & various contributors.
// http://code.google.com/p/itg-3200driver
// Simple example of library usage with almost every gyro and lib features being used.
 
#include <Wire.h>
#include <ITG3200.h>
 
ITG3200 gyro = ITG3200();
float xyz[3], temperature;
 
void setup(void) {
Serial.begin(9600);
Wire.begin(); // if experiencing gyro problems/crashes while reading XYZ values
// please read class constructor comments for further info.
delay(1000);
gyro.reset();
// Use ITG3200_ADDR_AD0_HIGH or ITG3200_ADDR_AD0_LOW as the ITG3200 address
// depending on how AD0 is connected on your breakout board, check its schematics for details
gyro.init(ITG3200_ADDR_AD0_HIGH);
Serial.print("zeroCalibrating...");
gyro.zeroCalibrate(2500,2);
Serial.println("done.");
showall();
Serial.println("Registers dump");
Serial.println("==========================================================");
dumpRegisters();
Serial.println("==========================================================");
delay(5000);
}
 
void loop(void) {
while (gyro.isRawDataReady()) {
gyro.readGyro(xyz);
Serial.print("X:");
Serial.print(xyz[0]);
Serial.print(" Y:");
Serial.print(xyz[1]);
Serial.print(" Z:");
Serial.println(xyz[2]);
}
}
void showall(void) {
Serial.println("Current ITG3200 settings");
Serial.println("==========================================================");
Serial.print("device address = 0x");
Serial.println(gyro.getDevAddr(), HEX);
Serial.print("Sample rate divider (Hz) = ");
if (gyro.getFilterBW() == BW256_SR8)
Serial.println(8000 / (gyro.getSampleRateDiv()+1), DEC);
else
Serial.println(1000 / (gyro.getSampleRateDiv()+1), DEC);
Serial.print("full scale range = ");
if (gyro.getFSRange() == RANGE2000)
Serial.println("+-2000 deg/sec");
else
Serial.println("reserved");
Serial.print("low pass filter BW = ");
switch (gyro.getFilterBW()) {
case BW256_SR8:
Serial.println("256Hz LowPassFilter BW/ 8Khz Sample Rate");
break;
case BW188_SR1:
Serial.println("188Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
case BW098_SR1:
Serial.println("98Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
case BW042_SR1:
Serial.println("42Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
case BW020_SR1:
Serial.println("20Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
case BW010_SR1:
Serial.println("10Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
case BW005_SR1:
Serial.println("5Hz LowPassFilter BW/ 1Khz Sample Rate");
break;
}
Serial.print("Logic level for INT output pin = ");
if (gyro.isINTActiveOnLow())
Serial.println("Active on Low");
else
Serial.println("Active on High");
Serial.print("INT drive type = ");
if (gyro.isINTOpenDrain())
Serial.println("Open Drain");
else
Serial.println("Push-Pull");
Serial.print("INT latch mode = ");
if (gyro.isLatchUntilCleared())
Serial.println("Latch until interrupt is cleared");
else
Serial.println("50us pulse");
Serial.print("INT latch clear mode = ");
if (gyro.isAnyRegClrMode())
Serial.println("Any register read");
else
Serial.println("Status register read only");
 
Serial.print("ITGReady trigger status = ");
if (gyro.isITGReadyOn())
Serial.println("High/Set");
else
Serial.println("Low/Clear");
 
Serial.print("RawDataReady trigger status = ");
if (gyro.isRawDataReady())
Serial.println("High/Set");
else
Serial.println("Low/Clear");
Serial.print("Temperature (Celsius) = ");
gyro.readTemp(&temperature);
Serial.println(temperature);
Serial.print("Power mode = ");
gyro.setPowerMode(NORMAL);
if (gyro.isLowPower() == STANDBY)
Serial.println("Low power (sleep)");
else
Serial.println("Normal");
 
Serial.print("Xgyro status = ");
if (gyro.isXgyroStandby() == NORMAL )
Serial.println("Normal");
else
Serial.println("StandBy");
Serial.print("Ygyro status = ");
if (gyro.isYgyroStandby() == NORMAL )
Serial.println("Normal");
else
Serial.println("StandBy");
 
Serial.print("Zgyro status = ");
if (gyro.isZgyroStandby() == NORMAL )
Serial.println("Normal");
else
Serial.println("StandBy");
 
Serial.print("Clock source = ");
switch (gyro.getClockSource()) {
case INTERNALOSC:
Serial.println("Internal oscillator");
break;
case PLL_XGYRO_REF:
Serial.println("PLL with X Gyro reference");
break;
case PLL_YGYRO_REF:
Serial.println("PLL with Y Gyro reference");
break;
case PLL_ZGYRO_REF:
Serial.println("PLL with Z Gyro reference");
break;
case PLL_EXTERNAL32:
Serial.println("PLL with external 32.768kHz reference");
break;
case PLL_EXTERNAL19:
Serial.println("PLL with external 19.2MHz reference");
break;
}
Serial.print("X offset = ");
Serial.println(gyro.offsets[0]);
Serial.print("Y offset = ");
Serial.println(gyro.offsets[1]);
Serial.print("Z offset = ");
Serial.println(gyro.offsets[2]);
}
 
void dumpRegisters() {
byte ValidRegisterAddr[]={0,21,22,23,26,27,28,29,30,31,32,33,34,57,56,62};
byte _b, i, totregisters = sizeof(ValidRegisterAddr);
Serial.println("---dump start---");
Serial.println("Register address|Register data");
Serial.println("Reg.address(hex,dec) Reg.data(bin,hex,dec)");
for (i=0;i<totregisters;i++){
Serial.print("0x");
Serial.print(ValidRegisterAddr[i], HEX);
Serial.print(",");
Serial.print(ValidRegisterAddr[i], DEC);
Serial.print(",");
gyro.readmem(ValidRegisterAddr[i], 1, &_b);
Serial.print("b");
print_bits(_b);
Serial.print(",0x");
Serial.print(_b,HEX);
Serial.print(",");
Serial.println(_b,DEC);
}
Serial.println("---dump end---");
}
 
void print_bits(uint8_t val){
for(int i=7; i>=0; i--)
Serial.print(val >> i & 1, BIN);
}
void print_unit16(uint16_t val){
for(int i=15; i>=0; i--)
Serial.print(val >> i & 1, BIN);
}
/branches/V0.82b-Arthur-P/itg3200filv05/examples/ITG3200_test/ITG3200_test.pde
0,0 → 1,66
// ITG-3200_test
// Copyright 2010-2011 Filipe Vieira & various contributors.
// http://code.google.com/p/itg-3200driver
// Simple test of gyro sensors output using default settings.
 
#include <Wire.h>
#include <ITG3200.h>
 
ITG3200 gyro = ITG3200();
float x,y,z,temperature;
int ix, iy, iz;
 
void setup(void) {
Serial.begin(9600);
Wire.begin(); // if experiencing gyro problems/crashes while reading XYZ values
// please read class constructor comments for further info.
delay(1000);
// Use ITG3200_ADDR_AD0_HIGH or ITG3200_ADDR_AD0_LOW as the ITG3200 address
// depending on how AD0 is connected on your breakout board, check its schematics for details
gyro.init(ITG3200_ADDR_AD0_HIGH);
Serial.print("zeroCalibrating...");
gyro.zeroCalibrate(2500, 2);
Serial.println("done.");
}
 
void loop(void) {
while (gyro.isRawDataReady()) {
/*
// Reads uncalibrated raw values from the sensor
gyro.readGyroRaw(&ix,&iy,&iz);
Serial.print("X:");
Serial.print(ix);
Serial.print(" Y:");
Serial.print(iy);
Serial.print(" Z:");
Serial.print(iz);
*/
/*
// Reads calibrated raw values from the sensor
gyro.readGyroRawCal(&ix,&iy,&iz);
Serial.print("X:");
Serial.print(ix);
Serial.print(" Y:");
Serial.print(iy);
Serial.print(" Z:");
Serial.print(iz);
*/
// Reads calibrated values in deg/sec
gyro.readTemp(&temperature);
gyro.readGyro(&x,&y,&z);
Serial.print("X:");
Serial.print(x);
Serial.print(" Y:");
Serial.print(y);
Serial.print(" Z:");
Serial.print(z);
Serial.print(" T:");
Serial.println(temperature);
}
}
 
 
 
/branches/V0.82b-Arthur-P/itg3200filv05/keywords.txt
0,0 → 1,42
ITG3200 KEYWORD1
init KEYWORD2
getDevAddr KEYWORD2
setDevAddr KEYWORD2
getSampleRateDiv KEYWORD2
setSampleRateDiv KEYWORD2
getFSRange KEYWORD2
setFSRange KEYWORD2
getFilterBW KEYWORD2
setFilterBW KEYWORD2
isINTActiveOnLow KEYWORD2
setINTLogiclvl KEYWORD2
isINTOpenDrain KEYWORD2
setINTDriveType KEYWORD2
isLatchUntilCleared KEYWORD2
setLatchMode KEYWORD2
isAnyRegClrMode KEYWORD2
setLatchClearMode KEYWORD2
isITGReadyOn KEYWORD2
setITGReady KEYWORD2
isRawDataReadyOn KEYWORD2
setRawDataReady KEYWORD2
isITGReady KEYWORD2
isRawDataReady KEYWORD2
readTemp KEYWORD2
readGyroRaw KEYWORD2
setRevPolarity KEYWORD2
setGains KEYWORD2
setOffsets KEYWORD2
zeroCalibrate KEYWORD2
readGyro KEYWORD2
reset KEYWORD2
isLowPower KEYWORD2
isXgyroStandby KEYWORD2
isYgyroStandby KEYWORD2
isZgyroStandby KEYWORD2
setXgyroStandby KEYWORD2
setYgyroStandby KEYWORD2
setZgyroStandby KEYWORD2
getClockSource KEYWORD2
setClockSource KEYWORD2