Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Teensy3: Serial1, Serial2, Serial2 separate code?

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Location
    SF Bay area
    Posts
    1

    Teensy3: Serial1, Serial2, Serial2 separate code?

    So how come the drivers for the three serial ports on Teensy3 are three completely separate files/etc?
    When I first saw this, I assumed there was some sort of hack to save space when only one was used, but even sketches that use no serial traffic at all end up including all three drivers...

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Usually, there's one code base (C reentrant or C++ class), used for all three UARTs. Often, there are small differences in some of the UARTs like FIFO size, number of modem control lines. But this doesn't preclude a common core.

    Including all 3 might be an issue with the infamous Arduino build process.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,380
    Quote Originally Posted by westfw View Post
    When I first saw this, I assumed there was some sort of hack to save space when only one was used,
    That was actually the idea. It's never been realized, and reducing memory use has been a much lower priority than LOTS of other stuff, since Teensy 3.1 has plenty of memory.

    But yes, it's someday supposed to save space. Ideas and especially pull requests are welcome....

  4. #4
    Senior Member
    Join Date
    Sep 2013
    Location
    Hamburg, Germany
    Posts
    894
    Quote Originally Posted by PaulStoffregen View Post
    Ideas and especially pull requests are welcome....
    Are templates allowed?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,380
    I generally don't use C++ templates. I'd rather than 3 copies of the source that resort to templates.

Posting Permissions

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