X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fchime.h;h=412c082dee453062333af24e759866c957d681e3;hb=24f4e50d8f5671b40d2662bbcd50e3859bcd5205;hp=7cc7fa7a900147583d8680661612d15fe1abefc1;hpb=9366107abfbfbe85f00b27449c79284d0e1aa59e;p=uccvend-snackrom.git diff --git a/ROM2/chime.h b/ROM2/chime.h index 7cc7fa7..412c082 100644 --- a/ROM2/chime.h +++ b/ROM2/chime.h @@ -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_ */