From bf1c7d0e371a9fb2dda76d9a4ba374d2c1bc55ff Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Mon, 23 Aug 2021 09:40:54 +0100 Subject: [PATCH] Add a "flip" method to device to allow tone sequence generation. Signed-off-by: Adrian Conlon --- inc/Device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/Device.h b/inc/Device.h index f3ab5ed..0263aa4 100644 --- a/inc/Device.h +++ b/inc/Device.h @@ -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()); }