Skip to content

Commit

Permalink
Add Receiver::rxWatchPin() to get the RX monitoring pin
Browse files Browse the repository at this point in the history
Also:
1. Updated the docs for 'setRXWatchPin' to remind the caller to configure
   the pin for input.
2. Updated the README.
  • Loading branch information
ssilverman committed Jan 23, 2021
1 parent b645314 commit 6bc65cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to
### Added
* Added a BREAK start timestamp to `PacketStats`, `frameTimestamp`. The value is
in microseconds.
* Added `Receiver::rxWatchPin()` for retrieving the RX watch pin number.
* Added a note to the docs for `Receiver::setRXWatchPin` reminding the caller to
configure the pin for input.

### Changed
* DMX TX and RX are now started with new `startRx` and `startTx` convenience
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,17 @@ Packet statistics are tracked and the latest can be retrieved from a
4. `breakPlusMABTime`: The sum of the BREAK and MAB times, in microseconds. It's
not possible to determine where the BREAK ends and the MAB starts without
using another pin to watch the RX line. To set up a connected pin, see
`setRXWatchPin` and the section above on _RX line monitoring_.
`setRXWatchPin` and the section above on
[RX line monitoring](#receiver-timing-limitations-and-rx-line-monitoring).
5. `breakToBreakTime`: The latest measured BREAK-to-BREAK time, in microseconds.
Note that this is not collected at the same time as the other variables and
only represents the last known duration. This will be out of sync with the
rest of the values in the presence of packet errors.
6. `frameTimestamp`: The BREAK start timestamp, in microseconds.
7. `packetTime`: The duration of the last packet, in microseconds, measured from
BREAK start to the end of the last slot.
8. `breakTime`: The packet's BREAK time.
9. `mabTime`: The packet's MAB time.
8. `breakTime`: The packet's BREAK time, set if RX line monitoring is enabled.
9. `mabTime`: The packet's MAB time, set if RX line monitoring is enabled.

If the RX line is not being monitored, then the BREAK and MAB times will be set
to zero.
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ lastPacketTimestamp KEYWORD2
setResponder KEYWORD2
setSetTXNotRXFunc KEYWORD2
setRXWatchPin KEYWORD2
rxWatchPin KEYWORD2
connected KEYWORD2
onConnectChange KEYWORD2
errorStats KEYWORD2
Expand Down
7 changes: 7 additions & 0 deletions src/TeensyDMX.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,15 @@ class Receiver final : public TeensyDMX {

// Sets the pin that monitors the RX line to determine BREAK and MAB timing.
// Set to a negative value to unset. The default is unset.
//
// Don't forget to configure the pin as an input.
void setRXWatchPin(int pin);

// Returns the RX monitoring pin. This will return a negative value if unset.
int rxWatchPin() const {
return rxWatchPin_;
}

// Returns whether this is considered to be connected to a DMX transmitter. A
// connection is considered to have been broken if a timeout was detected or a
// BREAK plus Mark after BREAK (MAB) was too short.
Expand Down

0 comments on commit 6bc65cf

Please sign in to comment.