Miscellaneous Library, read Encoder etc.

Dependents:   My_Libraries

Files at this revision

API Documentation at this revision

Comitter:
altb
Date:
Wed Mar 06 14:19:10 2019 +0000
Parent:
0:3312872854c4
Child:
2:1c5c71a6fac9
Commit message:
dropped Signal

Changed in this revision

Signal.cpp Show diff for this revision Revisions of this file
Signal.h Show diff for this revision Revisions of this file
--- a/Signal.cpp	Mon Mar 04 11:03:51 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Signal.cpp
- * Copyright (c) 2017, ZHAW
- * All rights reserved.
- */
-
-#include "Signal.h"
-
-using namespace std;
-
-int32_t Signal::signals = 0;
-
-/**
- * Creates a signal object and assignes a unique flag.
- */
-Signal::Signal() {
-    
-    mutex.lock();
-    
-    int32_t n = 0;
-    while ((((1 << n) & signals) > 0) && (n < 30)) n++;
-    signal = (1 << n);
-    
-    mutex.unlock();
-}
-
-/**
- * Deletes the signal object and releases the assigned flag.
- */
-Signal::~Signal() {
-    
-    mutex.lock();
-    
-    signals &= ~signal;
-    
-    mutex.unlock();
-}
-
-/**
- * Gets the assigned signal flag.
- */
-int32_t Signal::read() {
-    
-    return signal;
-}
-
-/**
- * The empty operator is a shorthand notation of the <code>read()</code> method.
- */
-Signal::operator int32_t() {
-    
-    return read();
-}
-
--- a/Signal.h	Mon Mar 04 11:03:51 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Signal.h
- * Copyright (c) 2017, ZHAW
- * All rights reserved.
- */
-
-#ifndef SIGNAL_H_
-#define SIGNAL_H_
-
-#include <cstdlib>
-#include <stdint.h>
-#include <mbed.h>
-
-/**
- * This class manages the handling of unique signal flags to trigger rtos threads.
- */
-class Signal {
-    
-    public:
-        
-                        Signal();
-        virtual         ~Signal();
-        virtual int32_t read();
-                        operator int32_t();
-        
-    private:
-        
-        static int32_t  signals;    // variable that holds all assigned signal flags
-        int32_t         signal;     // signal flag of this object
-        Mutex           mutex;      // mutex to lock critical sections
-};
-
-#endif /* SIGNAL_H_ */
-