ArduinoCore-API icon indicating copy to clipboard operation
ArduinoCore-API copied to clipboard

Adding maxspeed to shiftIn and shiftOut

Open lemio opened this issue 4 years ago • 1 comments

Allowing the user to set the max speed will enable newer faster Arduino based MCU's to control older devices that need slower clock speeds to function.

https://github.com/arduino/ArduinoCore-API/issues/83

lemio avatar Dec 01 '21 21:12 lemio

Hi @lemio , as pointed out by the CI unit test failure, Common.h functions have C "namespace" (see the extern "C" on the top of the file), so function overloading is not available. Finding another way that doesn't break backwards compatibility while keeping the API is not super easy but I'm pretty sure it can be done :wink:

facchinm avatar Dec 02 '21 08:12 facchinm

Closing this, since nothing has been happening for a long time.

aentinger avatar Sep 13 '23 14:09 aentinger

Dear Alexander,

first of all, I would like to thank @lemio for his work in this area. It was fundamental for the patch we submitted to the canonical HX711 repository the other day, to work around this issue.

Please find references below why the community is dearly needing this improvement. Clock speeds will probably not stop to increase, so I am wondering how the Arduino HAL will approach that problem with respect to this important detail.

I see what @facchinm is referring to here, and it might be a valid point why this patch can not be integrated, for example because of backward compatibility issues. This is why I am writing to you, because I think, or would like to see, that a bit more attention is given to this patch, or any reasoning why it is rejected. Thank you already for taking the time.

With kind regards, Andreas.

References

  • https://github.com/arduino/ArduinoCore-API/issues/83
  • https://github.com/bogde/HX711/issues/75
  • https://github.com/bogde/HX711/pull/123
  • https://community.hiveeyes.org/t/improving-the-canonical-arduino-hx711-library-for-esp8266-esp32-and-beyond/539

amotl avatar Sep 13 '23 16:09 amotl

Please let me know what it would take to bring in such a patch. I can't promise anything, but with guidance by you guys, when possible at all, I may dare to try.

amotl avatar Sep 13 '23 16:09 amotl

Finding another way that doesn't break backwards compatibility while keeping the API is not super easy but I'm pretty sure it can be done 😉.

Ah, re-reading what @facchinm wrote there, it sounds like it might be beyond my capacity. Sorry for the noise. :sunflower:

amotl avatar Sep 13 '23 16:09 amotl

Could it be done in the same way as https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein/ where the last argument is optional? In this way it might be possible without function overloading.

lemio avatar Sep 13 '23 22:09 lemio