diff --git a/build/devices/esp/targets/adafruit_oled/manifest.json b/build/devices/esp/targets/adafruit_oled/manifest.json
new file mode 100644
index 0000000000..428e271514
--- /dev/null
+++ b/build/devices/esp/targets/adafruit_oled/manifest.json
@@ -0,0 +1,10 @@
+{
+ "include": [
+ "$(MODULES)/drivers/ssd1351/manifest.json",
+ ],
+ "config": {
+ "screen": "ssd1351",
+ "touch": "",
+ "format": "RGB565LE",
+ },
+}
\ No newline at end of file
diff --git a/build/devices/esp/targets/crystalfontz_monochrome_epaper/manifest.json b/build/devices/esp/targets/crystalfontz_monochrome_epaper/manifest.json
new file mode 100644
index 0000000000..95e1ed93e9
--- /dev/null
+++ b/build/devices/esp/targets/crystalfontz_monochrome_epaper/manifest.json
@@ -0,0 +1,16 @@
+{
+ "include": [
+ "$(MODULES)/drivers/destm32s/manifest.json",
+ ],
+ "config": {
+ "screen": "destm32s",
+ "touch": "",
+ "format": "Gray256",
+ },
+ "defines": {
+ "destm32s": {
+ "width": 122,
+ "height": 250,
+ }
+ }
+}
\ No newline at end of file
diff --git a/build/devices/esp/targets/sharp_memory/manifest.json b/build/devices/esp/targets/sharp_memory/manifest.json
new file mode 100644
index 0000000000..aa095d6aad
--- /dev/null
+++ b/build/devices/esp/targets/sharp_memory/manifest.json
@@ -0,0 +1,18 @@
+{
+ "include": [
+ "$(MODULES)/drivers/ls013b4dn04/manifest.json",
+ ],
+ "config": {
+ "screen": "ls013b4dn04",
+ "touch": "",
+ "format": "Gray256",
+ },
+ "defines": {
+ "ls013b4dn04": {
+ "width": 400,
+ "height": 240,
+ "cs_pin": 4,
+ "spi_port": "#HSPI",
+ }
+ }
+}
\ No newline at end of file
diff --git a/build/devices/esp/targets/sparkfun_teensyview/manifest.json b/build/devices/esp/targets/sparkfun_teensyview/manifest.json
new file mode 100644
index 0000000000..3cbcc8a008
--- /dev/null
+++ b/build/devices/esp/targets/sparkfun_teensyview/manifest.json
@@ -0,0 +1,15 @@
+{
+ "include": [
+ "$(MODDABLE)/modules/drivers/ssd1306/manifest_spi.json",
+ ],
+ "config": {
+ "screen": "ssd1306",
+ "touch": "",
+ "format": "Gray256",
+ },
+ "defines": {
+ "ssd1306": {
+ "dither": true,
+ }
+ },
+}
\ No newline at end of file
diff --git a/build/devices/esp/targets/switch_science_reflective_lcd/manifest.json b/build/devices/esp/targets/switch_science_reflective_lcd/manifest.json
new file mode 100644
index 0000000000..015361efe9
--- /dev/null
+++ b/build/devices/esp/targets/switch_science_reflective_lcd/manifest.json
@@ -0,0 +1,10 @@
+{
+ "include": [
+ "$(MODULES)/drivers/lpm013m126a/manifest.json",
+ ],
+ "config": {
+ "screen": "lpm013m126a",
+ "touch": "",
+ "format": "RGB332",
+ },
+}
\ No newline at end of file
diff --git a/documentation/displays/wiring-guide-adafruit-OLED.md b/documentation/displays/wiring-guide-adafruit-OLED.md
index 04e75693f8..b07cd94020 100644
--- a/documentation/displays/wiring-guide-adafruit-OLED.md
+++ b/documentation/displays/wiring-guide-adafruit-OLED.md
@@ -1,35 +1,33 @@
-# Wiring Guides for Moddable supported SPI displays
+# Adafruit OLED Display Wiring Guide
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Adafruit OLED display
-**Part:** Adafruit Product ID: 1431
+## Specs
-**Size:** 1.5", 128 × 128
-
-**Type:** OLED
-
-**Interface:** SPI
-
-**Drivers:** video [SSD1351](../../documentation/drivers/ssd1351/ssd1351.md), No touch
-
-**Availability:** [1.5" OLED Breakout Board] (https://www.adafruit.com/product/1431)
-
-**Description:** Excellent color, small OLED.
+| | |
+| :---: | :--- |
+| **Part** | Adafruit Product ID: 1431
+| **Size** | 1.5", 128 × 128
+| **Type** | OLED
+| **Interface** | SPI
+| **Drivers** | video [SSD1351](../../documentation/drivers/ssd1351/ssd1351.md), no touch
+| **Availability** | [1.5" OLED Breakout Board](https://www.adafruit.com/product/1431)
+| **Description** | Excellent color, small OLED.
-
-**Moddable Sample code:** The Piu example [transitions](../../examples/piu/transitions/) is good for testing this display. The build command below includes the -d, debug flag.
+## Moddable example code
+
+The [countdown](../../examples/piu/countdown/) example is good for testing this display. To run a debug build, use the following build command:
```
-cd $MODDABLE/examples/piu/transitions
-mcconfig -d -m -r 0 -f rgb332 -p esp screen=ssd1351 touch=""
+cd $MODDABLE/examples/piu/countdown
+mcconfig -d -m -p esp/adafruit_oled
```
-
-**ESP8266 Pinout:**
+## ESP8266 pinout
| Adafruit OLED | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
diff --git a/documentation/displays/wiring-guide-crystalfontz-eink.md b/documentation/displays/wiring-guide-crystalfontz-eink.md
index b3f43cf526..4d9cdf2249 100644
--- a/documentation/displays/wiring-guide-crystalfontz-eink.md
+++ b/documentation/displays/wiring-guide-crystalfontz-eink.md
@@ -1,41 +1,32 @@
-# Wiring Guides for Moddable supported SPI displays
+# Crystalfontz ePaper Display Wiring Guide
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Crystalfontz ePaper display
-**Part:** CFAP128296C0-0290
-[Datasheet] (https://www.crystalfontz.com/products/document/3660/CFAP128296C0-0290DatasheetReleaseDate2017-08-14.pdf)
+## Specs
-**Size:** 2.9" 128x296
+| | |
+| :---: | :--- |
+| **Part** | CFAP128296C0-0290 ([datasheet](https://www.crystalfontz.com/products/document/3660/CFAP128296C0-0290DatasheetReleaseDate2017-08-14.pdf))
+| **Size** | 2.9" 128x296
+| **Type** | EPD (Electronic Paper Displays)
+| **Interface** | SPI
+| **Drivers** | video [destm32s](../../documentation/drivers/destm32s/destm32s.md), No touch
+| **Availability** | [128x296 ePaper Display](https://www.crystalfontz.com/product/cfap128296c00290-128x296-epaper-display-eink)
+| **Description** | This is a TFT active matrix electrophoretic display (ePaper/E-Ink) with 1-bit white/black full display capabilities.
One benefit of this display is very low power consumption. The only time you need to provide power to this ePaper module is while updating the display. Once the image is displayed you can remove the power source and the display will continue to display the image appropriately.
We used the destm32s adaptor board to interface with the display. See: Crystalfontz part CFAP128296C0-E1-1 on the [display product](https://www.crystalfontz.com/product/cfap128296c00290-128x296-epaper-display-eink) page.
-**Type:** EPD (Electronic Paper Displays)
+## Moddable example code
-**Interface:** SPI
-
-**Drivers:** video [destm32s](../../documentation/drivers/destm32s/destm32s.md), No touch
-
-**Availability:** [128x296 ePaper Display] (https://www.crystalfontz.com/product/cfap128296c00290-128x296-epaper-display-eink)
-
-**Description:** This is a TFT active matrix electrophoretic display (ePaper/E-Ink) with 1-bit white/black full display capabilities.
-
-One benefit of this display is very low power consumption. The only time you need to provide power to this ePaper module is while updating the display. Once the image is displayed you can remove the power source and the display will continue to display the image appropriately.
-
-We used the destm32s adaptor board to interface with the display. See: Crystalfontz part CFAP128296C0-E1-1 on the [display product](https://www.crystalfontz.com/product/cfap128296c00290-128x296-epaper-display-eink) page.
-
-
-
-
-**Moddable Sample code:** The Piu example [love-e-ink](../../examples/piu/love-e-ink/) is good for testing this display. The build command below includes the -d, debug flag.
+The [love-e-ink](../../examples/piu/love-e-ink/) example is good for testing this display. To run a debug build, use the following build command:
```
-cd $MODDABLE/examples/piu/love-e-ink
-mcconfig -d -m -p esp -f gray256 -r 270
+cd $MODDABLE/examples/piu/love-e-ink/
+mcconfig -d -m -p esp/crystalfontz_monochrome_epaper -r 270
```
-
-**ESP8266 Pinout:**
+## ESP8266 Pinout
| eInk Display | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
diff --git a/documentation/displays/wiring-guide-generic-2.4-spi-esp32.md b/documentation/displays/wiring-guide-generic-2.4-spi-esp32.md
index bf13fad637..1342c33ce2 100644
--- a/documentation/displays/wiring-guide-generic-2.4-spi-esp32.md
+++ b/documentation/displays/wiring-guide-generic-2.4-spi-esp32.md
@@ -1,36 +1,35 @@
-# Wiring Guides for Moddable supported SPI displays
+# Generic 2.4" & 2.8" Displays (Resistive Touch) Wiring Guide - ESP32
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Generic 2.4" & 2.8" displays - ESP32
-**Size:** 2.4" & 2.8", 320 x 240
+## Specs
-**Type:** TFT LCD
+| | |
+| :---: | :--- |
+| **Size** | 2.4" & 2.8", 320 x 240
+| **Type** | TFT LCD
+| **Interface** | SPI
+| **Drivers** | video [ILI9341](../../documentation/drivers/ili9341/ili9341.md), touch XPT2046
+| **Availability** | [Generic SPI Displays on eBay](https://www.ebay.com/sch/i.html?_odkw=spi+display+2.4&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xspi+display+2.4+touch.TRS0&_nkw=spi+display+2.4+touch&_sacat=0)
+| **Description** | These inexpensive displays are available on eBay and other resources.
Note: They are available in touch and non-touch versions which appear very similar.
-**Interface:** SPI
-**Drivers:** video [ILI9341](../../documentation/drivers/ili9341/ili9341.md), touch XPT2046
+## Moddable example code
-**Availability:** [Generic SPI Displays on eBay] (https://www.ebay.com/sch/i.html?_odkw=spi+display+2.4&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xspi+display+2.4+touch.TRS0&_nkw=spi+display+2.4+touch&_sacat=0)
-
-**Description:** These inexpensive displays are available on eBay and other resources. Note: They are available in touch and non-touch versions which appear very similar.
-
-
-
-**Moddable Sample code:** The Piu example [Drag](../../examples/piu/drag/) is good for testing this display. The build command below includes the -d, debug flag.
+The [drag](../../examples/piu/drag/) example is good for testing this display. To run a debug build, use the following build command:
```
cd $MODDABLE/examples/piu/drag
-mcconfig -d -m -r 0 -f rgb565le -p esp screen=ili9341 touch=xpt2046
+mcconfig -d -m -p esp32/moddable_zero
```
-At this time Moddable sample code does not include display SD card support.
-**ESP8266 Pinout:**
+## ESP8266 Pinout
| ILI9341 Display | ESP32 |
-| --- | --- | --- |
+| --- | --- |
| SDO / MISO | GPIO 12
| LED | 3.3V |
| SCK | GPIO 14 |
diff --git a/documentation/displays/wiring-guide-generic-2.4-spi.md b/documentation/displays/wiring-guide-generic-2.4-spi.md
index 762d59e244..d7e46b4687 100644
--- a/documentation/displays/wiring-guide-generic-2.4-spi.md
+++ b/documentation/displays/wiring-guide-generic-2.4-spi.md
@@ -1,33 +1,33 @@
-# Wiring Guides for Moddable supported SPI displays
+# Generic 2.4" & 2.8" Displays (Resistive Touch) Wiring Guide - ESP8266
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Generic 2.4" & 2.8" displays (with resistive touch)
-**Size:** 2.4" & 2.8", 320 x 240
+## Specs
-**Type:** TFT LCD
+| | |
+| :---: | :--- |
+| **Size** | 2.4" & 2.8", 320 x 240
+| **Type** | TFT LCD
+| **Interface** | SPI
+| **Drivers** | video [ILI9341](../../documentation/drivers/ili9341/ili9341.md), touch XPT2046
+| **Availability** | [Generic SPI Displays on eBay](https://www.ebay.com/sch/i.html?_odkw=spi+display+2.4&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xspi+display+2.4+touch.TRS0&_nkw=spi+display+2.4+touch&_sacat=0)
+| **Description** | These inexpensive displays are available on eBay and other resources.
Note: They are available in touch and non-touch versions which appear very similar.
-**Interface:** SPI
+> At this time Moddable sample code does not include display SD card support.
-**Drivers:** video [ILI9341](../../documentation/drivers/ili9341/ili9341.md), touch XPT2046
+## Moddable example code
-**Availability:** [Generic SPI Displays on eBay] (https://www.ebay.com/sch/i.html?_odkw=spi+display+2.4&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xspi+display+2.4+touch.TRS0&_nkw=spi+display+2.4+touch&_sacat=0)
-
-**Description:** These inexpensive displays are available on eBay and other resources. Note: They are available in touch and non-touch versions which appear very similar.
-
-
-
-**Moddable Sample code:** The Piu example [Drag](../../examples/piu/drag/) is good for testing this display. The build command below includes the -d, debug flag.
+The [drag](../../examples/piu/drag/) example is good for testing this display. To run a debug build, use the following build command:
```
cd $MODDABLE/examples/piu/drag
-mcconfig -d -m -r 0 -f rgb565le -p esp screen=ili9341 touch=xpt2046
+mcconfig -d -m -p esp/moddable_zero
```
-At this time Moddable sample code does not include display SD card support.
-**ESP8266 Pinout:**
+## ESP8266 Pinout
| ILI9341 Display | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
diff --git a/documentation/displays/wiring-guide-sharp-memory-2.7-spi.md b/documentation/displays/wiring-guide-sharp-memory-2.7-spi.md
index 2d72d66b38..e028f93017 100644
--- a/documentation/displays/wiring-guide-sharp-memory-2.7-spi.md
+++ b/documentation/displays/wiring-guide-sharp-memory-2.7-spi.md
@@ -1,39 +1,34 @@
-# Wiring Guides for Moddable supported SPI displays
+# Sharp Memory Display Wiring Guide
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Sharp Memory Screen
-**Part:** LS027B7DH01A
+## Specs
-**Size:** 2.7", 240 x 400
+| | |
+| :---: | :--- |
+| **Part** | LS027B7DH01A
+| **Size** | 2.7", 240 x 400
+| **Type** | Sharp Memory TFT-LCD, Monochrome
+| **Interface** | SPI
+| **Drivers** | video [ls013b4dn04](../../documentation/drivers/ls013b4dn04/ls013b4dn04.md), no touch
+| **Availability** | [Sharp Memory 2,7" LCD on Digi-Key](https://www.digikey.com/product-detail/en/sharp-microelectronics/LS027B7DH01A/425-2908-ND/5054067?utm_adgroup=Optoelectronics&gclid=Cj0KCQiAvrfSBRC2ARIsAFumcm-L2iz88RlcYf9Z1MU0J1ZW97VgAa0oPoDBgqYSIIRUyZnhGNURyY4aAjIgEALw_wcB)
+| **Description** | The Sharp Memory display is a blend of an eInk (e-paper) display and an LCD. It has the very-low power draw of eInk and fast-refresh rates of an LCD.
Moddable uses the [Kuzyatech Sharp Memory display breakout board] (https://www.tindie.com/products/kuzyatech/sharp-memory-lcd-breakout-a2/) to interface with the display FFC and boost the ESP8266 power to the 5V needed to drive the display.
-**Type:** Sharp Memory TFT-LCD, Monochrome
+## Moddable example code
-**Interface:** SPI
-
-**Drivers:** video [ls013b4dn04](../../documentation/drivers/ls013b4dn04/ls013b4dn04.md), no touch
-
-**Availability:** [Sharp Memory 2,7" LCD on Digi-Key] (https://www.digikey.com/product-detail/en/sharp-microelectronics/LS027B7DH01A/425-2908-ND/5054067?utm_adgroup=Optoelectronics&gclid=Cj0KCQiAvrfSBRC2ARIsAFumcm-L2iz88RlcYf9Z1MU0J1ZW97VgAa0oPoDBgqYSIIRUyZnhGNURyY4aAjIgEALw_wcB)
-
-**Description:** The Sharp Memory display is a blend of an eInk (e-paper) display and an LCD. It has the very-low power draw of eInk and fast-refresh rates of an LCD.
-
-Moddable used the [Kuzyatech Sharp Memory display breakout board] (https://www.tindie.com/products/kuzyatech/sharp-memory-lcd-breakout-a2/) to interface with the display FFC and boost the ESP8266 power to the 5v needed to drive the display.
-
-
-
-
-**Moddable Sample code:** The Piu example [Balls](../../examples/piu/balls/) is good for testing this display. The build command below includes the -d, debug flag.
+The [balls](../../examples/piu/balls/) example is good for testing this display. To run a debug build, use the following build command:
```
cd $MODDABLE/examples/piu/balls
-mcconfig -d -m -r 0 -f rgb565le -p esp screen=ili9341 touch=xpt2046
+mcconfig -d -m -p esp/sharp_memory
```
-**ESP8266 Pinout:**
+## ESP8266 pinout
-| 2.7" Memory Display | ESP8266 | ESP8266 Devboard label
+| Sharp Memory Display | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
| VIN | 3.3V |
| GND | GND |
diff --git a/documentation/displays/wiring-guide-sparkFun-teensyview-spi.md b/documentation/displays/wiring-guide-sparkFun-teensyview-spi.md
index 509ff62117..0a1a608bdc 100644
--- a/documentation/displays/wiring-guide-sparkFun-teensyview-spi.md
+++ b/documentation/displays/wiring-guide-sparkFun-teensyview-spi.md
@@ -1,35 +1,32 @@
-# Wiring Guides for Moddable supported SPI displays
+# SparkFun TeensyView Wiring Guide
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Sparkfun TeensyView
-**Part:** Sparkfun - LCD-14048
+## Specs
-**Size:** 128 x 32
+| | |
+| :---: | :--- |
+| **Part** | Sparkfun - LCD-14048
+| **Size** | 128 x 32
+| **Type** | OLED, Monochrome
+|**Interface** | SPI
+|**Drivers** | video [SSD1306](../../documentation/drivers/ssd1306/ssd1306.md), no touch
+|**Availability** | [TeensyView on Sparkfun](https://www.sparkfun.com/products/14048)
+|**Description** | Very small monochrome, OLED display. Moddable uses the TeensyView configured in [standard](https://learn.sparkfun.com/tutorials/teensyview-hookup-guide) mode.
-**Type:** OLED, Monochrome
+## Moddable example code
-**Interface:** SPI
-
-**Drivers:** video [SSD1306](../../documentation/drivers/ssd1306/ssd1306.md), no touch
-
-**Availability:** [TeensyView on Sparkfun] (https://www.sparkfun.com/products/14048)
-
-**Description:** Very small monochrome, OLED display. Moddable used the TeensyView configured in [standard] (https://learn.sparkfun.com/tutorials/teensyview-hookup-guide) mode.
-
-
-
-
-**Moddable Sample code:** The Piu example [Balls](../../examples/piu/balls/) is good for testing this display. The build command below includes the -d, debug flag.
+The [balls](../../examples/piu/balls/) example is good for testing this display. To run a debug build, use the following build command:
```
cd $MODDABLE/examples/piu/balls
-mcconfig -d -m -r 0 -f rgb565le -p esp screen=ili9341 touch=xpt2046
+mcconfig -d -m -p esp/teensyview
```
-**ESP8266 Pinout:**
+## ESP8266 pinout
| TeensyView Display | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
diff --git a/documentation/displays/wiring-guide-switch-science-LCD.md b/documentation/displays/wiring-guide-switch-science-LCD.md
index 8208ddc3c3..5c2fd799ff 100644
--- a/documentation/displays/wiring-guide-switch-science-LCD.md
+++ b/documentation/displays/wiring-guide-switch-science-LCD.md
@@ -1,35 +1,32 @@
-# Wiring Guides for Moddable supported SPI displays
+# Switch Science Reflective LCD Display Wiring Guide
Copyright 2018 Moddable Tech, Inc.
-Revised: January 2, 2018
+Revised: October 23, 2018
+
-## Switch Science reflective LCD display
-**Part:** 2858: JDI - REFLCD - 128
+## Specs
-**Size:** 1.28", 176 × 176
+| | |
+| :---: | :--- |
+| **Part** | 2858: JDI - REFLCD - 128
+| **Size** | 1.28", 176 × 176
+| **Type** | Color reflective LCD (no backlight)
+| **Interface** | SPI
+| **Drivers** | video [lpm013m126a](../../documentation/drivers/lpm013m126a/lpm013m126a.md), no touch
+| **Availability** | [1.28" Switch Science Color reflective LCD](https://translate.google.com/translate?hl=en&sl=ja&tl=en&u=https%3A%2F%2Fwww.switch-science.com%2Fcatalog%2F2874%2F)
+| **Description** | Moddable purchased this display in Tokyo. [Here](https://translate.googleusercontent.com/translate_c?depth=1&hl=en&rurl=translate.google.com&sl=ja&sp=nmt4&tl=en&u=https://www.switch-science.com/catalog/2858/&usg=ALkJrhijtlYZnC4qJ2sRkLE3mkVZujVU1w) is some info on the display.
-**Type:** Color reflective LCD (no backlight)
+## Moddable example code
-**Interface:** SPI
-
-**Drivers:** video [lpm013m126a](../../documentation/drivers/lpm013m126a/lpm013m126a.md), No touch
-
-**Availability:** [1.28" Switch Science Color reflective LCD] (https://translate.google.com/translate?hl=en&sl=ja&tl=en&u=https%3A%2F%2Fwww.switch-science.com%2Fcatalog%2F2874%2F)
-
-**Description:** Moddable purchased this display in Tokyo. [Here](https://translate.googleusercontent.com/translate_c?depth=1&hl=en&rurl=translate.google.com&sl=ja&sp=nmt4&tl=en&u=https://www.switch-science.com/catalog/2858/&usg=ALkJrhijtlYZnC4qJ2sRkLE3mkVZujVU1w) is some info on the display.
-
-
-
-**Moddable Sample code:** The Piu example [transitions](../../examples/piu/transitions/) is good for testing this display. The build command below includes the -d, debug flag.
+The [balls](../../examples/piu/balls/) example is good for testing this display. To run a debug build, use the following build command:
```
-cd $MODDABLE/examples/piu/transitions
-mcconfig -d -m -r 0 -f rgb332 -p esp screen=lpm013m126a touch=""
+cd $MODDABLE/examples/piu/balls
+mcconfig -d -m -p esp/switch_science_reflective_lcd
```
-
-**ESP8266 Pinout:**
+## ESP8266 pinout
| Switch Science LCD | ESP8266 | ESP8266 Devboard label
| --- | --- | --- |
diff --git a/examples/piu/heartrate/main.js b/examples/piu/heartrate/main.js
index 0b1164d64c..5aa73699ed 100644
--- a/examples/piu/heartrate/main.js
+++ b/examples/piu/heartrate/main.js
@@ -18,18 +18,16 @@ const GRAPH_INTERVAL = 2000; // Changes how frequently a bar is added to the gra
const MAX_RATE = 210; // Max heart rate value
const MIN_RATE = 40; // Min heart rate value
-/* Skins and styles */
const GRAPH_COLORS = ["#0000FF", "#00FFFF", "#00FF00"];
const TEXT_COLOR = "#FFFFFF";
const BACKGROUND_COLOR = "#000000";
const digitsTexture = new Texture("digits.png");
-/* UI templates */
const GraphLine = Port.template($ => ({
bottom: 0, height: $.barHeight, left: 0, width:16,
Behavior: class extends Behavior {
- onCreate(port) {
+ onCreate(port, data) {
this.data = {remainder: $.remainder, fullBars: $.fullBars};
this.state = 0;
port.interval = 650;
@@ -65,34 +63,41 @@ const GraphLine = Port.template($ => ({
}));
const GraphContainer = Row.template($ => ({
- bottom:0, height: 64, left: 0, right:0,
+ anchor: "GRAPH", bottom:0, height: 64,
Behavior: class extends Behavior {
- onCreate(content) {
- content.interval = GRAPH_INTERVAL;
- content.time = 0;
- content.start();
+ onCreate(row, data) {
+ this.data = data;
+ }
+ onDisplaying(row) {
+ row.interval = GRAPH_INTERVAL;
+ row.time = 0;
+ row.start();
for (let i = 0; i < 11; i++) {
let dummyLine = new GraphLine({barHeight: 2, fullBars: 0, remainder: 2});
- content.add(dummyLine);
+ row.add(dummyLine);
dummyLine.delegate("onStopFlickering");
}
+ // row.distribute("onStopFlickering");
}
- onTimeChanged(content) {
- let rate = application.first.delegate("getRate");
- let barHeight = Math.round((rate-MIN_RATE)/(MAX_RATE-MIN_RATE)*content.height);
+ onTimeChanged(row) {
+ let rate = this.data["DIGITS"].delegate("getRate");
+ let barHeight = Math.round((rate-MIN_RATE)/(MAX_RATE-MIN_RATE)*row.height);
let fullBars = Math.floor(barHeight / 12);
let remainder = barHeight % 12;
- content.remove(content.first)
- content.last.delegate("onStopFlickering")
- content.add(new GraphLine({barHeight, fullBars, remainder}))
+ row.remove(row.first)
+ row.last.delegate("onStopFlickering")
+ row.add(new GraphLine({barHeight, fullBars, remainder}))
application.purge();
}
}
}))
const DigitContainer = Port.template($ => ({
- top:0, width:128, height:112,
+ anchor: "DIGITS", top:0, width:128, height:112,
Behavior: class extends Behavior {
+ onCreate(port, data) {
+ this.data = data;
+ }
onChangeRate(port, rate) {
this.rate = rate;
port.invalidate();
@@ -113,23 +118,27 @@ const DigitContainer = Port.template($ => ({
return this.rate;
}
}
-}))
+}));
-/* Application set-up */
-export default new Application(null, {
- commandListLength:4096, displayListLength:4096, touchCount:0, skin: new Skin({ fill: BACKGROUND_COLOR }),
+const HeartRateApp = Application.template($ => ({
+ skin: new Skin({ fill: BACKGROUND_COLOR }),
contents: [
- new DigitContainer,
- new GraphContainer
+ new DigitContainer($),
+ new GraphContainer($),
],
Behavior: class extends Behavior {
- onCreate(application) {
+ onCreate(application, data) {
+ this.data = data;
+ }
+ onDisplaying(application) {
application.interval = 2000;
application.start();
}
onTimeChanged(application) {
let randomHeartRate = Math.floor(Math.random() * (MAX_RATE - MIN_RATE + 1)) + MIN_RATE;
- application.first.delegate("onChangeRate", randomHeartRate);
+ this.data["DIGITS"].delegate("onChangeRate", randomHeartRate);
}
}
-});
+}))
+
+export default new HeartRateApp({}, { commandListLength:4096, displayListLength:4096, touchCount:0 });
diff --git a/examples/piu/heartrate/manifest.json b/examples/piu/heartrate/manifest.json
index 11631d3708..9f6ca46a15 100644
--- a/examples/piu/heartrate/manifest.json
+++ b/examples/piu/heartrate/manifest.json
@@ -6,20 +6,11 @@
"modules": {
"*": [
"./main",
- "$(MODULES)/drivers/lpm013m126a/*",
]
},
"resources":{
"*-alpha": [
"./digits",
- "./graph",
],
},
- "platforms": {
- "esp/rgb332": {
- "modules": {
- "screen": "$(BUILD)/devices/esp/lpm013m126a/rgb332/screen",
- },
- },
- }
-}
+}
\ No newline at end of file
diff --git a/examples/piu/love-js/manifest.json b/examples/piu/love-js/manifest.json
index c9709e7484..0ab412ec47 100644
--- a/examples/piu/love-js/manifest.json
+++ b/examples/piu/love-js/manifest.json
@@ -7,9 +7,6 @@
"*": "./main",
},
"resources":{
- "*": [
- "./main",
- ],
"*-mask": [
"./heart",
"./strip",
diff --git a/modules/drivers/ssd1306/manifest_i2c.json b/modules/drivers/ssd1306/manifest_i2c.json
new file mode 100644
index 0000000000..82b7de9763
--- /dev/null
+++ b/modules/drivers/ssd1306/manifest_i2c.json
@@ -0,0 +1,51 @@
+{
+ "defines": {
+ "ssd1306": {
+ "width": 128,
+ "height": 32,
+ "dither": false,
+ "spi": false,
+ "i2c": true,
+ }
+ },
+ "preload": [
+ "ssd1306",
+ "commodetto/Bitmap",
+ ],
+ "platforms": {
+ "esp": {
+ "include": [
+ "$(MODULES)/pins/digital/manifest.json",
+ "$(MODULES)/pins/i2c/manifest.json",
+ ],
+ "modules": {
+ "*": "$(MODULES)/drivers/ssd1306/*",
+ "commodetto/Bitmap": "$(COMMODETTO)/commodettoBitmap",
+ },
+ "defines": {
+ "ssd1306": {
+ "scl_pin": 4,
+ "sda_pin": 5,
+ "address": "0x3c",
+ }
+ }
+ },
+ "esp32": {
+ "include": [
+ "$(MODULES)/pins/digital/manifest.json",
+ "$(MODULES)/pins/i2c/manifest.json",
+ ],
+ "modules": {
+ "*": "$(MODULES)/drivers/ssd1306/*",
+ "commodetto/Bitmap": "$(COMMODETTO)/commodettoBitmap",
+ },
+ "defines": {
+ "ssd1306": {
+ "scl_pin": 4,
+ "sda_pin": 5,
+ "address": "0x3c",
+ }
+ }
+ }
+ }
+}
diff --git a/modules/drivers/ssd1306/manifest.json b/modules/drivers/ssd1306/manifest_spi.json
similarity index 91%
rename from modules/drivers/ssd1306/manifest.json
rename to modules/drivers/ssd1306/manifest_spi.json
index 54ca9d5ba7..f84c411d99 100644
--- a/modules/drivers/ssd1306/manifest.json
+++ b/modules/drivers/ssd1306/manifest_spi.json
@@ -16,7 +16,6 @@
"esp": {
"include": [
"$(MODULES)/pins/digital/manifest.json",
- "$(MODULES)/pins/i2c/manifest.json",
"$(MODULES)/pins/spi/manifest.json",
],
"modules": {
@@ -34,7 +33,6 @@
"esp32": {
"include": [
"$(MODULES)/pins/digital/manifest.json",
- "$(MODULES)/pins/i2c/manifest.json",
"$(MODULES)/pins/spi/manifest.json",
],
"modules": {
diff --git a/modules/drivers/ssd1306/modSsd1306.c b/modules/drivers/ssd1306/modSsd1306.c
index 5d9a273007..e7a022d242 100644
--- a/modules/drivers/ssd1306/modSsd1306.c
+++ b/modules/drivers/ssd1306/modSsd1306.c
@@ -22,9 +22,13 @@
#include "xsesp.h"
#include "mc.defines.h"
-#include "modSPI.h"
+#if MODDEF_SSD1306_SPI
+ #include "modSPI.h"
+#endif
#include "modGPIO.h"
-#include "modI2C.h"
+#if MODDEF_SSD1306_I2C
+ #include "modI2C.h"
+ #endif
#include "commodettoPixelsOut.h"