15 template<u
int8_t PIN,
class PINTYPE=ArduinoPins>
19 uint16_t ontime, offtime;
21 Buzzer () :
Alarm(0), enable(
false), repeat(0), ontime(0), offtime(0) {
27 PINTYPE::setOutput(PIN);
30 void enabled(
bool value) {
34 bool on (uint16_t onticks,uint16_t offticks,int8_t repeat) {
48 bool on (uint16_t ticks) {
49 return on(ticks,0,1) ;
53 if( enable ==
true ) {
54 sysclock.cancel(*
this);
55 PINTYPE::setHigh(PIN);
61 bool off (
bool force) {
62 if ( force ==
true ) {
75 return PINTYPE::getState(PIN) == HIGH;
78 virtual void trigger (__attribute__ ((unused))
AlarmClock& clock) {
81 if (repeat != -1) repeat--;
82 if( (repeat != 0) && ontime > 0 ) {
87 else if( (repeat != 0) && ontime > 0 ) {
100 void enabled(__attribute__ ((unused))
bool value) {}
101 bool on (__attribute__ ((unused))uint16_t onticks,__attribute__ ((unused))uint16_t offticks,__attribute__ ((unused))uint8_t repeat) {
return false; }
102 bool on (__attribute__ ((unused)) uint16_t ticks) {
return false; }
103 bool on () {
return false; }
105 bool active () {
return false; }