Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

exampleAPI.bash 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env bash
  2. # STLcd
  3. # Virtual Serial Port API Example
  4. # Jacob Alexander 2015
  5. # XXX Set this to match your virtual serialport
  6. # TODO Show examples for Mac OSX and Cygwin/Windows
  7. SERIALPORT=/dev/ttyACM0
  8. # NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer
  9. # Generally this just means commands will get ignored
  10. # I'm using 100 ms sleeps here, but much smaller are probably sufficient
  11. # Clear out cli buffer
  12. printf "\r" > $SERIALPORT
  13. # Change backlight color
  14. # 3 16-bit numbers (hex or decimal) Red, Green and Blue
  15. sleep 0.1
  16. printf "lcdColor 0x100 0x2000 0x4000\r" > $SERIALPORT # Light blue
  17. # Change the lcd image
  18. # Arguments:
  19. # - page
  20. # - starting address
  21. # - pixels (1 bit per pixel)
  22. #
  23. # There are 9 total pages of display memory, but only 4 are visable at time (it is possible to scroll though)
  24. # Each page is 128 bits wide (16 bytes)
  25. # See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf
  26. sleep 0.1
  27. printf "lcdDisp 0x0 0x0 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
  28. sleep 0.1
  29. printf "lcdDisp 0x1 0x10 0xFF 0x13 0xFF 0x11 0xFF 0x44\r" > $SERIALPORT
  30. sleep 0.1
  31. printf "lcdDisp 0x2 0x20 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
  32. sleep 0.1
  33. printf "lcdDisp 0x3 0x30 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
  34. # Send command directly to the lcd
  35. # See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf
  36. sleep 0.1
  37. printf "lcdCmd 0xA7\r" > $SERIALPORT # Reverse display (0xA6 is Normal)