Skip to content

Modify default ISR handling in Serial library (HardwareSerial.cpp) #1487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pabloxid opened this issue Jun 26, 2013 · 3 comments
Closed

Modify default ISR handling in Serial library (HardwareSerial.cpp) #1487

pabloxid opened this issue Jun 26, 2013 · 3 comments
Labels
Component: Core Related to the code for the standard Arduino API

Comments

@pabloxid
Copy link

Years ago I developed a library for Dynmamixel motors (AX12, AX18, RX24F, MX28, etc. http://www.pablogindel.com/2010/01/biblioteca-de-arduino-para-ax-12 ).

These motors work with 1 Mbps serial connection. My library is based on the original Arbotix library, and has a custom ISR (RX_VECT) handler, ie not using HardwareSerial.cpp.

On boards with multiple UARTs (such as Mega2560, etc.), it would be good to use 1 UART for the Dynamixel motors, and the remaining UARTs with Arduino Serial library. But this is not possible, because HardwareSerial.cpp appropriates all the 4 UARTs ISRs, even if only one serial port is actually used.

It would be nice that HardwareSerial.cpp will declare the ISR only for the ports that have been initialized with Serial.begin (), or that Serial objects were not pre-instantiated, or whatever else that allows to declare an ISR (RX_VECT) for a UART that is not in use by the library, and then use it to control Dynamixel motors.

@s-light
Copy link

s-light commented Dec 24, 2013

this would also help for libraries that creates DMX.
on devices like 1284 or 2560 it makes sens to just instantiate the Serial Class for the ports you need it..
so you can mix the build In Serial with other libs that use the Hardware USARTs

@matthijskooijman
Copy link
Collaborator

My pullrequest #1711 achieves exactly this, the commit "Put each HardwareSerial instance in its own .cpp file" prevents ISRs for a UART from being included in the final program if the corresponding HardwareSerial object is not used in any way.

@cmaglie
Copy link
Member

cmaglie commented Jan 29, 2014

The fix has been merged and will be available in 1.5.6
C

@cmaglie cmaglie closed this as completed Jan 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API
Projects
None yet
Development

No branches or pull requests

4 participants