Mechatronic Zen Garden  0.1
This webpage contains documentation for the ME 507 term project: Mechatronic Zen Garden.
baseshare.h
Go to the documentation of this file.
1 //*****************************************************************************
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIB-
23  * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29  * THE POSSIBILITY OF SUCH DAMAGE. */
30 //*****************************************************************************
31 
32 // This define prevents this .h file from being included more than once
33 #ifndef _BASESHARE_H_
34 #define _BASESHARE_H_
35 
36 #include <Arduino.h>
37 
38 // Different functions are used in STM32's and ESP32's to determine if the CPU
39 // is currently running within an interrupt service routine
40 #ifdef ESP32
41  #define CHECK_IF_IN_ISR() xPortInIsrContext()
42 #elif (defined STM32F4xx || defined STM32L4xx)
43  #define CHECK_IF_IN_ISR() xPortIsInsideInterrupt()
44 #endif
45 
46 
54 class BaseShare
55 {
56  protected:
61  char name[16];
62 
71 
79 
80  public:
81  // Construct a base shared data item
82  BaseShare (const char* p_name = NULL);
83 
92  virtual void print_in_list (Print& printer) = 0;
93 
94  // }
95  friend void print_all_shares (Print& printer);
96 };
97 
98 
99 // Function that prints a list of shares and queues
100 void print_all_shares (Print& printer);
101 
102 #endif // _BASESHARE_H_
BaseShare::print_all_shares
friend void print_all_shares(Print &printer)
Start the printout showing the status of all shared data items.
Definition: baseshare.cpp:74
BaseShare::print_in_list
virtual void print_in_list(Print &printer)=0
Print one shared data item within a list.
BaseShare::name
char name[16]
The name of the shared item.
Definition: baseshare.h:61
BaseShare::p_next
BaseShare * p_next
Pointer to the next item in the linked list of shares.
Definition: baseshare.h:70
BaseShare::p_newest
static BaseShare * p_newest
Pointer to the most recently created shared data item.
Definition: baseshare.h:78
BaseShare::BaseShare
BaseShare(const char *p_name=NULL)
Construct a base shared data item.
Definition: baseshare.cpp:46
print_all_shares
void print_all_shares(Print &printer)
Start the printout showing the status of all shared data items.
Definition: baseshare.cpp:74
BaseShare
Base class for classes that share data in a thread-safe manner between tasks.
Definition: baseshare.h:55