Skip to content

Commit

Permalink
Merge pull request #33 from adafruit/ifdef_avr
Browse files Browse the repository at this point in the history
Fix Due Build Errors
  • Loading branch information
toddtreece committed Jul 10, 2015
2 parents 4fc3c72 + 06bf70b commit 8e2d53e
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 326 deletions.
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ before_install:
install:
- ln -s $PWD /usr/local/share/arduino/libraries/Adafruit_FONA
- arduino --install-boards arduino:sam > /dev/null
- arduino --install-library "Adafruit SleepyDog Library,Adafruit MQTT Library"
script:
- arduino --verify --board arduino:avr:uno $PWD/examples/FONAtest/FONAtest.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/IncomingCall/IncomingCall.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/AdafruitIO_GPS/AdafruitIO_GPS.ino
- arduino --verify --board arduino:sam:due $PWD/examples/FONAtest/FONAtest.ino
- arduino --verify --board arduino:sam:due $PWD/examples/IncomingCall/IncomingCall.ino
- arduino --verify --board arduino:sam:due $PWD/examples/AdafruitIO_GPS/AdafruitIO_GPS.ino
- arduino --board arduino:avr:uno --save-prefs
- arduino --verify $PWD/examples/FONAtest/FONAtest.ino
- arduino --verify $PWD/examples/IncomingCall/IncomingCall.ino
- arduino --verify $PWD/examples/GPS/GPS.ino
- arduino --board arduino:sam:arduino_due_x --save-prefs
- arduino --verify $PWD/examples/FONAtest/FONAtest.ino
- arduino --verify $PWD/examples/IncomingCall/IncomingCall.ino
- arduino --verify $PWD/examples/GPS/GPS.ino
notifications:
email:
on_success: change
Expand Down
248 changes: 0 additions & 248 deletions examples/AdafruitIO_GPS/AdafruitIO_GPS.ino

This file was deleted.

44 changes: 0 additions & 44 deletions examples/AdafruitIO_GPS/fonahelper.cpp

This file was deleted.

25 changes: 14 additions & 11 deletions examples/FONAtest/FONAtest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Open up the serial console on the Arduino at 115200 baud to interact with FONA
Note that if you need to set a GPRS APN, username, and password scroll down to
the commented section below at the end of the setup() function.
*/

#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

#define FONA_RX 2
Expand All @@ -36,8 +34,17 @@ the commented section below at the end of the setup() function.
// this is a large buffer for replies
char replybuffer[255];

// or comment this out & use a hardware serial port like Serial1 (see below)
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
// This is to handle the absence of software serial on platforms
// like the Arduino Due. Modify this code if you are using different
// hardware serial port, or if you are using a non-avr platform
// that supports software serial.
#ifdef __AVR__
#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
#else
HardwareSerial *fonaSerial = &Serial1;
#endif

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

Expand All @@ -50,14 +57,10 @@ void setup() {
Serial.println(F("FONA basic test"));
Serial.println(F("Initializing....(May take 3 seconds)"));

// make it slow so its easy to read!
fonaSS.begin(4800); // if you're using software serial
//Serial1.begin(4800); // if you're using hardware serial

// See if the FONA is responding
if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
while (1);
while(1);
}
Serial.println(F("FONA is OK"));

Expand Down
Loading

0 comments on commit 8e2d53e

Please sign in to comment.