Browse Source

Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".

Modified FastSerial's write function to return size_t (number of bytes written).
master
Randy Mackay 13 years ago
parent
commit
ed19c25a97
  1. 6
      libraries/APM_RC/APM_RC_APM1.cpp
  2. 6
      libraries/APM_RC/APM_RC_APM2.cpp
  3. 10
      libraries/AP_ADC/AP_ADC_ADS7844.cpp
  4. 6
      libraries/AP_ADC/AP_ADC_HIL.cpp
  5. 6
      libraries/AP_AnalogSource/AP_AnalogSource_Arduino.cpp
  6. 6
      libraries/AP_Baro/AP_Baro_BMP085.cpp
  7. 6
      libraries/AP_Baro/AP_Baro_BMP085_hil.cpp
  8. 6
      libraries/AP_Common/AP_Common.h
  9. 6
      libraries/AP_Common/AP_Vector.h
  10. 6
      libraries/AP_Common/c++.cpp
  11. 6
      libraries/AP_Compass/AP_Compass_HMC5843.cpp
  12. 7
      libraries/AP_DCM/AP_DCM.h
  13. 6
      libraries/AP_DCM/AP_DCM_HIL.h
  14. 7
      libraries/AP_EEPROMB/AP_EEPROMB.h
  15. 6
      libraries/AP_GPS/AP_GPS_406.cpp
  16. 6
      libraries/AP_GPS/AP_GPS_HIL.cpp
  17. 6
      libraries/AP_GPS/AP_GPS_IMU.cpp
  18. 6
      libraries/AP_GPS/AP_GPS_MTK16.cpp
  19. 6
      libraries/AP_GPS/GPS.cpp
  20. 6
      libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp
  21. 6
      libraries/AP_Navigation/Navigation.h
  22. 6
      libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080.cpp
  23. 6
      libraries/AP_PeriodicProcess/AP_TimerProcess.cpp
  24. 6
      libraries/AP_RC/AP_RC.cpp
  25. 6
      libraries/AP_RC_Channel/AP_RC_Channel.cpp
  26. 6
      libraries/AP_RangeFinder/AP_RangeFinder_MaxsonarXL.cpp
  27. 6
      libraries/AP_RangeFinder/AP_RangeFinder_SharpGP2Y.cpp
  28. 6
      libraries/AP_RangeFinder/RangeFinder.cpp
  29. 6
      libraries/AP_Relay/AP_Relay.cpp
  30. 6
      libraries/DataFlash/DataFlash_APM2.cpp
  31. 32
      libraries/FastSerial/FastSerial.cpp
  32. 4
      libraries/FastSerial/FastSerial.h
  33. 6
      libraries/I2C/I2C.cpp
  34. 6
      libraries/I2C/I2C.h
  35. 6
      libraries/ModeFilter/ModeFilter.cpp
  36. 6
      libraries/RC_Channel/RC_Channel.cpp
  37. 6
      libraries/Waypoints/Waypoints.h

6
libraries/APM_RC/APM_RC_APM1.cpp

@ -21,7 +21,11 @@ @@ -21,7 +21,11 @@
#include "APM_RC_APM1.h"
#include <avr/interrupt.h>
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
# error Please check the Tools/Board menu to ensure you have selected Arduino Mega as your target.

6
libraries/APM_RC/APM_RC_APM2.cpp

@ -20,7 +20,11 @@ @@ -20,7 +20,11 @@
*/
#include "APM_RC_APM2.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
# error Please check the Tools/Board menu to ensure you have selected Arduino Mega as your target.

10
libraries/AP_ADC/AP_ADC_ADS7844.cpp

@ -44,15 +44,19 @@ @@ -44,15 +44,19 @@
Channel 7 : Differential pressure sensor port
*/
#include "AP_ADC_ADS7844.h"
extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <stdint.h>
#include <avr/interrupt.h>
#include "WConstants.h"
}
#include "AP_ADC_ADS7844.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
// Commands for reading ADC channels on ADS7844
static const unsigned char adc_cmd[9] = { 0x87, 0xC7, 0x97, 0xD7, 0xA7, 0xE7, 0xB7, 0xF7, 0x00 };

