Skip to content

Commit c35868d

Browse files
author
Guillaume Giraudon
committed
Complete implementation of Bryston protocol
1 parent e77a9de commit c35868d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/ir_Bryston.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
// Copyright 2025 Guillaume Giraudon - Colquhoun Audio Laboratories
2+
3+
14
/// @file
2-
/// @brief Bryston
5+
/// @brief Support for Bryston Protocols.
6+
/// @note Currently only tested BP19/BR20 but should work for all Bryston Products.
37

48

59
// Supports:
@@ -12,36 +16,32 @@
1216

1317

1418
// Constants
15-
const uint16_t kBrystonTick = 315;
16-
const uint16_t kBrystonHdrMarkTicks = 1;
17-
const uint16_t kBrystonHdrMark = kBrystonHdrMarkTicks * kBrystonTick;
18-
const uint16_t kBrystonHdrSpaceTicks = 3;
19-
const uint16_t kBrystonHdrSpace = kBrystonHdrSpaceTicks * kBrystonTick;
20-
const uint16_t kBrystonBitMarkTicks = 6;
21-
const uint16_t kBrystonBitMark = kBrystonBitMarkTicks * kBrystonTick;
22-
const uint16_t kBrystonOneSpaceTicks = 1;
23-
const uint16_t kBrystonOneSpace = kBrystonOneSpaceTicks * kBrystonTick;
24-
const uint16_t kBrystonZeroSpaceTicks = 6;
25-
const uint16_t kBrystonZeroSpace = kBrystonZeroSpaceTicks * kBrystonTick;
26-
const uint16_t kBrystonMinGapTicks = 18;
27-
const uint16_t kBrystonMinGap = kBrystonMinGapTicks * kBrystonTick;
19+
const uint16_t kBrystonTicks = 315; // Number of bits in a Bryston message.
20+
const uint16_t kBrystonHdrMark = 0;
21+
const uint16_t kBrystonHdrSpace = 0;
22+
const uint16_t kBrystonOneMark = 6 * kBrystonTicks;
23+
const uint16_t kBrystonOneSpace = 1 * kBrystonTicks;
24+
const uint16_t kBrystonZeroMark = 1 * kBrystonTicks;
25+
const uint16_t kBrystonZeroSpace = 6 * kBrystonTicks;
26+
const uint16_t kBrystonMinGap = 0;
27+
const uint16_t kBrystonFooterMark = 0;
2828

2929
#if SEND_BRYSTON
3030
/// Send a Bryston formatted message.
31-
/// Status: STABLE / Working.
3231
/// @param[in] data The message to be sent.
3332
/// @param[in] nbits The number of bits of message to be sent.
3433
/// @param[in] repeat The number of times the command is to be repeated.
3534
void IRsend::sendBryston(uint64_t data, uint16_t nbits, uint16_t repeat) {
36-
sendGeneric(kBrystonHdrMark, kBrystonHdrSpace, kBrystonBitMark, kBrystonOneSpace,
37-
kBrystonBitMark, kBrystonZeroSpace, kBrystonBitMark, kBrystonMinGap, data,
35+
Serial.printf("Sending Bryston: %016llX\n", data);
36+
37+
sendGeneric(kBrystonHdrMark, kBrystonHdrSpace, kBrystonOneMark, kBrystonOneSpace,
38+
kBrystonZeroMark, kBrystonZeroSpace, kBrystonFooterMark, kBrystonMinGap, data,
3839
nbits, 38, true, repeat, 33);
3940
}
4041
#endif // SEND_Bryston
4142

4243
#if DECODE_BRYSTON
4344
/// Decode the supplied Bryston message.
44-
/// Status: STABLE / Working.
4545
/// @param[in,out] results Ptr to the data to decode & where to store the result
4646
/// @param[in] offset The starting index to use when attempting to decode the
4747
/// raw data. Typically/Defaults to kStartOffset.
@@ -58,9 +58,9 @@ bool IRrecv::decodeBryston(decode_results *results, uint16_t offset,
5858
if (!matchGeneric(results->rawbuf + offset, &data,
5959
results->rawlen - offset, nbits,
6060
kBrystonHdrMark, kBrystonHdrSpace,
61-
kBrystonBitMark, kBrystonOneSpace,
62-
kBrystonBitMark, kBrystonZeroSpace,
63-
kBrystonBitMark, kBrystonMinGap, true)) return false;
61+
kBrystonOneMark, kBrystonOneSpace,
62+
kBrystonZeroMark, kBrystonZeroSpace,
63+
kBrystonFooterMark, kBrystonMinGap, true)) return false;
6464
// Success
6565
results->bits = nbits;
6666
results->value = data;

0 commit comments

Comments
 (0)