summaryrefslogtreecommitdiff
path: root/samples/dashboard_oled
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-05-17 23:29:58 +1000
committerStanley Huang <stanleyhuangyc@gmail.com>2015-05-17 23:29:58 +1000
commit06baa20150ece9b45d038234a04ed558ed2effab (patch)
tree08a689727d049ead87b5855adae8c9c5ded3c4f4 /samples/dashboard_oled
parente494891c8cb7a47279d5ce514850fa855e64ab0c (diff)
download2021-arduino-obd-06baa20150ece9b45d038234a04ed558ed2effab.tar.gz
2021-arduino-obd-06baa20150ece9b45d038234a04ed558ed2effab.tar.bz2
2021-arduino-obd-06baa20150ece9b45d038234a04ed558ed2effab.zip
Remove deprecated samples
Diffstat (limited to 'samples/dashboard_oled')
-rw-r--r--samples/dashboard_oled/ZtLib.cpp603
-rw-r--r--samples/dashboard_oled/ZtLib.h127
-rw-r--r--samples/dashboard_oled/dashboard_oled.cbp574
-rw-r--r--samples/dashboard_oled/dashboard_oled.ino158
4 files changed, 0 insertions, 1462 deletions
diff --git a/samples/dashboard_oled/ZtLib.cpp b/samples/dashboard_oled/ZtLib.cpp
deleted file mode 100644
index 8eaec6e..0000000
--- a/samples/dashboard_oled/ZtLib.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- ZtLib.cpp - ZT module Drive Library for Wiring & Arduino
- Copyright (c) 2012 Alvin Li(Kozig/www.kozig.com). All right reserved.
- This library is free software;
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Version:V1.1
-*/
-
-extern "C" {
- #include <stdlib.h>
- #include <string.h>
- #include <inttypes.h>
- #include "..\Wire\utility/twi.h"
-}
-
-#include "ZtLib.h"
-
-///ZT.SEG8B4A036A PART///-------------------------------------------------------------------s
-unsigned char codetable[] =
-{
- 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F, 0x77, 0x7C,0x39,0x5E,0x79,0x71,0x00
-};
-
-// Public Methods //////////////////////////////////////////////////////////////
-/*
- * Function I2cInit
- * Desc TWI/I2C init
- * Input none
- * Output none
- */
-void ZtLib::I2cInit(void)
-{
- twi_init();
-}
-/*
- * Function Seg8b4a036aSleep
- * Desc Set ZT.SEG8B4A036A Go to Sleep
- * Input addr:ZT.SEG8B4A036A Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aSleep(uint8_t addr)
-{
- uint8_t buff[5]={REG_SLEEP, SLEEP_ON, 0, 0, 0};
-
- return twi_writeTo(addr, buff, 5, 1, 1);
-}
-/*
- * Function Seg8b4a036aUnSleep
- * Desc Set ZT.SEG8B4A036A Wait Up From Sleep
- * Input addr:ZT.SEG8B4A036A Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aUnSleep(uint8_t addr)
-{
- uint8_t buff[5]={REG_SLEEP, SLEEP_OFF, 0, 0, 0};
-
- return twi_writeTo(addr, buff, 5, 1, 1);
-}
-/*
- * Function Seg8b4a036aReadState
- * Desc Read ZT.SEG8B4A036A Status
- * Input addr:ZT.SEG8B4A036A Address
- * Output !=0xFF ZT.SC-I2CMx Status
- * 0xFF .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aReadState(uint8_t addr)
-{
- uint8_t state = 0xFF;
- uint8_t temp;
- uint8_t buff[1] = {REG_STATUS};
- temp = twi_writeTo(addr, buff, 1, 1, 0); // no stop
- if (temp ==0)
- {
- temp = twi_readFrom(addr, buff, 1, 1);
- }
- if (temp==1)
- {
- state = buff[0];
- }
-
- return state;
-}
-/*
- * Function Seg8b4a036aReadVersion
- * Desc Read ZT.SEG8B4A036A Fireware Version
- * Input addr:ZT.SEG8B4A036A Address
- *buf:Version Buffer
- * Output .. number bytes of Version Read out
- */
-int ZtLib::Seg8b4a036aReadVersion(uint8_t addr, uint8_t *buf)
-{
- uint8_t state = 0xFF;
- uint8_t temp;
- uint8_t regv[1] = {REG_VERSION};
- temp = twi_writeTo(addr, regv, 1, 1, 0); // no stop
- if (temp ==0)
- {
- temp = twi_readFrom(addr, &(*buf), 19, 1);
- }
- return temp;
-}
-/*
- * Function Seg8b4a036aDisplayDec
- * Desc ZT.SEG8B4A036A Display decimal numeral
- * Input addr:ZT.SEG8B4A036A Address
- val: Display Val
- bitnum:Display Bit Number
- dotbit: Dot Display
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aDisplayDec(uint8_t addr,unsigned short val, uint8_t bitnum, uint8_t dotbit)
-{
- uint8_t i;
- uint8_t segnum[5];
- if (val>9999) return 0xFF;
-
- segnum[0] = REG_DAT;
- segnum[1] = val%10;
- segnum[2] = (val%100)/10;
- segnum[3] = (val/100)%10;
- segnum[4] = val/1000;
- for (i=1; i<5; i++)
- {
- segnum[i] = codetable[segnum[i]];
- if (dotbit&0x01)
- {
- segnum[i] |= 0x80;
- }
- dotbit >>= 1;
- }
-
- if (bitnum==DISP_0BIT) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;segnum[1] = 0;}
- else if (bitnum==DISP_1BIT) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;}
- else if (bitnum==DISP_2BIT) {segnum[4] = 0;segnum[3] = 0;}
- else if (bitnum==DISP_3BIT) {segnum[4] = 0;}
- else if (bitnum==DISP_AUTO)
- {
- if (val<10) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;}
- else if (val<100) {segnum[4] = 0;segnum[3] = 0;}
- else if (val<1000) {segnum[4] = 0;}
- }
-
- return twi_writeTo(addr, segnum, 5, 1, 1);
-}
-/*
- * Function Seg8b4a036aDisplayHex
- * Desc Read ZT.SEG8B4A036A Display hexadecimal number
- * Input addr:ZT.SEG8B4A036A Address
- val: Display Val
- bitnum:Display Bit Number
- dotbit: Dot Display
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aDisplayHex(uint8_t addr,unsigned short val, uint8_t bitnum, uint8_t dotbit)
-{
- uint8_t i;
- unsigned short temp;
- uint8_t segnum[5];
- segnum[0] = REG_DAT;
- temp = val;
- for (i=1; i<5; i++)
- {
- segnum[i] = temp&0x000F;
- temp >>= 4;
- segnum[i] = codetable[segnum[i]];
- if (dotbit&0x01)
- {
- segnum[i] |= 0x80;
- }
- dotbit >>= 1;
- }
-
- if (bitnum==DISP_0BIT) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;segnum[1] = 0;}
- else if (bitnum==DISP_1BIT) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;}
- else if (bitnum==DISP_2BIT) {segnum[4] = 0;segnum[3] = 0;}
- else if (bitnum==DISP_3BIT) {segnum[4] = 0;}
- else if (bitnum==DISP_AUTO)
- {
- if (!(val&0xFFF0)) {segnum[4] = 0;segnum[3] = 0;segnum[2] = 0;}
- else if (!(val&0xFF00)) {segnum[4] = 0;segnum[3] = 0;}
- else if (!(val&0xF000)) {segnum[4] = 0;}
- }
-
- return twi_writeTo(addr, segnum, 5, 1, 1);
-}
-/*
- * Function Seg8b4a036aSetBrightness
- * Desc Set ZT.SEG8B4A036A Brightness
- * Input addr:ZT.SEG8B4A036A Address
- OnDelay:
- OffDelay:
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aSetBrightness(uint8_t addr, uint8_t OnDelay, uint8_t OffDelay)
-{
- uint8_t buff[5] = {REG_BRIGHTNESS, OnDelay, OffDelay, 0, 0};
- return twi_writeTo(addr, buff, 5, 1, 1);
-}
-/*
- * Function Seg8b4a036aSetAddress
- * Desc Set ZT.SEG8B4A036A New Address
- * Input val:ZT.SEG8B4A036A Address New Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aSetAddress(uint8_t val)
-{
- uint8_t buff[2] = {REG_ADDRESS, val};
- return twi_writeTo(ZTSEG8B4A036A_DADDR, buff, 2, 1, 1);
-}
-/*
- * Function Seg8b4a036aDisplayBuff
- * Desc Set ZT.SEG8B4A036A Brightness
- * Input addr:ZT.SEG8B4A036A Address
- *buf: Display buffer
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::Seg8b4a036aDisplayBuff(uint8_t addr,uint8_t *buf)
-{
- uint8_t buff[5]={REG_DAT, buf[0], buf[1], buf[2], buf[3]};
-
- return twi_writeTo(addr, buff, 5, 1, 1);
-}
-
-
-///ZT.ScI2cMx PART///-------------------------------------------------------------------
-/*
- * Function ScI2cMxReadState
- * Desc Read ZT.SC-I2CMx Status
- * Input addr:ZT.SC-I2CMx Address
- * Output !=0xFF ZT.SC-I2CMx Status
- * 0xFF .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxReadState(uint8_t addr)
-{
- uint8_t state = 0xFF;
- uint8_t temp;
- uint8_t buff[1] = {REG_STATUS};
- temp = twi_writeTo(addr, buff, 1, 1, 0); // no stop
- if (temp ==0)
- {
- temp = twi_readFrom(addr, buff, 1, 1);
- }
- if (temp==1)
- {
- state = buff[0];
- }
-
- return state;
-}
-
-/*
- * Function ScI2cMxReadVersion
- * Desc Read ZT.SC-I2CMx Fireware Version
- * Input addr:ZT.SC-I2CMx Address
- *buf:Version Buffer
- * Output !=0xFF ZT.SC-I2CMx Status
- * othe .. number bytes of Version Read out
- */
-int ZtLib::ScI2cMxReadVersion(uint8_t addr, uint8_t *buf)
-{
- uint8_t state = 0xFF;
- uint8_t temp;
- uint8_t regv[1] = {REG_VERSION};
- temp = twi_writeTo(addr, regv, 1, 1, 0); // no stop
- if (temp ==0)
- {
- temp = twi_readFrom(addr, &(*buf), 16, 1);
- }
- return temp;
-}
-/*
- * Function ScI2cMxSetAddress
- * Desc Set ZT.SC-I2CMx New Address
- * Input val:ZT.SC-I2CMx Address New Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxSetAddress(uint8_t newaddr)
-{
- uint8_t buff[2] = {REG_ADDRESS, newaddr};
- return twi_writeTo(ZTSCI2CMX_DADDRESS, buff, 2, 1, 1);
-}
-
-/*
- * Function ScI2cMxSetBrightness
- * Desc Set ZT.SC-I2CMx Brightness
- * Input addr:ZT.SC-I2CMx Address
- val: Brightness 0~0xFF
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxSetBrightness(uint8_t addr, uint8_t val)
-{
- uint8_t buff[2] = {REG_BRIGHTNESS, val};
- return twi_writeTo(addr, buff, 2, 1, 1);
-}
-/*
- * Function ScI2cMxSetVcomH
- * Desc Set ZT.SC-I2CMx VcomH
- * Input addr:ZT.SC-I2CMx Address
- val: Brightness 0~7
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxSetVcomH(uint8_t addr, uint8_t val)
-{
- uint8_t buff[2] = {REG_VCOMH, val};
- return twi_writeTo(addr, buff, 2, 1, 1);
-}
-
-/*
- * Function ScI2cMxDisplay8x16Str
- * Desc ZT.SC-I2CMx Display 8x16 English String
- * Input addr:ZT.SC-I2CMx Address
- page: location page
- column: location column
- *str: 8X16 English String
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxDisplay8x16Str(uint8_t addr, uint8_t page, uint8_t column, const char *str)
-{
- uint8_t i=0;
- uint8_t buff[19];
- buff[0] = REG_8X16STR;
- buff[1] = page;
- buff[2] = column;
- i=0;
- while ((*str != '\0') && (i<16))
- {
- buff[i+3] = (uint8_t)*str++;
- i++;
- }
- return twi_writeTo(addr, buff, i+3, 1, 1);
-}
-/*
- * Function ScI2cMxFillArea
- * Desc ZT.SC-I2CMx Fill Area
- * Input addr:ZT.SC-I2CMx Address
- spage: start page
- epage: end page
- scolumn: start column
- ecolumn: end column
- filldata: fill data
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxFillArea(uint8_t addr, uint8_t spage, uint8_t epage,uint8_t scolumn, uint8_t ecolumn,uint8_t filldata)
-{
- uint8_t buff[6] = {REG_FILL_AREA, spage, epage, scolumn, ecolumn, filldata};
- return twi_writeTo(addr, buff, 6, 1, 1);
-}
-/*
- * Function ScI2cMxScrollingHorizontal
- * Desc ZT.SC-I2CMx Scrolling Horizontal
- * Input addr:ZT.SC-I2CMx Address
- lr: Scroll direction
- spage: start page
- epage: end page
- frames: Scroll fram
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxScrollingHorizontal(uint8_t addr, uint8_t lr, uint8_t spage, uint8_t epage,uint8_t frames)
-{
- uint8_t buff[9] = {REG_CMD, 0x2E, 0x00, spage, frames, epage, 0x00, 0xFF, 0x2F};
- twi_writeTo(addr, buff, 2, 1, 1);
- buff[0] = REG_CMD;
- buff[1] = lr;
- for (int i=0; i<10; i++);
- return twi_writeTo(addr, buff, 9, 1, 1);
-}
-/*
- * Function ScI2cMxScrollingHorizontal
- * Desc ZT.SC-I2CMx Scrolling Vertical
- * Input addr:ZT.SC-I2CMx Address
- lr: Scroll direction
- rowsfixed: rows fixed
- rowsscroll: rows scroll
- scrollstep: scroll step
- stepdelay: step delay
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxScrollingVertical(uint8_t addr, uint8_t scrollupdown, uint8_t rowsfixed, uint8_t rowsscroll, uint8_t scrollstep, uint8_t stepdelay)
-{
- uint8_t buff[6] = {REG_SCROVER, scrollupdown, rowsfixed, rowsscroll, scrollstep, stepdelay};
- return twi_writeTo(addr, buff, 6, 1, 1);
-}
-/*
- * function ScI2cMxScrollingVerticalHorizontal
- * Desc Continuous Vertical / Horizontal / Diagonal Scrolling (Partial or Full Screen)
- * input :
- Sdirection: Scrolling Direction
- "0x00" (Vertical & Rightward)
- "0x01" (Vertical & Leftward)
- spage: Define Start Page Address (Horizontal / Diagonal Scrolling)
- epage: Define End Page Address (Horizontal / Diagonal Scrolling)
- fixedarea: Set Top Fixed Area (Vertical Scrolling)
- scrollarea: Set Vertical Scroll Area (Vertical Scrolling)
- frames: Set Time Interval between Each Scroll Step in Terms of Frame Frequency
- offset: Set Numbers of Row Scroll per Step (Vertical / Diagonal Scrolling)
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxScrollingVerticalHorizontal(uint8_t addr, uint8_t Sdirection, uint8_t spage, uint8_t epage, uint8_t fixedarea, uint8_t scrollarea, uint8_t offset, uint8_t frames)
-{
- uint8_t buff[8] = {REG_SCROVERHOR, Sdirection, spage, epage, fixedarea, scrollarea, offset, frames};
- return twi_writeTo(addr, buff, 8, 1, 1);
-}
-/*
- * Function ScI2cMxDeactivateScroll
- * Desc ZT.SC-I2CMx Deactivate Scroll
- * Input addr:ZT.SC-I2CMx Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxDeactivateScroll(uint8_t addr)
-{
- uint8_t buff[2] = {REG_CMD, 0x2E};
- return twi_writeTo(addr, buff, 2, 1, 1);
-}
-
-/*
- * Function ScI2cMxReset
- * Desc ZT.SC-I2CMx Reset OLED
- * Input addr:ZT.SC-I2CMx Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxReset(uint8_t addr)
-{
- uint8_t buff[2] = {REG_RESET,RESET_OLED};
- return twi_writeTo(addr, buff, 2, 1, 1);
-}
-
-/*
- * Function ScI2cMxSetLocation
- * Desc Set ZT.SC-I2CMx SetLocation
- * Input addr:ZT.SC-I2CMx Address
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-int ZtLib::ScI2cMxSetLocation(uint8_t addr, uint8_t page,uint8_t column)
-{
- uint8_t buff[4] = {REG_CMD, (0xB0|page), (column%16), (column/16+0x10)};
- return twi_writeTo(addr, buff, 4, 1, 1);
-}
-/*
- * Function ScI2cMxDisplayDot16x16
- * Desc Set ZT.SC-I2CMx Display 16*16 Dot
- * Input addr:ZT.SC-I2CMx Address
- page:page
- column:column
- *str:16*16 Dot Data
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-void ZtLib::ScI2cMxDisplayDot16x16(uint8_t addr, uint8_t page, uint8_t column, const char *str)
-{
- uint8_t buff[17];
- buff[0] = REG_DAT;
- ScI2cMxSetLocation(addr, page, column);
- for (int i=0; i<16; i++)
- {
- buff[i+1] = str[i];
- }
- twi_writeTo(addr, buff, 17, 1, 1);
- ScI2cMxSetLocation(addr, page+1, column);
- for (int i=0; i<16; i++)
- {
- buff[i+1] = str[i+16];
- }
- twi_writeTo(addr, buff, 17, 1, 1);
-}
-/*
- * Function ScI2cMxDisplayArea
- * Desc Set ZT.SC-I2CMx Display Area
- * Input addr:ZT.SC-I2CMx Address
- spage: start page
- epage: end page
- scolumn: start column
- ecolumn: end column
- *pt: Data
- * Output 0 .. success
- * 1 .. length to long for buffer
- * 2 .. address send, NACK received
- * 3 .. data send, NACK received
- * 4 .. other twi error (lost bus arbitration, bus error, ..)
- */
-void ZtLib::ScI2cMxDisplayArea(uint8_t addr, uint8_t spage, uint8_t epage, uint8_t scolumn, uint8_t ecolumn, const char *pt)
-{
- uint8_t i = 0;
- uint8_t j = 0;
- uint8_t h = 0;
- uint8_t w = 0;
- uint16_t cnt = 0;
- uint8_t buff[32];
- buff[0] = REG_DAT;
-
- h = epage - spage;
- w = ecolumn - scolumn;
-
- while ( j<h )
- {
- ScI2cMxSetLocation(addr, spage + j, scolumn);
- uint8_t p=w;
- while(p)
- {
- if(p>=31)
- {
- for (int n=0; n<31; n++)
- {
- buff[1+n] = pt[cnt++];
- }
- twi_writeTo(addr, buff, 32, 1, 1);
- p -= 31;
- }
- else
- {
- int n;
- for (n=0; n<p; n++)
- {
- buff[1+n] = pt[cnt++];
- }
- twi_writeTo(addr, buff, n+1, 1, 1);
- p -= n;
- }
- }
- j++;
- }
-}
-
-// Preinstantiate Objects //////////////////////////////////////////////////////
-
-ZtLib ZT;
-
diff --git a/samples/dashboard_oled/ZtLib.h b/samples/dashboard_oled/ZtLib.h
deleted file mode 100644
index b93ccc1..0000000
--- a/samples/dashboard_oled/ZtLib.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- ZtLib.cpp - ZT module Drive Library for Wiring & Arduino
- Copyright (c) 2012 Alvin Li(Kozig/www.kozig.com). All right reserved.
- This library is free software;
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Version:V1.1
-*/
-
-#ifndef __ZTLIB_H__
-#define __ZTLIB_H__
-
-#include <inttypes.h>
-
-//////////////////
-#define ZTSEG8B4A036A_DADDR 0x51
-#define SET_ADDR 0x61
-#define WRITE_CODE 0xAA
-#define WRITE_CMD 0x55
-
-#define DOT_NONE (0)
-#define DOT_BIT1 (1<<0)
-#define DOT_BIT2 (1<<1)
-#define DOT_BIT3 (1<<2)
-#define DOT_BIT4 (1<<3)
-
-#define DISP_0BIT (0)
-#define DISP_1BIT (1)
-#define DISP_2BIT (2)
-#define DISP_3BIT (3)
-#define DISP_4BIT (4)
-#define DISP_AUTO (5)
-///////////////////////////////////
-
-#define ZTSCI2CMX_DADDRESS 0x51
-// Ä£¿é¼Ä´æÆ÷µØÖ·
-#define REG_CMD 0x01
-#define REG_DAT 0x02
-#define REG_RESET 0x03
- #define RESET_OLED 0x06
-#define REG_VERSION 0x1F
-#define REG_SLEEP 0x04
- #define SLEEP_ON 0xA5
- #define SLEEP_OFF 0xA1
-#define REG_VCOMH 0x05
-#define REG_STATUS 0x06
- #define STATUS_RUN 0x00
- #define STATUS_RUN 0x00
- #define STATUS_SLEEP 0x01
- #define STATUS_SET_ADDRESS 0x02
- #define STATUS_TEST 0x04
- #define STATUS_BUSY 0x10
-
-#define REG_ADDRESS 0x08
-#define REG_BRIGHTNESS 0x0A
-#define REG_8X16STR 0x52
-#define REG_OLED_XY 0x60
-#define REG_FILL_AREA 0x61
-#define REG_SCROHOR 0x62
-#define REG_SCROVER 0x63
-#define REG_SCROVERHOR 0x64
-
-#define PAGE0 0x00
-#define PAGE1 0x01
-#define PAGE2 0x02
-#define PAGE3 0x03
-#define PAGE4 0x04
-#define PAGE5 0x05
-#define PAGE6 0x06
-#define PAGE7 0x07
-
-#define SCROLL_UP 0x01
-#define SCROLL_DOWN 0x00
-#define SCROLL_RIGHT 0x26
-#define SCROLL_LEFT 0x27
-#define SCROLL_VR 0x29
-#define SCROLL_VL 0x2A
-
-#define FRAMS_2 0x07
-#define FRAMS_3 0x04
-#define FRAMS_4 0x05
-#define FRAMS_5 0x00
-#define FRAMS_25 0x06
-#define FRAMS_64 0x01
-#define FRAMS_128 0x02
-#define FRAMS_256 0x03
-
-class ZtLib
-{
- private:
-
- public:
- void I2cInit(void);
-// Module ZT.SEG8B4A036A FUNCTION
- int Seg8b4a036aSleep(uint8_t);
- int Seg8b4a036aUnSleep(uint8_t);
- int Seg8b4a036aReadState(uint8_t addr);
- int Seg8b4a036aReadVersion(uint8_t addr, uint8_t *buf);
- int Seg8b4a036aDisplayDec(uint8_t,unsigned short, uint8_t, uint8_t);
- int Seg8b4a036aDisplayHex(uint8_t,unsigned short, uint8_t, uint8_t);
- int Seg8b4a036aSetBrightness(uint8_t, uint8_t, uint8_t);
- int Seg8b4a036aSetAddress(uint8_t);
- int Seg8b4a036aDisplayBuff(uint8_t,uint8_t *);
-// Module ZT.SC-I2CMx
- int ScI2cMxReadState(uint8_t);
- int ScI2cMxReadVersion(uint8_t, uint8_t *);
- int ScI2cMxSetAddress(uint8_t);
- int ScI2cMxSetBrightness(uint8_t, uint8_t);
- int ScI2cMxSetVcomH(uint8_t, uint8_t);
- int ScI2cMxDisplay8x16Str(uint8_t, uint8_t, uint8_t, const char *);
- int ScI2cMxFillArea(uint8_t, uint8_t, uint8_t,uint8_t, uint8_t,uint8_t);
- int ScI2cMxScrollingHorizontal(uint8_t, uint8_t, uint8_t, uint8_t,uint8_t);
- int ScI2cMxScrollingVertical(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);
- int ScI2cMxScrollingVerticalHorizontal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);
- int ScI2cMxDeactivateScroll(uint8_t);
- int ScI2cMxReset(uint8_t);
- int ScI2cMxSetLocation(uint8_t, uint8_t, uint8_t);
- void ScI2cMxDisplayDot16x16(uint8_t, uint8_t, uint8_t, const char *);
- void ScI2cMxDisplayArea(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, const char *);
-};
-
-
-extern ZtLib ZT;
-
-#endif
-
diff --git a/samples/dashboard_oled/dashboard_oled.cbp b/samples/dashboard_oled/dashboard_oled.cbp
deleted file mode 100644
index 67c6456..0000000
--- a/samples/dashboard_oled/dashboard_oled.cbp
+++ /dev/null
@@ -1,574 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="dashboard_oled" />
- <Option pch_mode="2" />
- <Option compiler="avrgcc" />
- <Build>
- <Target title="Arduino Uno">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Uno" />
- <Variable name="BOARD_ID" value="uno" />
- <Variable name="MCU" value="atmega328p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="115200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Leonardo">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega32U4__" />
- <Add option="-DUSB_VID=0x2341" />
- <Add option="-DUSB_PID=0x8036" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/leonardo" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Leonardo" />
- <Variable name="BOARD_ID" value="leonardo" />
- <Variable name="MCU" value="atmega32u4" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Esplora">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega32U4__" />
- <Add option="-DUSB_VID=0x2341" />
- <Add option="-DUSB_PID=0x8037" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/leonardo" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Esplora" />
- <Variable name="BOARD_ID" value="esplora" />
- <Variable name="MCU" value="atmega32u4" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Micro">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega32U4__" />
- <Add option="-DUSB_VID=0x2341" />
- <Add option="-DUSB_PID=0x803C" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/micro" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Micro" />
- <Variable name="BOARD_ID" value="micro" />
- <Variable name="MCU" value="atmega32u4" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Duemilanove (328)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Duemilanove (328)" />
- <Variable name="BOARD_ID" value="duemilanove328" />
- <Variable name="MCU" value="atmega328p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Duemilanove (168)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Duemilanove (168)" />
- <Variable name="BOARD_ID" value="duemilanove168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Nano (328)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Nano (328)" />
- <Variable name="BOARD_ID" value="nano328" />
- <Variable name="MCU" value="atmega328p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Nano (168)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Nano (168)" />
- <Variable name="BOARD_ID" value="nano168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Mini (328)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mini (328)" />
- <Variable name="BOARD_ID" value="mini328" />
- <Variable name="MCU" value="atmega328p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Mini (168)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mini (168)" />
- <Variable name="BOARD_ID" value="mini168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Pro Mini (328)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Pro Mini (328)" />
- <Variable name="BOARD_ID" value="promini328" />
- <Variable name="MCU" value="atmega328p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Pro Mini (168)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Pro Mini (168)" />
- <Variable name="BOARD_ID" value="promini168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Mega 2560/ADK">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega2560__" />
- <Add option="-O2" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/mega" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mega 2560\ADK" />
- <Variable name="BOARD_ID" value="mega2560" />
- <Variable name="MCU" value="atmega2560" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Mega 1280">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega1280__" />
- <Add option="-O2" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/mega" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mega 1280" />
- <Variable name="BOARD_ID" value="mega1280" />
- <Variable name="MCU" value="atmega1280" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Arduino Mega 8">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mega 8" />
- <Variable name="BOARD_ID" value="mega8" />
- <Variable name="MCU" value="atmega8" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Microduino Core+ (644P)">
- <Option output="bin/Release/dashboard_oled_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega644P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/plus" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Microduino Core+ (644P)" />
- <Variable name="BOARD_ID" value="uduino644p" />
- <Variable name="MCU" value="atmega644p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="115200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- </Build>
- <Compiler>
- <Add directory="." />
- </Compiler>
- <Unit filename="ZtLib.cpp" />
- <Unit filename="ZtLib.h" />
- <Unit filename="dashboard_oled.ino">
- <Option compile="1" />
- <Option link="1" />
- </Unit>
- <Extensions>
- <code_completion />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/samples/dashboard_oled/dashboard_oled.ino b/samples/dashboard_oled/dashboard_oled.ino
deleted file mode 100644
index 653a006..0000000
--- a/samples/dashboard_oled/dashboard_oled.ino
+++ /dev/null
@@ -1,158 +0,0 @@
-/*************************************************************************
-* Sample sketch based on OBD-II library for Arduino
-* Using a OLED module to display realtime vehicle data
-* Distributed under GPL v2.0
-* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@gmail.com>
-* All rights reserved.
-*************************************************************************/
-
-#include <Arduino.h>
-#include <Wire.h>
-#include "OBD.h"
-#include "ZtLib.h"
-
-#define OLED_ADDRESS 0x27
-#define LOOP_COUNT 50
-
-const char PROGMEM font16x32[][32] = {
-{0x00,0xE0,0xF8,0xFC,0xFE,0x1E,0x07,0x07,0x07,0x07,0x1E,0xFE,0xFC,0xF8,0xF0,0x00,0x00,0x07,0x0F,0x3F,0x3F,0x7C,0x70,0x70,0x70,0x70,0x7C,0x3F,0x1F,0x1F,0x07,0x00},/*0*/
-{0x00,0x00,0x00,0x06,0x07,0x07,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00},/*1*/
-{0x00,0x38,0x3C,0x3E,0x3E,0x0F,0x07,0x07,0x07,0xCF,0xFF,0xFE,0xFE,0x38,0x00,0x00,0x00,0x40,0x40,0x60,0x70,0x78,0x7C,0x7E,0x7F,0x77,0x73,0x71,0x70,0x70,0x00,0x00},/*2*/
-{0x00,0x18,0x1C,0x1E,0x1E,0x0F,0xC7,0xC7,0xE7,0xFF,0xFE,0xBE,0x9C,0x00,0x00,0x00,0x00,0x0C,0x1C,0x3C,0x3C,0x78,0x70,0x70,0x70,0x79,0x7F,0x3F,0x1F,0x0F,0x00,0x00},/*3*/
-{0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x1E,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x06,0x07,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x7F,0x7F,0x7F,0x7F,0x06,0x06,0x00},/*4*/
-{0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xE7,0xE7,0xE7,0xE7,0xC7,0x87,0x00,0x00,0x00,0x00,0x38,0x78,0x71,0x70,0x70,0x70,0x70,0x70,0x39,0x3F,0x3F,0x1F,0x0F,0x00},/*5*/
-{0x00,0x80,0xE0,0xF0,0xF8,0xFC,0x7F,0x7F,0x6F,0x67,0xE1,0xE1,0xC0,0x80,0x00,0x00,0x00,0x0F,0x1F,0x3F,0x3F,0x78,0x70,0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x0F,0x00},/*6*/
-{0x00,0x07,0x07,0x07,0x07,0x07,0xC7,0xE7,0xF7,0xFF,0x7F,0x3F,0x1F,0x07,0x03,0x01,0x00,0x20,0x38,0x7C,0x7E,0x3F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*7*/
-{0x00,0x00,0x00,0x1C,0xBE,0xFE,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFE,0xBE,0x1C,0x00,0x00,0x00,0x0E,0x3F,0x3F,0x7F,0x71,0x60,0x60,0x60,0x71,0x7F,0x3F,0x3F,0x0F,0x00},/*8*/
-{0x00,0x78,0xFC,0xFE,0xFE,0x8F,0x07,0x07,0x07,0x07,0x8F,0xFE,0xFE,0xFC,0xF8,0x00,0x00,0x00,0x00,0x01,0x43,0x43,0x73,0x7B,0x7F,0x7F,0x1F,0x0F,0x07,0x03,0x00,0x00},/*9*/
-};
-
-class COBDDash : public COBD
-{
-public:
- void Connect()
- {
- char buf[16];
-
- InitScreen();
- for (int n = 1; !init(); n++) {
- sprintf(buf, "Connecting [%d]", n);
- if (n <= 20)
- DisplayString(buf);
- else if (n == 21)
- ClearScreen(); // blank screen after a while
- }
- DisplayString("Connected! ");
-
- int value;
- DisplayString("Wait ECU start", 0 , 2);
- do {
- delay(500);
- } while (!readSensor(PID_RPM, value));
- DisplayString("ECU started ", 0 , 4);
- delay(500);
- DisplayString("Wait ignition ", 0 , 6);
- delay(500);
- do {
- delay(500);
- } while (!readSensor(PID_RPM, value) || value == 0);
- DisplayString("Engine started!", 0 , 6);
- delay(1000);
- }
- void Loop()
- {
- int value;
- byte count = 0;
- ClearScreen();
- DisplayString("rpm", 84, 0);
- DisplayString("km/h", 84, 3);
- for (;;) {
- char buf[16];
-
- if (count == 0) {
- DisplayString("AIR: ", 0, 6);
- if (readSensor(PID_INTAKE_TEMP, value)) {
- sprintf(buf, "%4dC", value);
- DisplayString(buf, 11 * 8, 6);
- }
- } else if (count == LOOP_COUNT / 2) {
- DisplayString("ENGINE: ", 0, 6);
- if (readSensor(PID_COOLANT_TEMP, value)) {
- sprintf(buf, "%4dC", value);
- DisplayString(buf, 11 * 8, 6);
- }
- }
- if (count < LOOP_COUNT / 2) {
- if (readSensor(PID_INTAKE_MAP, value)) {
- sprintf(buf, "%dkPa ", value);
- DisplayString(buf, 5 * 8, 6);
- }
- } else {
- if (readSensor(PID_ENGINE_LOAD, value)) {
- sprintf(buf, "%d%% ", value);
- DisplayString(buf, 8 * 8, 6);
- }
- }
-
- if (readSensor(PID_RPM, value)) {
- sprintf(buf, "%4d", value);
- DisplayLargeNumber(buf, 16, 0);
- }
-
- if (readSensor(PID_SPEED, value)) {
- sprintf(buf, "%3d", value);
- DisplayLargeNumber(buf, 32, 3);
- }
-
- if (errors > 5) {
- return;
- }
- count = (count + 1) % LOOP_COUNT;
- }
- }
-private:
- void DisplayString(const char* s, char x = 0, char y = 0)
- {
- ZT.ScI2cMxDisplay8x16Str(OLED_ADDRESS, y, x, s);
- }
- void DisplayLargeNumber(const char* s, char x = 0, char y = 0)
- {
- char data[32];
- while (*s) {
- if (*s >= '0' && *s <= '9') {
- memcpy_P(data, font16x32[*s - '0'], 32);
- ZT.ScI2cMxDisplayDot16x16(OLED_ADDRESS, y , x, data);
- } else {
- ZT.ScI2cMxFillArea(OLED_ADDRESS, y, y + 1, x, x + 16, 0);
- }
- x += 16;
- s++;
- }
- }
- void ClearScreen()
- {
- ZT.ScI2cMxFillArea(OLED_ADDRESS, 0, 7, 0, 127, 0);
- delay(10);
- }
- void InitScreen()
- {
- ZT.I2cInit();
- ZT.ScI2cMxReset(OLED_ADDRESS);
- delay(10);
- ClearScreen();
- }
-};
-
-COBDDash dash;
-
-void loop()
-{
- dash.Connect();
- dash.Loop();
-}
-
-void setup()
-{
- dash.begin();
-}
-