diff --git a/libgy521.h b/libgy521.h index ecdccb7..ef356d8 100644 --- a/libgy521.h +++ b/libgy521.h @@ -1,13 +1,13 @@ -int setupgy521(void); -int read_i2c_word(int reg); -int read_i2c_word16(int reg); -float getTemp(void); -void setAccelerometerRange(int range); -int readAccelerometerRange(int raw); -int getAccelerometerData(char axis, int g); -void setGyroscopeRange(int range); -int readGyroscopeRange(int raw); -int getGyroscopeData(char axis); -float getAngleX(void); -float getAngleY(void); -float getAngleZ(void); +extern int setupgy521(void); +extern int read_i2c_word(int reg); +extern int read_i2c_word16(int reg); +extern float getTemp(void); +extern void setAccelerometerRange(int range); +extern int readAccelerometerRange(int raw); +extern int getAccelerometerData(char axis, int g); +extern void setGyroscopeRange(int range); +extern int readGyroscopeRange(int raw); +extern int getGyroscopeData(char axis); +extern float getAngleX(void); +extern float getAngleY(void); +extern float getAngleZ(void); diff --git a/makefile b/makefile index 842fa82..fcbad0a 100644 --- a/makefile +++ b/makefile @@ -1,20 +1,15 @@ -#Infos: http://www.ijon.de/comp/tutorials/makefile.html - - VERSION = 1.0 -CC = /usr/bin/gcc -CFLAGS = -Wall -g -D_REENTRANT -DVERSION=\"$(VERSION)\" -#LDFLAGS = -lm -lpthread `gtk-config --cflags` `gtk-config --libs` -lgthread +CFLAGS = -Wall -g -D_REENTRANT -DVERSION=\"$(VERSION)\" -O3 LDFLAGS = -lwiringPi -lm -OBJ = gy521example.o libgy521.o +all: lib test -libgy521: $(OBJ) - $(CC) $(CFLAGS) -o gy521example $(OBJ) $(LDFLAGS) - -%.o: %.c - $(CC) $(CFLAGS) -c $< +lib: libgy521.o + cc -shared -o libgy521.so libgy521.o -lm -lwiringPi +test: gy521example.o + cc -o test -L. gy521example.o -lgy521 -lwiringPi + .PHONY: clean clean: rm -r *.o