ROBOTIS-GIT / OpenCR

Software for ROS Embedded board (a.k.a. OpenCR). OpenCR means Open-source Control Module for ROS.
Apache License 2.0
386 stars 238 forks source link

digitalWriteFast and digitalReadFast #90

Closed KurtE closed 6 years ago

KurtE commented 6 years ago

This version still requires the user to include:

include

In their sketch. I am sort of torn between this and either including this stuff directly into wiring_digital.h or have wiring_digital.h include this file.

OpusK commented 6 years ago

I think it is better that wiring_digital.h include digitalWriteFast.h

KurtE commented 6 years ago

Thanks, I will see where to add it in. I am running into a chicken and egg problem. That is the file also requires variant.h to have been included. in order to get the definitions for g_Pin2PortMapArray. And variant.h includes wiring_digital.h... and so there are some files that start off with first include file of variant.h which includes Arduino, ... which includes our file, but before the array is defined so compiler errors out. And since we have #if statements in place to only include once, my adding #include "wiring.h" does not help... that is we have wiring.h -> Arduino.h (which also includes wiring.h) -> wiring_digital.h -> digitalWriteFast.h And only after this unwinds the #includes will the define of g_Pin2... is defined.

Still trying a few iterations... One obvious thing to try is to update those files who start off with

include "variant.h" to include "arduino.h". like in variants->hw.c

OpusK commented 6 years ago

Ah, there was a problem with the order. We prefer the way you are currently PR.

We will merge into this state and add an example about digitalWriteFast.

Again, thanks for your contributions :)