|
@@ -27,6 +27,7 @@ static uint8_t parity;
|
|
|
ISR(USART1_UDRE_vect)
|
|
|
{
|
|
|
static uint8_t data, left, gap;
|
|
|
+ static uint16_t block_bytes;
|
|
|
uint8_t pattern;
|
|
|
|
|
|
if (!left) {
|
|
@@ -45,18 +46,37 @@ ISR(USART1_UDRE_vect)
|
|
|
fmtx_disable();
|
|
|
return;
|
|
|
}
|
|
|
+ data = nd;
|
|
|
+ if (!block_bytes) {
|
|
|
+ if (data == 0x02) {
|
|
|
+ /*
|
|
|
+ * Beginning of a data block, suppress
|
|
|
+ * FF = silence until the end of the block
|
|
|
+ *
|
|
|
+ * STX+header+data+ETX+csum
|
|
|
+ */
|
|
|
+ block_bytes = 1+3+253+1+2;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ block_bytes--;
|
|
|
+ }
|
|
|
+
|
|
|
data = nd;
|
|
|
left = 8;
|
|
|
gap = 0;
|
|
|
}
|
|
|
|
|
|
- pattern = fm_pat[data & PATTERN_BIT_MASK] ^ parity;
|
|
|
+ if (!block_bytes && data == 0xff) {
|
|
|
+ pattern = parity;
|
|
|
+ } else {
|
|
|
+ pattern = fm_pat[data & PATTERN_BIT_MASK] ^ parity;
|
|
|
+ data >>= BITS_PER_PATTERN_BYTE;
|
|
|
+ parity = -((int8_t)pattern < 0);
|
|
|
+ }
|
|
|
+ left -= BITS_PER_PATTERN_BYTE;
|
|
|
|
|
|
UCSR1A = TX_IDLE;
|
|
|
UDR1 = pattern;
|
|
|
- data >>= BITS_PER_PATTERN_BYTE;
|
|
|
- left -= BITS_PER_PATTERN_BYTE;
|
|
|
- parity = -((int8_t)pattern < 0);
|
|
|
}
|
|
|
|
|
|
/*
|