mirror of
https://github.com/geekammo/MicroView-Arduino-Library.git
synced 2026-02-20 11:31:24 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87e118eb44 | ||
|
|
94fc7e6437 | ||
|
|
7c3ec25d70 | ||
|
|
dce58d7069 | ||
|
|
82d55a8201 | ||
|
|
d28428ce35 | ||
|
|
77faa7d583 | ||
|
|
eb9edb19d6 | ||
|
|
21fa22bec2 | ||
|
|
5afff4bff7 | ||
|
|
b5462c5bcb | ||
|
|
7b66741f79 | ||
|
|
c1e8756c4e |
2193
MicroView.cpp
2193
MicroView.cpp
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,8 @@
|
||||
#define WIDGETSTYLE0 0
|
||||
#define WIDGETSTYLE1 1
|
||||
#define WIDGETSTYLE2 2
|
||||
//Added for Vertical slider styles
|
||||
#define WIDGETSTYLE3 3
|
||||
|
||||
#define SETCONTRAST 0x81
|
||||
#define DISPLAYALLONRESUME 0xA4
|
||||
@@ -224,6 +226,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();
|
||||
@@ -240,6 +243,7 @@ public:
|
||||
virtual void draw(){};
|
||||
/** \brief Draw widget face overridden by child class. */
|
||||
virtual void drawFace(){};
|
||||
void reDraw();
|
||||
|
||||
private:
|
||||
uint8_t x;
|
||||
@@ -255,9 +259,9 @@ public:
|
||||
MicroViewSlider(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty);
|
||||
void draw();
|
||||
void drawFace();
|
||||
void reDraw();
|
||||
private:
|
||||
uint8_t totalTicks, style;
|
||||
bool needFirstDraw;
|
||||
int16_t prevValue;
|
||||
};
|
||||
|
||||
@@ -267,9 +271,9 @@ public:
|
||||
MicroViewGauge(uint8_t newx, uint8_t newy, int16_t min, int16_t max, uint8_t sty);
|
||||
void draw();
|
||||
void drawFace();
|
||||
void reDraw();
|
||||
private:
|
||||
uint8_t radius, style;
|
||||
bool needFirstDraw;
|
||||
int16_t prevValue;
|
||||
};
|
||||
|
||||
@@ -337,6 +341,5 @@ void MVSPIClass::detachInterrupt() {
|
||||
SPCR &= ~_BV(SPIE);
|
||||
}
|
||||
|
||||
|
||||
extern MicroView uView;
|
||||
#endif
|
||||
|
||||
21
README.md
21
README.md
@@ -83,6 +83,7 @@ void loop() {
|
||||
void setup() {
|
||||
uView.begin();
|
||||
uView.clear(PAGE);
|
||||
Serial.begin(115200); // user decide the baud rate
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -91,7 +92,23 @@ void loop() {
|
||||
</code></pre>
|
||||
|
||||
## History
|
||||
**v1.14b: 26th July 2014 by JP Liew
|
||||
**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
|
||||
|
||||
**v1.15b: 3rd August 2014 by Scott Allen**
|
||||
* improved lots of low level routines, Fast SPI
|
||||
* fixed some compilation warnings
|
||||
* reduced overdriving display inputs
|
||||
* added uVuew.end() to power off the display
|
||||
* improved speed of display() and clear() functions
|
||||
* fixed positionning of "3" on clock face
|
||||
|
||||
**v1.14b: 26th July 2014 by JP Liew**
|
||||
* added Learning Kit Circuit Sketch
|
||||
|
||||
**v1.13b: 13th June 2014 by JP Liew**
|
||||
@@ -132,7 +149,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
|
||||
|
||||
43
examples/MicroViewVSlider/MicroViewVSlider.ino
Normal file
43
examples/MicroViewVSlider/MicroViewVSlider.ino
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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 *vWidget1, *vWidget2;
|
||||
|
||||
void setup() {
|
||||
uView.begin();
|
||||
uView.clear(PAGE);
|
||||
|
||||
vWidget1 = new MicroViewSlider(0, 0, 0, 255, WIDGETSTYLE2);
|
||||
vWidget2 = new MicroViewSlider(31, 0, 0, 255, WIDGETSTYLE3);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
for (int i=0;i<=255;i++) {
|
||||
vWidget1->setValue(i);
|
||||
vWidget2->setValue(255-i);
|
||||
uView.display();
|
||||
}
|
||||
|
||||
for(int i=255; i>=0;i--) {
|
||||
vWidget1->setValue(i);
|
||||
vWidget2->setValue(255-i);
|
||||
uView.display();
|
||||
}
|
||||
}
|
||||
|
||||
48
examples/MicroViewWidgetRedraw/MicroViewWidgetRedraw.ino
Normal file
48
examples/MicroViewWidgetRedraw/MicroViewWidgetRedraw.ino
Normal 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);
|
||||
}
|
||||
@@ -77,5 +77,6 @@ ALL LITERAL1
|
||||
WIDGETSTYLE0 LITERAL1
|
||||
WIDGETSTYLE1 LITERAL1
|
||||
WIDGETSTYLE2 LITERAL1
|
||||
WIDGETSTYLE3 LITERAL1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user