pololu / fastgpio-arduino

C++ library for the Arduino IDE that allows you to manipulate general-purpose I/O (GPIO) pins on your Arduino or Arduino-compatible board with minimal overhead.
MIT License
73 stars 21 forks source link

Support for Atmega2560 #3

Open stephanbrunner opened 6 years ago

stephanbrunner commented 6 years ago

Hi all,

Is there a technical reason for not supporting the Arduino Mega? I'm thinking of writing the extra code, but I'm not sure if I will bump into some technical limitations...

Thanks, Stephan

DavidEGrayson commented 6 years ago

You should be able to add support for ports A through G on the ATmega2560 without any technical limitations. To support the other ports, I believe you would need to make major changes to the assembly code.

stephanbrunner commented 6 years ago

I see. I'll try, but probably go with a hacky version then. If I get something worth pushing I'll let you know. Thanks! And a beauty of a library by the way.

ryanaltair commented 6 years ago

this do the same in Marlin fast io for 2560 https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/fastio.h https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/fastio_1280.h

StormTrooper commented 5 years ago

Has anyone had any luck hacking this to work on the 2560 yet?

stephanbrunner commented 5 years ago

I have a hacky version I can share with you, but not generalized enough to be worth publishing. That would be a cool job to do though. Unfortunattely, because I didn't plan to publish the code, I made some codestyle addaption. Sorry for that. The technical changes may only be in the #define sections to define the chips pinout. But I don't really remember.

Hope that helps anyway: FastGPIO_MEGA.h.txt

StormTrooper commented 5 years ago

Thanks very much. I think its done the job.

stuart1975 commented 5 years ago

I installed the latest version and still no official support of ATMega 2560. Please make it official.

stephanbrunner commented 5 years ago

Find a hacky version attached to my comment 1 month ago. That shound serve for some use cases, not all gpios are supported though. At some point someone probably will write an update supporting all gpios.

jkwphysics commented 4 years ago

I have a hacky version I can share with you, but not generalized enough to be worth publishing. That would be a cool job to do though. Unfortunattely, because I didn't plan to publish the code, I made some codestyle addaption. Sorry for that. The technical changes may only be in the #define sections to define the chips pinout. But I don't really remember.

Hope that helps anyway: FastGPIO_MEGA.h.txt

Was really hoping to try this, but I'm getting some errors that are beyond my c/c++ abilities...

FastGPIO_MEGA.h:424:71: error: impossible constraint in asm _FG_SBI(pinStructs[pin].portAddr, pinStructs[pin].bit);

Any update on officially supported 2560?

stephanbrunner commented 4 years ago

Some code might help. : )