Honor --invert-start-stop in TX
This commit is contained in:
parent
d4d54b2c14
commit
99e221619e
|
@ -83,12 +83,13 @@ static void fsk_transmit_frame(
|
||||||
float bfsk_space_f,
|
float bfsk_space_f,
|
||||||
float bfsk_nstartbits,
|
float bfsk_nstartbits,
|
||||||
float bfsk_nstopbits,
|
float bfsk_nstopbits,
|
||||||
|
int invert_start_stop,
|
||||||
int bfsk_msb_first
|
int bfsk_msb_first
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if ( bfsk_nstartbits > 0 )
|
if ( bfsk_nstartbits > 0 )
|
||||||
simpleaudio_tone(sa_out, bfsk_space_f,
|
simpleaudio_tone(sa_out, invert_start_stop ? bfsk_mark_f : bfsk_space_f,
|
||||||
bit_nsamples * bfsk_nstartbits); // start
|
bit_nsamples * bfsk_nstartbits); // start
|
||||||
for ( i=0; i<n_data_bits; i++ ) { // data
|
for ( i=0; i<n_data_bits; i++ ) { // data
|
||||||
unsigned int bit;
|
unsigned int bit;
|
||||||
|
@ -102,7 +103,7 @@ static void fsk_transmit_frame(
|
||||||
simpleaudio_tone(sa_out, tone_freq, bit_nsamples);
|
simpleaudio_tone(sa_out, tone_freq, bit_nsamples);
|
||||||
}
|
}
|
||||||
if ( bfsk_nstopbits > 0 )
|
if ( bfsk_nstopbits > 0 )
|
||||||
simpleaudio_tone(sa_out, bfsk_mark_f,
|
simpleaudio_tone(sa_out, invert_start_stop ? bfsk_space_f : bfsk_mark_f,
|
||||||
bit_nsamples * bfsk_nstopbits); // stop
|
bit_nsamples * bfsk_nstopbits); // stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ static void fsk_transmit_stdin(
|
||||||
int n_data_bits,
|
int n_data_bits,
|
||||||
float bfsk_nstartbits,
|
float bfsk_nstartbits,
|
||||||
float bfsk_nstopbits,
|
float bfsk_nstopbits,
|
||||||
|
int invert_start_stop,
|
||||||
int bfsk_msb_first,
|
int bfsk_msb_first,
|
||||||
unsigned int bfsk_do_tx_sync_bytes,
|
unsigned int bfsk_do_tx_sync_bytes,
|
||||||
unsigned int bfsk_sync_byte,
|
unsigned int bfsk_sync_byte,
|
||||||
|
@ -160,19 +162,19 @@ static void fsk_transmit_stdin(
|
||||||
tx_transmitting = 1;
|
tx_transmitting = 1;
|
||||||
/* emit leader tone (mark) */
|
/* emit leader tone (mark) */
|
||||||
for ( j=0; j<tx_leader_bits_len; j++ )
|
for ( j=0; j<tx_leader_bits_len; j++ )
|
||||||
simpleaudio_tone(sa_out, bfsk_mark_f, bit_nsamples);
|
simpleaudio_tone(sa_out, invert_start_stop ? bfsk_space_f : bfsk_mark_f, bit_nsamples);
|
||||||
/* emit "preamble" of sync bytes */
|
/* emit "preamble" of sync bytes */
|
||||||
for ( j=0; j<bfsk_do_tx_sync_bytes; j++ )
|
for ( j=0; j<bfsk_do_tx_sync_bytes; j++ )
|
||||||
fsk_transmit_frame(sa_out, bfsk_sync_byte, n_data_bits,
|
fsk_transmit_frame(sa_out, bfsk_sync_byte, n_data_bits,
|
||||||
bit_nsamples, bfsk_mark_f, bfsk_space_f,
|
bit_nsamples, bfsk_mark_f, bfsk_space_f,
|
||||||
bfsk_nstartbits, bfsk_nstopbits, 0);
|
bfsk_nstartbits, bfsk_nstopbits, invert_start_stop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emit data bits */
|
/* emit data bits */
|
||||||
for ( j=0; j<nwords; j++ )
|
for ( j=0; j<nwords; j++ )
|
||||||
fsk_transmit_frame(sa_out, bits[j], n_data_bits,
|
fsk_transmit_frame(sa_out, bits[j], n_data_bits,
|
||||||
bit_nsamples, bfsk_mark_f, bfsk_space_f,
|
bit_nsamples, bfsk_mark_f, bfsk_space_f,
|
||||||
bfsk_nstartbits, bfsk_nstopbits, bfsk_msb_first);
|
bfsk_nstartbits, bfsk_nstopbits, invert_start_stop, bfsk_msb_first);
|
||||||
|
|
||||||
if ( tx_interactive )
|
if ( tx_interactive )
|
||||||
setitimer(ITIMER_REAL, &itv, NULL);
|
setitimer(ITIMER_REAL, &itv, NULL);
|
||||||
|
@ -867,6 +869,7 @@ main( int argc, char*argv[] )
|
||||||
bfsk_n_data_bits,
|
bfsk_n_data_bits,
|
||||||
bfsk_nstartbits,
|
bfsk_nstartbits,
|
||||||
bfsk_nstopbits,
|
bfsk_nstopbits,
|
||||||
|
invert_start_stop,
|
||||||
bfsk_msb_first,
|
bfsk_msb_first,
|
||||||
bfsk_do_tx_sync_bytes,
|
bfsk_do_tx_sync_bytes,
|
||||||
bfsk_sync_byte,
|
bfsk_sync_byte,
|
||||||
|
|
Loading…
Reference in New Issue