ibrahimuslu / xbee-arduino

Automatically exported from code.google.com/p/xbee-arduino
GNU General Public License v2.0
0 stars 0 forks source link

Error compiling on Teensy 2.0 #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compiling "ATCommand" for Teensy 2.0 in Arduino 1.0.1
2. Removed NewSoftSerial lines, since we can use the Serial port
3. added "#define nss Serial" to replace the missing class.

What is the expected output? What do you see instead?

/Documents/Arduino/libraries/xbee/XBee.cpp: In constructor 'XBee::XBee()':
/Documents/Arduino/libraries/xbee/XBee.cpp:748: error: cannot convert 
'usb_serial_class*' to 'HardwareSerial*' in assignment

What version of the product are you using? On what operating system?

Tried on several versions of xbee-arduino (SVN latest, to last release). 

Original issue reported on code.google.com by husl...@gmail.com on 22 Aug 2012 at 5:23

GoogleCodeExporter commented 9 years ago
Here is my changed file.

Original comment by husl...@gmail.com on 22 Aug 2012 at 5:24

Attachments:

GoogleCodeExporter commented 9 years ago
Here is a minor modification to the XBee constructor, to work on boards where 
"Serial" is a USB virtual serial port, but "Serial1" is a real hardware serial 
port.

XBee::XBee(): _response(XBeeResponse()) {
        _pos = 0;
        _escape = false;
        _checksumTotal = 0;
        _nextFrameId = 0;

        _response.init();
        _response.setFrameData(_responseFrameData);
        // default
#if defined(__AVR_ATmega32U4__) || defined(__MK20DX128__)
        _serial = &Serial1;
#else
        _serial = &Serial;
#endif
}

A more substantial change, which I'd be happy to contribute, would use Stream 
instead of HardwareSerial.  That would allow XBee to use NewSoftSerial or 
AltSoftSerial.  The downside is XBee.begin(baud) would need to be removed 
because Stream lacks begin().  In the user's program, Serial.begin(baud) would 
be needed before using XBee.  Perhaps that change would be worthwhile, to allow 
XBee to use software serial?

Original comment by paul.sto...@gmail.com on 11 Oct 2012 at 4:50

GoogleCodeExporter commented 9 years ago
Paul,

Thanks for the fix. I've added your change to the code in subversion. A lot of 
people have asked for the ability to use softserial, so that would be great to 
add to the library.

Original comment by andrew.rapp@gmail.com on 15 Oct 2012 at 4:42