39 Commits

Author SHA1 Message Date
jpliew
c86b454924 Merge pull request #15 from MLXXXp/add_keywords
Add keywords for existing functions
2014-08-27 10:15:11 +10:00
JP
ad46711f11 added version history 2014-08-27 10:14:36 +10:00
JP
34de240739 Merge branch 'emilong-circle-fill' 2014-08-27 10:09:04 +10:00
Scott Allen
6333d7c561 Removed duplicate "invert" keyword 2014-08-26 12:42:07 -04:00
Scott Allen
a5ed62704a Added keywords for existing functions
Added missing setColumnAddress, setPageAddress and data keywords.
Moved getScreenBuffer keyword to a more appropriate location.
2014-08-26 10:49:09 -04:00
Emil Ong
9573e7d6cc Fix clipping issue for circleFill when top is offscreen.
Replaced circleFill algorithm with a scanning algorithm. Also fixes
problem with XOR draw mode for filled circles.
2014-08-24 14:28:33 -07:00
Scott Allen
86784fe2a4 Merge branch 'master' of https://github.com/geekammo/MicroView-Arduino-Library 2014-08-21 10:55:24 -04:00
JP
cf97ba6c23 added Flashing Heart Example 2014-08-21 13:47:36 +10:00
Scott Allen
dfe47be3c8 Merge branch 'user_screen_access'
Change name from uView.screenBuffer() to uView.getScreenBuffer()
2014-08-20 17:26:56 -04:00
jpliew
db155041ff Merge pull request #13 from MLXXXp/user_screen_access
Add uView.screenBuffer() for access to screen RAM.
2014-08-20 20:46:43 +10:00
Scott Allen
ba0b779740 Changed name from screenBuffer to getScreenBuffer 2014-08-20 06:24:57 -04:00
Scott Allen
8eab806dec Merge branch 'master' of https://github.com/MLXXXp/MicroView-Arduino-Library 2014-08-19 11:07:37 -04:00
Scott Allen
9873dc728a Merge branch 'user_screen_access'
Added screenBuffer keyword
2014-08-19 11:02:34 -04:00
Scott Allen
72fdeeb77b Added screenBuffer keyword 2014-08-19 10:57:31 -04:00
Scott Allen
4a8583e2a6 Merge branch 'user_screen_access'
Add function to get a pointer to the start of the RAM screen buffer
for direct write and read access.
2014-08-19 10:16:51 -04:00
Scott Allen
b0e4a9600f Add uView.screenBuffer() for access to screen RAM.
Returns a pointer to the start of the RAM screen buffer
for direct write and read access.
2014-08-19 10:01:51 -04:00
JP
9dba039aa5 v1.19b 2014-08-19 13:14:20 +10:00
jpliew
e5e5ecb037 Merge pull request #12 from MLXXXp/left_scroll
Left scroll
2014-08-19 12:37:20 +10:00
Scott Allen
e203d3b7cd Merge branch 'user_screen_access'
Allow users to gain direct write and read access to the RAM screen buffer.
2014-08-17 08:41:00 -04:00
Scott Allen
c07b86476a Add uView.scrollLeft() function.
Same as existing uView.scrollRight() but in the opposite direction.
2014-08-16 22:58:28 -04:00
Scott Allen
db2904c64e Merge branch 'master' of https://github.com/geekammo/MicroView-Arduino-Library 2014-08-16 22:43:42 -04:00
Scott Allen
b91baf75f8 Add uView.screenBuffer() for access to screen RAM.
Returns a pointer the the start of the RAM screen buffer
for direct write and read access.
2014-08-16 21:56:47 -04:00
jpliew
6208dcd106 Merge pull request #11 from MLXXXp/slider_ticks
Simplify slider widget drawFace() function.
2014-08-12 12:17:02 +10:00
jpliew
1349942310 Merge pull request #10 from MLXXXp/widget_val_range
Handle full signed 16 bit ranges for widgets.
2014-08-12 12:16:46 +10:00
Scott Allen
95626610e1 Merge branch 'slider_ticks'.
Simplified slider widget drawFace() function.
2014-08-10 20:33:05 -04:00
Scott Allen
0b56edc962 Handle full signed 16 bit ranges for widgets.
Widgets will now work properly with minimum and maximum values
from −32,768 to 32,767.
Also, place the numeric value field close to sliders
and horizontally centred in gauges.
2014-08-10 20:23:16 -04:00
Scott Allen
4bbfea3cf2 Simplify slider widget drawFace() function.
Use just one loop to draw all minor ticks.
Use a second loop to extend lines for major ticks.
Use totalTicks variable to determine number of ticks to draw.
2014-08-10 15:37:48 -04:00
Scott Allen
0eeb47d20a Fix reDraw keyword - changed spaces to tab. 2014-08-05 17:59:30 -04:00
Scott Allen
fa93b3e21e Added reDraw keyword. 2014-08-04 19:47:38 -04:00
JP
78e7abeafa merged vSlider_reverse_2 2014-08-05 09:41:47 +10:00
jpliew
0d06e90e3d Merge pull request #9 from MLXXXp/vSlider_reverse_2
Reverse direction of virtical sliders
2014-08-05 09:39:19 +10:00
Scott Allen
cc1d78384a Changed vertical slider direction.
Low values at the bottom. High values at the top.
2014-08-04 19:20:18 -04:00
Scott Allen
77928f1b74 Fixed compiler warning in MicroViewSlider.
In drawFace, majorLine could be left uninitialised if style was invalid
(although this couldn't happen with the current code).
Also cleaned up the WIDGETSTYLE tests.
2014-08-04 17:54:10 -04:00
JP
00a80911de fixed typo 2014-08-04 21:27:06 +10:00
JP
b64d5e4417 fixed child widget double declare of reDraw() 2014-08-04 21:23:06 +10:00
JP
87e118eb44 moved reDraw() to parent 2014-08-04 11:00:49 +10:00
JP
94fc7e6437 moved reDraw() to parent 2014-08-04 11:00:08 +10:00
JP
7c3ec25d70 added reDraw() 2014-08-04 10:36:33 +10:00
JP
dce58d7069 added reDraw() for MicroViewWidget class 2014-08-04 10:22:47 +10:00
6 changed files with 1352 additions and 1147 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -114,7 +114,7 @@
#define DEACTIVATESCROLL 0x2E
#define SETVERTICALSCROLLAREA 0xA3
#define RIGHTHORIZONTALSCROLL 0x26
#define LEFT_HORIZONTALSCROLL 0x27
#define LEFTHORIZONTALSCROLL 0x27
#define VERTICALRIGHTHORIZONTALSCROLL 0x29
#define VERTICALLEFTHORIZONTALSCROLL 0x2A
@@ -192,6 +192,7 @@ public:
uint8_t getLCDHeight(void);
void setColor(uint8_t color);
void setDrawMode(uint8_t mode);
uint8_t *getScreenBuffer(void);
// Font functions
uint8_t getFontWidth(void);
@@ -226,6 +227,7 @@ private:
class MicroViewWidget {
public:
bool needFirstDraw;
MicroViewWidget(uint8_t newx, uint8_t newy, int16_t min, int16_t max);
uint8_t getX();
uint8_t getY();
@@ -238,10 +240,12 @@ public:
void setMaxValue(int16_t max);
void setMinValue(int16_t max);
void setValue(int16_t val);
uint8_t getMaxValLen();
/** \brief Draw widget value overridden by child class. */
virtual void draw(){};
/** \brief Draw widget face overridden by child class. */
virtual void drawFace(){};
void reDraw();
private:
uint8_t x;
@@ -259,7 +263,6 @@ public:
void drawFace();
private:
uint8_t totalTicks, style;
bool needFirstDraw;
int16_t prevValue;
};
@@ -271,7 +274,6 @@ public:
void drawFace();
private:
uint8_t radius, style;
bool needFirstDraw;
int16_t prevValue;
};
@@ -339,6 +341,9 @@ void MVSPIClass::detachInterrupt() {
SPCR &= ~_BV(SPIE);
}
extern MicroView uView;
/** \brief Get the number of print characters for a 16 bit signed value. */
uint8_t getInt16PrintLen(int16_t val);
#endif

