coursework
Dependencies: USBDevice mbed-rtos mbed
function_generator/signal.cpp@0:c059d38d6074, 2016-11-28 (annotated)
- Committer:
- riyood
- Date:
- Mon Nov 28 10:32:43 2016 +0000
- Revision:
- 0:c059d38d6074
the coursework;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
riyood | 0:c059d38d6074 | 1 | #include "signal.h" |
riyood | 0:c059d38d6074 | 2 | #include "stdio.h" // for sprintf() |
riyood | 0:c059d38d6074 | 3 | |
riyood | 0:c059d38d6074 | 4 | const char* Signal::c_str (char* str) { |
riyood | 0:c059d38d6074 | 5 | switch(type){ |
riyood | 0:c059d38d6074 | 6 | case CONSTANT: sprintf(str, "constant %f", amplitude); break; |
riyood | 0:c059d38d6074 | 7 | case SINE: sprintf(str, "sin %f %f", amplitude, frequency); break; |
riyood | 0:c059d38d6074 | 8 | case SQUARE: sprintf(str, "square %f %f", amplitude, frequency); break; |
riyood | 0:c059d38d6074 | 9 | default: sprintf(str, "none"); break; |
riyood | 0:c059d38d6074 | 10 | } |
riyood | 0:c059d38d6074 | 11 | return str; |
riyood | 0:c059d38d6074 | 12 | } |
riyood | 0:c059d38d6074 | 13 |