5 Commits

Author SHA1 Message Date
JP
fb8b9c4a43 added debug messages for doCmd() 2014-04-17 15:49:39 +10:00
JP
e6045dcfa1 added flipVertical and horizontal 2014-02-25 11:58:56 +11:00
JP
93beac25d5 added checkComm() function to communicate with host PC 2014-02-15 10:15:03 +11:00
JP
7fd29e3c92 added Serial command 2014-02-12 20:50:07 +11:00
JP
eaf0862bb5 added invert function, contrast function, changed scrollStop to scrollStop for consistency 2014-02-11 19:43:01 +11:00
6 changed files with 882 additions and 321 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -64,6 +64,28 @@
#define VERTICALRIGHTHORIZONTALSCROLL 0x29
#define VERTICALLEFTHORIZONTALSCROLL 0x2A
typedef enum CMD {
CMD_CLEAR, //0
CMD_INVERT, //1
CMD_CONTRAST, //2
CMD_DISPLAY, //3
CMD_SETCURSOR, //4
CMD_PIXEL, //5
CMD_LINE, //6
CMD_LINEH, //7
CMD_LINEV, //8
CMD_RECT, //9
CMD_RECTFILL, //10
CMD_CIRCLE, //11
CMD_CIRCLEFILL, //12
CMD_DRAWCHAR, //13
CMD_DRAWBITMAP, //14
CMD_GETLCDWIDTH, //15
CMD_GETLCDHEIGHT, //16
CMD_SETCOLOR, //17
CMD_SETDRAWMODE //18
} commCommand_t;
class MicroView : public Print{
public:
MicroView(void) {};
@@ -81,10 +103,11 @@ public:
void setColumnAddress(uint8_t add);
void setPageAddress(uint8_t add);
// LCD Draw functions
// LCD Draw functions
void clear(uint8_t mode);
void clear(uint8_t mode, uint8_t c);
void invert(uint8_t i);
void invert(boolean inv);
void contrast(uint8_t contrast);
void display(void);
void setCursor(uint8_t x, uint8_t y);
void pixel(uint8_t x, uint8_t y);
@@ -125,7 +148,13 @@ public:
void scrollLeft(uint8_t start, uint8_t stop);
void scrollVertRight(uint8_t start, uint8_t stop);
void scrollVertLeft(uint8_t start, uint8_t stop);
void stopScroll(void);
void scrollStop(void);
void flipVertical(boolean flip);
void flipHorizontal(boolean flip);
// Communication
void checkComm(void);
void doCmd(uint8_t index);
private:
//uint8_t cs;
@@ -135,6 +164,8 @@ private:
uint16_t fontMapWidth;
//unsigned char *fontsPointer[TOTALFONTS];
static const unsigned char *fontsPointer[];
int readSerial(void);
};
class MicroViewWidget {

View File

@@ -16,7 +16,7 @@ Arduino library for MicroView.
2. Start Arduino IDE.
3. MicroView example is located at, File--->Example--->MicroView--->MicroViewDemo
### Example 1
### Example 1 - Hello World!
<pre><code>
#include &lt;MicroView.h&gt;
@@ -30,7 +30,7 @@ void loop() {
}
</code></pre>
### Example 2
### Example 2 - Basic Drawing
<pre><code>
#include &lt;MicroView.h&gt;
@@ -50,7 +50,7 @@ void loop() {
}
</code></pre>
### Example 3
### Example 3 - Widgets
<pre><code>
#include &lt;MicroView.h&gt;
@@ -72,13 +72,41 @@ void loop() {
}
</code></pre>
### Example 4 - Communication
<pre><code>
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.clear(PAGE);
}
void loop() {
uView.checkComm();
}
</code></pre>
## History
**v1.06b: by JP Liew**
**v1.09b: 17th April 2014 by JP Liew**
* changed verticalFlip() to flipVertical() and horizontalFlip() to flipHorizontal() for consistency
* added debug messages for doCmd()
**v1.08b: 18th February 2014 by JP Liew**
* added verticalFlip(), horizontalFlip()
**v1.07b: 15th February 2014 by JP Liew**
* changed function name stopScroll to scrollStop for consistency
* added contrast function
* added invert function
* added KEYWORD to keywords.txt
* added checkComm() function to communicate with host PC
**v1.06b: 9th February 2014 by JP Liew**
* fixed Slider negative value not working
* added round Gauge widget
* changed Example 3 to show round Gauge
**v1.05b: 6th February by JP Liew**
**v1.05b: 6th February 2014 by JP Liew**
* changed MICROVIEW class name to MicroView
* created MICROVIEWWIDGET class
* added routines to draw widget

View File

