display & keypad work
[uccvend-snackrom.git] / ROM2 / keypad.c
index 80a11a7..5ab9b45 100644 (file)
@@ -1,2 +1,19 @@
 #include "vend.h"
 
+int keypad_read_row() {
+       bclr_misc_output(A3800_DISPLAY_WRITE);  /* disable the display clock */
+
+       _io_ports[M6811_SPDR] = 0;
+       while(!(_io_ports[M6811_SPDR]&M6811_SPIE)); /* wait for completion */
+
+       return _io_ports[M6811_SPDR];
+}
+
+/* row is 0 or 1 */
+void keypad_select_row(int row) {
+       if (row)
+               _io_ports[M6811_PORTD] |= PORTD_KEYPAD_ROW;
+       else
+               _io_ports[M6811_PORTD] &= ~PORTD_KEYPAD_ROW;
+}
+

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