Revision 8673ee72
| b/host/examples/tx_waveforms.cpp | ||
|---|---|---|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
float gen_square(float x){
|
| 40 |
return (std::fmod(x, 1) < float(0.5))? 0 : 1;
|
|
| 40 |
return float((std::fmod(x, 1) < float(0.5))? 0 : 1);
|
|
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
float gen_ramp(float x){
|
| ... | ... | |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
float gen_sine(float x){
|
| 48 |
return std::sin(x*2*M_PI); |
|
| 48 |
static const float two_pi = 2*std::acos(float(-1)); |
|
| 49 |
return std::sin(x*two_pi); |
|
| 49 | 50 |
} |
| 50 | 51 |
|
| 51 | 52 |
int UHD_SAFE_MAIN(int argc, char *argv[]){
|
| ... | ... | |
| 123 | 124 |
|
| 124 | 125 |
//allocate the buffer and precalculate values |
| 125 | 126 |
std::vector<std::complex<float> > buff(spb); |
| 126 |
const float cps = wave_freq/sdev->get_tx_rate();
|
|
| 127 |
const float cps = float(wave_freq/sdev->get_tx_rate());
|
|
| 127 | 128 |
const float i_off = (wave_freq > 0)? float(0.25) : 0; |
| 128 | 129 |
const float q_off = (wave_freq < 0)? float(0.25) : 0; |
| 129 | 130 |
float theta = 0; |
Also available in: Unified diff