diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3ff034a --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +CC = gcc +LIB = lib/ +SRC = src/ +INCLUDE = include/ + +.PHONY: all +all: lsm9ds1.so + +lsm9ds1.so: $(SRC)LSM9DS1.cpp + $(CC) -I./include -Wall -O2 $(SRC)LSM9DS1.cpp -lwiringPi -shared -o $(LIB)liblsm9ds1.so diff --git a/README.md b/README.md index 9b0f4d4..4240f5d 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,10 @@ This library supports only I2C. * [WiringPi](http://wiringpi.com/) -## Install & Usage - -Pin assignment is below: - -|RasPi|IMU| -|:-:|:-:| -|GND|GND| -|3.3VDC Power|VDD| -|Pin3|SDA| -|Pin5|SCL| +## Build ``` -$ git clone https://github.com/akimach/SparkFun_LSM9DS1_Arduino_Library.git +$ git clone https://github.com/akimach/LSM9DS1_RaspberryPi_Library.git +$ cd LSM9DS1_RaspberryPi_Library $ make -$ sudo ./LSM9DS1_Basic_I2C ``` diff --git a/src/LSM9DS1_Basic_I2C.cpp b/example/LSM9DS1_Basic_I2C.cpp similarity index 100% rename from src/LSM9DS1_Basic_I2C.cpp rename to example/LSM9DS1_Basic_I2C.cpp diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..e334e5e --- /dev/null +++ b/example/Makefile @@ -0,0 +1,8 @@ +CC = gcc +LIB = ../lib +INCLUDE = ../include +.PHONY: all +all: LSM9DS1_Basic_I2C + +LSM9DS1_Basic_I2C: LSM9DS1_Basic_I2C.cpp + $(CC) -I$(INCLUDE) -L$(LIB) -llsm9ds1 -Wall -O2 LSM9DS1_Basic_I2C.cpp -o LSM9DS1_Basic_I2C diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..2d7f8a5 --- /dev/null +++ b/example/README.md @@ -0,0 +1,16 @@ +# Build & Run + +Pin assignment is below: + +|RasPi|IMU| +|:-:|:-:| +|GND|GND| +|3.3VDC Power|VDD| +|Pin3|SDA| +|Pin5|SCL| + +``` +$ make +$ sudo -s +$ LD_LIBRARY_PATH=../lib ./LSM9DS1_Basic_I2C +``` diff --git a/src/LSM9DS1.h b/include/LSM9DS1.h similarity index 100% rename from src/LSM9DS1.h rename to include/LSM9DS1.h diff --git a/src/LSM9DS1_Registers.h b/include/LSM9DS1_Registers.h similarity index 100% rename from src/LSM9DS1_Registers.h rename to include/LSM9DS1_Registers.h diff --git a/src/LSM9DS1_Types.h b/include/LSM9DS1_Types.h similarity index 100% rename from src/LSM9DS1_Types.h rename to include/LSM9DS1_Types.h diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index a385f71..0000000 --- a/src/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -OBJS = main.o lsm9ds1.o -CC = gcc - -.PHONY: all -all: LSM9DS1_Basic_I2C - -LSM9DS1_Basic_I2C: $(OBJS) - $(CC) -Wall -O2 $(OBJS) -lwiringPi -o LSM9DS1_Basic_I2C - -main.o: LSM9DS1_Basic_I2C.cpp LSM9DS1.h - $(CC) -c -Wall -O2 LSM9DS1_Basic_I2C.cpp -lwiringPi -o main.o - -lsm9ds1.o: LSM9DS1.cpp LSM9DS1.h LSM9DS1_Registers.h LSM9DS1_Types.h - $(CC) -c -Wall -O2 LSM9DS1.cpp -lwiringPi -o lsm9ds1.o - -.PHONY: clean -clean: - rm -f $(OBJS) \ No newline at end of file