Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 35

Thread: Teensyduino 1.37 Beta #2 (Arduino 1.8.3 support)

  1. #1
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    271

    Teensyduino 1.37 Beta #2 (Arduino 1.8.3 support)

    Teensyduino 1.37 Beta #2

    Here is a second beta test for Teensyduino 1.37.

    Linux 32 bit:
    https://www.pjrc.com/teensy/td_137-b...nstall.linux32

    Linux 64 bit:
    https://www.pjrc.com/teensy/td_137-b...nstall.linux64

    Linux ARM: (coming soon...)
    https://www.pjrc.com/teensy/td_137-b...stall.linuxarm

    Mac OS-X:
    https://www.pjrc.com/teensy/td_137-b...inoInstall.dmg

    Windows:
    https://www.pjrc.com/teensy/td_137-b...inoInstall.exe


    Changes since Teensyduino 1.37-beta1:

    Support for Arduino 1.8.3
    Drop Arduino 1.6.12 & 1.6.13 support
    Fix FastLED with OctoWS2811 on Teensy 3.6

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    @Paul. Just downloaded the new installer and gave it a try. The issue with including "vector" is still persisting. See https://forum.pjrc.com/threads/44509...l=1#post144929 for details.

  3. #3
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,220
    Quote Originally Posted by mjs513 View Post
    @Paul. Just downloaded the new installer and gave it a try. The issue with including "vector" is still persisting. See https://forum.pjrc.com/threads/44509...l=1#post144929 for details.
    I believe the issue has to do with stuff in wiring.h...
    Code:
    #define min(a,b) ((a)<(b)?(a):(b))
    #define max(a,b) ((a)>(b)?(a):(b))
    You can probably get the #include <vector> to work if you:
    #undef min
    #undef max
    just before the include... Not sure what the proper fix is here as the min/max may be used in several other places in core...

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    @KurtE. It's interesting that in 1.36 never threw an error, worked no issue. But will give the undefs a try and let you know.

    UPDATE1: Ok. It worked as you predicted. However, now anytime you use anything from the std C++ lib you need to make sure you preface it with the undef's. Like you said not sure what the fix is for this.

    Update2: Just went into wiring.h and found that it does an undefined for abs from stdlib:
    Code:
    // undefine stdlib's abs if encountered
    #ifdef abs
    #undef abs
    #endif
    Couldn't you just add something like this:
    Code:
    // undefine stdlib's abs if encountered
    #ifdef abs
    #undef abs
    #ifdef min
    #undef min
    #ifdef max
    #undef max
    #endif
    But not sure why its needed between 1.36 and 1.37.
    Last edited by mjs513; 06-05-2017 at 03:52 PM. Reason: Update

  5. #5
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,220
    Quote Originally Posted by mjs513 View Post
    @KurtE. It's interesting that in 1.36 never threw an error, worked no issue. But will give the undefs a try and let you know.
    My guess is that the wiring header changed with the new toolchain? Although that should have happened in 1.36...
    The min/max macros were added 2 years ago (at least that is what the blame view says up on github).

    The only other thing I can think of is maybe wire.h is being included now in some places where it was not before?

  6. #6
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    Just by way of an update on changing wiring.h. I added this to wiring.h:
    Code:
    // undefine stdlib's min and max if encountered
    #ifdef min
    #undef min
    #endif
    #ifdef max
    #undef max
    #endif
    Recompiled and got the same error message.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,222
    Quote Originally Posted by mjs513 View Post
    not sure why its needed between 1.36 and 1.37.
    Might have something to do with my attempt to rewrite map() using templates. Now wiring.h includes a C++ header. Previously no part of the Arduino headers included any C++ headers.

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    As a test I commented out the two class templates that were added but still threw the error.

    UPDATE: I messed up. Made the change in 1.8.2 instead of 1.8.3. Paul is right when I comment out the map classes it compiles no issue. Working too many ide's.
    Last edited by mjs513; 06-05-2017 at 04:28 PM.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,222
    On C++14, tni raised a good point that we've effectively been on C++11 for years.

    For 1.37, we've staying the C++11. I need to release in 2 to 3 weeks, and I'm just not willing to risk a language dialect chance with so little testing time.

    But I do want to move forward. Like we did with to toolchain update 1.36-beta1, I'll publish 1.38-beta1 shortly after 1.37 final release, with no changes other than switching to C++14.

    This isn't an absolute guarantee 1.38 will end up using C++14. If we run into significant problems, or if Arduino makes another release quickly, it will end up looking like the first aborted toolchain update on 1.34-beta1, where 1.34-beta2 reverted to the old toolchain.

    So the goal will be releasing 1.38 based on C++14. I'm going to need your feedback and help testing. We'll be able to start that process right after 1.37 releases.

  10. #10
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,220
    Paul: Are you making some of the same changes to core that went into 1.8.3, like availableForWrite moving? likewise flush?

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,222
    Quote Originally Posted by KurtE View Post
    like availableForWrite moving? likewise flush?
    Yes. In fact, these were already in 1.37-beta1, and on github.

    https://github.com/PaulStoffregen/co...72a5d70fc6f5ae
    https://github.com/PaulStoffregen/co...54b75e0b8d5b07

  12. #12
    ... the IDE 1.8.3 thread was here :: Arduino-1-8-3

  13. #13
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,220
    Put on the wrong thread. But the Clear Output button added to Monitor does not appear to do anything when working with Teensy

  14. #14
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    Quote Originally Posted by PaulStoffregen View Post
    Might have something to do with my attempt to rewrite map() using templates. Now wiring.h includes a C++ header. Previously no part of the Arduino headers included any C++ headers.
    It's a bad idea to have min / max macros in the first place. 'c++config.h', which is included with GCC undefines that crap. However, by including 'type_traits', you include 'c++config.h' in turn. You define min() / max() afterwards (so the undef isn't performed anymore), which breaks tons of C++ headers.

    wiring.h:

    // type_traits interferes with min() and other defines
    // include it early, so we can define these later
    // for Arduino compatibility


    No, min / max macros interfere with everything. There are literally dozens of standard C++ member functions in various headers called min / max.

    Unfortunately, non-macro versions will definitely break some code.

  15. #15
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    As FYI. The new map function seems to working rather nicely even thought it breaks the min/max macros. Pretty responsive to RC commands. What I mean by this is that I map RC throttle and steering ranges to motor control ranges, ie. 1000-2000 mapped to 0-225. When I move the throttle it appears to be reactive. In the past was a little more choppy.

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,222
    Quote Originally Posted by tni View Post
    Unfortunately, non-macro versions will definitely break some code.
    Any ideas on what sort of breakage or compatiblity issues we could expect if I abandon the classic/legacy Arduino min() & max()?

  17. #17
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    Quote Originally Posted by PaulStoffregen View Post
    Any ideas on what sort of breakage or compatiblity issues we could expect if I abandon the classic/legacy Arduino min() & max()?
    Actually, your min() version is a statement expression (not a raw ternary operator) - that eliminates most (maybe all?) issues. Something like this should work for the C++ side:

    C++11:

    Code:
    #include <utility>
    
    template<class A, class B>
    constexpr auto min(A&& a, B&& b) -> decltype(a < b ? std::forward<A>(a) : std::forward<B>(b)) {
        return a < b ? std::forward<A>(a) : std::forward<B>(b);
    }
    C++14:

    Code:
    template<class A, class B>
    constexpr decltype(auto) min(A&& a, B&& b) {
        return a < b ? std::forward<A>(a) : std::forward<B>(b);
    }
    (I wouldn't put this in 1.37.)

  18. #18
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    @tni. I deleted the existing min/max in wiring.h and included your c++11 version, as well as max so the header now reads (hope I did it right):
    Code:
    #ifdef __cplusplus
    #include <type_traits>
    #include <utility>
    // when the input number is an integer type, do all math as 32 bit signed long
    template <class T, class A, class B, class C, class D>
    long map(T _x, A _in_min, B _in_max, C _out_min, D _out_max, typename std::enable_if<std::is_integral<T>::value >::type* = 0)
    {
    	long x = _x, in_min = _in_min, in_max = _in_max, out_min = _out_min, out_max = _out_max;
    	// Arduino's traditional algorithm
    	//return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    	// st42's suggestion: https://github.com/arduino/Arduino/i...mment-69873889
    	// more conversation:
    	// https://forum.pjrc.com/threads/44503...n-improvements
    	if ((in_max - in_min) > (out_max - out_min)) {
    		return (x - in_min) * (out_max - out_min+1) / (in_max - in_min+1) + out_min;
    	} else {
    		return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    	}
    }
    // when the input is a float or double, do all math using the input's type
    template <class T, class A, class B, class C, class D>
    T map(T x, A in_min, B in_max, C out_min, D out_max, typename std::enable_if<std::is_floating_point<T>::value >::type* = 0)
    {
    	return (x - (T)in_min) * ((T)out_max - (T)out_min) / ((T)in_max - (T)in_min) + (T)out_min;
    }
    
    template<class A, class B>
    constexpr auto min(A&& a, B&& b) -> decltype(a < b ? std::forward<A>(a) : std::forward<B>(b)) {
        return a < b ? std::forward<A>(a) : std::forward<B>(b);
    }
    
    template<class A, class B>
    constexpr auto max(A&& a, B&& b) -> decltype(a < b ? std::forward<A>(a) : std::forward<B>(b)) {
        return a > b ? std::forward<A>(a) : std::forward<B>(b);
    }
    #endif
    It complies fine with the changes using vector plus the libs that I referenced in the other thread. I also did compiles for a threaded version of one of my rover sketches which includes the encoder, NeoGPS, TeensyThreads and atomic and compiled fine. In addition, I compiled it with my version of the FreeIMU library which is pretty much all legacy Arduino libraries and again compiled without an issue. Hope this info helps.

    Mike
    Last edited by mjs513; 06-06-2017 at 01:21 AM.

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,222
    Quote Originally Posted by mjs513 View Post
    I also did compiles for a threaded version of one of my rover sketches which includes the encoder, NeoGPS, TeensyThreads and atomic and compiled fine. In addition, I compiled it with my version of the FreeIMU library which is pretty much all legacy Arduino libraries and again compiled without an issue.
    Do any of these fail to compile or work properly with wiring.h as it is now in 1.37-beta2?

  20. #20
    Member
    Join Date
    Oct 2015
    Location
    Mt Beauty, Aus
    Posts
    23
    Going to install it and try soon. Been having problems with SPI... Got the same hardware working on Due, Mega2560 and Uno but getting glitches with Teensy 3.1.

    By glitches... I can't get Teensy to init my SSD1351 so started testing using my simplest SPI device... MAX7219. It seems to not transmit the 1st byte or something... my MAX7219 library has a test pattern function and it seems to be out with the Teensy. I have tried with standard SPI library and also a FIFO one, oddly both give the same results. However... I'm 1 step ahead of 2 days ago where I was getting nothing at all to happen.

    I have tried different clock rates and even compiled Teensy to 16Mhz so there was no way the clock could be too fast.

    I'll just install and see if anything changes and go from there.

  21. #21
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    FreeIMU compiles fine with current version of wiring. My rover sketches throws the min/max error if only if I use#include <vector>. I also tested it the USB Host Sheild 2.0 library and no issue.

  22. #22
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    Forgot to mention the issue is in stl_algobase.h

  23. #23
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    524
    @PaulStroffregen. Just remembered that I had a sketch that uses the Eigen library (right now I have 3.25) for a Kalman filter that I use in conjunction with the FreeIMU library. I figured I would give that one a try and received numerous errors associated with min/max:
    Code:
    In file included from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\char_traits.h:39:0,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\ios:40,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\istream:38,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\sstream:38,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\complex:45,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/Eigen/Core:28,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/EigenArm.h:42,
    
                     from C:\Users\CYBERP~1\AppData\Local\Temp\arduino_modified_sketch_687549\FreeIMU_EKF2.ino:47:
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
    
         min(const _Tp& __a, const _Tp& __b, _Compare __comp)
    
                                                            ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
    
         max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    
                                                            ^
    
    In file included from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/Eigen/Core:157:0,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/EigenArm.h:42,
    
                     from C:\Users\CYBERP~1\AppData\Local\Temp\arduino_modified_sketch_687549\FreeIMU_EKF2.ino:47:
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:320:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:324:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:387:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return false; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:390:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return true; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:394:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:456:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:459:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:463:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:523:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:526:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:530:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:593:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return 0; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:596:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:600:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:666:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:669:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:673:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:735:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() noexcept { return __glibcxx_min (char16_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:738:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() noexcept { return __glibcxx_max (char16_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:741:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:796:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() noexcept { return __glibcxx_min (char32_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:799:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() noexcept { return __glibcxx_max (char32_t); }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:802:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:858:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:861:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:865:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:925:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return 0; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:928:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:932:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:998:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1001:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1005:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1065:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return 0; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1068:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1072:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1137:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1140:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1144:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1204:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return 0; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1207:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1211:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1277:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1280:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1284:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1347:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return 0; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1350:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1354:38: error: macro "min" requires 2 arguments, but only 1 given
    
           lowest() noexcept { return min(); }
    
                                          ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1598:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1601:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1673:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1676:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1748:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; }
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\limits:1751:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; }
    
               ^
    
    In file included from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algo.h:60:0,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\algorithm:62,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/Eigen/Core:160,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/EigenArm.h:42,
    
                     from C:\Users\CYBERP~1\AppData\Local\Temp\arduino_modified_sketch_687549\FreeIMU_EKF2.ino:47:
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\algorithmfwd.h:362:41: error: macro "max" passed 3 arguments, but takes just 2
    
         max(const _Tp&, const _Tp&, _Compare);
    
                                             ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\algorithmfwd.h:375:41: error: macro "min" passed 3 arguments, but takes just 2
    
         min(const _Tp&, const _Tp&, _Compare);
    
                                             ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\algorithmfwd.h:403:30: error: macro "min" requires 2 arguments, but only 1 given
    
         min(initializer_list<_Tp>);
    
                                  ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\algorithmfwd.h:413:30: error: macro "max" requires 2 arguments, but only 1 given
    
         max(initializer_list<_Tp>);
    
                                  ^
    
    In file included from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algo.h:66:0,
    
                     from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\algorithm:62,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/Eigen/Core:160,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/EigenArm.h:42,
    
                     from C:\Users\CYBERP~1\AppData\Local\Temp\arduino_modified_sketch_687549\FreeIMU_EKF2.ino:47:
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:76:56: error: macro "max" requires 2 arguments, but only 1 given
    
          _IntType __b = std::numeric_limits<_IntType>::max())
    
                                                            ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:105:57: error: macro "max" requires 2 arguments, but only 1 given
    
           _IntType __b = std::numeric_limits<_IntType>::max())
    
                                                             ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:149:11: error: macro "min" requires 2 arguments, but only 1 given
    
           min() const
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:156:11: error: macro "max" requires 2 arguments, but only 1 given
    
           max() const
    
               ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:227:40: error: macro "min" requires 2 arguments, but only 1 given
    
      const __uctype __urngmin = __urng.min();
    
                                            ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:228:40: error: macro "max" requires 2 arguments, but only 1 given
    
      const __uctype __urngmax = __urng.max();
    
                                            ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:296:40: error: macro "min" requires 2 arguments, but only 1 given
    
      const __uctype __urngmin = __urng.min();
    
                                            ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\uniform_int_dist.h:297:40: error: macro "max" requires 2 arguments, but only 1 given
    
      const __uctype __urngmax = __urng.max();
    
                                            ^
    
    In file included from c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\algorithm:62:0,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/Eigen/Core:160,
    
                     from C:\Users\CyberPalin\Documents\Arduino\libraries\Eigen325/EigenArm.h:42,
    
                     from C:\Users\CYBERP~1\AppData\Local\Temp\arduino_modified_sketch_687549\FreeIMU_EKF2.ino:47:
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algo.h:3445:34: error: macro "min" requires 2 arguments, but only 1 given
    
         min(initializer_list<_Tp> __l)
    
                                      ^
    
    c:\local programs\arduino-1.8.3\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\bits\stl_algo.h:3457:34: error: macro "max" requires 2 arguments, but only 1 given
    
         max(initializer_list<_Tp> __l)
    
                                      ^
    
    Multiple libraries were found for "SPI.h"
     Used: C:\Local Programs\arduino-1.8.3\hardware\teensy\avr\libraries\SPI
     Not used: C:\Users\CyberPalin\Documents\Arduino\libraries\FlutterWirelessLibrary-master
    Multiple libraries were found for "I2Cdev.h"
     Used: C:\Users\CyberPalin\Documents\Arduino\libraries\I2Cdev
     Not used: C:\Users\CyberPalin\Documents\Arduino\libraries\MotionDriver
    Error compiling for board Teensy 3.5.
    Sorry to be the bearer of bad news.

  24. #24
    Member
    Join Date
    Oct 2015
    Location
    Mt Beauty, Aus
    Posts
    23
    Installed and tried the 1.37 Beta... had no problems compiling under Visual Micro.

    Because of the problem I'm still having with SPI I tried a lot of different speeds and although all compiles and run I still get the original SPI problem.

    I don't use many of the SPI functions and as previously mentioned the same code and wiring works on UNO, Mega and Due however on Teensy 3.1 it behaves differently.

    I have tested on a SSD1305 OLED, SSD1351 OLED and MAX7219. All work fine except for on the Teensy. The OLEDS won't initialise so I switched to a single MAX7219 wired directly so I could hopefully get "something".

    The small MAX7219 class just encapsulates a few SPI functions. My SPIBase class has hardware specific implementations if coded... or drops into standard SPI if nothing is found. I commented out the implementations for AVR and Due so it dropped into the standard library and it worked.

    Oddly the behaviour for the Teensy is identical for the SPI standard library and a hardware specific one I was adapting.

    While testing nothing else was connected and no interrupts happening.

    I'm really at a loss as to what to try next. I suppose the logical step would be to try the Teensy hardware with a software bit-banged implementation however I feel it should be working as is.

    I don't own a scope but used a led array on the pins for diagnostics and they seem to "flash" in a way that indicates all are getting "stuff" send to them.

    The data being sent seems to miss a byte occasionally... and consistently.

    I tried moving the SCK to 14 (from 13) and it was the same. Also moved the CS to other pins and it made no difference.

    I have also tried compiling with a few different optimizations.


    Code:
    void setup()
    {
    	delay(1000);
    
      Serial.begin(9600);
    
      Serial.println(F("Setup"));
    
      cMAX7219 gmax;
      gmax.setSCKDiv(utils::getMaxSCKDiv(16, false)); // 16 = 16 Mhz
      gmax.begin("cMAX7219", SCK, MOSI, 15, 1, 1, 1);  // teensy
    
      gmax.shutdown(false); // wake
      gmax.clearDisplay(0); // clear all
      gmax.setIntensity(2); // intensity 2
    
      
      for (int i = 0; i < 10; i++)
      {
    	  for (uint8_t x = 8; x--;)	 // loop for each column
    	  {
    		  gmax._chip_enable(0); // for a MAX there may be multiple device chains... 0 = cs[0], 1 = cs[1], etc
    		  gmax._write8(_MAX_7219_OP_DIGIT0 + x);
    		  gmax._write8(255 >> x);
    		  gmax._chip_disable(0);
    	  }
    
    	  delay(1000);
    
      }

    part of the implementation is :-

    Code:
    void cDMA_spi_init()
    {
    	static uint8_t done = 0;
    
    	if (!done)
    	{
    		done++;
    	   	SPI.begin();
    		Serial.println(F("SPI.begin();"));
    	}
    }
    
    bool cDMA_spi_check_div(uint8_t sckDivisor) // to do ... cache current div
    {
    	uint32_t mhz = F_CPU / (uint32_t)sckDivisor;
    	SPI.beginTransaction(SPISettings(mhz, MSBFIRST, SPI_MODE0));		
    		
    	return false; 
    }

  25. #25
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,220
    @hoek67 - Is there a link to your library? With simple test case? If so I will try to take a look and see if I notice anything...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •