Skip to content
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

digitalWrite() is embarassingly slow on Due... #4030

Closed
WestfW opened this issue Oct 27, 2015 · 3 comments
Closed

digitalWrite() is embarassingly slow on Due... #4030

WestfW opened this issue Oct 27, 2015 · 3 comments
Assignees
Labels
Architecture: SAM Applies only to the SAM microcontrollers (Due)

Comments

@WestfW
Copy link
Contributor

WestfW commented Oct 27, 2015

There's a relatively senseless use of Atmel Libraries that duplicate a lot of the effort. The attached patch approximately doubles the speed of a pin-toggle loop...
(umm. I can't attach a diff...)


--- wiring_digital.c~   2015-04-23 08:30:36.000000000 -0700
+++ wiring_digital.c    2015-10-26 20:59:25.000000000 -0700
@@ -84,7 +84,12 @@
   }
   else
   {
-    PIO_SetOutput( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal, 0, PIO_PULLUP ) ;
+      if (ulVal) {
+     digitalPinToPort(ulPin)->PIO_SODR = digitalPinToBitMask(ulPin);
+      } else {
+     digitalPinToPort(ulPin)->PIO_CODR = digitalPinToBitMask(ulPin);
+      }
+//    PIO_SetOutput( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal, 0, PIO_PULLUP ) ;
   }
 }
@sandeepmistry sandeepmistry added the Architecture: SAM Applies only to the SAM microcontrollers (Due) label Mar 10, 2016
@archenemies
Copy link

Seems like a useful patch

@agdl
Copy link
Member

agdl commented Feb 8, 2017

This issue was moved to arduino/ArduinoCore-sam#16

@agdl agdl closed this as completed Feb 8, 2017
@dsyleixa
Copy link

@WestfW
will this patch be fixed/integrated in the next official board core? (currently 1.6.11)?

@arduino arduino locked as resolved and limited conversation to collaborators Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Architecture: SAM Applies only to the SAM microcontrollers (Due)
Projects
None yet
Development

No branches or pull requests

6 participants