6
libraries/AP_ADC/AP_ADC_HIL.cpp

@ -1,5 +1,9 @@ @@ -1,5 +1,9 @@
#include "AP_ADC_HIL.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
/*
AP_ADC_HIL.cpp

6
libraries/AP_AnalogSource/AP_AnalogSource_Arduino.cpp

@ -1,6 +1,10 @@ @@ -1,6 +1,10 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "wiring.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
#include "AP_AnalogSource_Arduino.h"
float AP_AnalogSource_Arduino::read(void)

6
libraries/AP_Baro/AP_Baro_BMP085.cpp

@ -39,8 +39,12 @@ extern "C" { @@ -39,8 +39,12 @@ extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
#include "WConstants.h"
}
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include <AP_Common.h>
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library

6
libraries/AP_Baro/AP_Baro_BMP085_hil.cpp

@ -4,8 +4,12 @@ extern "C" { @@ -4,8 +4,12 @@ extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
#include "WConstants.h"
}
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "AP_Baro_BMP085_hil.h"

6
libraries/AP_Common/AP_Common.h

@ -16,7 +16,11 @@ @@ -16,7 +16,11 @@
#define _AP_COMMON_H
// Get the common arduino functions
#include "wiring.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
// ... and remove some of their stupid macros
#undef round
#undef abs

6
libraries/AP_Common/AP_Vector.h

@ -22,7 +22,11 @@ @@ -22,7 +22,11 @@
#include "../FastSerial/BetterStream.h"
#include <stdlib.h>
#include <inttypes.h>
#include <WProgram.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include <WProgram.h>
#endif
#ifdef ASSERT
const static char vectorSource[] ="Vector.hpp";

6
libraries/AP_Common/c++.cpp

@ -9,7 +9,11 @@ @@ -9,7 +9,11 @@
#include <stdlib.h>
#include "c++.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
void * operator new(size_t size)
{

6
libraries/AP_Compass/AP_Compass_HMC5843.cpp

@ -15,8 +15,12 @@ @@ -15,8 +15,12 @@
// AVR LibC Includes
#include <math.h>
#include "WConstants.h"
#include <FastSerial.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include <I2C.h>
#include "AP_Compass_HMC5843.h"

7
libraries/AP_DCM/AP_DCM.h

@ -10,12 +10,15 @@ @@ -10,12 +10,15 @@
#include "../FastSerial/FastSerial.h"
#include "../AP_Math/AP_Math.h"
#include <inttypes.h>
#include "WProgram.h"
#include "../AP_Compass/AP_Compass.h"
#include "../AP_ADC/AP_ADC.h"
#include "../AP_GPS/AP_GPS.h"
#include "../AP_IMU/AP_IMU.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class AP_DCM
{

6
libraries/AP_DCM/AP_DCM_HIL.h

@ -4,11 +4,15 @@ @@ -4,11 +4,15 @@
#include "../FastSerial/FastSerial.h"
#include "../AP_Math/AP_Math.h"
#include <inttypes.h>
#include "WProgram.h"
#include "../AP_Compass/AP_Compass.h"
#include "../AP_ADC/AP_ADC.h"
#include "../AP_GPS/AP_GPS.h"
#include "../AP_IMU/AP_IMU.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class AP_DCM_HIL

7
libraries/AP_EEPROMB/AP_EEPROMB.h

@ -6,8 +6,11 @@ @@ -6,8 +6,11 @@
#ifndef AP_EEPROMB_h
#define AP_EEPROMB_h
//#include <stdint.h>
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
/// @class AP_EEPROMB
/// @brief Object for reading and writing to the EEPROM

6
libraries/AP_GPS/AP_GPS_406.cpp

@ -11,7 +11,11 @@ @@ -11,7 +11,11 @@
#include "../FastSerial/FastSerial.h" // because we need to change baud rates... ugh.
#include "AP_GPS_406.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
static const char init_str[] = "$PSRF100,0,57600,8,1,0*37";

6
libraries/AP_GPS/AP_GPS_HIL.cpp

@ -12,7 +12,11 @@ @@ -12,7 +12,11 @@
//
#include "AP_GPS_HIL.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Constructors ////////////////////////////////////////////////////////////////
AP_GPS_HIL::AP_GPS_HIL(Stream *s) : GPS(s)

6
libraries/AP_GPS/AP_GPS_IMU.cpp

@ -28,7 +28,11 @@ @@ -28,7 +28,11 @@
*/
#include "AP_GPS_IMU.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Constructors ////////////////////////////////////////////////////////////////

