The Arduino Projects have a lot of libraries for the diffents HATs or Sensors, is it possible to use compiled code from this libs ?
PS: This is no question about the license, only if it possible.
The Arduino Projects have a lot of libraries for the diffents HATs or Sensors, is it possible to use compiled code from this libs ?I did not test it, but you'd need to write units for the compiled libraries and then use {$L code.o} for each file you need (most files will probably require other files). Or you could try to move all .o files into a static library and link against that...
I think it will be challenging since many (most?) of the libraries are written in C++. One could write a C layer on top to flatten the code, but for that much effort I would rather stay with Arduino. Or better yet, rewrite library in Pascal.@ccrause: you are an expert, but:
How does free pascal work on Arduino?Build a cross compiler for it.... Both AVR and ARM bare bone are supported as micro controllers.... Which one do you have?
Thaddy, have you a sample for me ? Please.There are (is) simple stuff in the wiki... Start here, but there is more: https://wiki.freepascal.org/Arduino
Arduino is almost all plain C, not C++. It is written C++ style., but it is usually plain C.
C++ is way too heavy to use at all.
How does free pascal work on Arduino?Build a cross compiler for it.... Both AVR and ARM bare bone are supported as micro controllers.... Which one do you have?
Don't expect Lazarus component style programming to work, though.... But FPC does perfectly OK.
Just like the C cross-compilers
How does free pascal work on Arduino?
That's actually more like a pascal record and is not a true "class" in that sense. You can only use it in record style.... (bitpacked, btw)Arduino is almost all plain C, not C++. It is written C++ style., but it is usually plain C.
C++ is way too heavy to use at all.
The base wiring library is plain C, but most other libraries seem like C++ (except if class X : public Y is a valid C construct). I'm no expert in C/C++, let alone the differences between the two, but I did spot use of inheritance and using-declaration (I had to search for that definition):
class TwoWire : public Stream { ... using Print::write; };
I only want to point out that the question to get access to available functionality in Arduino is reasonable, I just think it will be a lot more difficult that linking to a plain C library.
A wizard to create Arduino loadable module (.hex) using Lazarus/Free Pascal:
https://github.com/jmpessoa/lazarduinomodulewizard
I have both, but I am trying to use ARM (STM32). But they work (almost) out of the box in the Arduino IDE, and while I do seem to be able to build an image for them with FPC, it is far from working.