void chime() {
/* called from the RTI interrupt, sees if we need to turn the chime on or
- * off (chime would be on for N RTI cycles
+ * off (chime would be on for N RTI cycles)
*/
if (chime_count) {
- bset((void*)&_io_ports[M6811_PORTA], PORTA_CHIME);
+ chime_on();
--chime_count;
} else
- bclr((void*)&_io_ports[M6811_PORTA], PORTA_CHIME);
+ chime_off();
}
#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;
-void chime();
+/* outside world interface */
extern inline void chime_start() { chime_count = CHIME_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_ */