diff options
Diffstat (limited to 'commandline')
-rwxr-xr-x | commandline/examples/ds2482-100-readrom | 18 | ||||
-rwxr-xr-x | commandline/examples/ds2482-100-searchrom | 4 | ||||
-rwxr-xr-x | commandline/examples/ssd1306-getpixels | 5 | ||||
-rwxr-xr-x | commandline/examples/ssd1306-init | 12 | ||||
-rwxr-xr-x | commandline/examples/ssd1306-show | 6 | ||||
-rw-r--r-- | commandline/i2c-util.c | 2 | ||||
-rw-r--r-- | commandline/man/vusb-i2cdetect.1 | 2 | ||||
-rw-r--r-- | commandline/man/vusb-i2cget.1 | 2 | ||||
-rw-r--r-- | commandline/man/vusb-i2cset.1 | 2 |
9 files changed, 29 insertions, 24 deletions
diff --git a/commandline/examples/ds2482-100-readrom b/commandline/examples/ds2482-100-readrom index 88df4de..7b08b0f 100755 --- a/commandline/examples/ds2482-100-readrom +++ b/commandline/examples/ds2482-100-readrom @@ -11,7 +11,7 @@ vusb-i2cset 0x18 0xf0 || echo "Failed to reset chip" vusb-i2cset 0x18 0xd2 $CONFIG || echo "Failed to set config" vusb-i2cset 0x18 0xb4 || echo "Failed to initiate presence detection (OWR)" -ret=$(( $(vusb-i2cget 0x18 0xe1 0xf0) & 0x02 )) +ret=$(( $(vusb-i2cget 0x18 1 0xe1 0xf0) & 0x02 )) if [ "${ret}" = 0 ]; then echo "No presence detected" @@ -21,20 +21,20 @@ fi vusb-i2cset 0x18 0xa5 0x33 || echo "failed to issue READ ROM" vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b8=$(vusb-i2cget 0x18 0xe1 0xe1) +b8=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b7=$(vusb-i2cget 0x18 0xe1 0xe1) +b7=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b6=$(vusb-i2cget 0x18 0xe1 0xe1) +b6=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b5=$(vusb-i2cget 0x18 0xe1 0xe1) +b5=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b4=$(vusb-i2cget 0x18 0xe1 0xe1) +b4=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b3=$(vusb-i2cget 0x18 0xe1 0xe1) +b3=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b2=$(vusb-i2cget 0x18 0xe1 0xe1) +b2=$(vusb-i2cget 0x18 1 0xe1 0xe1) vusb-i2cset 0x18 0x96 || echo "failed to initiate read" -b1=$(vusb-i2cget 0x18 0xe1 0xe1) +b1=$(vusb-i2cget 0x18 1 0xe1 0xe1) printf "%02X%02X%02X%02X%02X%02X%02X%02X\n" $b1 $b2 $b3 $b4 $b5 $b6 $b7 $b8 diff --git a/commandline/examples/ds2482-100-searchrom b/commandline/examples/ds2482-100-searchrom index db478e7..1f97437 100755 --- a/commandline/examples/ds2482-100-searchrom +++ b/commandline/examples/ds2482-100-searchrom @@ -11,7 +11,7 @@ vusb-i2cset 0x18 0xf0 || echo "Failed to reset chip" vusb-i2cset 0x18 0xd2 $CONFIG || echo "Failed to set config" vusb-i2cset 0x18 0xb4 || echo "Failed to initiate presence detection (OWR)" -ret=$(( $(vusb-i2cget 0x18 0xe1 0xf0) & 0x02 )) +ret=$(( $(vusb-i2cget 0x18 1 0xe1 0xf0) & 0x02 )) if [ "${ret}" = 0 ]; then echo "No presence detected" @@ -27,7 +27,7 @@ for i in $(seq 1 8); do for j in $(seq 0 7); do vusb-i2cset 0x18 0x78 0x00 || echo "failed to send triplet" - bit=$(vusb-i2cget 0x18 0xe1 0xf0) + bit=$(vusb-i2cget 0x18 1 0xe1 0xf0) if [ "${bit}" -ge 80 ]; then byte=$((byte | (1 << j))) diff --git a/commandline/examples/ssd1306-getpixels b/commandline/examples/ssd1306-getpixels index 8527b7a..ba3e2b3 100755 --- a/commandline/examples/ssd1306-getpixels +++ b/commandline/examples/ssd1306-getpixels @@ -3,9 +3,6 @@ from PIL import Image import sys -buf_w = 128 -buf_h = 64 - def load_image(filename): im = Image.open(filename) @@ -20,6 +17,8 @@ def load_image(filename): filename = sys.argv[1] offset = int(sys.argv[2]) +buf_w = int(sys.argv[3]) +buf_h = int(sys.argv[4]) buf = load_image(filename) buf = buf[offset : offset + 128] diff --git a/commandline/examples/ssd1306-init b/commandline/examples/ssd1306-init index 56e77e5..4d587be 100755 --- a/commandline/examples/ssd1306-init +++ b/commandline/examples/ssd1306-init @@ -3,8 +3,14 @@ WR_CMD=0x80 WR_DATA=0x40 -WIDTH=128 -HEIGHT=64 +: ${WIDTH:=128} +: ${HEIGHT:=64} + +if [ "${HEIGHT}" = 32 ]; then + COM_PIN_CFG=0x02 +else + COM_PIN_CFG=0x12 +fi SET_CONTRAST=0x81 SET_ENTIRE_ON=0xa4 @@ -32,7 +38,7 @@ for cmd in $SET_DISP_OFF \ $SET_MUX_RATIO $(( HEIGHT - 1 )) \ $SET_COM_OUT_DIR_08 \ $SET_DISP_OFFSET 0x00 \ - $SET_COM_PIN_CFG 0x12 \ + $SET_COM_PIN_CFG $COM_PIN_CFG \ $SET_DISP_CLK_DIV 0x80 \ $SET_PRECHARGE 0xf1 \ $SET_VCOM_DESEL 0x30 \ diff --git a/commandline/examples/ssd1306-show b/commandline/examples/ssd1306-show index bac18da..63a63cd 100755 --- a/commandline/examples/ssd1306-show +++ b/commandline/examples/ssd1306-show @@ -3,8 +3,8 @@ WR_CMD=0x80 WR_DATA=0x40 -WIDTH=128 -HEIGHT=64 +: ${WIDTH:=128} +: ${HEIGHT:=64} SET_CONTRAST=0x81 SET_ENTIRE_ON=0xa4 @@ -33,5 +33,5 @@ for cmd in $SET_COL_ADDR 0 $(( WIDTH - 1 )) \ done for offset in $(seq 0 7); do - vusb-i2cset 0x3c $WR_DATA $("${BASE}/ssd1306-getpixels" "$1" $(( offset * 128 ))) + vusb-i2cset 0x3c $WR_DATA $("${BASE}/ssd1306-getpixels" "$1" $(( offset * 128 )) "${WIDTH}" "${HEIGHT}") done diff --git a/commandline/i2c-util.c b/commandline/i2c-util.c index be33d4b..10f2432 100644 --- a/commandline/i2c-util.c +++ b/commandline/i2c-util.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * and (c) 2016 by Daniel Friesel + * and (c) 2016 by Birte Friesel * License: GNU GPL v2 */ diff --git a/commandline/man/vusb-i2cdetect.1 b/commandline/man/vusb-i2cdetect.1 index e43b268..a9fdec7 100644 --- a/commandline/man/vusb-i2cdetect.1 +++ b/commandline/man/vusb-i2cdetect.1 @@ -56,7 +56,7 @@ either caused by a hardware bug or a malfunctioning I2C device. . .Sh AUTHOR . -Copyright (C) 2013 by Daniel Friesel +Copyright (C) 2013 by Birte Friesel .Aq derf@finalrewind.org . .Sh LICENSE diff --git a/commandline/man/vusb-i2cget.1 b/commandline/man/vusb-i2cget.1 index 5125783..c255013 100644 --- a/commandline/man/vusb-i2cget.1 +++ b/commandline/man/vusb-i2cget.1 @@ -61,7 +61,7 @@ Bad input (not a number) . .Sh AUTHOR . -Copyright (C) 2013 by Daniel Friesel +Copyright (C) 2013 by Birte Friesel .Aq derf@finalrewind.org . . diff --git a/commandline/man/vusb-i2cset.1 b/commandline/man/vusb-i2cset.1 index 795345b..797a714 100644 --- a/commandline/man/vusb-i2cset.1 +++ b/commandline/man/vusb-i2cset.1 @@ -63,7 +63,7 @@ Bad input (not a number) .Sh AUTHOR . -Copyright (C) 2013 by Daniel Friesel +Copyright (C) 2013 by Birte Friesel .Aq derf@finalrewind.org . . |