2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.AltosLib;
20 public class AltosMs5607 {
35 static final boolean ms5611 = false;
44 dT = raw_temp - ((int) tref << 8);
46 TEMP = (int) (2000 + (((long) dT * (long) tempsens) >> 23));
49 OFF = ((long) off << 16) + (((long) tco * (long) dT) >> 7);
51 SENS = ((long) sens << 15) + (((long) tcs * (long) dT) >> 8);
53 OFF = ((long) off << 17) + (((long) tco * (long) dT) >> 6);
55 SENS = ((long) sens << 16) + (((long) tcs * (long) dT) >> 7);
59 int T2 = (int) (((long) dT * (long) dT) >> 31);
60 int TEMPM = TEMP - 2000;
61 long OFF2 = ((long) 61 * (long) TEMPM * (long) TEMPM) >> 4;
62 long SENS2 = (long) 2 * (long) TEMPM * (long) TEMPM;
64 int TEMPP = TEMP + 1500;
65 long TEMPP2 = (long) TEMPP * (long) TEMPP;
66 OFF2 = OFF2 + 15 * TEMPP2;
67 SENS2 = SENS2 + 8 * TEMPP2;
74 pa = (int) (((((long) raw_pres * SENS) >> 21) - OFF) >> 15);
78 public int set(int in_pres, int in_temp) {
85 public AltosMs5607() {
86 raw_pres = AltosRecord.MISSING;
87 raw_temp = AltosRecord.MISSING;
88 pa = AltosRecord.MISSING;
89 cc = AltosRecord.MISSING;