6
libraries/AP_GPS/AP_GPS_MTK16.cpp

@ -13,7 +13,11 @@ @@ -13,7 +13,11 @@
#include "AP_GPS_MTK16.h"
#include <stdint.h>
#include <wiring.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include <wiring.h>
#endif
// Constructors ////////////////////////////////////////////////////////////////
AP_GPS_MTK16::AP_GPS_MTK16(Stream *s) : GPS(s)

6
libraries/AP_GPS/GPS.cpp

@ -1,7 +1,11 @@ @@ -1,7 +1,11 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
#include "GPS.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
void
GPS::update(void)

6
libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp

@ -3,8 +3,12 @@ @@ -3,8 +3,12 @@
#include "AP_InertialSensor_MPU6000.h"
#include <wiring.h>
#include <SPI.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include <wiring.h>
#endif
// MPU 6000 registers
#define MPUREG_WHOAMI 0x75 //

6
libraries/AP_Navigation/Navigation.h

@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
#define XTRACK_ENTRY_ANGLE 3000 // Max angle used to correct for track following degrees*100
#include <GPS.h> // ArduPilot GPS Library
#include "Waypoints.h" // ArduPilot Waypoints Library
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define T7 10000000

6
libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080.cpp

@ -24,8 +24,12 @@ @@ -24,8 +24,12 @@
*/
#include "AP_OpticalFlow_ADNS3080.h"
#include "WProgram.h"
#include "SPI.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define AP_SPI_TIMEOUT 1000

6
libraries/AP_PeriodicProcess/AP_TimerProcess.cpp

@ -5,9 +5,13 @@ @@ -5,9 +5,13 @@
extern "C" {
#include <inttypes.h>
#include <stdint.h>
#include "WConstants.h"
#include <avr/interrupt.h>
}
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
uint8_t AP_TimerProcess::_period;
ap_procedure AP_TimerProcess::_proc[AP_TIMERPROCESS_MAX_PROCS];

6
libraries/AP_RC/AP_RC.cpp

@ -10,8 +10,12 @@ @@ -10,8 +10,12 @@
*/
#include "AP_RC.h"
#include "WProgram.h"
#include <avr/interrupt.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Variable definition for interrupt
volatile uint16_t timer1count = 0;

6
libraries/AP_RC_Channel/AP_RC_Channel.cpp

@ -11,7 +11,11 @@ @@ -11,7 +11,11 @@
#include <math.h>
#include <avr/eeprom.h>
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "AP_RC_Channel.h"
#define ANGLE 0

6
libraries/AP_RangeFinder/AP_RangeFinder_MaxsonarXL.cpp

@ -26,7 +26,11 @@ @@ -26,7 +26,11 @@
*/
// AVR LibC Includes
#include "WConstants.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "AP_RangeFinder_MaxsonarXL.h"
// Constructor //////////////////////////////////////////////////////////////

6
libraries/AP_RangeFinder/AP_RangeFinder_SharpGP2Y.cpp

@ -26,7 +26,11 @@ @@ -26,7 +26,11 @@
*/
// AVR LibC Includes
#include "WConstants.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "AP_RangeFinder_SharpGP2Y.h"
// Constructor //////////////////////////////////////////////////////////////

