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
Update README to reflect new repository structure
[uccvend-snackrom.git]
/
ROM2
/
keypad.c
diff --git
a/ROM2/keypad.c
b/ROM2/keypad.c
index
8ffa664
..
5bd5e2e
100644
(file)
--- a/
ROM2/keypad.c
+++ b/
ROM2/keypad.c
@@
-16,8
+16,8
@@
const u8 keymap1[3] = {KEY_9, KEY_0, KEY_RESET};
/* reads the keypad and returns the bit number that was turned on in the shift
* register (from 0..7). If no bits were turned on, it returns 8 (aka NO_KEY)
*/
/* reads the keypad and returns the bit number that was turned on in the shift
* register (from 0..7). If no bits were turned on, it returns 8 (aka NO_KEY)
*/
-extern inline u8 keypad_read_row(u8 row) {
- u8 i,
j,
num;
+extern inline u8 keypad_read_row(
const
u8 row) {
+ u8 i, num;
if (row)
bset((void*)&_io_ports[M6811_PORTD], PORTD_KEYPAD_ROW);
if (row)
bset((void*)&_io_ports[M6811_PORTD], PORTD_KEYPAD_ROW);
@@
-31,30
+31,15
@@
extern inline u8 keypad_read_row(u8 row) {
bclr_misc_output(A3800_DISPLAY_WRITE); /* disable the display clock */
bclr_misc_output(A3800_DISPLAY_WRITE); /* disable the display clock */
- /* _io_ports[M6811_SPDR] = 0; */
- asm volatile (
- "ldab #0\n"
- "stab %0\n"
- : "=m" (_io_ports[M6811_SPDR])
- :
- : "b"
- );
+ _io_ports[M6811_SPDR] = 0x55; /* doesn't matter what we send. */
while(!(_io_ports[M6811_SPSR]&M6811_SPIF)); /* wait for completion */
/* SPDR read to clear SPIF flag is performed below: */
i = _io_ports[M6811_SPDR];
while(!(_io_ports[M6811_SPSR]&M6811_SPIF)); /* wait for completion */
/* SPDR read to clear SPIF flag is performed below: */
i = _io_ports[M6811_SPDR];
- /* print out the row & read in key in binary */
- char msg_buf[11] = "XKXXXXXXXX";
- msg_buf[0] = row?'1':'0';
- for (j = 1, num = 0; num < 8; j = j << 1, num++) {
- msg_buf[num+2] = (i & j)?'1':'0';
- }
- set_msg(msg_buf);
-
num = 0;
num = 0;
- while (((i & 0x
01
) == 0) && (num < 8)) {
- i = i
>>
1;
+ while (((i & 0x
80
) == 0) && (num < 8)) {
+ i = i
<<
1;
num++;
}
num++;
}
UCC
git Repository :: git.ucc.asn.au