chain morse operator <<

This commit is contained in:
Kizarm 2024-01-20 13:09:36 +01:00
parent 99f41213c3
commit 26c483196a

View file

@ -32,11 +32,11 @@ export class Morse {
: unit (ms), led (pin) {
sys::init ();
}
void operator<< (const char * text) const;
const Morse & operator<< (const char * text) const;
protected:
void out (const morse_byte mb) const;
};
void Morse::operator<< (const char * text) const {
const Morse & Morse::operator<< (const char * text) const {
const unsigned len = slen (text);
for (unsigned n=0; n<len; n++) {
const char c = text [n];
@ -54,6 +54,7 @@ void Morse::operator<< (const char * text) const {
out (mb);
}
sys::delay (10 * unit);
return * this;
}
/* . => 1 x unit
* - => 3 x unit