From 210dbaa23cdacf3a6f2d6e23493e96ee2ac9bca7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 4 Jun 2009 10:41:34 -0700 Subject: [PATCH] Use autotools, move altos to src subdir Signed-off-by: Keith Packard --- .gitignore | 12 + AUTHORS | 1 + ChangeLog | 0 INSTALL | 290 +++++++++++++++++++ Makefile.am | 1 + NEWS | 0 aoview/Makefile | 48 --- aoview/Makefile.am | 28 ++ aoview/aoview_convert.c | 2 +- autogen.sh | 12 + configure.ac | 58 ++++ 25lc1024.h => src/25lc1024.h | 0 Makefile => src/Makefile | 12 +- _bp.c => src/_bp.c | 10 +- altitude.h => src/altitude.h | 0 ao-make-product.5c => src/ao-make-product.5c | 0 ao.h => src/ao.h | 0 ao_adc.c => src/ao_adc.c | 5 +- ao_adc_fake.c => src/ao_adc_fake.c | 0 ao_beep.c => src/ao_beep.c | 0 ao_cmd.c => src/ao_cmd.c | 6 +- ao_config.c => src/ao_config.c | 0 ao_convert.c => src/ao_convert.c | 0 ao_dbg.c => src/ao_dbg.c | 6 +- ao_dma.c => src/ao_dma.c | 6 +- ao_ee.c => src/ao_ee.c | 16 +- ao_ee_fake.c => src/ao_ee_fake.c | 0 ao_flight.c => src/ao_flight.c | 0 ao_flight_test.c => src/ao_flight_test.c | 0 ao_gps.c => src/ao_gps.c | 24 +- ao_gps_print.c => src/ao_gps_print.c | 1 - ao_gps_report.c => src/ao_gps_report.c | 0 ao_ignite.c => src/ao_ignite.c | 0 ao_led.c => src/ao_led.c | 0 ao_log.c => src/ao_log.c | 6 +- ao_main.c => src/ao_main.c | 0 ao_monitor.c => src/ao_monitor.c | 0 ao_mutex.c => src/ao_mutex.c | 2 +- ao_panic.c => src/ao_panic.c | 2 +- ao_product.c => src/ao_product.c | 0 ao_radio.c => src/ao_radio.c | 1 - ao_report.c => src/ao_report.c | 0 ao_rssi.c => src/ao_rssi.c | 0 ao_serial.c => src/ao_serial.c | 0 ao_state.c => src/ao_state.c | 0 ao_stdio.c => src/ao_stdio.c | 0 ao_task.c => src/ao_task.c | 10 +- ao_teledongle.c => src/ao_teledongle.c | 2 +- ao_telemetrum.c => src/ao_telemetrum.c | 0 ao_telemetry.c => src/ao_telemetry.c | 0 ao_teleterra.c => src/ao_teleterra.c | 0 ao_test.c => src/ao_test.c | 2 +- ao_tidongle.c => src/ao_tidongle.c | 2 +- ao_timer.c => src/ao_timer.c | 1 - ao_usb.c => src/ao_usb.c | 12 +- ao_usb.h => src/ao_usb.h | 0 cc1111.h => src/cc1111.h | 12 +- check-stack => src/check-stack | 0 gps-cksum => src/gps-cksum | 0 make-altitude => src/make-altitude | 22 +- 60 files changed, 481 insertions(+), 131 deletions(-) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS delete mode 100644 aoview/Makefile create mode 100644 aoview/Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac rename 25lc1024.h => src/25lc1024.h (100%) rename Makefile => src/Makefile (98%) rename _bp.c => src/_bp.c (89%) rename altitude.h => src/altitude.h (100%) rename ao-make-product.5c => src/ao-make-product.5c (100%) rename ao.h => src/ao.h (100%) rename ao_adc.c => src/ao_adc.c (99%) rename ao_adc_fake.c => src/ao_adc_fake.c (100%) rename ao_beep.c => src/ao_beep.c (100%) rename ao_cmd.c => src/ao_cmd.c (99%) rename ao_config.c => src/ao_config.c (100%) rename ao_convert.c => src/ao_convert.c (100%) rename ao_dbg.c => src/ao_dbg.c (99%) rename ao_dma.c => src/ao_dma.c (97%) rename ao_ee.c => src/ao_ee.c (99%) rename ao_ee_fake.c => src/ao_ee_fake.c (100%) rename ao_flight.c => src/ao_flight.c (100%) rename ao_flight_test.c => src/ao_flight_test.c (100%) rename ao_gps.c => src/ao_gps.c (99%) rename ao_gps_print.c => src/ao_gps_print.c (99%) rename ao_gps_report.c => src/ao_gps_report.c (100%) rename ao_ignite.c => src/ao_ignite.c (100%) rename ao_led.c => src/ao_led.c (100%) rename ao_log.c => src/ao_log.c (99%) rename ao_main.c => src/ao_main.c (100%) rename ao_monitor.c => src/ao_monitor.c (100%) rename ao_mutex.c => src/ao_mutex.c (98%) rename ao_panic.c => src/ao_panic.c (99%) rename ao_product.c => src/ao_product.c (100%) rename ao_radio.c => src/ao_radio.c (99%) rename ao_report.c => src/ao_report.c (100%) rename ao_rssi.c => src/ao_rssi.c (100%) rename ao_serial.c => src/ao_serial.c (100%) rename ao_state.c => src/ao_state.c (100%) rename ao_stdio.c => src/ao_stdio.c (100%) rename ao_task.c => src/ao_task.c (99%) rename ao_teledongle.c => src/ao_teledongle.c (99%) rename ao_telemetrum.c => src/ao_telemetrum.c (100%) rename ao_telemetry.c => src/ao_telemetry.c (100%) rename ao_teleterra.c => src/ao_teleterra.c (100%) rename ao_test.c => src/ao_test.c (99%) rename ao_tidongle.c => src/ao_tidongle.c (99%) rename ao_timer.c => src/ao_timer.c (99%) rename ao_usb.c => src/ao_usb.c (99%) rename ao_usb.h => src/ao_usb.h (100%) rename cc1111.h => src/cc1111.h (99%) rename check-stack => src/check-stack (100%) rename gps-cksum => src/gps-cksum (100%) rename make-altitude => src/make-altitude (94%) diff --git a/.gitignore b/.gitignore index 24dee3b0..190ba2fd 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,15 @@ ao-telemetrum.h ao-teleterra.h ao-teledongle.h ao-tidongle.h +Makefile.in +aclocal.m4 +.deps +autom4te.cache +config.* +depcomp +install-sh +missing +stamp-h1 +configure +Makefile +aoview/Makefile diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..9cee0373 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Keith Packard diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..c9fd2c0c --- /dev/null +++ b/INSTALL @@ -0,0 +1,290 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..e5c0c1e8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=src aoview diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/aoview/Makefile b/aoview/Makefile deleted file mode 100644 index 6bf789bb..00000000 --- a/aoview/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -VERSION=$(shell git describe) -MODULES=gtk+-2.0 libglade-2.0 gconf-2.0 -INCLUDES=$(shell pkg-config --cflags $(MODULES)) -I.. -WARN= -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -CFLAGS=$(INCLUDES) -O0 -g $(WARN) -DAOVIEW_VERSION='"$(VERSION)"' -LIBS=$(shell pkg-config --libs $(MODULES)) -lm - -BIN=/usr/local/bin - -SRC = \ - aoview_main.c \ - aoview_dev.c \ - aoview_dev_dialog.c \ - aoview_serial.c \ - aoview_monitor.c \ - aoview_state.c \ - aoview_convert.c \ - aoview_log.c \ - aoview_table.c \ - aoview_util.c \ - aoview_file.c \ - aoview_eeprom.c - -INC = \ - aoview.h - -OBJ = \ - $(SRC:.c=.o) - -PROG = aoview - -$(PROG): $(OBJ) - $(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS) - -$(OBJ): $(INC) - -aoview_main.o: aoview_glade.h - -clean: - rm -f $(OBJ) $(PROG) - -install: $(BIN)/aoview - -$(BIN)/aoview: aoview - install aoview $(BIN) - -aoview_glade.h: aoview.glade - sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' $< > $@ diff --git a/aoview/Makefile.am b/aoview/Makefile.am new file mode 100644 index 00000000..9f67ac40 --- /dev/null +++ b/aoview/Makefile.am @@ -0,0 +1,28 @@ +VERSION=$(shell git describe) +AM_CFLAGS=$(AOVIEW_CFLAGS) -I$(top_srcdir)/src -DAOVIEW_VERSION=\"$(VERSION)\" + +bin_PROGRAMS=aoview + +aoview_LDADD=$(AOVIEW_LIBS) + +aoview_SOURCES = \ + aoview_main.c \ + aoview_dev.c \ + aoview_dev_dialog.c \ + aoview_serial.c \ + aoview_monitor.c \ + aoview_state.c \ + aoview_convert.c \ + aoview_log.c \ + aoview_table.c \ + aoview_util.c \ + aoview_file.c \ + aoview_eeprom.c \ + aoview.h + +BUILT_SOURCES = aoview_glade.h + +CLEANFILES = aoview_glade.h + +aoview_glade.h: aoview.glade + sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' $< > $@ diff --git a/aoview/aoview_convert.c b/aoview/aoview_convert.c index a4bf813d..02416647 100644 --- a/aoview/aoview_convert.c +++ b/aoview/aoview_convert.c @@ -18,7 +18,7 @@ #include "aoview.h" static int16_t altitude_table[2048] = { -#include "../altitude.h" +#include "altitude.h" }; int16_t diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..4e8b11ba --- /dev/null +++ b/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf --force -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..0419489a --- /dev/null +++ b/configure.ac @@ -0,0 +1,58 @@ +dnl +dnl Copyright © 2008 Keith Packard +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +dnl +dnl Process this file with autoconf to create configure. + +AC_INIT(aoview) + +AM_INIT_AUTOMAKE(aoview, 0.1) +AM_MAINTAINER_MODE + +dnl ========================================================================== + +AM_CONFIG_HEADER(config.h) + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_RANLIB +PKG_PROG_PKG_CONFIG + +CFLAGS="-g" +WARN_CFLAGS="" +if test "x$GCC" = "xyes"; then + WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ + -Wmissing-prototypes -Wmissing-declarations \ + -Wnested-externs -fno-strict-aliasing" + AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1, + [Can use #warning in C files]) +fi +AC_SUBST(WARN_CFLAGS) + +dnl ========================================================================== + +AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes) + +dnl ========================================================================== + + +PKG_CHECK_MODULES([AOVIEW], [gtk+-2.0 libglade-2.0 gconf-2.0]) + +AC_OUTPUT([ +Makefile +aoview/Makefile +]) diff --git a/25lc1024.h b/src/25lc1024.h similarity index 100% rename from 25lc1024.h rename to src/25lc1024.h diff --git a/Makefile b/src/Makefile similarity index 98% rename from Makefile rename to src/Makefile index ca296c6f..39281369 100644 --- a/Makefile +++ b/src/Makefile @@ -1,12 +1,12 @@ # # AltOS build # -# +# CC=sdcc VERSION=$(shell git describe) -CFLAGS=--model-small --debug --opt-code-speed +CFLAGS=--model-small --debug --opt-code-speed LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \ --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff @@ -68,7 +68,7 @@ TELE_FAKE_SRC = \ ao_adc_fake.c \ ao_ee_fake.c -# +# # Drivers only on TeleMetrum # TM_DRIVER_SRC = \ @@ -114,7 +114,7 @@ TI_SRC = \ $(TELE_COMMON_SRC) \ $(TELE_FAKE_SRC) \ $(TI_MAIN_SRC) - + TT_MAIN_SRC = \ ao_teleterra.c # @@ -128,8 +128,8 @@ TT_SRC = \ $(TELE_COMMON_SRC) \ $(TELE_FAKE_SRC) \ $(TT_MAIN_SRC) - - + + # # Sources for TeleDongle # diff --git a/_bp.c b/src/_bp.c similarity index 89% rename from _bp.c rename to src/_bp.c index a57b99bc..6bf135bc 100644 --- a/_bp.c +++ b/src/_bp.c @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------- - _bp.c :- just declares bp as a variable + _bp.c :- just declares bp as a variable Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999) @@ -8,19 +8,19 @@ under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + This library 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 Library General Public License for more details. - + You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - + In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! + what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ __data unsigned char bp ; diff --git a/altitude.h b/src/altitude.h similarity index 100% rename from altitude.h rename to src/altitude.h diff --git a/ao-make-product.5c b/src/ao-make-product.5c similarity index 100% rename from ao-make-product.5c rename to src/ao-make-product.5c diff --git a/ao.h b/src/ao.h similarity index 100% rename from ao.h rename to src/ao.h diff --git a/ao_adc.c b/src/ao_adc.c similarity index 99% rename from ao_adc.c rename to src/ao_adc.c index bef6bb7f..26209dcf 100644 --- a/ao_adc.c +++ b/src/ao_adc.c @@ -44,7 +44,7 @@ ao_adc_isr(void) interrupt 1 { uint8_t sequence; uint8_t __xdata *a; - + sequence = (ADCCON2 & ADCCON2_SCH_MASK) >> ADCCON2_SCH_SHIFT; a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].accel + sequence); a[0] = ADCL; @@ -84,10 +84,9 @@ ao_adc_init(void) (1 << 3) | /* battery voltage */ (1 << 4) | /* drogue sense */ (1 << 5)); /* main sense */ - + /* enable interrupts */ ADCIF = 0; IEN0 |= IEN0_ADCIE; ao_cmd_register(&ao_adc_cmds[0]); } - diff --git a/ao_adc_fake.c b/src/ao_adc_fake.c similarity index 100% rename from ao_adc_fake.c rename to src/ao_adc_fake.c diff --git a/ao_beep.c b/src/ao_beep.c similarity index 100% rename from ao_beep.c rename to src/ao_beep.c diff --git a/ao_cmd.c b/src/ao_cmd.c similarity index 99% rename from ao_cmd.c rename to src/ao_cmd.c index 827545d0..33619b24 100644 --- a/ao_cmd.c +++ b/src/ao_cmd.c @@ -69,7 +69,7 @@ readline(void) /* map CR to NL */ if (c == '\r') c = '\n'; - + if (c == '\n') { if (lex_echo) putchar('\n'); @@ -133,7 +133,7 @@ void ao_cmd_hex(void) { __xdata uint8_t r = ao_cmd_lex_error; - + ao_cmd_lex_i = 0; ao_cmd_white(); for(;;) { @@ -156,7 +156,7 @@ void ao_cmd_decimal(void) { __xdata uint8_t r = ao_cmd_lex_error; - + ao_cmd_lex_i = 0; ao_cmd_white(); for(;;) { diff --git a/ao_config.c b/src/ao_config.c similarity index 100% rename from ao_config.c rename to src/ao_config.c diff --git a/ao_convert.c b/src/ao_convert.c similarity index 100% rename from ao_convert.c rename to src/ao_convert.c diff --git a/ao_dbg.c b/src/ao_dbg.c similarity index 99% rename from ao_dbg.c rename to src/ao_dbg.c index 8a11a444..c8dc6ddc 100644 --- a/ao_dbg.c +++ b/src/ao_dbg.c @@ -174,12 +174,12 @@ ao_dbg_set_pins(void) /* Disable peripheral use of P0 */ ADCCFG = 0; P0SEL = 0; - - + + /* make P0_4 tri-state */ P0INP = DBG_DATA; P2INP &= ~(P2INP_PDUP0_PULL_DOWN); - + /* Raise RESET_N and CLOCK */ P0 = DBG_RESET_N | DBG_CLOCK; diff --git a/ao_dma.c b/src/ao_dma.c similarity index 97% rename from ao_dma.c rename to src/ao_dma.c index 8d96cc4b..a4d45f14 100644 --- a/ao_dma.c +++ b/src/ao_dma.c @@ -21,7 +21,7 @@ /* * The config address for DMA0 is programmed - * separately from that of DMA1-4, but for simplicity, + * separately from that of DMA1-4, but for simplicity, * we make them all contiguous. */ @@ -46,7 +46,7 @@ ao_dma_alloc(__xdata uint8_t *done) DMAIRQ = 0; DMAIF = 0; IEN1 |= IEN1_DMAIE; - } + } return id; } @@ -113,7 +113,7 @@ void ao_dma_isr(void) interrupt 8 { uint8_t id, mask; - + /* Find the first DMA channel which is done */ mask = 1; for (id = 0; id < ao_next_dma; id++) { diff --git a/ao_ee.c b/src/ao_ee.c similarity index 99% rename from ao_ee.c rename to src/ao_ee.c index a0f2e23a..f299b925 100644 --- a/ao_ee.c +++ b/src/ao_ee.c @@ -214,7 +214,7 @@ ao_ee_read_block(void) ao_ee_recv(ao_ee_data, EE_BLOCK); ao_ee_cs_high(); } - + static void ao_ee_flush_internal(void) { @@ -223,7 +223,7 @@ ao_ee_flush_internal(void) ao_ee_block_dirty = 0; } } - + static void ao_ee_fill(uint16_t block) { @@ -240,11 +240,11 @@ ao_ee_write(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant uint16_t block; uint16_t this_len; uint8_t this_off; - + if (pos >= AO_EE_DATA_SIZE || pos + len > AO_EE_DATA_SIZE) return 0; while (len) { - + /* Compute portion of transfer within * a single block */ @@ -281,11 +281,11 @@ ao_ee_read(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant uint16_t block; uint16_t this_len; uint8_t this_off; - + if (pos >= AO_EE_DATA_SIZE || pos + len > AO_EE_DATA_SIZE) return 0; while (len) { - + /* Compute portion of transfer within * a single block */ @@ -354,7 +354,7 @@ ee_dump(void) __xdata uint8_t b; __xdata uint16_t block; __xdata uint8_t i; - + ao_cmd_hex(); block = ao_cmd_lex_i; if (ao_cmd_status != ao_cmd_success) @@ -400,7 +400,7 @@ ee_store(void) ao_ee_write(addr, &b, 1); addr++; } - ao_ee_flush(); + ao_ee_flush(); } __code struct ao_cmds ao_ee_cmds[] = { diff --git a/ao_ee_fake.c b/src/ao_ee_fake.c similarity index 100% rename from ao_ee_fake.c rename to src/ao_ee_fake.c diff --git a/ao_flight.c b/src/ao_flight.c similarity index 100% rename from ao_flight.c rename to src/ao_flight.c diff --git a/ao_flight_test.c b/src/ao_flight_test.c similarity index 100% rename from ao_flight_test.c rename to src/ao_flight_test.c diff --git a/ao_gps.c b/src/ao_gps.c similarity index 99% rename from ao_gps.c rename to src/ao_gps.c index e5a5a884..cbde8b48 100644 --- a/ao_gps.c +++ b/src/ao_gps.c @@ -41,7 +41,7 @@ ao_gps_lexchar(void) { if (ao_gps_error) ao_gps_char = '\n'; - else + else ao_gps_char = ao_serial_getchar(); ao_gps_cksum ^= ao_gps_char; } @@ -74,7 +74,7 @@ ao_gps_decimal(uint8_t max_width) { int16_t v; __xdata uint8_t neg = 0; - + ao_gps_skip_sep(); if (ao_gps_char == '-') { neg = 1; @@ -168,7 +168,7 @@ ao_gps(void) __reentrant ao_gps_cksum = 0; ao_gps_error = 0; - + /* Skip anything other than GGA */ for (i = 0; i < AO_GPS_LEADER; i++) { ao_gps_lexchar(); @@ -181,9 +181,9 @@ ao_gps(void) __reentrant /* Now read the data into the gps data record * * $GPGGA,025149.000,4528.1723,N,12244.2480,W,1,05,2.0,103.5,M,-19.5,M,,0000*66 - * + * * Essential fix data - * + * * 025149.000 time (02:51:49.000 GMT) * 4528.1723,N Latitude 45°28.1723' N * 12244.2480,W Longitude 122°44.2480' W @@ -211,27 +211,27 @@ ao_gps(void) __reentrant ao_gps_next.minute = ao_gps_decimal(2); ao_gps_next.second = ao_gps_decimal(2); ao_gps_skip_field(); /* skip seconds fraction */ - + ao_gps_parse_pos(&ao_gps_next.latitude, 2); ao_gps_parse_flag('N', AO_GPS_LATITUDE_NORTH, 'S', AO_GPS_LATITUDE_SOUTH); ao_gps_parse_pos(&ao_gps_next.longitude, 3); ao_gps_parse_flag('W', AO_GPS_LONGITUDE_WEST, 'E', AO_GPS_LONGITUDE_EAST); - + i = ao_gps_decimal(0xff); if (i == 1) ao_gps_next.flags |= AO_GPS_VALID; - + i = ao_gps_decimal(0xff) << AO_GPS_NUM_SAT_SHIFT; if (i > AO_GPS_NUM_SAT_MASK) i = AO_GPS_NUM_SAT_MASK; ao_gps_next.flags |= i; - + ao_gps_lexchar(); ao_gps_skip_field(); /* Horizontal dilution */ - + ao_gps_next.altitude = ao_gps_decimal(0xff); ao_gps_skip_field(); /* skip any fractional portion */ - + /* Skip remaining fields */ while (ao_gps_char != '*' && ao_gps_char != '\n' && ao_gps_char != '\r') { ao_gps_lexchar(); @@ -241,7 +241,7 @@ ao_gps(void) __reentrant uint8_t cksum = ao_gps_cksum ^ '*'; if (cksum != ao_gps_hex(2)) ao_gps_error = 1; - } else + } else ao_gps_error = 1; if (!ao_gps_error) { ao_mutex_get(&ao_gps_mutex); diff --git a/ao_gps_print.c b/src/ao_gps_print.c similarity index 99% rename from ao_gps_print.c rename to src/ao_gps_print.c index 8cadd31f..7e157db5 100644 --- a/ao_gps_print.c +++ b/src/ao_gps_print.c @@ -43,4 +43,3 @@ ao_gps_print(__xdata struct ao_gps_data *gps_data) __reentrant printf(" unlocked\n"); } } - diff --git a/ao_gps_report.c b/src/ao_gps_report.c similarity index 100% rename from ao_gps_report.c rename to src/ao_gps_report.c diff --git a/ao_ignite.c b/src/ao_ignite.c similarity index 100% rename from ao_ignite.c rename to src/ao_ignite.c diff --git a/ao_led.c b/src/ao_led.c similarity index 100% rename from ao_led.c rename to src/ao_led.c diff --git a/ao_log.c b/src/ao_log.c similarity index 99% rename from ao_log.c rename to src/ao_log.c index 7284121d..19bfdfb8 100644 --- a/ao_log.c +++ b/src/ao_log.c @@ -113,12 +113,12 @@ void ao_log(void) { static __xdata struct ao_log_record log; - + ao_log_dump_scan(); while (!ao_log_running) ao_sleep(&ao_log_running); - + log.type = AO_LOG_FLIGHT; log.tick = ao_flight_tick; log.u.flight.ground_accel = ao_ground_accel; @@ -163,7 +163,7 @@ ao_log(void) if (ao_log_state == ao_flight_landed) ao_log_stop(); } - + /* Wait for a while */ ao_delay(AO_MS_TO_TICKS(100)); diff --git a/ao_main.c b/src/ao_main.c similarity index 100% rename from ao_main.c rename to src/ao_main.c diff --git a/ao_monitor.c b/src/ao_monitor.c similarity index 100% rename from ao_monitor.c rename to src/ao_monitor.c diff --git a/ao_mutex.c b/src/ao_mutex.c similarity index 98% rename from ao_mutex.c rename to src/ao_mutex.c index 8212a515..c82a7d57 100644 --- a/ao_mutex.c +++ b/src/ao_mutex.c @@ -23,7 +23,7 @@ ao_mutex_get(__xdata uint8_t *mutex) __reentrant if (*mutex == ao_cur_task->task_id) ao_panic(AO_PANIC_MUTEX); __critical { - while (*mutex) + while (*mutex) ao_sleep(mutex); *mutex = ao_cur_task->task_id; } diff --git a/ao_panic.c b/src/ao_panic.c similarity index 99% rename from ao_panic.c rename to src/ao_panic.c index f6ecc380..e996371e 100644 --- a/ao_panic.c +++ b/src/ao_panic.c @@ -32,7 +32,7 @@ void ao_panic(uint8_t reason) { uint8_t n; - + __critical for (;;) { ao_panic_delay(20); for (n = 0; n < 5; n++) { diff --git a/ao_product.c b/src/ao_product.c similarity index 100% rename from ao_product.c rename to src/ao_product.c diff --git a/ao_radio.c b/src/ao_radio.c similarity index 99% rename from ao_radio.c rename to src/ao_radio.c index e090fe74..ca1ec7e8 100644 --- a/ao_radio.c +++ b/src/ao_radio.c @@ -284,4 +284,3 @@ ao_radio_init(void) ao_radio_dma_done = 1; ao_radio_dma = ao_dma_alloc(&ao_radio_dma_done); } - diff --git a/ao_report.c b/src/ao_report.c similarity index 100% rename from ao_report.c rename to src/ao_report.c diff --git a/ao_rssi.c b/src/ao_rssi.c similarity index 100% rename from ao_rssi.c rename to src/ao_rssi.c diff --git a/ao_serial.c b/src/ao_serial.c similarity index 100% rename from ao_serial.c rename to src/ao_serial.c diff --git a/ao_state.c b/src/ao_state.c similarity index 100% rename from ao_state.c rename to src/ao_state.c diff --git a/ao_stdio.c b/src/ao_stdio.c similarity index 100% rename from ao_stdio.c rename to src/ao_stdio.c diff --git a/ao_task.c b/src/ao_task.c similarity index 99% rename from ao_task.c rename to src/ao_task.c index 06c279e9..12b73943 100644 --- a/ao_task.c +++ b/src/ao_task.c @@ -38,10 +38,10 @@ ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *nam * to the start of the task */ stack = task->stack; - + *stack++ = ((uint16_t) start); *stack++ = ((uint16_t) start) >> 8; - + /* and the stuff saved by ao_switch */ *stack++ = 0; /* acc */ *stack++ = 0x80; /* IE */ @@ -92,7 +92,7 @@ ao_yield(void) _naked _asm push _bp _endasm; - + if (ao_cur_task_index != AO_NO_TASK_INDEX) { uint8_t stack_len; @@ -107,7 +107,7 @@ ao_yield(void) _naked *save_ptr++ = *stack_ptr++; while (--stack_len); } - + /* Empty the stack; might as well let interrupts have the whole thing */ SP = AO_STACK_START - 1; @@ -141,7 +141,7 @@ ao_yield(void) _naked /* Restore the old stack */ stack_len = ao_cur_task->stack_count; SP = AO_STACK_START - 1 + stack_len; - + stack_ptr = (uint8_t __data *) AO_STACK_START; save_ptr = (uint8_t __xdata *) ao_cur_task->stack; do diff --git a/ao_teledongle.c b/src/ao_teledongle.c similarity index 99% rename from ao_teledongle.c rename to src/ao_teledongle.c index 67fe7614..567751c6 100644 --- a/ao_teledongle.c +++ b/src/ao_teledongle.c @@ -25,7 +25,7 @@ main(void) CLKCON = 0; while (!(SLEEP & SLEEP_XOSC_STB)) ; - + /* Turn on the LED until the system is stable */ ao_led_init(AO_LED_RED|AO_LED_GREEN); ao_led_on(AO_LED_RED); diff --git a/ao_telemetrum.c b/src/ao_telemetrum.c similarity index 100% rename from ao_telemetrum.c rename to src/ao_telemetrum.c diff --git a/ao_telemetry.c b/src/ao_telemetry.c similarity index 100% rename from ao_telemetry.c rename to src/ao_telemetry.c diff --git a/ao_teleterra.c b/src/ao_teleterra.c similarity index 100% rename from ao_teleterra.c rename to src/ao_teleterra.c diff --git a/ao_test.c b/src/ao_test.c similarity index 99% rename from ao_test.c rename to src/ao_test.c index 6d005ff6..c9bb02ae 100644 --- a/ao_test.c +++ b/src/ao_test.c @@ -114,6 +114,6 @@ main(void) ao_beep_init(); ao_led_init(); ao_usb_init(); - + ao_start_scheduler(); } diff --git a/ao_tidongle.c b/src/ao_tidongle.c similarity index 99% rename from ao_tidongle.c rename to src/ao_tidongle.c index b068d045..6dfa9ae9 100644 --- a/ao_tidongle.c +++ b/src/ao_tidongle.c @@ -25,7 +25,7 @@ main(void) CLKCON = 0; while (!(SLEEP & SLEEP_XOSC_STB)) ; - + /* Turn on the LED until the system is stable */ ao_led_init(AO_LED_RED); ao_led_on(AO_LED_RED); diff --git a/ao_timer.c b/src/ao_timer.c similarity index 99% rename from ao_timer.c rename to src/ao_timer.c index a6a7646f..81c3b376 100644 --- a/ao_timer.c +++ b/src/ao_timer.c @@ -83,4 +83,3 @@ ao_timer_init(void) /* enable timer 1 in module mode, dividing by 8 */ T1CTL = T1CTL_MODE_MODULO | T1CTL_DIV_8; } - diff --git a/ao_usb.c b/src/ao_usb.c similarity index 99% rename from ao_usb.c rename to src/ao_usb.c index 315eea08..99f0715b 100644 --- a/ao_usb.c +++ b/src/ao_usb.c @@ -38,7 +38,7 @@ ao_usb_set_interrupts(void) USBCIE = USBCIE_RSTIE; } -/* This interrupt is shared with port 2, +/* This interrupt is shared with port 2, * so when we hook that up, fix this */ void @@ -80,7 +80,7 @@ ao_usb_ep0_flush(void) { __xdata uint8_t this_len; __xdata uint8_t cs0; - + USBINDEX = 0; cs0 = USBCS0; if (cs0 & USBCS0_INPKT_RDY) @@ -132,7 +132,7 @@ static void ao_usb_ep0_fill(void) { __xdata uint8_t len; - + USBINDEX = 0; len = USBCNT0; if (len > ao_usb_ep0_out_len) @@ -198,7 +198,7 @@ ao_usb_ep0_setup(void) USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_DATA_END; else USBCS0 = USBCS0_CLR_OUTPKT_RDY; - + ao_usb_ep0_in_data = ao_usb_ep0_in_buf; ao_usb_ep0_in_len = 0; switch(ao_usb_setup.dir_type_recip & AO_USB_SETUP_TYPE_MASK) { @@ -379,7 +379,7 @@ ao_usb_enable(void) SLEEP |= SLEEP_USB_EN; ao_usb_set_configuration(); - + ao_usb_set_interrupts(); /* enable USB interrupts */ @@ -399,7 +399,7 @@ ao_usb_disable(void) USBOIE = 0; USBCIE = 0; IEN2 &= ~IEN2_USBIE; - + /* Clear any pending interrupts */ USBCIF = 0; USBOIF = 0; diff --git a/ao_usb.h b/src/ao_usb.h similarity index 100% rename from ao_usb.h rename to src/ao_usb.h diff --git a/cc1111.h b/src/cc1111.h similarity index 99% rename from cc1111.h rename to src/cc1111.h index 4e451465..f55e802f 100644 --- a/cc1111.h +++ b/src/cc1111.h @@ -2,22 +2,22 @@ Register Declarations for the ChipCon CC1111 Processor Range Copyright © 2008 Keith Packard - + 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; version 2 of the 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 General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. Adapted from the Cygnal C8051F12x config file which is: - + Copyright (C) 2003 - Maarten Brock, sourceforge.brock@dse.nl This library is free software; you can redistribute it and/or @@ -129,7 +129,7 @@ sbit at 0x99 ENCIF_1; /* AES interrupt 1. */ #define S0CON_ENCIF_1 (1 << 1) #define S0CON_ENCIF_0 (1 << 0) -/* +/* * S1CON */ sfr at 0x9B S1CON; /* CPU Interrupt Flag 3 */ @@ -261,7 +261,7 @@ sfr at 0xCA T3CNT; sfr at 0xEA T4CNT; /* Timer control */ - + sfr at 0xCB T3CTL; sfr at 0xEB T4CTL; diff --git a/check-stack b/src/check-stack similarity index 100% rename from check-stack rename to src/check-stack diff --git a/gps-cksum b/src/gps-cksum similarity index 100% rename from gps-cksum rename to src/gps-cksum diff --git a/make-altitude b/src/make-altitude similarity index 94% rename from make-altitude rename to src/make-altitude index ddfab5fc..ac04e84f 100644 --- a/make-altitude +++ b/src/make-altitude @@ -39,7 +39,7 @@ const int[NUMBER_OF_LAYERS] base_altitude = { /* outputs atmospheric pressure associated with the given altitude. altitudes are measured with respect to the mean sea level */ real altitude_to_pressure(real altitude) { - + real base_temperature = LAYER0_BASE_TEMPERATURE; real base_pressure = LAYER0_BASE_PRESSURE; @@ -48,7 +48,7 @@ real altitude_to_pressure(real altitude) { real exponent; /* exponent for function to determine pressure */ int layer_number; /* identifies layer in the atmosphere */ int delta_z; /* difference between two altitudes */ - + if (altitude > MAXIMUM_ALTITUDE) /* FIX ME: use sensor data to improve model */ return 0; @@ -57,13 +57,13 @@ real altitude_to_pressure(real altitude) { for(layer_number = 0; layer_number < NUMBER_OF_LAYERS - 1 && altitude > base_altitude[layer_number + 1]; layer_number++) { delta_z = base_altitude[layer_number + 1] - base_altitude[layer_number]; if (lapse_rate[layer_number] == 0.0) { - exponent = GRAVITATIONAL_ACCELERATION * delta_z + exponent = GRAVITATIONAL_ACCELERATION * delta_z / AIR_GAS_CONSTANT / base_temperature; base_pressure *= exp(exponent); } else { base = (lapse_rate[layer_number] * delta_z / base_temperature) + 1.0; - exponent = GRAVITATIONAL_ACCELERATION / + exponent = GRAVITATIONAL_ACCELERATION / (AIR_GAS_CONSTANT * lapse_rate[layer_number]); base_pressure *= pow(base, exponent); } @@ -73,7 +73,7 @@ real altitude_to_pressure(real altitude) { /* calculate the pressure at the inputted altitude */ delta_z = altitude - base_altitude[layer_number]; if (lapse_rate[layer_number] == 0.0) { - exponent = GRAVITATIONAL_ACCELERATION * delta_z + exponent = GRAVITATIONAL_ACCELERATION * delta_z / AIR_GAS_CONSTANT / base_temperature; pressure = base_pressure * exp(exponent); } @@ -82,7 +82,7 @@ real altitude_to_pressure(real altitude) { exponent = GRAVITATIONAL_ACCELERATION / (AIR_GAS_CONSTANT * lapse_rate[layer_number]); pressure = base_pressure * pow(base, exponent); - } + } return pressure; } @@ -119,13 +119,13 @@ real pressure_to_altitude(real pressure) { base_temperature = next_base_temperature; delta_z = base_altitude[layer_number + 1] - base_altitude[layer_number]; if (lapse_rate[layer_number] == 0.0) { - exponent = GRAVITATIONAL_ACCELERATION * delta_z + exponent = GRAVITATIONAL_ACCELERATION * delta_z / AIR_GAS_CONSTANT / base_temperature; next_base_pressure *= exp(exponent); } else { base = (lapse_rate[layer_number] * delta_z / base_temperature) + 1.0; - exponent = GRAVITATIONAL_ACCELERATION / + exponent = GRAVITATIONAL_ACCELERATION / (AIR_GAS_CONSTANT * lapse_rate[layer_number]); next_base_pressure *= pow(base, exponent); } @@ -135,14 +135,14 @@ real pressure_to_altitude(real pressure) { /* calculate the altitude associated with the inputted pressure */ if (lapse_rate[layer_number] == 0.0) { - coefficient = (AIR_GAS_CONSTANT / GRAVITATIONAL_ACCELERATION) + coefficient = (AIR_GAS_CONSTANT / GRAVITATIONAL_ACCELERATION) * base_temperature; altitude = base_altitude[layer_number] + coefficient * log(pressure / base_pressure); } else { base = pressure / base_pressure; - exponent = AIR_GAS_CONSTANT * lapse_rate[layer_number] + exponent = AIR_GAS_CONSTANT * lapse_rate[layer_number] / GRAVITATIONAL_ACCELERATION; coefficient = base_temperature / lapse_rate[layer_number]; altitude = base_altitude[layer_number] @@ -171,7 +171,7 @@ real meters_to_feet(real meters) * Voltage at 115kPa: 2.82 * Output scale: 27mV/kPa * - * + * * 27 mV/kPa * 2047 / 3300 counts/mV = 16.75 counts/kPa * 2.82V * 2047 / 3.3 counts/V = 1749 counts/115 kPa */ -- 2.30.2