X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fmain_basic.c;h=6019371dc265cc4e7eca1653e3544a7159f2ad66;hb=0b1cde693aae432ed16592cc85edfc3ae0d645a2;hp=8a48086ced1c688656405375e5f4c0cb0b997042;hpb=41ad37ba6d86ccc4f8f720cb09f7891ae166cb38;p=uccvend-snackrom.git diff --git a/ROM2/main_basic.c b/ROM2/main_basic.c index 8a48086..6019371 100644 --- a/ROM2/main_basic.c +++ b/ROM2/main_basic.c @@ -90,6 +90,7 @@ void give_change() { coin_cost(cost); send_ack(); } + void send_keypress(u8 key) { /* send a packet of the form KX with X being the key, or R for reset */ wait_for_tx_free(); @@ -97,7 +98,7 @@ void send_keypress(u8 key) { if (key == KEY_RESET) tx_buffer[1] = 'R'; else - tx_buffer[1] = key+'0'; + tx_buffer[1] = (key%10)+'0'; tx_buffer[2] = '\n'; tx_buffer[3] = 0; send_packet(); @@ -121,13 +122,17 @@ int main() { u16 last_coin_value; bool last_door_open; - chime_start(); + chime_on(); misc_output = 0; changer_output = 0x7f; _io_ports[M6811_PORTA] = 0xc8; _io_ports[M6811_DDRD] = 0x3e; _io_ports[M6811_SPCR] = 0x12; + + delay(1000); chime_off(); /* mainly for debugging */ + + unlock(); /* enable interrupts */ display_init(); comm_init(); @@ -135,6 +140,7 @@ int main() { last_coin_value = 0; last_door_open = 0; + while(1) { if (door_open() != last_door_open) { last_door_open = door_open(); @@ -169,7 +175,6 @@ int main() { keypad_read(); if (keypad_pressed()) { send_keypress(last_key); - /* beep? */ } if (coin_value != last_coin_value) {