2 * display.c - functions for controlling the display on the vending machine.
4 * Use set_msg(char*) to write a new message to the screen, replacing the previous
5 * one. The message can be at most 1023 characters long. Use set_wrap_mode with
6 * one of the WRAP_* options in vend.h to set the scrolling behaviour. If the
7 * message is less than 10 characters, it is centered and is not scrolled.
8 * Otherwise, the message will scroll.
15 char display_buffer[10]; /* what each byte on the display reads */
16 char current_message[1024]; /* message that is scrolled or switched between */
17 u8 wrap_mode; /* whether to scroll or alternate between msgs */
19 void set_msg(char* newmsg) {
20 char* dest = current_message;
21 /* while (dest++ = newmsg++); */
29 void __inline__ set_wrap_mode(u8 new_wrap_mode) {
30 /* in theory it should be inlined anyway? */
31 wrap_mode = new_wrap_mode;
34 void display_send_byte(u8 b) {
35 bset_3800(A3800_DISPLAY_WRITE);
38 #define DISPLAY_DELAY 100 /* ms to delay between ops - could be tweaked */
39 void display_reset() {
40 /* lower the reset line for 100ms */
41 bclr(PORTA, PORTA_DISP_RESET);
43 bset(PORTA, PORTA_DISP_RESET);
49 /* tell the controller there are 10 digits */
53 void display_refresh() {