mirror of
https://github.com/geekammo/MicroView-Arduino-Library.git
synced 2026-02-20 11:31:24 +01:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dba039aa5 | ||
|
|
e5e5ecb037 | ||
|
|
c07b86476a | ||
|
|
db2904c64e | ||
|
|
6208dcd106 | ||
|
|
1349942310 | ||
|
|
95626610e1 | ||
|
|
0b56edc962 | ||
|
|
4bbfea3cf2 | ||
|
|
0eeb47d20a | ||
|
|
fa93b3e21e | ||
|
|
78e7abeafa | ||
|
|
0d06e90e3d | ||
|
|
cc1d78384a | ||
|
|
77928f1b74 | ||
|
|
00a80911de | ||
|
|
b64d5e4417 | ||
|
|
87e118eb44 | ||
|
|
94fc7e6437 | ||
|
|
7c3ec25d70 | ||
|
|
dce58d7069 |
2298
MicroView.cpp
2298
MicroView.cpp
File diff suppressed because it is too large
Load Diff
12
MicroView.h
12
MicroView.h
@@ -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
|
||||
|
||||
@@ -226,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();
|
||||
@@ -238,10 +239,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 +262,6 @@ public:
|
||||
void drawFace();
|
||||
private:
|
||||
uint8_t totalTicks, style;
|
||||
bool needFirstDraw;
|
||||
int16_t prevValue;
|
||||
};
|
||||
|
||||
@@ -271,7 +273,6 @@ public:
|
||||
void drawFace();
|
||||
private:
|
||||
uint8_t radius, style;
|
||||
bool needFirstDraw;
|
||||
int16_t prevValue;
|
||||
};
|
||||
|
||||
@@ -339,6 +340,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
|
||||
|
||||
20
README.md
20
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,6 +92,21 @@ void loop() {
|
||||
</code></pre>
|
||||
|
||||
## History
|
||||
**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 +114,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 +159,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
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -61,6 +61,7 @@ setMaxValue KEYWORD2
|
||||
setMinValue KEYWORD2
|
||||
setValue KEYWORD2
|
||||
draw KEYWORD2
|
||||
reDraw KEYWORD2
|
||||
drawFace KEYWORD2
|
||||
checkComm KEYWORD2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user