chain morse operator <<
This commit is contained in:
parent
99f41213c3
commit
26c483196a
1 changed files with 3 additions and 2 deletions
|
@ -32,11 +32,11 @@ export class Morse {
|
||||||
: unit (ms), led (pin) {
|
: unit (ms), led (pin) {
|
||||||
sys::init ();
|
sys::init ();
|
||||||
}
|
}
|
||||||
void operator<< (const char * text) const;
|
const Morse & operator<< (const char * text) const;
|
||||||
protected:
|
protected:
|
||||||
void out (const morse_byte mb) const;
|
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);
|
const unsigned len = slen (text);
|
||||||
for (unsigned n=0; n<len; n++) {
|
for (unsigned n=0; n<len; n++) {
|
||||||
const char c = text [n];
|
const char c = text [n];
|
||||||
|
@ -54,6 +54,7 @@ void Morse::operator<< (const char * text) const {
|
||||||
out (mb);
|
out (mb);
|
||||||
}
|
}
|
||||||
sys::delay (10 * unit);
|
sys::delay (10 * unit);
|
||||||
|
return * this;
|
||||||
}
|
}
|
||||||
/* . => 1 x unit
|
/* . => 1 x unit
|
||||||
* - => 3 x unit
|
* - => 3 x unit
|
||||||
|
|
Loading…
Reference in a new issue