[riot-notifications] [RIOT-OS/RIOT] sys/arduino: Added Wire (I2C) interface (#10592)

Gunar Schorcht notifications at github.com
Thu Sep 5 18:29:55 CEST 2019


@cladmin The situation was the following:

You have a directory with an Arduino application, for example `examples/hello-world-arduino`. The `Makefile` enables the `arduino` module
```
USEMODULE += arduino
```
In this case, the make system expects a file with extension `.sketch` from which the file `_sketch.cpp` is generated and compiled afterwards.

However, when you have an Arduino library, the directory usually contains only a `.h` and a `.cpp` file, for example:
```
pkg/vl53l1x_arduino/VL53L1X.cpp
pkg/vl53l1x_arduino/VL53L1X.h
```
The compilation of such a directory requires same compiler configuration as for an Arduino application using `sys/arduino` library.

So the idea was just to declare a pseudomodule `arduino_lib` in addition to the `arduino` psdeudomodule. The makefile would then enable
```
USEMODULE += arduino_lib
```
which enables module `arduino` implicitly. The make system wouldn't try to generate `_sketch.cpp` from a `.sketch` file.

Therefore I used the following construct in former `sys/arduino/Makefile.include`
```diff
- $(shell $(RIOTTOOLS)/arduino/pre_build.sh $(SRCDIR) $(APPDIR) $(SKETCHES))
+ # run the Arduino pre-build script if Arduino module is not used as library
+ ifeq (, $(filter arduino_lib, $(USEMODULE)))
+     $(shell $(RIOTTOOLS)/arduino/pre_build.sh $(SRCDIR) $(APPDIR) $(SKETCHES))
+ endif
```
and in `sys/Makefile.dep`
```diff
+ ifneq (, $(filter arduino_lib, $(USEMODULE)))
+     USEMODULE += arduino
+ endif  
```

It would be really cool if it would be possible to import Arduino libraries as packages and to compile them since there are thousands of drivers available for Arduino IDE.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10592#issuecomment-528450212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190905/8159a891/attachment.htm>


More information about the notifications mailing list