6
libraries/AP_RangeFinder/RangeFinder.cpp

@ -13,7 +13,11 @@ @@ -13,7 +13,11 @@
*/
// AVR LibC Includes
#include "WConstants.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "RangeFinder.h"

6
libraries/AP_Relay/AP_Relay.cpp

@ -8,7 +8,11 @@ @@ -8,7 +8,11 @@
*/
#include <avr/io.h>
#include "wiring.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
#include "AP_Relay.h"

6
libraries/DataFlash/DataFlash_APM2.cpp

@ -36,8 +36,12 @@ extern "C" { @@ -36,8 +36,12 @@ extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
#include "WConstants.h"
}
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "DataFlash_APM2.h"

32
libraries/FastSerial/FastSerial.cpp

@ -31,7 +31,12 @@ @@ -31,7 +31,12 @@
//#include "../AP_Common/AP_Common.h"
#include "FastSerial.h"
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#if defined(UDR3)
# define FS_MAX_PORTS 4
@ -197,6 +202,30 @@ void FastSerial::flush(void) @@ -197,6 +202,30 @@ void FastSerial::flush(void)
_txBuffer->tail = _txBuffer->head;
}
#if defined(ARDUINO) && ARDUINO >= 100
size_t FastSerial::write(uint8_t c)
{
uint16_t i;
if (!_open) // drop bytes if not open
return 0;
// wait for room in the tx buffer
i = (_txBuffer->head + 1) & _txBuffer->mask;
while (i == _txBuffer->tail)
;
// add byte to the buffer
_txBuffer->bytes[_txBuffer->head] = c;
_txBuffer->head = i;
// enable the data-ready interrupt, as it may be off if the buffer is empty
*_ucsrb |= _portTxBits;
// return number of bytes written (always 1)
return 1;
}
#else
void FastSerial::write(uint8_t c)
{
uint16_t i;
@ -216,6 +245,7 @@ void FastSerial::write(uint8_t c) @@ -216,6 +245,7 @@ void FastSerial::write(uint8_t c)
// enable the data-ready interrupt, as it may be off if the buffer is empty
*_ucsrb |= _portTxBits;
}
#endif
// Buffer management ///////////////////////////////////////////////////////////

4
libraries/FastSerial/FastSerial.h

@ -116,7 +116,11 @@ public: @@ -116,7 +116,11 @@ public:
virtual int read(void);
virtual int peek(void);
virtual void flush(void);
#if defined(ARDUINO) && ARDUINO >= 100
virtual size_t write(uint8_t c);
#else
virtual void write(uint8_t c);
#endif
using BetterStream::write;
//@}

6
libraries/I2C/I2C.cpp

@ -31,9 +31,13 @@ @@ -31,9 +31,13 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "WProgram.h"
#include <inttypes.h>
#include "I2C.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

6
libraries/I2C/I2C.h

@ -31,8 +31,12 @@ @@ -31,8 +31,12 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "WProgram.h"
#include <inttypes.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#ifndef I2C_h
#define I2C_h

6
libraries/ModeFilter/ModeFilter.cpp

@ -14,7 +14,11 @@ @@ -14,7 +14,11 @@
#include "ModeFilter.h"
#include <avr/interrupt.h>
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// Constructors ////////////////////////////////////////////////////////////////

6
libraries/RC_Channel/RC_Channel.cpp

@ -11,7 +11,11 @@ @@ -11,7 +11,11 @@
#include <math.h>
#include <avr/eeprom.h>
#include "WProgram.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "RC_Channel.h"
#define RC_CHANNEL_ANGLE 0

6
libraries/Waypoints/Waypoints.h

@ -2,8 +2,12 @@ @@ -2,8 +2,12 @@
#define Waypoints_h
#include <inttypes.h>
#include "WProgram.h"
#include <avr/eeprom.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class Waypoints
{

Loading…
Cancel
Save