Message Integrity Checking
[uccvend-snackrom.git] / ROM2 / chime.h
index 7cc7fa7..412c082 100644 (file)
@@ -2,12 +2,23 @@
 #define _CHIME_H_
 
 #include "types.h"
+#include "vend.h"
 
-#define CHIME_TIME 10 /* number of RTI interrupts to have the chimer on */
+#define CHIME_TIME 5 /* number of RTIs to have the chime on (6.6ms each) */
 
-extern u8 chime_count;
+extern volatile u8 chime_count;
+extern volatile u8 unchime_count;
 
-void chime();
+/* outside world interface */
 extern inline void chime_start() { chime_count = CHIME_TIME; }
+extern inline void unchime_start() { unchime_count = CHIME_TIME; }
+extern inline void chime_for(u8 time) { chime_count = time; }
+extern inline void unchime_for(u8 time) { unchime_count = time; }
+
+void chime(); /* RTI interrupt */
+
+/* internal helpers, also could be called from outside world */
+extern inline void chime_on() { bset((void*)&_io_ports[M6811_PORTA], PORTA_CHIME); }
+extern inline void chime_off() { bclr((void*)&_io_ports[M6811_PORTA], PORTA_CHIME);}
 
 #endif /* _CHIME_H_ */

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