diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-07-28 19:39:58 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-07-28 19:39:58 +0200 |
commit | d7b52ba112b3bc5293e3e6c361e8d0cd64fc75bf (patch) | |
tree | 2bcb0d5fb6376e48ca88ef8e03aaf598b77015b2 /commandline | |
parent | 33b42c688eaea23c14abe8d57b5b0f68c9373b86 (diff) |
add vusb-i2cwrite
Diffstat (limited to 'commandline')
-rw-r--r-- | commandline/Makefile | 10 | ||||
-rw-r--r-- | commandline/i2cwrite.c | 22 |
2 files changed, 29 insertions, 3 deletions
diff --git a/commandline/Makefile b/commandline/Makefile index 6c51294..a4d0792 100644 --- a/commandline/Makefile +++ b/commandline/Makefile @@ -9,7 +9,7 @@ LIBS = $(USBLIBS) PREFIX ?= /usr/local bin_dir = ${DESTDIR}${PREFIX}/bin -PROGRAMS = vusb-i2c vusb-i2cdetect +PROGRAMS = vusb-i2c vusb-i2cdetect vusb-i2cwrite all: $(PROGRAMS) @@ -18,7 +18,8 @@ all: $(PROGRAMS) i2c.o: i2c.c i2c-util.c i2c-util.h i2c-util.o: i2c-util.c -i2cdetect.o: i2cdetect.c +i2cdetect.o: i2cdetect.c i2c-util.c i2c-util.h +i2cwrite.o: i2cwrite.c i2c-util.c i2c-util.h vusb-i2c: i2c.o i2c-util.o $(CC) -o $@ $^ $(LIBS) @@ -26,11 +27,14 @@ vusb-i2c: i2c.o i2c-util.o vusb-i2cdetect: i2cdetect.o i2c-util.o $(CC) -o $@ $^ $(LIBS) +vusb-i2cwrite: i2cwrite.o i2c-util.o + $(CC) -o $@ $^ $(LIBS) + clean: rm -f *.o $(PROGRAMS) install: - install -m 0755 $(PROGRAMS) $(bin_dir) + install -m 4755 $(PROGRAMS) $(bin_dir) uninstall: rm -rf $(bin_dir)/vusb-i2c $(bin_dir)/vusb-i2cdetect diff --git a/commandline/i2cwrite.c b/commandline/i2cwrite.c new file mode 100644 index 0000000..56031f9 --- /dev/null +++ b/commandline/i2cwrite.c @@ -0,0 +1,22 @@ +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "i2c-util.h" + +int main(int argc, char **argv) +{ + int i; + + i2c_init(); + i2c_start(); + + for (i = 1; i < argc; i++) { + i2c_tx_byte(atoi(argv[i])); + } + + i2c_stop(); + i2c_deinit(); + + return 0; +} |