Skip to content

Commit

Permalink
transmit update
Browse files Browse the repository at this point in the history
  • Loading branch information
paulh002 committed Aug 19, 2021
1 parent 89c1207 commit b6ae7ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions SoapyRadioberrySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ void SoapyRadioberry::setGain( const int direction, const size_t channel, const
{ // 0 -7 TX RF gain

int v = (int)value;
if (v > 16) v = 16;
if (v > 15) v = 15;
if (v < 0) v = 0;
v = v << 28;
command = 0x15;
command = 0x13;
command_data = v;
}

Expand Down
27 changes: 13 additions & 14 deletions SoapyRadioberryStreaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,20 @@ int SoapyRadioberry::writeStream(SoapySDR::Stream *stream, const void * const *b

char tx_buffer[4];

for (int ii = 0; ii < numElems * 2; ii++)
for (int ii = 0; ii < numElems; ii++)
{
float f;
int d;
f = target_buffer[iq];
if (iq % 2)
{
f = -1.0 * f;
}
iq++;
d = f * 2048.0;
tx_buffer[0] = 0;
tx_buffer[1] = (d & 0xFF0000) >> 16;
tx_buffer[2] = (d & 0xFF00) >> 8;
tx_buffer[3] = (d & 0xFF);
float i, q;
uint16_t di, dq;

di = target_buffer[iq++] * 32767.999f;
dq = target_buffer[iq++] * 32767.999f;
// i
tx_buffer[0] = (di & 0xFF00) >> 8;
tx_buffer[1] = (di & 0x00FF);
// q
tx_buffer[2] = (dq & 0xFF00) >> 8;
tx_buffer[3] = (dq & 0x00FF);

// wrtie 4 bytes 1 sample per write
ret = write(fd_rb, tx_buffer, sizeof(tx_buffer));
if (ret == 0)
Expand Down

0 comments on commit b6ae7ba

Please sign in to comment.