Skip to content

Commit

Permalink
sys/arduino: Wire requires periph_i2c module
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Oct 20, 2019
1 parent 6dc58b0 commit 4cc7fa5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sys/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ifneq (,$(filter arduino,$(USEMODULE)))
FEATURES_OPTIONAL += periph_i2c
endif

ifneq (,$(filter eepreg,$(USEMODULE)))
FEATURES_REQUIRED += periph_eeprom
endif
Expand Down
4 changes: 4 additions & 0 deletions sys/arduino/include/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#ifndef WIRE_H
#define WIRE_H

#ifndef MODULE_PERIPH_I2C
#error "No I2C support on your board"
#endif

#ifdef __cplusplus
#include "wireport.hpp"
#endif
Expand Down
8 changes: 8 additions & 0 deletions sys/arduino/wireport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
* (https://creativecommons.org/licenses/by-sa/3.0/).
*/

#if MODULE_PERIPH_I2C

extern "C" {
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -269,3 +271,9 @@ void TwoWire::flush(void)
/* single instance */

TwoWire Wire;

#else /* MODULE_PERIPH_I2C */

typedef int dont_be_pedantic;

#endif /* MODULE_PERIPH_I2C */

0 comments on commit 4cc7fa5

Please sign in to comment.