New Update ofxGPIO


#1

Hi guys,

a update for ofxGPIO, added support for zenity-UI to build simple GUI for your projects in c++
without openframeworks and add bcm2835 support and examples for RF24 radio analysis
module.

Added tool for compile and template for makefile without openframeworks


good day


#2

Hi @kashim,

Thanks for this add-on. Im trying to compile it on a RPi3, but I’m getting these errors on all examples:

>  In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:5:0,
>                  from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:
> /usr/include/linux/i2c.h:68:8: error: previous definition of ‘struct i2c_msg’
>  struct i2c_msg {
>         ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:89:7: error: redefinition of ‘union i2c_smbus_data’
>  union i2c_smbus_data {
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:5:0,
>                  from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:
> /usr/include/linux/i2c.h:128:7: error: previous definition of ‘union i2c_smbus_data’
>  union i2c_smbus_data {
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’:
> /usr/include/linux/i2c-dev.h:157:74: error: ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                       int size, union i2c_smbus_data *data)
>                                                                           ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:7:14: note: previous declaration of ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’
>  extern __s32 i2c_smbus_access(int file, char read_write, __u8 command,
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_write_quick(int, __u8)’:
> /usr/include/linux/i2c-dev.h:169:63: error: ‘__s32 i2c_smbus_write_quick(int, __u8)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_write_quick(int file, __u8 value)
>                                                                ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:10:14: note: previous declaration of ‘__s32 i2c_smbus_write_quick(int, __u8)’
>  extern __s32 i2c_smbus_write_quick(int file, __u8 value);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_read_byte(int)’:
> /usr/include/linux/i2c-dev.h:174:49: error: ‘__s32 i2c_smbus_read_byte(int)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_read_byte(int file)
>                                                  ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:11:14: note: previous declaration of ‘__s32 i2c_smbus_read_byte(int)’
>  extern __s32 i2c_smbus_read_byte(int file);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_write_byte(int, __u8)’:
> /usr/include/linux/i2c-dev.h:183:62: error: ‘__s32 i2c_smbus_write_byte(int, __u8)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
>                                                               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:12:14: note: previous declaration of ‘__s32 i2c_smbus_write_byte(int, __u8)’
>  extern __s32 i2c_smbus_write_byte(int file, __u8 value);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:189:68: error: ‘__s32 i2c_smbus_read_byte_data(int, __u8)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
>                                                                     ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:13:14: note: previous declaration of ‘__s32 i2c_smbus_read_byte_data(int, __u8)’
>  extern __s32 i2c_smbus_read_byte_data(int file, __u8 command);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:200:57: error: ‘__s32 i2c_smbus_write_byte_data(int, __u8, __u8)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                __u8 value)
>                                                          ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:14:14: note: previous declaration of ‘__s32 i2c_smbus_write_byte_data(int, __u8, __u8)’
>  extern __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:208:68: error: ‘__s32 i2c_smbus_read_word_data(int, __u8)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
>                                                                     ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:15:14: note: previous declaration of ‘__s32 i2c_smbus_read_word_data(int, __u8)’
>  extern __s32 i2c_smbus_read_word_data(int file, __u8 command);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:219:58: error: ‘__s32 i2c_smbus_write_word_data(int, __u8, __u16)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                __u16 value)
>                                                           ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:16:14: note: previous declaration of ‘__s32 i2c_smbus_write_word_data(int, __u8, __u16)’
>  extern __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:227:79: error: ‘__s32 i2c_smbus_process_call(int, __u8, __u16)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>  static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
>                                                                                ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:17:14: note: previous declaration of ‘__s32 i2c_smbus_process_call(int, __u8, __u16)’
>  extern __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:241:59: error: ‘__s32 i2c_smbus_read_block_data(int, __u8, __u8*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                __u8 *values)
>                                                            ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:20:14: note: previous declaration of ‘__s32 i2c_smbus_read_block_data(int, __u8, __u8*)’
>  extern __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values);
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:256:79: error: ‘__s32 i2c_smbus_write_block_data(int, __u8, __u8, const __u8*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                 __u8 length, const __u8 *values)
>                                                                                ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:21:14: note: previous declaration of ‘__s32 i2c_smbus_write_block_data(int, __u8, __u8, const __u8*)’
>  extern __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’:
> /usr/include/linux/i2c-dev.h:274:76: error: ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                    __u8 length, __u8 *values)
>                                                                             ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:28:14: note: previous declaration of ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’
>  extern __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 length,
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’:
> /usr/include/linux/i2c-dev.h:295:70: error: ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                     const __u8 *values)
>                                                                       ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:30:14: note: previous declaration of ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’
>  extern __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length,
>               ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h: In function ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’:
> /usr/include/linux/i2c-dev.h:310:75: error: ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
>                                                   __u8 length, __u8 *values)
>                                                                            ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:2:0:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.h:34:14: note: previous declaration of ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’
>  extern __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length,
>               ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:16:7: error: redefinition of ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’
>  __s32 i2c_smbus_access(int file, char read_write, __u8 command,
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:156:21: note: ‘__s32 i2c_smbus_access(int, char, __u8, int, i2c_smbus_data*)’ previously defined here
>  static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_quick(int, __u8)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:34:7: error: redefinition of ‘__s32 i2c_smbus_write_quick(int, __u8)’
>  __s32 i2c_smbus_write_quick(int file, __u8 value)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:169:21: note: ‘__s32 i2c_smbus_write_quick(int, __u8)’ previously defined here
>  static inline __s32 i2c_smbus_write_quick(int file, __u8 value)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_read_byte(int)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:39:7: error: redefinition of ‘__s32 i2c_smbus_read_byte(int)’
>  __s32 i2c_smbus_read_byte(int file)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:174:21: note: ‘__s32 i2c_smbus_read_byte(int)’ previously defined here
>  static inline __s32 i2c_smbus_read_byte(int file)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_byte(int, __u8)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:51:7: error: redefinition of ‘__s32 i2c_smbus_write_byte(int, __u8)’
>  __s32 i2c_smbus_write_byte(int file, __u8 value)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:183:21: note: ‘__s32 i2c_smbus_write_byte(int, __u8)’ previously defined here
>  static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_read_byte_data(int, __u8)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:57:7: error: redefinition of ‘__s32 i2c_smbus_read_byte_data(int, __u8)’
>  __s32 i2c_smbus_read_byte_data(int file, __u8 command)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:189:21: note: ‘__s32 i2c_smbus_read_byte_data(int, __u8)’ previously defined here
>  static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_byte_data(int, __u8, __u8)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:70:7: error: redefinition of ‘__s32 i2c_smbus_write_byte_data(int, __u8, __u8)’
>  __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:199:21: note: ‘__s32 i2c_smbus_write_byte_data(int, __u8, __u8)’ previously defined here
>  static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_read_word_data(int, __u8)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:78:7: error: redefinition of ‘__s32 i2c_smbus_read_word_data(int, __u8)’
>  __s32 i2c_smbus_read_word_data(int file, __u8 command)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:208:21: note: ‘__s32 i2c_smbus_read_word_data(int, __u8)’ previously defined here
>  static inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_word_data(int, __u8, __u16)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:91:7: error: redefinition of ‘__s32 i2c_smbus_write_word_data(int, __u8, __u16)’
>  __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:218:21: note: ‘__s32 i2c_smbus_write_word_data(int, __u8, __u16)’ previously defined here
>  static inline __s32 i2c_smbus_write_word_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_process_call(int, __u8, __u16)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:99:7: error: redefinition of ‘__s32 i2c_smbus_process_call(int, __u8, __u16)’
>  __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:227:21: note: ‘__s32 i2c_smbus_process_call(int, __u8, __u16)’ previously defined here
>  static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_read_block_data(int, __u8, __u8*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:110:7: error: redefinition of ‘__s32 i2c_smbus_read_block_data(int, __u8, __u8*)’
>  __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values)
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:240:21: note: ‘__s32 i2c_smbus_read_block_data(int, __u8, __u8*)’ previously defined here
>  static inline __s32 i2c_smbus_read_block_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_block_data(int, __u8, __u8, const __u8*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:125:7: error: redefinition of ‘__s32 i2c_smbus_write_block_data(int, __u8, __u8, const __u8*)’
>  __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:255:21: note: ‘__s32 i2c_smbus_write_block_data(int, __u8, __u8, const __u8*)’ previously defined here
>  static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:143:7: error: redefinition of ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’
>  __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 length,
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:273:21: note: ‘__s32 i2c_smbus_read_i2c_block_data(int, __u8, __u8, __u8*)’ previously defined here
>  static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:164:7: error: redefinition of ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’
>  __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length,
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:293:21: note: ‘__s32 i2c_smbus_write_i2c_block_data(int, __u8, __u8, const __u8*)’ previously defined here
>  static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp: In function ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’:
> /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:180:7: error: redefinition of ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’
>  __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length,
>        ^
> In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/smbus.cpp:6:0:
> /usr/include/linux/i2c-dev.h:309:21: note: ‘__s32 i2c_smbus_block_process_call(int, __u8, __u8, __u8*)’ previously defined here
>  static inline __s32 i2c_smbus_block_process_call(int file, __u8 command,
>                      ^
> /home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:336: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxGPIO/src/smbus.o' failed

Any ideas on what could be the problem?

Thanks again!


#3

Hi @medul_la

Perhaps it is a problem related to the presence of some struct of smbus.h which are also present in: “i2c.h” of its operating system.

Try moving file: ofxGPIO/src/smbus.* in your home and recompile progect!


#4

and comment: //#include “smbus.h” in ofxGPIO/src/i2c.cpp


#5

Thanks for the quick response @kashim!

I did as you suggested and now I’m getting these errors:

In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/i2c.cpp:4:0:
/usr/include/linux/i2c-dev.h:37:8: error: redefinition of ‘struct i2c_msg’
 struct i2c_msg {
        ^
In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/i2c.cpp:3:0:
/usr/include/linux/i2c.h:68:8: error: previous definition of ‘struct i2c_msg’
 struct i2c_msg {
        ^
In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/i2c.cpp:4:0:
/usr/include/linux/i2c-dev.h:89:7: error: redefinition of ‘union i2c_smbus_data’
 union i2c_smbus_data {
       ^
In file included from /home/pi/openFrameworks/addons/ofxGPIO/src/i2c.cpp:3:0:
/usr/include/linux/i2c.h:128:7: error: previous definition of ‘union i2c_smbus_data’
 union i2c_smbus_data {
       ^
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:336: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxGPIO/src/i2c.o' failed

#6

ehmm… this very strange,

Now i can not do tests tomorrow i do some checks, can you tell me your operating system? And if this happens with all the examples? you can use:

cd tools/
./buildAllExample.sh


#7

I’m getting these errors on all examples, unfortunately. I’m running Raspbian Jessie v8, this is the output of cat /etc/os-release:

NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"

I really appreciate if you could look into it. Many thanks!


#8

Ok @kashim, I figured out what was the problem.

I had libi2c-dev package installed in the OS, it was somehow interfering with the compilation of ofxGPIO. When I removed the package, the add-on and the examples compiled fine :slight_smile:

Many thanks for your quick replies and thanks again for the great add-on!


#9

Thank you for this! I must try to resolve this conflict
eliminating smbus from the adddons.


#10

Sorry to bother you again @kashim, but I would like to use a HMC5883L digital compass with the RPi and I’ve noticed you have a specific example for it. In that example, there is this setting:

busCompass->writeByte(1, 0b00100000); // 1.3 gain LSb / Gauss 1090 (default)

If I wanted to set it to the +/- 8.10 Gauss range, what would be the byte value?

And to what GPIO ports of the RPi should I connect the SDA/SCL ports from the HMC5883L module?

Many many thanks!


#11

These are some conversions:

# HEX = BIN         RANGE  GAIN X/Y/Z   GAIN Z
0x20 = 0b00100000   ±1.3     1055             950 
0x40 = 0b01000000   ±1.9     795              710
0x60 = 0b01100000   ±2.5     635              570
0x80 = 0b10000000   ±4.0     430              385
0xE0 = 0b11100000   ±8.1     230              205

this table range:

 * Value | Field Range | Gain (LSB/Gauss)
 * ------+-------------+-----------------
 * 0     | +/- 0.88 Ga | 1370
 * 1     | +/- 1.3 Ga  | 1090 (Default)
 * 2     | +/- 1.9 Ga  | 820
 * 3     | +/- 2.5 Ga  | 660
 * 4     | +/- 4.0 Ga  | 440
 * 5     | +/- 4.7 Ga  | 390
 * 6     | +/- 5.6 Ga  | 330
 * 7     | +/- 8.1 Ga  | 230

check this for SDA and SCL connection:


#12

Great. You saved my life today! Cheers!