From 35cd1f0704429b2bdf3923e2b90b7058eb69484d Mon Sep 17 00:00:00 2001 From: Joshua Saxby <joshua.a.saxby@gmail.com> Date: Thu, 5 Mar 2020 18:51:04 +0000 Subject: [PATCH] Some tidy up, removed unrequired methods from Transceiver Wrote very small amount of demo code in main() to test pairing --- source/Transceiver.hpp | 17 +---------------- source/main.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/source/Transceiver.hpp b/source/Transceiver.hpp index 3707b6e..b71da6d 100644 --- a/source/Transceiver.hpp +++ b/source/Transceiver.hpp @@ -30,25 +30,10 @@ // SAXBOPHONE.COM is my domain, so I'm using the reverse form as my namespace namespace com_saxbophone { /** - * @brief A basic class responsible only for pairing and low-level comms + * @brief A basic class responsible only for low-level comms */ class Transceiver { public: - /** - * @brief Attempt to pair with another connected micro:bit - * @param my_role Whether we wish to be the Master or Slave for comms - * purposes - * @returns true if paired successfully - * @returns false if unable to pair successfully - * @note This is a blocking call! - */ - bool pair(Role my_role); - - /** - * @returns Whether or not this Transceiver is currently paired - */ - bool is_paired() const; - /** * @brief Used to allow synchronising both of a paired Master and Slave * @details Blocks the caller until a point in time a fixed duration diff --git a/source/main.cpp b/source/main.cpp index 047622c..0547b9d 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -375,7 +375,7 @@ void morse_checker() { * NOTE: for now, just sending characters as-is but in the future * they will be encoded rather than sent raw */ - transceiver.send(current); // NOTE: Might need cast + // transceiver.send(current); // NOTE: Might need cast } else { // otherwise, peek into what the code appears to be thus far char peek = decoder.peek(); @@ -414,10 +414,15 @@ int main() { button_tracker.init(); // enable the morse checker! morse_checker_enabled = true; + // scroll "PM" to mean "PAIRED MASTER" + ubit.display.scroll("PM"); + } else if (my_role == Role::SLAVE) { + // scroll "PS" to mean "PAIRED SLAVE" + ubit.display.scroll("PS"); } // call barrier to synchronise both master and slave - transceiver.barrier(); + // transceiver.barrier(); /* BEGIN COMMS */ @@ -434,7 +439,7 @@ int main() { * in the future */ - transceiver.close(); + // transceiver.close(); // if we're the Master, we need to stop the button tracker if (my_role == Role::MASTER) { -- GitLab