display & keypad work
[uccvend-snackrom.git] / ROM2 / keypad.c
1 #include "vend.h"
2
3 int keypad_read_row() {
4         bclr_misc_output(A3800_DISPLAY_WRITE);  /* disable the display clock */
5
6         _io_ports[M6811_SPDR] = 0;
7         while(!(_io_ports[M6811_SPDR]&M6811_SPIE)); /* wait for completion */
8
9         return _io_ports[M6811_SPDR];
10 }
11
12 /* row is 0 or 1 */
13 void keypad_select_row(int row) {
14         if (row)
15                 _io_ports[M6811_PORTD] |= PORTD_KEYPAD_ROW;
16         else
17                 _io_ports[M6811_PORTD] &= ~PORTD_KEYPAD_ROW;
18 }
19

UCC git Repository :: git.ucc.asn.au