From e5a7dc5982b0ba1b6ac1d0d2040af0a2458552bb Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Tue, 22 Nov 2016 17:45:38 -0500 Subject: [PATCH] Declare friend class Arduboy2Ex A friend class named Arduboy2Ex is declared by the Arduboy2 classes. The intention is to allow a sketch to create an Arduboy2Ex class which would have access to the private and protected members of the Arduboy2 classes. It is hoped that this may eliminate the need to create an entire local copy of the library, in order to extend the functionality, in most circumstances. --- src/Arduboy2.h | 21 ++++++++++++++++++++- src/Arduboy2Audio.h | 11 +++++++++++ src/Arduboy2Core.h | 13 +++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/Arduboy2.h b/src/Arduboy2.h index 41724f1..77b88b4 100644 --- a/src/Arduboy2.h +++ b/src/Arduboy2.h @@ -117,7 +117,7 @@ struct Point * _minus_ text output. * * This class in inherited by Arduboy2, so if text output functions are - * requred Arduboy2 should be used instead. + * required Arduboy2 should be used instead. * * \note * \parblock @@ -139,10 +139,20 @@ struct Point * \endcode * \endparblock * + * \note + * \parblock + * A friend class named _Arduboy2Ex_ is declared by this class. The intention + * is to allow a sketch to create an _Arduboy2Ex_ class which would have access + * to the private and protected members of the Arduboy2Base class. It is hoped + * that this may eliminate the need to create an entire local copy of the + * library, in order to extend the functionality, in most circumstances. + * \endparblock + * * \see Arduboy2 */ class Arduboy2Base : public Arduboy2Core { + friend class Arduboy2Ex; friend class Sprites; public: @@ -819,10 +829,19 @@ class Arduboy2Base : public Arduboy2Core * This class is derived from Arduboy2Base. It provides text output functions * in addition to all the functions inherited from Arduboy2Base. * + * \note + * A friend class named _Arduboy2Ex_ is declared by this class. The intention + * is to allow a sketch to create an _Arduboy2Ex_ class which would have access + * to the private and protected members of the Arduboy2 class. It is hoped + * that this may eliminate the need to create an entire local copy of the + * library, in order to extend the functionality, in most circumstances. + * * \see Arduboy2Base */ class Arduboy2 : public Print, public Arduboy2Base { + friend class Arduboy2Ex; + public: Arduboy2(); diff --git a/src/Arduboy2Audio.h b/src/Arduboy2Audio.h index fea5fc8..afa6e54 100644 --- a/src/Arduboy2Audio.h +++ b/src/Arduboy2Audio.h @@ -60,9 +60,20 @@ * ArduboyTones sound(arduboy.audio.enabled); * \endcode * \endparblock + * + * \note + * \parblock + * A friend class named _Arduboy2Ex_ is declared by this class. The intention + * is to allow a sketch to create an _Arduboy2Ex_ class which would have access + * to the private and protected members of the Arduboy2Audio class. It is hoped + * that this may eliminate the need to create an entire local copy of the + * library, in order to extend the functionality, in most circumstances. + * \endparblock */ class Arduboy2Audio { + friend class Arduboy2Ex; + public: /** \brief * Initialize the speaker based on the current mute setting. diff --git a/src/Arduboy2Core.h b/src/Arduboy2Core.h index bb5182f..03d4062 100644 --- a/src/Arduboy2Core.h +++ b/src/Arduboy2Core.h @@ -145,9 +145,18 @@ * \details * This class is inherited by Arduboy2Base and thus also Arduboy2, so wouldn't * normally be used directly by a sketch. + * + * \note + * A friend class named _Arduboy2Ex_ is declared by this class. The intention + * is to allow a sketch to create an _Arduboy2Ex_ class which would have access + * to the private and protected members of the Arduboy2Core class. It is hoped + * that this may eliminate the need to create an entire local copy of the + * library, in order to extend the functionality, in most circumstances. */ class Arduboy2Core { + friend class Arduboy2Ex; + public: Arduboy2Core(); @@ -422,18 +431,22 @@ class Arduboy2Core * to 255 (fully on). * * \note + * \parblock * Certain libraries that take control of the hardware timers may interfere * with the ability of this function to properly control the RGB LED. *_ArduboyPlaytune_ is one such library known to do this. * The digitalWriteRGB() function will still work properly in this case. + * \endparblock * * \note + * \parblock * Many of the Kickstarter Arduboys were accidentally shipped with the * RGB LED installed incorrectly. For these units, the green LED cannot be * lit. As long as the green led is set to off, setting the red LED will * actually control the blue LED and setting the blue LED will actually * control the red LED. If the green LED is turned fully on, none of the * LEDs will light. + * \endparblock * * \see digitalWriteRGB() */