uncrustify libraries/AP_Baro/AP_Baro_BMP085.cpp

This commit is contained in:
uncrustify 2012-08-16 23:09:23 -07:00 committed by Pat Hickey
parent b0003c020f
commit 5a99d6b697
1 changed files with 135 additions and 135 deletions

View File

@ -1,44 +1,44 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/*
APM_BMP085.cpp - Arduino Library for BMP085 absolute pressure sensor
Code by Jordi Mu<EFBFBD>oz and Jose Julio. DIYDrones.com
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 2.1 of the License, or (at your option) any later version.
Sensor is conected to I2C port
Sensor End of Conversion (EOC) pin is PC7 (30)
Variables:
RawTemp : Raw temperature data
RawPress : Raw pressure data
Temp : Calculated temperature (in 0.1<EFBFBD>C units)
Press : Calculated pressure (in Pa units)
Methods:
Init() : Initialization of I2C and read sensor calibration data
Read() : Read sensor data and calculate Temperature and Pressure
This function is optimized so the main host don<EFBFBD>t need to wait
You can call this function in your main loop
It returns a 1 if there are new data.
Internal functions:
Command_ReadTemp(): Send commando to read temperature
Command_ReadPress(): Send commando to read Pressure
ReadTemp() : Read temp register
ReadPress() : Read press register
Calculate() : Calculate Temperature and Pressure in real units
*/
* APM_BMP085.cpp - Arduino Library for BMP085 absolute pressure sensor
* Code by Jordi Mu<EFBFBD>oz and Jose Julio. DIYDrones.com
*
* 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 2.1 of the License, or (at your option) any later version.
*
* Sensor is conected to I2C port
* Sensor End of Conversion (EOC) pin is PC7 (30)
*
* Variables:
* RawTemp : Raw temperature data
* RawPress : Raw pressure data
*
* Temp : Calculated temperature (in 0.1<EFBFBD>C units)
* Press : Calculated pressure (in Pa units)
*
* Methods:
* Init() : Initialization of I2C and read sensor calibration data
* Read() : Read sensor data and calculate Temperature and Pressure
* This function is optimized so the main host don<EFBFBD>t need to wait
* You can call this function in your main loop
* It returns a 1 if there are new data.
*
* Internal functions:
* Command_ReadTemp(): Send commando to read temperature
* Command_ReadPress(): Send commando to read Pressure
* ReadTemp() : Read temp register
* ReadPress() : Read press register
* Calculate() : Calculate Temperature and Pressure in real units
*
*
*/
extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
}
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
@ -58,7 +58,7 @@ extern "C" {
// chip using a direct IO port
// On APM2 prerelease hw, the data ready port is hooked up to PE7, which
// is not available to the arduino digitalRead function.
#define BMP_DATA_READY() (_apm2_hardware?(PINE&0x80):digitalRead(BMP085_EOC))
#define BMP_DATA_READY() (_apm2_hardware ? (PINE&0x80) : digitalRead(BMP085_EOC))
// oversampling 3 gives highest resolution
#define OVERSAMPLING 3
@ -107,14 +107,14 @@ uint8_t AP_Baro_BMP085::read()
{
uint8_t result = 0;
if (BMP085_State == 1){
if (BMP_DATA_READY()){
if (BMP085_State == 1) {
if (BMP_DATA_READY()) {
BMP085_State = 2;
ReadTemp(); // On state 1 we read temp
Command_ReadPress();
}
}else{
if (BMP_DATA_READY()){
if (BMP_DATA_READY()) {
BMP085_State = 1; // Start again from state = 1
ReadPress();
Calculate();