From df7d0be00d11dead100a688f37b6465612dd7f0c Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Mon, 14 Sep 2015 23:37:32 -0700 Subject: [PATCH] Adding example API scripts --- Scan/ISSILed/exampleAPI.bash | 31 +++++++++++++++++++++++++ Scan/STLcd/exampleAPI.bash | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 Scan/ISSILed/exampleAPI.bash create mode 100755 Scan/STLcd/exampleAPI.bash diff --git a/Scan/ISSILed/exampleAPI.bash b/Scan/ISSILed/exampleAPI.bash new file mode 100755 index 0000000..5d66c37 --- /dev/null +++ b/Scan/ISSILed/exampleAPI.bash @@ -0,0 +1,31 @@ +#!/bin/bash +# ISSILed +# Virtual Serial Port API Example +# Jacob Alexander 2015 + +# XXX Set this to match your virtual serialport +# TODO Show examples for Mac OSX and Cygwin/Windows +SERIALPORT=/dev/ttyACM0 + +# NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer +# Generally this just means commands will get ignored +# I'm using 100 ms sleeps here, but much smaller are probably sufficient + +# Clear out cli buffer +printf "\r" > $SERIALPORT + +# Write to ISSI Page +# Arguments +# - page +# - starting address +# - data (usually brightness) (8 bits) +# +# For brightness control, set the starting address to 0x24 +# By default only page 0x00 is used +# There are 8 pages of memory (these can be cycled through for animiations) +# 144 led channels +# Page 0x0A is used for configuration +# See the datasheet for full details http://www.issi.com/WW/pdf/31FL3731C.pdf +sleep 0.1 +printf "ledWPage 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT + diff --git a/Scan/STLcd/exampleAPI.bash b/Scan/STLcd/exampleAPI.bash new file mode 100755 index 0000000..8c2dda5 --- /dev/null +++ b/Scan/STLcd/exampleAPI.bash @@ -0,0 +1,44 @@ +#!/bin/bash +# STLcd +# Virtual Serial Port API Example +# Jacob Alexander 2015 + +# XXX Set this to match your virtual serialport +# TODO Show examples for Mac OSX and Cygwin/Windows +SERIALPORT=/dev/ttyACM0 + +# NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer +# Generally this just means commands will get ignored +# I'm using 100 ms sleeps here, but much smaller are probably sufficient + +# Clear out cli buffer +printf "\r" > $SERIALPORT + +# Change backlight color +# 3 16-bit numbers (hex or decimal) Red, Green and Blue +sleep 0.1 +printf "lcdColor 0x100 0x2000 0x4000\r" > $SERIALPORT # Light blue + +# Change the lcd image +# Arguments: +# - page +# - starting address +# - pixels (1 bit per pixel) +# +# There are 9 total pages of display memory, but only 4 are visable at time (it is possible to scroll though) +# Each page is 128 bits wide (16 bytes) +# See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf +sleep 0.1 +printf "lcdDisp 0x0 0x0 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT +sleep 0.1 +printf "lcdDisp 0x1 0x10 0xFF 0x13 0xFF 0x11 0xFF 0x44\r" > $SERIALPORT +sleep 0.1 +printf "lcdDisp 0x2 0x20 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT +sleep 0.1 +printf "lcdDisp 0x3 0x30 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT + +# Send command directly to the lcd +# See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf +sleep 0.1 +printf "lcdCmd 0xA7\r" > $SERIALPORT # Reverse display (0xA6 is Normal) + -- 2.39.2