u8 last_byte;
-
u8 parity_test(u8 c) {
u8 parity = 0;
for (parity = 0; c; c = c>>1) {
last_byte = c;
while (!(_io_ports[M6811_SCSR] & M6811_TDRE)); /* wait for TD register empty */
- if (parity_of(c))
- bset(&_io_ports[M6811_SCCR1], M6811_T8);
+ if (parity_test(c))
+ bset((void*)&_io_ports[M6811_SCCR1], M6811_T8);
else
- bclr(&_io_ports[M6811_SCCR1], M6811_T8);
+ bclr((void*)&_io_ports[M6811_SCCR1], M6811_T8);
}
void ask_for_retrans() {
}
/* all bytes must have the correct ID in the 3 MSBs */
- if (in & 0xe0 != COINMECH_ID) return;
+ if ((in & 0xe0) != COINMECH_ID) return;
/* we have a good packet */
if (in == 0x3f) {
return;
}
- if (packet_pos != 0 && !IS_CTRL(x&0x10)) {
+ if (packet_pos != 0 && !IS_CTRL(in&0x10)) {
switch (in & 0x0f) {
}
} else {
}
}
+
+void coin_eat() {
+}
/* take amt and show it on screen with a $ sign */
char str[10] = {' ', '$', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
u8 pos;
- for (pos = 7; amt; pos--, amt/=10);
+ for (pos = 7; amt; pos--, amt/=10) {
str[pos] = amt%10 + '0';
}
set_msg(str, WRAP_NONE);
#include "keypad.h"
#include "chime.h"
#include "server.h"
+#include "coinmech.h"
#include "vend.h"
u16 uid;
u8 selection;
u16 scroll_timer;
+u16 coin_value;
bool uid_enter() {
u8 uidpos;
switch (last_key) {
case KEY_RESET:
scroll_msg("PRESS COIN REFUND");
- goto reset;
+ while (coin_value);
+ break;
case KEY_0:
switch (server_credit_account(uid, pin, coin_value)) {
case CREDIT_OK:
coin_eat();
- set_msg(" SUCCESS! ");
+ set_msg(" SUCCESS! ", WRAP_NONE);
delay(1000);
break;
case CREDIT_FAIL:
- coin_refund();
- set_msg(" FAILED! ");
- delay(1000);
+ set_msg(" FAILED! " "PRESS COIN" " REFUND ",
+ WRAP_ALTERNATE);
+ while (coin_value);
break;
}
break;
break;
default:
selection = selection * 10 + (last_key%10);
- make_request(uid, pin, selection);
+ make_request(selection);
selection = 0;
}
}
#define REQUEST_INVAL -4 /* no such item */
u8 server_authenticate(u16 uid, u16 pin);
+u8 server_request(u16 uid, u16 pin, u8 item);
+u8 server_credit_account(u16 uid, u16 pin, u16 amt);
#endif /* _SERVER_H_ */