New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release notes? #1
Comments
it appears that the code will only compile if you remove i2c-dev-tools: this is problematic. |
ok get an update from the repo and i think that should fix the problem |
Sorry for the typo re: i2c-tools, and thanks very much for the update - works like a charm now. Your technique of including code from within .c and .h files is a bit unorthodox, though :-). If I have time (doubtful) I'll take a look at untangling this and having the Makefile generate a more conventional library that can be installed in /usr/local/lib and referenced at link time. In the meantime, it works. Can't argue with success! |
thanks, its my 1st "lib" ^^ |
fyi - to set this up as a library:
SRCS = lcd.c mcp.c rpii2c.c CC=gcc default: $(PROG) liblcd.a: $(OBJS)
clean: |
This is exactly what I was looking for - I have an Adafruit 2x16 I2C backpack that I want to talk to from C. I tried to build this code on a Pi running Raspbian, but got a ton of errors - is this not compatible with Raspbian? Or is there some prerequisite that I'm missing?
thx
pi@raspberrypi ~/rpi_lcd $ uname -a
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux
pi@raspberrypi ~/rpi_lcd $ make
gcc -Wall -Wextra -Werror -g -o lcd lcd.c
In file included from rpii2c.h:35:0,
from rpii2c.c:26,
from mcp.h:33,
from mcp.c:33,
from lcd.h:36,
from lcd.c:26:
/usr/include/linux/i2c.h:67:8: error: redefinition of ‘struct i2c_msg’
/usr/include/linux/i2c-dev.h:38:8: note: originally defined here
/usr/include/linux/i2c.h:125:7: error: redefinition of ‘union i2c_smbus_data’
/usr/include/linux/i2c-dev.h:90:7: note: originally defined here
In file included from smbus.c:25:0,
from rpii2c.h:37,
from rpii2c.c:26,
from mcp.h:33,
from mcp.c:33,
from lcd.h:36,
from lcd.c:26:
smbus.h:29:14: error: conflicting types for ‘i2c_smbus_access’
/usr/include/linux/i2c-dev.h:161:21: note: previous definition of ‘i2c_smbus_access’ was here
In file included from rpii2c.h:37:0,
from rpii2c.c:26,
from mcp.h:33,
from mcp.c:33,
from lcd.h:36,
from lcd.c:26:
smbus.c: In function ‘i2c_smbus_access’:
smbus.c:48:12: error: assignment from incompatible pointer type [-Werror]
smbus.c: At top level:
smbus.c:57:7: error: redefinition of ‘i2c_smbus_write_quick’
/usr/include/linux/i2c-dev.h:174:21: note: previous definition of ‘i2c_smbus_write_quick’ was here
smbus.c:62:7: error: redefinition of ‘i2c_smbus_read_byte’
/usr/include/linux/i2c-dev.h:179:21: note: previous definition of ‘i2c_smbus_read_byte’ was here
smbus.c:74:7: error: redefinition of ‘i2c_smbus_write_byte’
/usr/include/linux/i2c-dev.h:188:21: note: previous definition of ‘i2c_smbus_write_byte’ was here
smbus.c:80:7: error: redefinition of ‘i2c_smbus_read_byte_data’
/usr/include/linux/i2c-dev.h:194:21: note: previous definition of ‘i2c_smbus_read_byte_data’ was here
smbus.c:93:7: error: redefinition of ‘i2c_smbus_write_byte_data’
/usr/include/linux/i2c-dev.h:204:21: note: previous definition of ‘i2c_smbus_write_byte_data’ was here
smbus.c:101:7: error: redefinition of ‘i2c_smbus_read_word_data’
/usr/include/linux/i2c-dev.h:213:21: note: previous definition of ‘i2c_smbus_read_word_data’ was here
smbus.c:114:7: error: redefinition of ‘i2c_smbus_write_word_data’
/usr/include/linux/i2c-dev.h:223:21: note: previous definition of ‘i2c_smbus_write_word_data’ was here
smbus.c:122:7: error: redefinition of ‘i2c_smbus_process_call’
/usr/include/linux/i2c-dev.h:232:21: note: previous definition of ‘i2c_smbus_process_call’ was here
smbus.c:134:7: error: redefinition of ‘i2c_smbus_read_block_data’
/usr/include/linux/i2c-dev.h:245:21: note: previous definition of ‘i2c_smbus_read_block_data’ was here
smbus.c:149:7: error: redefinition of ‘i2c_smbus_write_block_data’
/usr/include/linux/i2c-dev.h:260:21: note: previous definition of ‘i2c_smbus_write_block_data’ was here
smbus.c:167:7: error: redefinition of ‘i2c_smbus_read_i2c_block_data’
/usr/include/linux/i2c-dev.h:278:21: note: previous definition of ‘i2c_smbus_read_i2c_block_data’ was here
smbus.c:188:7: error: redefinition of ‘i2c_smbus_write_i2c_block_data’
/usr/include/linux/i2c-dev.h:298:21: note: previous definition of ‘i2c_smbus_write_i2c_block_data’ was here
smbus.c:203:7: error: redefinition of ‘i2c_smbus_block_process_call’
/usr/include/linux/i2c-dev.h:314:21: note: previous definition of ‘i2c_smbus_block_process_call’ was here
cc1: all warnings being treated as errors
make: *** [lcd] Error 1
The text was updated successfully, but these errors were encountered: