Skip to content

Commit

Permalink
Move packet up one namespace level
Browse files Browse the repository at this point in the history
  • Loading branch information
higaski committed Jul 9, 2023
1 parent a637011 commit 945ebc2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Activation of the MDU protocol is accomplished through a sequence of commands to
| CV106 == 0x00 | CV106 == 0x00 |

### Alternative entry
As an alternative to entry via DCC CV verify commands, MDU commands with [default bit timings](#bit-timings) can be sent directly after switching on the track voltage. It is recommended to send out the shortest command, [Busy](#busy), for at least 20ms.
As an alternative to entry via DCC CV verify commands, MDU commands with [default bit timings](#bit-timings) can be sent directly after switching on the track voltage. It is recommended to send out the shortest command, [Busy](#busy), for at least 200ms.

### Transmission
Bit transmission takes place MSB-first similar to the DCC protocol described in [RCN-210](http://normen.railcommunity.de/RCN-210.pdf) through zero crossings (change of polarity) of the track signal. In contrast to DCC, the transmission of a bit does not require two, but only one zero crossing. The decision as to whether a received bit represents a zero bit, one bit or acknowledgment bit is determined by the time interval between the zero crossings. This time interval has a default value at the beginning, but can be varied using a separate command (see [Config-Transfer-Rate command](#config-transfer-rate)). In addition, there are so-called fallback timings that must be able to be received at any time.
Expand Down
15 changes: 7 additions & 8 deletions include/mdu/rx/packet.hpp → include/mdu/packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

/// Receive packet
/// Packet
///
/// \file mdu/rx/packet.hpp
/// \file mdu/packet.hpp
/// \author Vincent Hamp
/// \date 12/12/2022

Expand All @@ -13,13 +13,12 @@
#include <array>
#include <cstddef>
#include <cstdint>
#include "../command.hpp"
#include "../crc32.hpp"
#include "../utility.hpp"
#include "command.hpp"
#include "crc32.hpp"
#include "utility.hpp"

namespace mdu::rx {
namespace mdu {

/// Receive packet
struct Packet {
std::array<uint8_t,
sizeof(Command) + sizeof(uint32_t) + 256uz + sizeof(Crc32)>
Expand All @@ -35,4 +34,4 @@ constexpr Command packet2command(Packet const& packet) {
return static_cast<Command>(data2uint32(cbegin(packet.data)));
}

} // namespace mdu::rx
} // namespace mdu
2 changes: 1 addition & 1 deletion include/mdu/rx/firmware_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <span>
#include "../command.hpp"
#include "../crc32.hpp"
#include "../packet.hpp"
#include "base.hpp"
#include "packet.hpp"

extern "C" {
#include <salsa20/ecrypt-sync.h>
Expand Down
2 changes: 1 addition & 1 deletion include/mdu/rx/mixin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <type_traits>
#include "../command.hpp"
#include "packet.hpp"
#include "../packet.hpp"

namespace mdu::rx::detail {

Expand Down
2 changes: 1 addition & 1 deletion include/mdu/rx/zpp_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <span>
#include <string_view>
#include "../command.hpp"
#include "../packet.hpp"
#include "base.hpp"
#include "packet.hpp"

namespace mdu::rx {

Expand Down

0 comments on commit 945ebc2

Please sign in to comment.