config led in main
This commit is contained in:
parent
f6db62d0cf
commit
99f41213c3
4 changed files with 10 additions and 7 deletions
2
Makefile
2
Makefile
|
@ -53,7 +53,7 @@ tabgen: tabgen.cpp
|
|||
table.cpp: tabgen
|
||||
./tabgen
|
||||
# MODULES #
|
||||
main.o: main.cpp morse.pcm
|
||||
main.o: main.cpp morse.pcm io.pcm
|
||||
morse.o: morse.cpp table.cpp io.pcm sys.pcm
|
||||
morse.pcm: morse.cpp table.cpp io.pcm sys.pcm
|
||||
%.o: %.cpp
|
||||
|
|
6
main.cpp
6
main.cpp
|
@ -1,8 +1,10 @@
|
|||
/* SIMPLE EXAMPLE: LED blinking */
|
||||
import morse; // use module !!!
|
||||
import morse; // use modules !!!
|
||||
import io;
|
||||
//////////////////////////////////////
|
||||
int main () {
|
||||
Morse morse (330);
|
||||
const io::GpioClass led (io::GpioPortA, 10);
|
||||
const Morse morse (led, 330);
|
||||
for (;;) {
|
||||
morse << "Hello world";
|
||||
}
|
||||
|
|
|
@ -25,10 +25,11 @@ union morse_byte {
|
|||
#include "table.cpp"
|
||||
export class Morse {
|
||||
const unsigned unit;
|
||||
const io::GpioClass led;
|
||||
const io::GpioClass & led;
|
||||
|
||||
public:
|
||||
explicit Morse (const unsigned ms = 100) noexcept : unit (ms), led (io::GpioPortA, 10) {
|
||||
explicit Morse (const io::GpioClass & pin, const unsigned ms = 100) noexcept
|
||||
: unit (ms), led (pin) {
|
||||
sys::init ();
|
||||
}
|
||||
void operator<< (const char * text) const;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#error "BAD ENDIAN"
|
||||
#endif
|
||||
static const char * oname = "table.cpp";
|
||||
static const char * const morse_code [] = { /* nedefinované znaky nahrazeny mezrou */
|
||||
static const char * const morse_code [] = { /* nedefinované znaky nahrazeny mezerou */
|
||||
" ", /* */ " ", /*!*/ ".-..-.", /*"*/ " ", /*#*/ " ", /*$*/
|
||||
" ", /*%*/ " ", /*&*/ ".----.", /*'*/ "-.--.", /*(*/ "-.--.-", /*)*/
|
||||
" ", /***/ ".-.-.", /*+*/ "--..--", /*,*/ "-....-", /*-*/ ".-.-.-", /*.*/ "-..-." , /*/*/
|
||||
|
|
Loading…
Reference in a new issue