More bugfixes & initing
[uccvend-snackrom.git] / ROM2 / comm.h
index 69f8d00..65a3446 100644 (file)
@@ -12,6 +12,7 @@
  *  KX - keypad press where X is (ascii 0..9 or R)
  *  CXXXXX - coin balance, XXXXX is number of cents.
  *  MXYY - dispense ack/nack. X is what happened (0..MOTOR_*_FAIL), YY is the motor
+ *  DX - door open/close event where X is 1 for open, 0 for closed.
  *
  * Messages Received:
  *  VXX - vend a slot XX
@@ -23,7 +24,7 @@
  *
  */
 
-#define TX_BUFFER_LEN 6 /* maximum 13 due to the way tx_int works with the FIFO */
+#define TX_BUFFER_LEN 6 /* maximum 12 due to the way tx_int works with the FIFO */
 extern char tx_buffer[TX_BUFFER_LEN+2]; /* \n + null terminated */
 #define RX_BUFFER_LEN 11
 extern volatile char rx_buffer[RX_BUFFER_LEN+1]; /* null terminated */
@@ -42,8 +43,13 @@ extern volatile u8 rx_queue_state;
  */
 extern volatile u8 tx_queue_state;
 
+extern inline void wait_for_tx_free() { while (tx_queue_state & 0x01); }
+
 void comm_init();
 void msg_clr();
+void send_packet();
+void send_ack();
+void send_nack();
 
 /*************************************/
 /*** 16550 UART specific #defines  ***/

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