Skip to content

Commit

Permalink
OS avoid send_preamble if OS_PREAMBLE_PULSE_WIDTH = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
gioblu committed Oct 2, 2018
1 parent c3b3658 commit 53769a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/strategies/OverSampling/OverSampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,13 @@ class OverSampling {
/* Send preamble with a requested number of pulses: */

void send_preamble() {
PJON_IO_WRITE(_output_pin, HIGH);
uint32_t time = PJON_MICROS();
while((uint32_t)(PJON_MICROS() - time) < OS_PREAMBLE_PULSE_WIDTH);
PJON_IO_WRITE(_output_pin, LOW);
PJON_DELAY_MICROSECONDS(OS_TIMEOUT - OS_BIT_WIDTH);
#if OS_PREAMBLE_PULSE_WIDTH > 0
PJON_IO_WRITE(_output_pin, HIGH);
uint32_t time = PJON_MICROS();
while((uint32_t)(PJON_MICROS() - time) < OS_PREAMBLE_PULSE_WIDTH);
PJON_IO_WRITE(_output_pin, LOW);
PJON_DELAY_MICROSECONDS(OS_TIMEOUT - OS_BIT_WIDTH);
#endif
};


Expand Down

0 comments on commit 53769a4

Please sign in to comment.