daily_automated
This commit is contained in:
440
trunk/Arduino/libraries/DigoleSerial/old/DigoleSerial.cpp
Normal file
440
trunk/Arduino/libraries/DigoleSerial/old/DigoleSerial.cpp
Normal file
@@ -0,0 +1,440 @@
|
||||
//Digole Digital Solutions: www.digole.com
|
||||
#include "DigoleSerial.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "Arduino.h"
|
||||
|
||||
/*
|
||||
// Communication set up command
|
||||
* "SB":Baud (ascII bytes end with 0x00/0x0A/0x0D) -- set UART Baud Rate
|
||||
* "SI2CA":Address(1 byte <127) -- Set I2C address, default address is:0x27
|
||||
* "DC":1/0(1byte) -- set config display on/off, if set to 1, displayer will display current commucation setting when power on
|
||||
// Text Function command
|
||||
* "CL": -- Clear screen--OK
|
||||
* "CS":1/0 (1 byte)-- Cursor on/off
|
||||
* "TP":x(1 byte) y(1 byte) -- set text position
|
||||
* "TT":string(bytes) end with 0x00/0x0A/0x0D -- display string under regular mode
|
||||
// Graphic function command
|
||||
* "GP":x(1byte) y(1byte) -- set current graphic position
|
||||
* "DM":"C/!/~/&/|/^"(ASCII 1byte) -- set drawing mode--C="Copy",! and ~ = "Not", & = "And", | = "Or", ^ = "Xor"
|
||||
* "SC":1/0 (1byte) -- set draw color--only 1 and 0
|
||||
* "LN":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw line from x0,y0 to x1,y1,set new pot to x1,y1
|
||||
* "LT":x(1byte) y(1byte) -- draw line from current pos to x,y
|
||||
* "CC":x(1byte) y(1byte) ratio(byte) -- draw circle at x,y with ratio
|
||||
* "DP":x(1byte) y(1byte) Color(1byte) -- draw a pixel--OK
|
||||
* "DR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw rectangle, top-left:x0,y0; right-bottom:x1,y1
|
||||
* "FR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw filled rectangle, top-left:x0,y0; right-bottom:x1,y1
|
||||
*/
|
||||
|
||||
// that resetting the Arduino doesn't reset the LCD, so we
|
||||
// can't assume that its in that state when a sketch starts (and the
|
||||
// LiquidCrystal constructor is called).
|
||||
|
||||
//UART function
|
||||
|
||||
void DigoleSerialDisp::write2B(unsigned int v) {
|
||||
if (v < 255)
|
||||
write(v);
|
||||
else {
|
||||
write(255);
|
||||
write(v - 255);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::preprint(void) {
|
||||
//write((uint8_t)0);
|
||||
Print::print("TT");
|
||||
}
|
||||
|
||||
/*----------Functions for Graphic LCD/OLED adapters only---------*/
|
||||
void DigoleSerialDisp::drawBitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap) {
|
||||
uint8_t i = 0;
|
||||
if ((w & 7) != 0)
|
||||
i = 1;
|
||||
Print::print("DIM");
|
||||
write2B(x); //x;
|
||||
write2B(y);
|
||||
write2B(w);
|
||||
write2B(h);
|
||||
for (int j = 0; j < h * ((w >> 3) + i); j++) {
|
||||
write(pgm_read_byte_near(bitmap + j));
|
||||
// delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setRot90(void) {
|
||||
Print::print("SD1");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setRot180(void) {
|
||||
Print::print("SD2");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setRot270(void) {
|
||||
Print::print("SD3");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::undoRotation(void) {
|
||||
Print::print("SD0");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setRotation(uint8_t d) {
|
||||
Print::print("SD");
|
||||
write2B(d);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setContrast(uint8_t c) {
|
||||
Print::print("CT");
|
||||
write2B(c);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h) {
|
||||
Print::print("FR");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write2B(x + w);
|
||||
write2B(y + h);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawCircle(unsigned int x, unsigned int y, unsigned int r, uint8_t f) {
|
||||
Print::print("CC");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write2B(r);
|
||||
write(f);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawDisc(unsigned int x, unsigned int y, unsigned int r) {
|
||||
drawCircle(x, y, r, 1);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawFrame(unsigned int x, unsigned int y, unsigned int w, unsigned int h) {
|
||||
Print::print("DR");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write2B(x + w);
|
||||
write2B(y + h);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawPixel(unsigned int x, unsigned int y, uint8_t color) {
|
||||
Print::print("DP");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write(color);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawLine(unsigned int x, unsigned int y, unsigned int x1, unsigned int y1) {
|
||||
Print::print("LN");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write2B(x1);
|
||||
write2B(y1);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawLineTo(unsigned int x, unsigned int y) {
|
||||
Print::print("LT");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawHLine(unsigned int x, unsigned int y, unsigned int w) {
|
||||
drawLine(x, y, x + w, y);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawVLine(unsigned int x, unsigned int y, unsigned int h) {
|
||||
drawLine(x, y, x, y + h);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::nextTextLine(void) {
|
||||
write((uint8_t) 0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setFont(uint8_t font) {
|
||||
Print::print("SF");
|
||||
write(font);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setColor(uint8_t color) {
|
||||
Print::print("SC");
|
||||
write(color);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::backLightOn(void) {
|
||||
Print::print("BL");
|
||||
write((uint8_t) 1);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::backLightOff(void) {
|
||||
Print::print("BL");
|
||||
write((uint8_t) 0);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::directCommand(uint8_t d) {
|
||||
Print::print("MCD");
|
||||
write(d);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::directData(uint8_t d) {
|
||||
Print::print("MDT");
|
||||
write(d);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::moveArea(unsigned int x0, unsigned int y0, unsigned int w, unsigned int h, char xoffset, char yoffset) {
|
||||
Print::print("MA");
|
||||
write2B(x0);
|
||||
write2B(y0);
|
||||
write2B(w);
|
||||
write2B(h);
|
||||
write(xoffset);
|
||||
write(yoffset);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::uploadStartScreen(int lon, const unsigned char *data) {
|
||||
int j;
|
||||
uint8_t c;
|
||||
Print::print("SSS");
|
||||
write((uint8_t) (lon % 256));
|
||||
write((uint8_t) (lon / 256));
|
||||
delay(300);
|
||||
for (j = 0; j < lon; j++) {
|
||||
if ((j % 32) == 0)
|
||||
delay(50);
|
||||
delay(_Comdelay);
|
||||
c = pgm_read_byte_near(data + j);
|
||||
write(c);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::uploadUserFont(int lon, const unsigned char *data, uint8_t sect) {
|
||||
uint8_t c;
|
||||
Print::print("SUF");
|
||||
write(sect);
|
||||
write((uint8_t) (lon % 256));
|
||||
write((uint8_t) (lon / 256));
|
||||
for (int j = 0; j < lon; j++) {
|
||||
if ((j % 32) == 0)
|
||||
delay(50);
|
||||
delay(_Comdelay);
|
||||
c = pgm_read_byte_near(data + j);
|
||||
write(c);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawBitmap256(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap) { //display 256 color image
|
||||
uint8_t i = 0;
|
||||
Print::print("EDIM1");
|
||||
write2B(x); //x;
|
||||
write2B(y);
|
||||
write2B(w);
|
||||
write2B(h);
|
||||
for (int j = 0; j < h * w; j++) {
|
||||
write(pgm_read_byte_near(bitmap + j));
|
||||
// delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawBitmap262K(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap) { //display 256 color image
|
||||
uint8_t i = 0;
|
||||
Print::print("EDIM3");
|
||||
write2B(x); //x;
|
||||
write2B(y);
|
||||
write2B(w);
|
||||
write2B(h);
|
||||
for (int j = 0; (j < h * w * 3); j++) {
|
||||
write(pgm_read_byte_near(bitmap + j));
|
||||
// delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setTrueColor(uint8_t r, uint8_t g, uint8_t b) { //Set true color
|
||||
uint8_t i = 0;
|
||||
Print::print("ESC");
|
||||
write(r);
|
||||
write(g);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::drawStr(unsigned int x, unsigned int y, const char *s) {
|
||||
Print::print("TP");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
Print::print("TT");
|
||||
Print::print(s);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setPrintPos(unsigned int x, unsigned int y, uint8_t graph) {
|
||||
if (graph == 0) {
|
||||
Print::print("TP");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
} else {
|
||||
Print::print("GP");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
}
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setLCDColRow(uint8_t col, uint8_t row) {
|
||||
Print::print("STCR");
|
||||
write(col);
|
||||
write(row);
|
||||
Print::print("\x80\xC0\x94\xD4");
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setTextPosAbs(unsigned int x, unsigned int y) {
|
||||
Print::print("ETP");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
}
|
||||
|
||||
//----Touch screen functions-----//
|
||||
|
||||
void DigoleSerialDisp::calibrateTouchScreen(void) {
|
||||
write('T');
|
||||
write('U');
|
||||
write('C');
|
||||
write('H');
|
||||
write('C');
|
||||
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::readTouchScreen() {
|
||||
write('R');
|
||||
write('P');
|
||||
write('N');
|
||||
write('X');
|
||||
write('Y');
|
||||
write('W'); //change to 'I' if you don't want wait till pen touched
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::readClick() //read a click on touch screen
|
||||
{
|
||||
write('R');
|
||||
write('P');
|
||||
write('N');
|
||||
write('X');
|
||||
write('Y');
|
||||
write('C');
|
||||
}
|
||||
int DigoleSerialDisp::readBattery(void)
|
||||
{
|
||||
int c;
|
||||
write('R');
|
||||
write('D');
|
||||
write('B');
|
||||
write('A');
|
||||
write('T');
|
||||
c=read1();
|
||||
c<<=8;
|
||||
c|=read1();
|
||||
return c;
|
||||
}
|
||||
int DigoleSerialDisp::readAux(void)
|
||||
{
|
||||
int c;
|
||||
write('R');
|
||||
write('D');
|
||||
write('A');
|
||||
write('U');
|
||||
write('X');
|
||||
c=read1();
|
||||
c<<=8;
|
||||
c+=read1();
|
||||
return c;
|
||||
}
|
||||
int DigoleSerialDisp::readTemperature(void)
|
||||
{
|
||||
int c;
|
||||
write('R');
|
||||
write('D');
|
||||
write('T');
|
||||
write('M');
|
||||
write('P');
|
||||
c=read1();
|
||||
c<<=8;
|
||||
c|=read1();
|
||||
return c;
|
||||
}
|
||||
//-----Flash memory functions----//
|
||||
|
||||
void DigoleSerialDisp::flashErase(unsigned long int addr, unsigned long int length) {
|
||||
write('F');
|
||||
write('L');
|
||||
write('M');
|
||||
write('E');
|
||||
write('R');
|
||||
write(addr >> 16);
|
||||
write(addr >> 8);
|
||||
write(addr);
|
||||
write(length >> 16);
|
||||
write(length >> 8);
|
||||
write(length);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::flashWriteL(unsigned long int addr, unsigned long int len, const unsigned char *data) {
|
||||
while (len > 1024) {
|
||||
flashWrite(addr, 1024, data);
|
||||
data += 1024;
|
||||
addr += 1024;
|
||||
len = len - 1024;
|
||||
}
|
||||
flashWrite(addr, len, data);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::flashWrite(unsigned long int addr, unsigned long int len, const unsigned char *data) {
|
||||
unsigned char c;
|
||||
write('F');
|
||||
write('L');
|
||||
write('M');
|
||||
write('W');
|
||||
write('R');
|
||||
write(addr >> 16);
|
||||
write(addr >> 8);
|
||||
write(addr);
|
||||
write(len >> 16);
|
||||
write(len >> 8);
|
||||
write(len);
|
||||
for (long int i = 0; i < len; i++) {
|
||||
c = pgm_read_byte_near(data + i);
|
||||
write(c);
|
||||
}
|
||||
//check write memory done
|
||||
while (read1()!= 17);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::flashReadStart(unsigned long int addr, unsigned long int len) {
|
||||
write('F');
|
||||
write('L');
|
||||
write('M');
|
||||
write('R');
|
||||
write('D');
|
||||
write(addr >> 16);
|
||||
write(addr >> 8);
|
||||
write(addr);
|
||||
write(len >> 16);
|
||||
write(len >> 8);
|
||||
write(len);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::setFlashFont(unsigned long int addr) {
|
||||
write('S');
|
||||
write('F');
|
||||
write('F');
|
||||
write(addr >> 16);
|
||||
write(addr >> 8);
|
||||
write(addr);
|
||||
}
|
||||
|
||||
void DigoleSerialDisp::runCommandSet(unsigned long int addr) {
|
||||
write('F');
|
||||
write('L');
|
||||
write('M');
|
||||
write('C');
|
||||
write('S');
|
||||
write(addr >> 16);
|
||||
write(addr >> 8);
|
||||
write(addr);
|
||||
}
|
||||
446
trunk/Arduino/libraries/DigoleSerial/old/DigoleSerial.h
Normal file
446
trunk/Arduino/libraries/DigoleSerial/old/DigoleSerial.h
Normal file
@@ -0,0 +1,446 @@
|
||||
//Digole Digital Solutions: www.digole.com
|
||||
#ifndef DigoleSerialDisp_h
|
||||
#define DigoleSerialDisp_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "Print.h"
|
||||
#include <Wire.h>
|
||||
#include "Arduino.h"
|
||||
// Communication set up command
|
||||
// Text function command
|
||||
// Graph function command
|
||||
#define Serial_UART 0
|
||||
#define Serial_I2C 1
|
||||
#define Serial_SPI 2
|
||||
#define _TEXT_ 0
|
||||
#define _GRAPH_ 1
|
||||
class Digole{
|
||||
public:
|
||||
|
||||
virtual size_t read1(void);
|
||||
};
|
||||
class DigoleSerialDisp : public Print,public Digole {
|
||||
public:
|
||||
#if defined(_Digole_Serial_UART_)
|
||||
|
||||
DigoleSerialDisp(HardwareSerial *s, unsigned long baud) //UART set up
|
||||
{
|
||||
_mySerial = s;
|
||||
_Baud = baud;
|
||||
_Comdelay = 2;
|
||||
}
|
||||
|
||||
size_t write(uint8_t value) {
|
||||
_mySerial->write((uint8_t) value);
|
||||
return 1; // assume sucess
|
||||
}
|
||||
|
||||
void begin(void) {
|
||||
_mySerial->begin(9600);
|
||||
_mySerial->print("SB");
|
||||
_mySerial->println(_Baud);
|
||||
delay(100);
|
||||
_mySerial->begin(_Baud);
|
||||
}
|
||||
size_t read1(void)
|
||||
{
|
||||
int t;
|
||||
do {
|
||||
t = _mySerial->read();
|
||||
} while (t == -1);
|
||||
return t;
|
||||
}
|
||||
#endif
|
||||
#if defined(_Digole_Serial_I2C_)
|
||||
|
||||
void begin(void) {
|
||||
_myWire->begin();
|
||||
}
|
||||
|
||||
DigoleSerialDisp(TwoWire *s, uint8_t add) //U2C set up
|
||||
{
|
||||
_myWire = s;
|
||||
_I2Caddress = add;
|
||||
_Comdelay = 6;
|
||||
}
|
||||
|
||||
size_t write(uint8_t value) {
|
||||
_myWire->beginTransmission(_I2Caddress);
|
||||
_myWire->write((uint8_t) value); //use yourself routing to send bulk of data, such as for…
|
||||
_myWire->endTransmission();
|
||||
return 1; // assume sucess
|
||||
}
|
||||
int readInt(void) {
|
||||
int t;
|
||||
_myWire->requestFrom((int) _I2Caddress, 2);
|
||||
while (_myWire->available() == 0);
|
||||
t = _myWire->read() << 8; //use yourself routing to read bulk of data, such as for…
|
||||
while (_myWire->available() == 0);
|
||||
t |= _myWire->read();
|
||||
_myWire->read();_myWire->read();
|
||||
return t;
|
||||
}
|
||||
|
||||
size_t read1(void)
|
||||
{
|
||||
int t;
|
||||
_myWire->requestFrom((int) _I2Caddress, 1);
|
||||
while (_myWire->available() == 0);
|
||||
t = _myWire->read(); //use yourself routing to read bulk of data, such as for…
|
||||
return t; // assume sucess
|
||||
}
|
||||
#endif
|
||||
#if defined(_Digole_Serial_SPI_)
|
||||
|
||||
void begin(void) {
|
||||
}
|
||||
|
||||
DigoleSerialDisp(uint8_t pin_data, uint8_t pin_clock, uint8_t SS, uint8_t SI = 0) //spi set up
|
||||
{
|
||||
_Clockpin = pin_clock;
|
||||
_Datapin = pin_data;
|
||||
_SSpin = SS;
|
||||
_SIpin = SI;
|
||||
pinMode(_Clockpin, OUTPUT);
|
||||
pinMode(_Datapin, OUTPUT);
|
||||
pinMode(_SSpin, OUTPUT);
|
||||
digitalWrite(_SSpin, HIGH);
|
||||
digitalWrite(_Clockpin, LOW);
|
||||
digitalWrite(_Datapin, LOW);
|
||||
if (_SIpin != 0) {
|
||||
pinMode(_SIpin, INPUT);
|
||||
}
|
||||
_Comdelay = 6;
|
||||
}
|
||||
|
||||
size_t write(uint8_t value) {
|
||||
digitalWrite(_SSpin, LOW);
|
||||
digitalWrite(_SSpin, LOW);
|
||||
digitalWrite(_SSpin, LOW);
|
||||
shiftOut(_Datapin, _Clockpin, MSBFIRST, value);
|
||||
digitalWrite(_SSpin, HIGH);
|
||||
return 1; // assume sucess
|
||||
}
|
||||
size_t read1(void)
|
||||
{
|
||||
int t = 0;
|
||||
char c;
|
||||
while (digitalRead(_SIpin) == LOW); //check to see the data is ready(1) or not(0)
|
||||
digitalWrite(_SSpin, LOW); //tell display module I will read data
|
||||
digitalWrite(_SSpin, LOW); //delay about 5us to wait module prepare data
|
||||
digitalWrite(_SSpin, LOW); //
|
||||
for (c = 8; c > 0; c = c - 1) {
|
||||
t <<= 1;
|
||||
digitalWrite(_Clockpin, HIGH);
|
||||
if (digitalRead(_SIpin))
|
||||
t |= 1;
|
||||
digitalWrite(_Clockpin, LOW);
|
||||
}
|
||||
|
||||
// t=shiftIn(_Datapin, _Clockpin, MSBFIRST);
|
||||
digitalWrite(_SSpin, HIGH);
|
||||
return t; // assume sucess
|
||||
}
|
||||
#endif
|
||||
/*---------fucntions for Text and Graphic LCD adapters---------*/
|
||||
|
||||
void disableCursor(void) {
|
||||
Print::print("CS0");
|
||||
}
|
||||
|
||||
void enableCursor(void) {
|
||||
Print::print("CS1");
|
||||
}
|
||||
|
||||
void clearScreen(void) {
|
||||
Print::print("CL");
|
||||
}
|
||||
|
||||
void setI2CAddress(uint8_t add) {
|
||||
Print::print("SI2CA");
|
||||
write(add);
|
||||
_I2Caddress = add;
|
||||
}
|
||||
|
||||
void displayConfig(uint8_t v) {
|
||||
Print::print("DC");
|
||||
write(v);
|
||||
}
|
||||
//print function
|
||||
|
||||
size_t println(const __FlashStringHelper *v) {
|
||||
preprint();
|
||||
Print::println(v);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(const String &v) {
|
||||
preprint();
|
||||
Print::println(v);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(const char v[]) {
|
||||
preprint();
|
||||
Print::println(v);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(char v) {
|
||||
preprint();
|
||||
Print::println(v);
|
||||
Print::println("\x0dTRT");
|
||||
}
|
||||
|
||||
size_t println(unsigned char v, int base = DEC) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
Print::println("\x0dTRT");
|
||||
}
|
||||
|
||||
size_t println(int v, int base = DEC) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(unsigned int v, int base = DEC) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(long v, int base = DEC) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(unsigned long v, int base = DEC) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(double v, int base = 2) {
|
||||
preprint();
|
||||
Print::println(v, base);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(const Printable& v) {
|
||||
preprint();
|
||||
Print::println(v);
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t println(void) {
|
||||
write((uint8_t)0);
|
||||
Print::print("TRT");
|
||||
}
|
||||
|
||||
size_t print(const __FlashStringHelper *v) {
|
||||
preprint();
|
||||
Print::print(v);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(const String &v) {
|
||||
preprint();
|
||||
Print::print(v);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(const char v[]) {
|
||||
preprint();
|
||||
Print::print(v);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(char v) {
|
||||
preprint();
|
||||
Print::print(v);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(unsigned char v, int base = DEC) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(int v, int base = DEC) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(unsigned int v, int base = DEC) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(long v, int base = DEC) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(unsigned long v, int base = DEC) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(double v, int base = 2) {
|
||||
preprint();
|
||||
Print::print(v, base);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
|
||||
size_t print(const Printable& v) {
|
||||
preprint();
|
||||
Print::print(v);
|
||||
write((uint8_t)0);
|
||||
}
|
||||
void preprint(void);
|
||||
/*----------Functions for Graphic LCD/OLED adapters only---------*/
|
||||
//the functions in this section compatible with u8glib
|
||||
void drawBitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap);
|
||||
void drawBitmap256(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap);
|
||||
void drawBitmap262K(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const uint8_t *bitmap);
|
||||
void setTrueColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setRot90(void);
|
||||
void setRot180(void);
|
||||
void setRot270(void);
|
||||
void undoRotation(void);
|
||||
void setRotation(uint8_t);
|
||||
void setContrast(uint8_t);
|
||||
void drawBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
|
||||
void drawCircle(unsigned int x, unsigned int y, unsigned int r, uint8_t = 0);
|
||||
void drawDisc(unsigned int x, unsigned int y, unsigned int r);
|
||||
void drawFrame(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
|
||||
void drawPixel(unsigned int x, unsigned int y, uint8_t = 1);
|
||||
void drawLine(unsigned int x, unsigned int y, unsigned int x1, unsigned int y1);
|
||||
void drawLineTo(unsigned int x, unsigned int y);
|
||||
void drawHLine(unsigned int x, unsigned int y, unsigned int w);
|
||||
void drawVLine(unsigned int x, unsigned int y, unsigned int h);
|
||||
//-------------------------------
|
||||
//special functions for our adapters
|
||||
void setFont(uint8_t font); //set font, availale: 6,10,18,51,120,123, user font: 200-203
|
||||
void nextTextLine(void); //got to next text line, depending on the font size
|
||||
void setColor(uint8_t); //set color for graphic function
|
||||
void backLightOn(void); //Turn on back light
|
||||
void backLightOff(void); //Turn off back light
|
||||
void directCommand(uint8_t d); //send command to LCD drectly
|
||||
void directData(uint8_t d); //send data to LCD drectly
|
||||
void moveArea(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, char xoffset, char yoffset); //move a area of screen to another place
|
||||
void drawStr(unsigned int x, unsigned int y, const char *s);
|
||||
void setPrintPos(unsigned int x, unsigned int y, uint8_t = 0);
|
||||
void setLCDColRow(uint8_t col, uint8_t row);
|
||||
void setTextPosAbs(unsigned int x, unsigned int y);
|
||||
/*-----Touch screen functions---*/
|
||||
void calibrateTouchScreen(void);
|
||||
void readTouchScreen(void);
|
||||
void readClick(void);
|
||||
int readBattery(void);
|
||||
int readAux(void);
|
||||
int readTemperature(void);
|
||||
|
||||
/*-----Flash memory functions---*/
|
||||
void flashErase(unsigned long int addr, unsigned long int length);
|
||||
void flashWriteL(unsigned long int addr, unsigned long int len, const unsigned char *data);
|
||||
void flashWrite(unsigned long int addr, unsigned long int len, const unsigned char *data);
|
||||
void flashReadStart(unsigned long int addr, unsigned long int len);
|
||||
void setFlashFont(unsigned long int addr);
|
||||
void runCommandSet(unsigned long int addr);
|
||||
size_t read(void);
|
||||
|
||||
void write2B(unsigned int v);
|
||||
//--- new function on V3.0 firmware ----//
|
||||
|
||||
void setBgColor(void) //set current color as background
|
||||
{
|
||||
Print::print("BGC");
|
||||
}
|
||||
|
||||
void setDrawWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height) {
|
||||
Print::print("DWWIN");
|
||||
write2B(x);
|
||||
write2B(y);
|
||||
write2B(width);
|
||||
write2B(height);
|
||||
}
|
||||
void resetDrawWindow(void)
|
||||
{
|
||||
Print::print("RSTDW");
|
||||
}
|
||||
void cleanDrawWindow(void)
|
||||
{
|
||||
Print::print("WINCL");
|
||||
}
|
||||
//---end of V3.0 functions
|
||||
void displayStartScreen(uint8_t m) {
|
||||
Print::print("DSS");
|
||||
write(m);
|
||||
} //display start screen
|
||||
|
||||
void setMode(uint8_t m) {
|
||||
Print::print("DM");
|
||||
write(m);
|
||||
} //set display mode
|
||||
|
||||
void setTextPosBack(void) {
|
||||
Print::print("ETB");
|
||||
} //set text position back to previous, only one back allowed
|
||||
|
||||
void setTextPosOffset(char xoffset, char yoffset) {
|
||||
Print::print("ETO");
|
||||
write(xoffset);
|
||||
write(yoffset);
|
||||
}
|
||||
|
||||
void setLinePattern(uint8_t pattern) {
|
||||
Print::print("SLP");
|
||||
write(pattern);
|
||||
}
|
||||
|
||||
void setLCDChip(uint8_t chip) { //only for universal LCD adapter
|
||||
Print::print("SLCD");
|
||||
write(chip);
|
||||
}
|
||||
|
||||
void setBackLight(uint8_t bl) {
|
||||
Print::print("BL");
|
||||
write(bl);
|
||||
}
|
||||
void uploadStartScreen(int lon, const unsigned char *data); //upload start screen
|
||||
void uploadUserFont(int lon, const unsigned char *data, uint8_t sect); //upload user font
|
||||
|
||||
void digitalOutput(uint8_t x) {
|
||||
Print::print("DOUT");
|
||||
write(x);
|
||||
}
|
||||
private:
|
||||
unsigned long _Baud;
|
||||
HardwareSerial *_mySerial;
|
||||
uint8_t _I2Caddress;
|
||||
TwoWire *_myWire;
|
||||
uint8_t _Clockpin;
|
||||
uint8_t _Datapin;
|
||||
uint8_t _SSpin;
|
||||
uint8_t _SIpin;
|
||||
uint8_t _Comdelay;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user