git.ucc.asn.au
/
uccvend-snackrom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more changes
[uccvend-snackrom.git]
/
ROM2
/
display.c
diff --git
a/ROM2/display.c
b/ROM2/display.c
index
b05d33a
..
84df86e
100644
(file)
--- a/
ROM2/display.c
+++ b/
ROM2/display.c
@@
-17,6
+17,7
@@
char current_message[256]; /* message that is scrolled or switched between */
u8 msg_length; /* length of current_message */
u8 wrap_mode; /* whether to scroll or alternate between msgs */
u8 scroll_point; /* how far through the message we have scrolled */
u8 msg_length; /* length of current_message */
u8 wrap_mode; /* whether to scroll or alternate between msgs */
u8 scroll_point; /* how far through the message we have scrolled */
+bool have_scrolled; /* true after one scroll (used for scroll_msg())*/
/* private prototypes */
void display_send_byte(char c);
/* private prototypes */
void display_send_byte(char c);
@@
-24,7
+25,7
@@
void display_reset();
void display_update();
void append_msg(char* newmsg, u8 wrap) {
void display_update();
void append_msg(char* newmsg, u8 wrap) {
- char* dest = current_message
[msg_length]
;
+ char* dest = current_message
+msg_length
;
/* equivalent of a string copy */
while (newmsg) {
dest = newmsg;
/* equivalent of a string copy */
while (newmsg) {
dest = newmsg;
@@
-42,13
+43,25
@@
void set_msg(char* newmsg, u8 wrap) {
display_update();
}
display_update();
}
+void scroll_msg(char* newmsg) {
+ /* puts a message on display and does not return until the message has
+ * scrolled across once.
+ */
+ set_msg(newmsg, WRAP_SCROLL);
+ have_scrolled = 0;
+ while (!have_scrolled);
+}
+
void display_shift() {
/* update the display for WRAP_SCROLL or WRAP_ALTERNATE modes */
switch (wrap_mode) {
case WRAP_SCROLL:
case WRAP_ALTERNATE:
scroll_point++;
void display_shift() {
/* update the display for WRAP_SCROLL or WRAP_ALTERNATE modes */
switch (wrap_mode) {
case WRAP_SCROLL:
case WRAP_ALTERNATE:
scroll_point++;
- if (scroll_point >= msg_length) scroll_point = 0;
+ if (scroll_point >= msg_length) {
+ scroll_point = 0;
+ have_scrolled = 1;
+ }
display_update();
break;
}
display_update();
break;
}
UCC
git Repository :: git.ucc.asn.au