diff options
author | Bernhard Tittelbach <bernhard@tittelbach.org> | 2016-05-28 02:53:04 +0200 |
---|---|---|
committer | Bernhard Tittelbach <bernhard@tittelbach.org> | 2016-06-12 03:33:08 +0200 |
commit | 0902b8396d74a2b1ba8bfd9e1f4e5517f590b369 (patch) | |
tree | cad355f11260307f6696987602e4a703187ec273 | |
parent | updated to PJON 3.0 Release (diff) |
Revert "bmp180 pressure sensor, just lacks arduino i2c-wire-lib and testing"
This reverts commit 9b0dc692177cdc6d8fa7aad4949e5e7a0abb6399.
# Conflicts:
# contrib/Makefile
-rw-r--r-- | bmp180.mk | 42 | ||||
-rw-r--r-- | contrib/Makefile | 8 | ||||
-rw-r--r-- | include.mk | 23 | ||||
-rw-r--r-- | usb-bmp180/Makefile | 53 | ||||
-rw-r--r-- | usb-bmp180/usb-bmp180.c | 162 |
5 files changed, 1 insertions, 287 deletions
diff --git a/bmp180.mk b/bmp180.mk deleted file mode 100644 index 5bac3ac..0000000 --- a/bmp180.mk +++ /dev/null @@ -1,42 +0,0 @@ -## -## spreadspace avr utils -## -## -## Copyright (C) 2013-2016 Christian Pointner <equinox@spreadspace.org> -## Copyright (C) 2016 Bernhard Tittelbach <bernhard@tittelbach.org> -## -## This file is part of spreadspace avr utils. -## -## spreadspace avr utils 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 -## any later version. -## -## spreadspace avr utils 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 spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. -## - -include $(SPREADAVR_PATH)/defines.mk - -SRC:=$(wildcard $(BMP180_PATH)/*.cpp) - -CXXFLAGS += -I$(BMP180_PATH) -CXXFLAGS += -DARDUINO=106 -CXXFLAGS += -DNEED_CXX_BITS -CXXFLAGS += $(BMP180_OPTS) - -OBJ = $(SRC:%.cpp=%.o) - -libbmp180.a: $(OBJ) - $(AR) $@ $(OBJ) - -%.o: %.cpp - $(CXX) -c $(CXXFLAGS) $< -o $@ - -clean: - rm -f $(SRC:%.cpp=%.o) diff --git a/contrib/Makefile b/contrib/Makefile index b09e6c0..3308183 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -25,9 +25,8 @@ LUFA_VERSION := 151115 FASTLED_VERSION := 3.1.0 PJON_VERSION := 3.0 -BMP180_VERSION := V_1.1.2 -all: download-lufa download-fastled download-pjon update-teensy-loader download-bmp180 +all: download-lufa download-fastled download-pjon update-teensy-loader download-lufa: LUFA-${LUFA_VERSION}.zip @@ -42,11 +41,6 @@ FastLED-${FASTLED_VERSION}.zip: unzip $@ cd FastLED-${FASTLED_VERSION}; patch -p1 < ../fastled4minimus32.patch -download-bmp180: BMP180-${BMP180_VERSION}.zip - -BMP180-${BMP180_VERSION}.zip: - wget "https://github.com/sparkfun/BMP180_Breakout_Arduino_Library/archive/${BMP180_VERSION}.zip" -O "$@" - unzip -j $@ -d BMP180-${BMP180_VERSION}/ \*/src/\* download-pjon: PJON-${PJON_VERSION}.zip @@ -123,29 +123,6 @@ clean-fastled: @echo "****************************************************" -build-bmp180: libbmp180.a - -libbmp180.a: Makefile - @echo "" - @echo "****************************************************" - @echo "building external BMP180 lib ($(BMP180_PATH))" - @echo "" - make -f $(SPREADAVR_PATH)/bmp180.mk libbmp180.a - make -f $(SPREADAVR_PATH)/bmp180.mk clean - @echo "" - @echo "****************************************************" - -clean-bmp180: - @echo "" - @echo "****************************************************" - @echo "cleaning external FastLED lib ($(BMP180_PATH))" - @echo "" - make -f $(SPREADAVR_PATH)/bmp180.mk clean - rm -f libbmp180.a - @echo "" - @echo "****************************************************" - - build-pjon: libpjon.a libpjon.a: Makefile diff --git a/usb-bmp180/Makefile b/usb-bmp180/Makefile deleted file mode 100644 index 94f98bc..0000000 --- a/usb-bmp180/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -## -## spreadspace avr utils -## -## -## Copyright (C) 2013-2016 Christian Pointner <equinox@spreadspace.org> -## 2016 Bernhard Tittelbach <bernhard@tittelbach.org> -## -## This file is part of spreadspace avr utils. -## -## spreadspace avr utils 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 -## any later version. -## -## spreadspace avr utils 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 spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. -## - -NAME := usb-bmp180 -BOARD_TYPE := teensy2 -CXX_OBJ := $(NAME).o -LIBS := util led lufa-descriptor-usbserial usbio -CXX_LIBS := arduino-stub -EXTERNAL_LIBS := lufa bmp180 -SPREADAVR_PATH := .. - -BMP180_PATH := $(SPREADAVR_PATH)/contrib/BMP180-V_1.1.2 -BMP180_OPTS := - -LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-151115 -LUFA_OPTS = -D USB_DEVICE_ONLY -LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 -LUFA_OPTS += -D ORDERED_EP_CONFIG -LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 -LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 -LUFA_OPTS += -D USE_FLASH_DESCRIPTORS -LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT - -LUFA_OPTS += -D USB_MANUFACTURER="L\"xro\"" -LUFA_OPTS += -D USB_PRODUCT="L\"spreadspace usb-bmp180 example\"" - -LUFA_COMPONENTS := USB USBCLASS - -include $(SPREADAVR_PATH)/include.mk - -RESET_FUNC := $(SPREADAVR_PATH)/tools/reset_lufa_cdc -RESET_PARAM := '!' diff --git a/usb-bmp180/usb-bmp180.c b/usb-bmp180/usb-bmp180.c deleted file mode 100644 index dabca95..0000000 --- a/usb-bmp180/usb-bmp180.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * spreadspace avr utils - usb-bmp180 example - * - * - * Copyright (C) 2016 Bernhard Tittelbach <bernhard@tittelbach.org> - * basically this is refactored and enhanced code from: - * https://github.com/sparkfun/BMP180_Breakout_Arduino_Library - * Please buy the sparkfun people Beer when you see them!!!! - * - * This file is part of spreadspace avr utils. - * - * spreadspace avr utils 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 - * any later version. - * - * spreadspace avr utils 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 spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <avr/io.h> -#include <avr/wdt.h> -#include <avr/interrupt.h> -#include <util/delay.h> -#include <stdio.h> - -#include "util.h" -#include "led.h" -#include "usbio.h" - -#include "Arduino.h" -#include "SFE_BMP180.h" - - -SFE_BMP180 pressure; - -#define ALTITUDE 353.0 // Altitude of Graz in Austria - - -int main(void) -{ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - cpu_init(); - led_init(); - usbio_init(); - sei(); - - arduino_init(); - - if (pressure.begin()) - printf("BMP180 init success"); - else - { - // Oops, something went wrong, this is usually a connection problem, - // see the comments at the top of this sketch for the proper connections. - - printf("BMP180 init fail\n\n"); - while(1); // Pause forever. - } - - for(;;) { - usbio_task(); - - char status; - double T,P,p0,a; - - // Loop here getting pressure readings every 10 seconds. - - // If you want sea-level-compensated pressure, as used in weather reports, - // you will need to know the altitude at which your measurements are taken. - // We're using a constant called ALTITUDE in this sketch: - - printf("\nprovided altitude: "); - printf(ALTITUDE,0); - printf(" meters, "); - printf(ALTITUDE*3.28084,0); - printf(" feet\n"); - - // If you want to measure altitude, and not pressure, you will instead need - // to provide a known baseline pressure. This is shown at the end of the sketch. - - // You must first get a temperature measurement to perform a pressure reading. - - // Start a temperature measurement: - // If request is successful, the number of ms to wait is returned. - // If request is unsuccessful, 0 is returned. - - status = pressure.startTemperature(); - if (status != 0) - { - // Wait for the measurement to complete: - _delay_ms(status); - - // Retrieve the completed temperature measurement: - // Note that the measurement is stored in the variable T. - // Function returns 1 if successful, 0 if failure. - - status = pressure.getTemperature(T); - if (status != 0) - { - // Print out the measurement: - printf("temperature: %02d degC\n",T); - - // Start a pressure measurement: - // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait). - // If request is successful, the number of ms to wait is returned. - // If request is unsuccessful, 0 is returned. - - status = pressure.startPressure(3); - if (status != 0) - { - // Wait for the measurement to complete: - _delay_ms(status); - - // Retrieve the completed pressure measurement: - // Note that the measurement is stored in the variable P. - // Note also that the function requires the previous temperature measurement (T). - // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.) - // Function returns 1 if successful, 0 if failure. - - status = pressure.getPressure(P,T); - if (status != 0) - { - // Print out the measurement: - printf("absolute pressure: %02d mb, %02d inHg\n", P, P*0.0295333727); - - // The pressure sensor returns abolute pressure, which varies with altitude. - // To remove the effects of altitude, use the sealevel function and your current altitude. - // This number is commonly used in weather reports. - // Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m. - // Result: p0 = sea-level compensated pressure in mb - - p0 = pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO) - printf("relative (sea-level) pressure: %02d mb, %0d2 inHg", p0, p0*0.0295333727); - - // On the other hand, if you want to determine your altitude from the pressure reading, - // use the altitude function along with a baseline pressure (sea-level or other). - // Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb. - // Result: a = altitude in m. - - a = pressure.altitude(P,p0); - printf("computed altitude: %dm\n",a); - } - else printf("error retrieving pressure measurement\n"); - } - else printf("error starting pressure measurement\n"); - } - else printf("error retrieving temperature measurement\n"); - } - else printf("error starting temperature measurement\n"); - - _delay_ms(5000); // Pause for 5 seconds. - - } -} |