ArduCopterNG - small cosmetic change & small change to how Wire.begin is called (now only called once). http://www.arduino.cc/en/Reference/WireBegin

git-svn-id: https://arducopter.googlecode.com/svn/trunk@885 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
rmackay9@yahoo.com 2010-11-22 13:53:13 +00:00
parent 3d80d7e580
commit ef6519e406
2 changed files with 9 additions and 5 deletions

View File

@ -165,12 +165,9 @@
#include <math.h>
#include <APM_RC.h> // ArduPilot Mega RC Library
#include <APM_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
APM_ADC_Class APM_ADC; // Declare an instance
#include <APM_BMP085.h> // ArduPilot Mega BMP085 Library
APM_BMP085_Class APM_BMP085;// Declare an instance
#include <DataFlash.h> // ArduPilot Mega Flash Memory Library
#include <APM_Compass.h> // ArduPilot Mega Magnetometer Library
APM_Compass_Class APM_Compass; // Declare an instance
#include <Wire.h> // I2C Communication library
#include <EEPROM.h> // EEPROM
//#include <AP_GPS.h>
@ -189,6 +186,10 @@ APM_Compass_Class APM_Compass; // Declare an instance
/* Software version */
#define VER 1.52 // Current software version (only numeric values)
// Sensors - declare one global instance
APM_ADC_Class APM_ADC;
APM_BMP085_Class APM_BMP085;
APM_Compass_Class APM_Compass;
/* ************************************************************ */
/* ************* MAIN PROGRAM - DECLARATIONS ****************** */

View File

@ -125,9 +125,12 @@ void APM_Init() {
APM_RC.OutputCh(2,MIN_THROTTLE);
APM_RC.OutputCh(3,MIN_THROTTLE);
// Initialise Wire library used by Magnetometer and Barometer
Wire.begin();
#ifdef IsMAG
if (MAGNETOMETER == 1) {
APM_Compass.Init(); // I2C initialization
APM_Compass.Init(FALSE); // I2C initialization
APM_Compass.SetOrientation(MAGORIENTATION);
APM_Compass.SetOffsets(MAGOFFSET);
APM_Compass.SetDeclination(ToRad(DECLINATION));
@ -169,7 +172,7 @@ void APM_Init() {
#endif
#ifdef UseBMP
APM_BMP085.Init();
APM_BMP085.Init(FALSE);
#endif
delay(1000);