View File

@@ -83,6 +83,7 @@ void loop() {
void setup() {
uView.begin();
uView.clear(PAGE);
Serial.begin(115200); // user decide the baud rate
}
void loop() {
@@ -91,6 +92,27 @@ void loop() {
</code></pre>
## History
**v1.20b: 27th August 2014 by Scott Allen, Emil Ong**
* added Flashing Heart Example - JP
* added getScreenBuffer() for access to screen RAM - Scott
* added keywords for existing functions - Scott
* fixed circleFill() - Emil
**v1.19b: 19th August 2014 by Scott Allen**
* added uView.scrollLeft() function
* simplified Silder Widget drawFace() function
* added full signed 16 bit ranges for widgets
* improved drawing for minor and major ticks
**v1.18b: 5th August 2014 by Scott Allen**
* fixed compiler warning in MicroViewSlider
* changed vertical slider direction.
**v1.17b: 4th August 2014 by JP Liew**
* added reDraw() for MicroViewWidget class
* removed Serial.begin() from uView.begin() so that user can have control
* added MicroViewWidgetRedraw example
**v1.16b: 3rd August 2014 by czetie**
* added vertical slider widget
@@ -98,7 +120,7 @@ void loop() {
* improved lots of low level routines, Fast SPI
* fixed some compilation warnings
* reduced overdriving display inputs
* added uVuew.end() to power off the display
* added uView.end() to power off the display
* improved speed of display() and clear() functions
* fixed positionning of "3" on clock face
@@ -143,7 +165,7 @@ void loop() {
**v1.05b: 6th February 2014 by JP Liew**
* changed MICROVIEW class name to MicroView
* created MICROVIEWWIDGET class
* created MicroViewWidget class
* added routines to draw widget
* added slider widget
* merged MicroViewWidget into MicroView

View File

@@ -0,0 +1,101 @@
/*
MicroView Arduino Flashing Heart Demo
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
const unsigned char logo [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xE0, 0xE0, 0xE0,
0xE0, 0xE0, 0xE0, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
0xFF, 0xFF, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xFF, 0xFF,
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,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x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup() {
uView.begin();
uView.clear(PAGE);
}
void loop() {
unsigned char i,j;
for (i=0; i<6; i++) {
uView.setPageAddress(i);
uView.setColumnAddress(0);
for (j=0;j<0x40;j++) {
uView.data(logo[i*0x40+j]);
}
}
delay(800);
for (i=0; i<6; i++) {
uView.setPageAddress(i);
uView.setColumnAddress(0);
for (j=0;j<0x40;j++) {
uView.data(logo2[i*0x40+j]);
}
}
delay(150);
}

View File

@@ -0,0 +1,48 @@
/*
MicroView Arduino Library
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
MicroViewWidget *widget[2]; // declaring an array of 4 MicroViewWidget
void setup() {
uView.begin(); // init and start MicroView
widget[0] = new MicroViewSlider(0,0,0,255); // declare widget0 as a Slider at x=0, y=0, min=0, max=100
widget[1] = new MicroViewGauge(32,24,0,255,WIDGETSTYLE0); // declare widget0 as a Slider at x=0, y=10, min=0, max=150
uView.clear(PAGE); // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
}
void loop() {
widget[0]->reDraw();
for (int i=0;i<=255;i++) {
widget[0]->setValue(i); // set value i to widget0
uView.display();
}
delay(500);
uView.clear(PAGE);
widget[1]->reDraw();
for (int i=0;i<=255;i++) {
widget[1]->setValue(i); // set value i to widget0
uView.display();
}
delay(500);
uView.clear(PAGE);
}

View File

@@ -17,7 +17,6 @@ MicroViewGauge KEYWORD1
#######################################
begin KEYWORD2
invert KEYWORD2
clear KEYWORD2
invert KEYWORD2
contrast KEYWORD2
@@ -50,6 +49,10 @@ scrollVertLeft KEYWORD2
scrollStop KEYWORD2
flipVertical KEYWORD2
flipHorizontal KEYWORD2
setColumnAddress KEYWORD2
setPageAddress KEYWORD2
data KEYWORD2
getScreenBuffer KEYWORD2
getX KEYWORD2
getY KEYWORD2
@@ -61,6 +64,7 @@ setMaxValue KEYWORD2
setMinValue KEYWORD2
setValue KEYWORD2
draw KEYWORD2
reDraw KEYWORD2
drawFace KEYWORD2
checkComm KEYWORD2