Eng Riyadh / mbed_function
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers signal.cpp Source File

signal.cpp

00001 #include "signal.h"
00002 #include "stdio.h"  // for sprintf()
00003 
00004 const char* Signal::c_str (char* str) {
00005     switch(type){
00006         case CONSTANT:  sprintf(str, "constant %f", amplitude); break;
00007         case SINE:      sprintf(str, "sin %f %f", amplitude, frequency); break;
00008         case SQUARE:    sprintf(str, "square %f %f", amplitude, frequency); break;
00009         default:        sprintf(str, "none"); break;
00010     }
00011     return str;
00012 }
00013