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
More bugfixes & initing
[uccvend-snackrom.git]
/
ROM2
/
main_basic.c
diff --git
a/ROM2/main_basic.c
b/ROM2/main_basic.c
index
e459471
..
8a48086
100644
(file)
--- a/
ROM2/main_basic.c
+++ b/
ROM2/main_basic.c
@@
-89,8
+89,7
@@
void give_change() {
coin_cost(cost);
send_ack();
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();
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();
@@
-104,18
+103,44
@@
void send_keypress(u8 key) {
send_packet();
}
send_packet();
}
+void send_door_msg(bool open) {
+ wait_for_tx_free();
+ tx_buffer[0] = 'D';
+ tx_buffer[1] = open?'1':'0';
+ tx_buffer[2] = '\n';
+ tx_buffer[3] = 0;
+ send_packet();
+}
+
void do_chime() {
chime_start();
send_ack();
}
int main() {
void do_chime() {
chime_start();
send_ack();
}
int main() {
- u16 last_coin_value = coin_value;
+ u16 last_coin_value;
+ bool last_door_open;
+
+ chime_start();
+
+ misc_output = 0;
+ changer_output = 0x7f;
+ _io_ports[M6811_PORTA] = 0xc8;
+ _io_ports[M6811_DDRD] = 0x3e;
+ _io_ports[M6811_SPCR] = 0x12;
- /* init coin mech */
- comm_init();
display_init();
display_init();
+ comm_init();
+ coinmech_init();
+
+ last_coin_value = 0;
+ last_door_open = 0;
while(1) {
while(1) {
+ if (door_open() != last_door_open) {
+ last_door_open = door_open();
+ send_door_msg(last_door_open);
+ }
+
if (rx_queue_state) {
switch (msg_buf[0]) {
case 'V':
if (rx_queue_state) {
switch (msg_buf[0]) {
case 'V':
@@
-135,6
+160,7
@@
int main() {
break;
default:
/* shrug */
break;
default:
/* shrug */
+ send_nack();
break;
}
msg_clr();
break;
}
msg_clr();
UCC
git Repository :: git.ucc.asn.au