@@ -1,18 +1,17 @@
#include <MicroView.h>
#include <Time.h>
//#define PI 3.141592654
#define clocksize 24
uint8_t onDelay=5; // This is the on delay in milliseconds, if there is no on delay, the erase will be too fast to clean up the screen.
uint8_t onDelay=5; // this is the on delay in milliseconds, if there is no on delay, the erase will be too fast to clean up the screen.
void setup() {
uView.begin(); // Begin of MicroView
uView.clear(ALL); // Erase hardware memory inside the OLED controller
uView.display(); // Display the content in the buffer memory, by default it is the MicroView logo
uView.begin(); // begin of MicroView
uView.clear(ALL); // erase hardware memory inside the OLED controller
uView.display(); // display the content in the buffer memory, by default it is the MicroView logo
setTime(10,10,01,17,1,2014);
delay(500);
uView.clear(PAGE); // Erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
uView.clear(PAGE); // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
}
void loop() {
@@ -261,8 +260,6 @@ void loop() {
}
}
uView.clear(PAGE);
}

View File

@@ -1,39 +1,30 @@
#include <SPI.h>
#include <MicroView.h>
MicroViewWidget *widget[4];
void setup() {
widget[0] = new MicroViewSlider(0,0,0,100);
widget[1] = new MicroViewSlider(0,10,0,150);
widget[2] = new MicroViewSlider(0,20,0,50);
widget[3] = new MicroViewSlider(0,30,0,200);
Serial.begin(115200);
Serial.println("start");
uView.begin();
uView.clear(PAGE);
widget[0]->draw();
widget[1]->draw();
widget[2]->draw();
widget[3]->draw();
}
void loop() {
for (int i=0;i<101;i++) {
widget[0]->setValue(i);
widget[1]->setValue(100-i);
widget[2]->setValue(i);
widget[3]->setValue(100-i);
uView.display();
}
for(int i=100; i>-1;i--) {
widget[0]->setValue(i);
widget[1]->setValue(100-i);
widget[2]->setValue(i);
widget[3]->setValue(100-i);
uView.display();
}
#include <MicroView.h>
MicroViewWidget *widget[4]; // declaring an array of 4 MicroViewWidget
void setup() {
uView.begin(); // init and start MicroView
uView.clear(PAGE); // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
widget[0] = new MicroViewSlider(0,0,0,100); // declare widget0 as a Slider at x=0, y=0, min=0, max=100
widget[1] = new MicroViewSlider(0,10,0,150); // declare widget0 as a Slider at x=0, y=10, min=0, max=150
widget[2] = new MicroViewSlider(0,20,0,50); // declare widget0 as a Slider at x=0, y=20, min=0, max=50
widget[3] = new MicroViewSlider(0,30,0,200); // declare widget0 as a Slider at x=0, y=30, min=0, max=200
}
void loop() {
for (int i=0;i<=100;i++) {
widget[0]->setValue(i); // set value i to widget0
widget[1]->setValue(100-i);
widget[2]->setValue(i);
widget[3]->setValue(100-i);
uView.display();
}
for(int i=100; i>=0;i--) {
widget[0]->setValue(i);
widget[1]->setValue(100-i);
widget[2]->setValue(i);
widget[3]->setValue(100-i);
uView.display();
}
}

View File

@@ -7,18 +7,75 @@
#######################################
MICROVIEW KEYWORD1
uView KEYWORD1
MicroViewWidget KEYWORD1
MicroViewSlider KEYWORD1
MicroViewGauge KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
begin KEYWORD2
invert KEYWORD2
clear KEYWORD2
home KEYWORD2
invert KEYWORD2
contrast KEYWORD2
display KEYWORD2
setCursor KEYWORD2
pixel KEYWORD2
line KEYWORD2
lineH KEYWORD2
lineV KEYWORD2
rect KEYWORD2
rectFill KEYWORD2
circle KEYWORD2
circleFill KEYWORD2
drawChar KEYWORD2
getLCDWidth KEYWORD2
getLCDHeight KEYWORD2
setColor KEYWORD2
setDrawMode KEYWORD2
getFontWidth KEYWORD2
getFontHeight KEYWORD2
getTotalFonts KEYWORD2
getFontType KEYWORD2
setFontType KEYWORD2
getFontStartChar KEYWORD2
getFontTotalChar KEYWORD2
scrollRight KEYWORD2
scrollLeft KEYWORD2
scrollVertRight KEYWORD2
scrollVertLeft KEYWORD2
scrollStop KEYWORD2
flipVertical KEYWORD2
flipHorizontal KEYWORD2
getX KEYWORD2
getY KEYWORD2
setX KEYWORD2
setY KEYWORD2
getMinValue KEYWORD2
getMaxValue KEYWORD2
setMaxValue KEYWORD2
setMinValue KEYWORD2
setValue KEYWORD2
draw KEYWORD2
drawFace KEYWORD2
checkComm KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
BLACK LITERAL1
WHITE LITERAL1
NORM LITERAL1
XOR LITERAL1
PAGE LITERAL1
ALL LITERAL1
WIDGETSTYLE0 LITERAL1
WIDGETSTYLE1 LITERAL1
WIDGETSTYLE2 LITERAL1