Skip to content

Commit 9584ff0

Browse files
committed
Added the missing scroll functions. Added scrollInterval as a parameter.
1 parent 0ecbcf8 commit 9584ff0

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

keywords.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,12 @@ NORM LITERAL1
7373
XOR LITERAL1
7474
PAGE LITERAL1
7575
ALL LITERAL1
76+
77+
SCROLL_INTERVAL_5_FRAMES LITERAL1
78+
SCROLL_INTERVAL_64_FRAMES LITERAL1
79+
SCROLL_INTERVAL_128_FRAMES LITERAL1
80+
SCROLL_INTERVAL_256_FRAMES LITERAL1
81+
SCROLL_INTERVAL_3_FRAMES LITERAL1
82+
SCROLL_INTERVAL_4_FRAMES LITERAL1
83+
SCROLL_INTERVAL_25_FRAMES LITERAL1
84+
SCROLL_INTERVAL_2_FRAMES LITERAL1

src/SFE_MicroOLED.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,15 @@ void MicroOLED::scrollStop(void)
10081008
10091009
Set row start to row stop on the OLED to scroll right. Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.
10101010
*/
1011-
void MicroOLED::scrollRight(uint8_t start, uint8_t stop)
1011+
void MicroOLED::scrollRight(uint8_t start, uint8_t stop, uint8_t scrollInterval)
10121012
{
10131013
if (stop < start) // stop must be larger or equal to start
10141014
return;
10151015
scrollStop(); // need to disable scrolling before starting to avoid memory corrupt
10161016
command(RIGHTHORIZONTALSCROLL);
10171017
command(0x00);
10181018
command(start);
1019-
command(0x7); // scroll speed frames , TODO
1019+
command(scrollInterval);
10201020
command(stop);
10211021
command(0x00);
10221022
command(0xFF);
@@ -1027,34 +1027,33 @@ void MicroOLED::scrollRight(uint8_t start, uint8_t stop)
10271027
10281028
Set row start to row stop on the OLED to scroll vert right.
10291029
*/
1030-
void MicroOLED::scrollVertRight(uint8_t start, uint8_t stop)
1030+
void MicroOLED::scrollVertRight(uint8_t start, uint8_t stop, uint8_t scrollInterval)
10311031
{
10321032
if (stop < start) // stop must be larger or equal to start
10331033
return;
10341034
scrollStop(); // need to disable scrolling before starting to avoid memory corrupt
10351035
command(VERTICALRIGHTHORIZONTALSCROLL);
10361036
command(0x00);
10371037
command(start);
1038-
command(0x7); // scroll speed frames , TODO
1038+
command(scrollInterval);
10391039
command(stop);
1040-
command(0x00);
1041-
command(0xFF);
1040+
command(0x01); // Vertical scrolling offset
10421041
command(ACTIVATESCROLL);
10431042
}
10441043

10451044
/** \brief Left scrolling.
10461045
10471046
Set row start to row stop on the OLED to scroll left.
10481047
*/
1049-
void MicroOLED::scrollLeft(uint8_t start, uint8_t stop)
1048+
void MicroOLED::scrollLeft(uint8_t start, uint8_t stop, uint8_t scrollInterval)
10501049
{
10511050
if (stop < start) // stop must be larger or equal to start
10521051
return;
10531052
scrollStop(); // need to disable scrolling before starting to avoid memory corrupt
10541053
command(LEFT_HORIZONTALSCROLL);
10551054
command(0x00);
10561055
command(start);
1057-
command(0x7); // scroll speed frames , TODO
1056+
command(scrollInterval);
10581057
command(stop);
10591058
command(0x00);
10601059
command(0xFF);
@@ -1065,18 +1064,17 @@ void MicroOLED::scrollLeft(uint8_t start, uint8_t stop)
10651064
10661065
Set row start to row stop on the OLED to scroll vert left.
10671066
*/
1068-
void MicroOLED::scrollVertLeft(uint8_t start, uint8_t stop)
1067+
void MicroOLED::scrollVertLeft(uint8_t start, uint8_t stop, uint8_t scrollInterval)
10691068
{
10701069
if (stop < start) // stop must be larger or equal to start
10711070
return;
10721071
scrollStop(); // need to disable scrolling before starting to avoid memory corrupt
10731072
command(VERTICALLEFTHORIZONTALSCROLL);
10741073
command(0x00);
10751074
command(start);
1076-
command(0x7); // scroll speed frames , TODO
1075+
command(scrollInterval);
10771076
command(stop);
1078-
command(0x00);
1079-
command(0xFF);
1077+
command(0x01); // Vertical scrolling offset
10801078
command(ACTIVATESCROLL);
10811079
}
10821080

src/SFE_MicroOLED.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
102102
#define VERTICALRIGHTHORIZONTALSCROLL 0x29
103103
#define VERTICALLEFTHORIZONTALSCROLL 0x2A
104104

105+
#define SCROLL_INTERVAL_5_FRAMES 0b000
106+
#define SCROLL_INTERVAL_64_FRAMES 0b001
107+
#define SCROLL_INTERVAL_128_FRAMES 0b010
108+
#define SCROLL_INTERVAL_256_FRAMES 0b011
109+
#define SCROLL_INTERVAL_3_FRAMES 0b100
110+
#define SCROLL_INTERVAL_4_FRAMES 0b101
111+
#define SCROLL_INTERVAL_25_FRAMES 0b110
112+
#define SCROLL_INTERVAL_2_FRAMES 0b111
113+
105114
typedef enum CMD
106115
{
107116
CMD_CLEAR, //0
@@ -194,10 +203,11 @@ class MicroOLED : public Print
194203
uint8_t getFontTotalChar(void);
195204

196205
// LCD Rotate Scroll functions
197-
void scrollRight(uint8_t start, uint8_t stop);
198-
void scrollLeft(uint8_t start, uint8_t stop);
199-
void scrollVertRight(uint8_t start, uint8_t stop);
200-
void scrollVertLeft(uint8_t start, uint8_t stop);
206+
// start and stop are PAGE addresses: 0-7
207+
void scrollRight(uint8_t start, uint8_t stop, uint8_t scrollInterval = SCROLL_INTERVAL_2_FRAMES);
208+
void scrollLeft(uint8_t start, uint8_t stop, uint8_t scrollInterval = SCROLL_INTERVAL_2_FRAMES);
209+
void scrollVertRight(uint8_t start, uint8_t stop, uint8_t scrollInterval = SCROLL_INTERVAL_2_FRAMES);
210+
void scrollVertLeft(uint8_t start, uint8_t stop, uint8_t scrollInterval = SCROLL_INTERVAL_2_FRAMES);
201211
void scrollStop(void);
202212
void flipVertical(boolean flip);
203213
void flipHorizontal(boolean flip);

0 commit comments

Comments
 (0)