Home | History | Annotate | Download | only in javascript
      1 /*jslint node:true, vars:true, bitwise:true, unparam:true */
      2 /*jshint unused:true */
      3 /*
      4 * Author:  Takahiro Poly Horikawa <horikawa.takahiro (at) gmail.com>
      5 * Copyright (c) 2015 Intel Corporation.
      6 *
      7 * Permission is hereby granted, free of charge, to any person obtaining
      8 * a copy of this software and associated documentation files (the
      9 * "Software"), to deal in the Software without restriction, including
     10 * without limitation the rights to use, copy, modify, merge, publish,
     11 * distribute, sublicense, and/or sell copies of the Software, and to
     12 * permit persons to whom the Software is furnished to do so, subject to
     13 * the following conditions:
     14 *
     15 * The above copyright notice and this permission notice shall be
     16 * included in all copies or substantial portions of the Software.
     17 *
     18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     25 */
     26 var st7735 = require('jsupm_st7735');
     27 
     28 var lcd = new st7735.ST7735(10, 7, 9, 8);
     29 lcd.fillScreen(st7735.ST7735_RED);
     30 lcd.refresh();
     31 
     32 lcd.fillScreen(st7735.ST7735_CYAN);
     33 lcd.refresh();
     34 
     35 lcd.fillScreen(st7735.ST7735_BLACK);
     36 lcd.refresh();
     37 
     38 lcd.drawLine(10, 10, 10, 100, st7735.ST7735_MAGENTA);
     39 lcd.drawLine(20, 20, 10, 100, st7735.ST7735_YELLOW);
     40 lcd.drawLine(30, 30, 10, 100, st7735.ST7735_WHITE);
     41 lcd.refresh();
     42 
     43 lcd.drawPixel(20, 20, st7735.ST7735_GREEN);
     44 lcd.refresh();
     45 
     46 lcd.drawTriangle(50, 50, 80, 80, 60, 90, st7735.ST7735_GREEN);
     47 lcd.refresh();
     48 
     49 lcd.drawCircle(100, 110, 10, st7735.ST7735_BLUE);
     50 lcd.refresh();
     51 
     52 lcd.setTextWrap(0x0);
     53 
     54 lcd.setCursor(0, 30);
     55 lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
     56 lcd.setTextSize(1);
     57 lcd.print('Hello World!');
     58 
     59 lcd.setCursor(10, 50);
     60 lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
     61 lcd.setTextSize(2);
     62 lcd.print('BIG');
     63 
     64 lcd.refresh();
     65 
     66