Add a "flip" method to device to allow tone sequence generation.

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2021-08-23 09:40:54 +01:00
parent 9ea21e786f
commit bf1c7d0e37

View File

@ -104,6 +104,8 @@ namespace EightBit {
static constexpr void match(PinLevel& line, bool condition) noexcept { condition ? raise(line) : lower(line); }
static constexpr void match(PinLevel& out, PinLevel in) noexcept { out = in; }
static constexpr void flip(PinLevel& out) noexcept { out = out == PinLevel::Low ? PinLevel::High : PinLevel::Low; }
virtual ~Device() noexcept {};
[[nodiscard]] constexpr bool powered() const noexcept { return raised(POWER()); }