From a9dfc68bc0e116be9c657a9317719b76bd947834 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 26 Nov 2011 10:11:14 +1100 Subject: [PATCH] libraries: rename purple to APM2 --- libraries/APM_BMP085/APM_BMP085.cpp | 10 +-- libraries/APM_BMP085/APM_BMP085.h | 4 +- libraries/APM_BMP085/APM_BMP085_hil.cpp | 2 +- libraries/APM_BMP085/APM_BMP085_hil.h | 2 +- .../APM_BMP085_test/APM_BMP085_test.pde | 8 +-- .../examples/APM_BMP085_test/Makefile | 4 +- libraries/APM_RC/APM_RC.h | 2 +- .../{APM_RC_Purple.cpp => APM_RC_APM2.cpp} | 40 +++++------ .../APM_RC/{APM_RC_Purple.h => APM_RC_APM2.h} | 8 +-- .../examples/{Purple_radio => APM2}/Makefile | 0 .../{Purple_radio => APM2}/Purple_radio.pde | 2 +- libraries/DataFlash/DataFlash.h | 2 +- ...ataFlash_Purple.cpp => DataFlash_APM2.cpp} | 66 +++++++++---------- .../{DataFlash_Purple.h => DataFlash_APM2.h} | 10 +-- libraries/Desktop/support/sitl_rc.h | 2 +- 15 files changed, 81 insertions(+), 81 deletions(-) rename libraries/APM_RC/{APM_RC_Purple.cpp => APM_RC_APM2.cpp} (87%) rename libraries/APM_RC/{APM_RC_Purple.h => APM_RC_APM2.h} (88%) rename libraries/APM_RC/examples/{Purple_radio => APM2}/Makefile (100%) rename libraries/APM_RC/examples/{Purple_radio => APM2}/Purple_radio.pde (97%) rename libraries/DataFlash/{DataFlash_Purple.cpp => DataFlash_APM2.cpp} (88%) rename libraries/DataFlash/{DataFlash_Purple.h => DataFlash_APM2.h} (88%) diff --git a/libraries/APM_BMP085/APM_BMP085.cpp b/libraries/APM_BMP085/APM_BMP085.cpp index ecb449a472..fd63d1c8e0 100644 --- a/libraries/APM_BMP085/APM_BMP085.cpp +++ b/libraries/APM_BMP085/APM_BMP085.cpp @@ -52,20 +52,20 @@ extern "C" { //{ //} -// the purple hardware needs to check the state of the +// the apm2 hardware needs to check the state of the // chip using a direct IO port -// On Purple prerelease hw, the data ready port is hooked up to PE7, which +// 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() (_purple_hardware?(PINE&0x80):digitalRead(BMP085_EOC)) +#define BMP_DATA_READY() (_apm2_hardware?(PINE&0x80):digitalRead(BMP085_EOC)) // Public Methods ////////////////////////////////////////////////////////////// -bool APM_BMP085_Class::Init(int initialiseWireLib, bool purple_hardware) +bool APM_BMP085_Class::Init(int initialiseWireLib, bool apm2_hardware) { byte buff[22]; int i = 0; - _purple_hardware = purple_hardware; + _apm2_hardware = apm2_hardware; pinMode(BMP085_EOC, INPUT); // End Of Conversion (PC7) input diff --git a/libraries/APM_BMP085/APM_BMP085.h b/libraries/APM_BMP085/APM_BMP085.h index e89a01535f..0a87268c35 100644 --- a/libraries/APM_BMP085/APM_BMP085.h +++ b/libraries/APM_BMP085/APM_BMP085.h @@ -19,10 +19,10 @@ class APM_BMP085_Class int32_t Press; //int Altitude; uint8_t oss; - bool _purple_hardware; + bool _apm2_hardware; //int32_t Press0; // Pressure at sea level - bool Init(int initialiseWireLib = 1, bool purple_hardware=false); + bool Init(int initialiseWireLib = 1, bool apm2_hardware=false); uint8_t Read(); private: diff --git a/libraries/APM_BMP085/APM_BMP085_hil.cpp b/libraries/APM_BMP085/APM_BMP085_hil.cpp index 1bafada55b..821e5e1b2e 100644 --- a/libraries/APM_BMP085/APM_BMP085_hil.cpp +++ b/libraries/APM_BMP085/APM_BMP085_hil.cpp @@ -15,7 +15,7 @@ APM_BMP085_HIL_Class::APM_BMP085_HIL_Class() } // Public Methods ////////////////////////////////////////////////////////////// -void APM_BMP085_HIL_Class::Init(int initialiseWireLib, bool purple_hardware) +void APM_BMP085_HIL_Class::Init(int initialiseWireLib, bool apm2_hardware) { BMP085_State=1; } diff --git a/libraries/APM_BMP085/APM_BMP085_hil.h b/libraries/APM_BMP085/APM_BMP085_hil.h index 68f9da07d7..ac515e7b8a 100644 --- a/libraries/APM_BMP085/APM_BMP085_hil.h +++ b/libraries/APM_BMP085/APM_BMP085_hil.h @@ -13,7 +13,7 @@ class APM_BMP085_HIL_Class int32_t Press; //int Altitude; uint8_t oss; - void Init(int initialiseWireLib = 1, bool purple_hardware=false); + void Init(int initialiseWireLib = 1, bool apm2_hardware=false); uint8_t Read(); void setHIL(float Temp, float Press); int32_t _offset_press; diff --git a/libraries/APM_BMP085/examples/APM_BMP085_test/APM_BMP085_test.pde b/libraries/APM_BMP085/examples/APM_BMP085_test/APM_BMP085_test.pde index 66f107e9be..ffbd13587e 100644 --- a/libraries/APM_BMP085/examples/APM_BMP085_test/APM_BMP085_test.pde +++ b/libraries/APM_BMP085/examples/APM_BMP085_test/APM_BMP085_test.pde @@ -13,10 +13,10 @@ unsigned long timer; FastSerialPort0(Serial); -#ifdef PURPLE_HARDWARE -static bool purple_hardware = true; +#ifdef APM2_HARDWARE +static bool apm2_hardware = true; #else -static bool purple_hardware = false; +static bool apm2_hardware = false; #endif void setup() @@ -24,7 +24,7 @@ void setup() Serial.begin(115200); Serial.println("ArduPilot Mega BMP085 library test"); Serial.println("Initialising barometer..."); delay(100); - if (!APM_BMP085.Init(1, purple_hardware)) { + if (!APM_BMP085.Init(1, apm2_hardware)) { Serial.println("Barometer initialisation FAILED\n"); } Serial.println("initialisation complete."); delay(100); diff --git a/libraries/APM_BMP085/examples/APM_BMP085_test/Makefile b/libraries/APM_BMP085/examples/APM_BMP085_test/Makefile index 4e3c0e42ba..bd5f874ba2 100644 --- a/libraries/APM_BMP085/examples/APM_BMP085_test/Makefile +++ b/libraries/APM_BMP085/examples/APM_BMP085_test/Makefile @@ -1,5 +1,5 @@ BOARD = mega include ../../../AP_Common/Arduino.mk -purple: - make -f Makefile EXTRAFLAGS="-DPURPLE_HARDWARE=1" +apm2: + make -f Makefile EXTRAFLAGS="-DAPM2_HARDWARE=1" diff --git a/libraries/APM_RC/APM_RC.h b/libraries/APM_RC/APM_RC.h index b4921f0747..4f3aaf57b0 100644 --- a/libraries/APM_RC/APM_RC.h +++ b/libraries/APM_RC/APM_RC.h @@ -46,6 +46,6 @@ class APM_RC_Class }; #include "APM_RC_APM1.h" -#include "APM_RC_Purple.h" +#include "APM_RC_APM2.h" #endif diff --git a/libraries/APM_RC/APM_RC_Purple.cpp b/libraries/APM_RC/APM_RC_APM2.cpp similarity index 87% rename from libraries/APM_RC/APM_RC_Purple.cpp rename to libraries/APM_RC/APM_RC_APM2.cpp index 1a3eb4a36d..3add822c94 100644 --- a/libraries/APM_RC/APM_RC_Purple.cpp +++ b/libraries/APM_RC/APM_RC_APM2.cpp @@ -1,5 +1,5 @@ /* - APM_RC_Purple.cpp - Radio Control Library for Ardupilot Mega 2.0. Arduino + APM_RC_APM2.cpp - Radio Control Library for Ardupilot Mega 2.0. Arduino Code by Jordi Muñoz and Jose Julio. DIYDrones.com This library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ Automatically resets when we call InputCh to read channels */ -#include "APM_RC_Purple.h" +#include "APM_RC_APM2.h" #include "WProgram.h" @@ -27,13 +27,13 @@ #else // Variable definition for Input Capture interrupt -volatile uint16_t APM_RC_Purple::_PWM_RAW[NUM_CHANNELS] = {2400,2400,2400,2400,2400,2400,2400,2400}; -volatile uint8_t APM_RC_Purple::_radio_status=0; +volatile uint16_t APM_RC_APM2::_PWM_RAW[NUM_CHANNELS] = {2400,2400,2400,2400,2400,2400,2400,2400}; +volatile uint8_t APM_RC_APM2::_radio_status=0; /**************************************************** Input Capture Interrupt ICP5 => PPM signal read ****************************************************/ -void APM_RC_Purple::_timer5_capt_cb(void) +void APM_RC_APM2::_timer5_capt_cb(void) { static uint16_t prev_icr; static uint8_t frame_idx; @@ -68,12 +68,12 @@ void APM_RC_Purple::_timer5_capt_cb(void) // Constructors //////////////////////////////////////////////////////////////// -APM_RC_Purple::APM_RC_Purple() +APM_RC_APM2::APM_RC_APM2() { } // Public Methods ////////////////////////////////////////////////////////////// -void APM_RC_Purple::Init( Arduino_Mega_ISR_Registry * isr_reg ) +void APM_RC_APM2::Init( Arduino_Mega_ISR_Registry * isr_reg ) { // --------------------- TIMER1: OUT1 and OUT2 ----------------------- pinMode(12,OUTPUT); // OUT1 (PB6/OC1B) @@ -147,7 +147,7 @@ void APM_RC_Purple::Init( Arduino_Mega_ISR_Registry * isr_reg ) TIMSK5 |= (1< // ArduPilot Mega RC Library Arduino_Mega_ISR_Registry isr_registry; -APM_RC_Purple APM_RC; +APM_RC_APM2 APM_RC; void setup() { diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 879e779b4d..37388feb7d 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -37,6 +37,6 @@ class DataFlash_Class }; #include "DataFlash_APM1.h" -#include "DataFlash_Purple.h" +#include "DataFlash_APM2.h" #endif diff --git a/libraries/DataFlash/DataFlash_Purple.cpp b/libraries/DataFlash/DataFlash_APM2.cpp similarity index 88% rename from libraries/DataFlash/DataFlash_Purple.cpp rename to libraries/DataFlash/DataFlash_APM2.cpp index 27cb341bc8..f0946cfde5 100644 --- a/libraries/DataFlash/DataFlash_Purple.cpp +++ b/libraries/DataFlash/DataFlash_APM2.cpp @@ -1,6 +1,6 @@ /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- /* - DataFlash_Purple.cpp - DataFlash log library for AT45DB321D + DataFlash_APM2.cpp - DataFlash log library for AT45DB321D Code by Jordi Muñoz and Jose Julio. DIYDrones.com This code works only on ATMega2560. It uses Serial port 3 in SPI MSPI mdoe. @@ -39,7 +39,7 @@ extern "C" { #include "WConstants.h" } -#include "DataFlash_Purple.h" +#include "DataFlash_APM2.h" // DataFlash is connected to Serial Port 3 (we will use SPI mode) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) @@ -79,7 +79,7 @@ extern "C" { #define OVERWRITE_DATA 0 // 0: When reach the end page stop, 1: Start overwritten from page 1 // *** INTERNAL FUNCTIONS *** -unsigned char DataFlash_Purple::SPI_transfer(unsigned char data) +unsigned char DataFlash_APM2::SPI_transfer(unsigned char data) { /* Wait for empty transmit buffer */ while ( !( UCSR3A & (1<>8); // High byte WriteByte(data&0xFF); // Low byte } -void DataFlash_Purple::WriteLong(int32_t data) +void DataFlash_APM2::WriteLong(int32_t data) { WriteByte(data>>24); // First byte WriteByte(data>>16); @@ -404,18 +404,18 @@ void DataFlash_Purple::WriteLong(int32_t data) } // Get the last page written to -int16_t DataFlash_Purple::GetWritePage() +int16_t DataFlash_APM2::GetWritePage() { return(df_PageAdr); } // Get the last page read -int16_t DataFlash_Purple::GetPage() +int16_t DataFlash_APM2::GetPage() { return(df_Read_PageAdr-1); } -void DataFlash_Purple::StartRead(int16_t PageAdr) +void DataFlash_APM2::StartRead(int16_t PageAdr) { df_Read_BufferNum=1; df_Read_BufferIdx=4; @@ -431,7 +431,7 @@ void DataFlash_Purple::StartRead(int16_t PageAdr) df_FilePage = (df_FilePage<<8) | BufferRead(df_Read_BufferNum,3); // Low byte } -byte DataFlash_Purple::ReadByte() +byte DataFlash_APM2::ReadByte() { byte result; @@ -458,7 +458,7 @@ byte DataFlash_Purple::ReadByte() return result; } -int16_t DataFlash_Purple::ReadInt() +int16_t DataFlash_APM2::ReadInt() { uint16_t result; @@ -467,7 +467,7 @@ int16_t DataFlash_Purple::ReadInt() return (int16_t)result; } -int32_t DataFlash_Purple::ReadLong() +int32_t DataFlash_APM2::ReadLong() { uint32_t result; @@ -478,18 +478,18 @@ int32_t DataFlash_Purple::ReadLong() return (int32_t)result; } -void DataFlash_Purple::SetFileNumber(uint16_t FileNumber) +void DataFlash_APM2::SetFileNumber(uint16_t FileNumber) { df_FileNumber = FileNumber; df_FilePage = 1; } -uint16_t DataFlash_Purple::GetFileNumber() +uint16_t DataFlash_APM2::GetFileNumber() { return df_FileNumber; } -uint16_t DataFlash_Purple::GetFilePage() +uint16_t DataFlash_APM2::GetFilePage() { return df_FilePage; } diff --git a/libraries/DataFlash/DataFlash_Purple.h b/libraries/DataFlash/DataFlash_APM2.h similarity index 88% rename from libraries/DataFlash/DataFlash_Purple.h rename to libraries/DataFlash/DataFlash_APM2.h index 95665bbd3c..3fec545c4f 100644 --- a/libraries/DataFlash/DataFlash_Purple.h +++ b/libraries/DataFlash/DataFlash_APM2.h @@ -1,12 +1,12 @@ /* ************************************************************ */ -/* DataFlash_Purple Log library */ +/* DataFlash_APM2 Log library */ /* ************************************************************ */ -#ifndef __DATAFLASH_PURPLE_H__ -#define __DATAFLASH_PURPLE_H__ +#ifndef __DATAFLASH_APM2_H__ +#define __DATAFLASH_APM2_H__ #include "DataFlash.h" -class DataFlash_Purple : public DataFlash_Class +class DataFlash_APM2 : public DataFlash_Class { private: // DataFlash Log variables... @@ -43,7 +43,7 @@ class DataFlash_Purple : public DataFlash_Class unsigned char df_device_1; uint16_t df_PageSize; - DataFlash_Purple(); // Constructor + DataFlash_APM2(); // Constructor void Init(); void ReadManufacturerID(); bool CardInserted(); diff --git a/libraries/Desktop/support/sitl_rc.h b/libraries/Desktop/support/sitl_rc.h index a7fb35a394..efffc0c095 100644 --- a/libraries/Desktop/support/sitl_rc.h +++ b/libraries/Desktop/support/sitl_rc.h @@ -34,7 +34,7 @@ struct RC_ICR4 { /* - ignore rate assignment for now (needed for purple + ignore rate assignment for now (needed for apm2 emulation) */ RC_ICR4& operator=(uint16_t rate) {