Mbed Cloud example program for workshop in W27 2018.

Dependencies:   MMA7660 LM75B

Committer:
MACRUM
Date:
Sat Jun 30 01:40:30 2018 +0000
Revision:
0:119624335925
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:119624335925 1 #ifndef BLOCK_EXEC_H
MACRUM 0:119624335925 2 #define BLOCK_EXEC_H
MACRUM 0:119624335925 3
MACRUM 0:119624335925 4 #include "mbed.h"
MACRUM 0:119624335925 5
MACRUM 0:119624335925 6 /* Helper class to execute something whenever entering/leaving a basic block */
MACRUM 0:119624335925 7 class BlockExecuter {
MACRUM 0:119624335925 8 public:
MACRUM 0:119624335925 9 BlockExecuter(Callback<void()> exit_cb, Callback<void()> enter_cb = Callback<void()>()) :
MACRUM 0:119624335925 10 _exit_cb(exit_cb) {
MACRUM 0:119624335925 11 if((bool)enter_cb) enter_cb();
MACRUM 0:119624335925 12 }
MACRUM 0:119624335925 13
MACRUM 0:119624335925 14 ~BlockExecuter(void) {
MACRUM 0:119624335925 15 _exit_cb();
MACRUM 0:119624335925 16 }
MACRUM 0:119624335925 17
MACRUM 0:119624335925 18 private:
MACRUM 0:119624335925 19 Callback<void()> _exit_cb;
MACRUM 0:119624335925 20 };
MACRUM 0:119624335925 21
MACRUM 0:119624335925 22 #endif //BLOCK_EXEC_H