TOF based Presence Detector

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
hux
Date:
Mon Aug 20 16:43:10 2018 +0000
Revision:
29:eceecbe28088
Parent:
28:a23b16555909
made in Shanghai

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 28:a23b16555909 1 // xn6180.h - X-NUCLEO 6180XA1 expansion board functionality
hux 28:a23b16555909 2 //
hux 28:a23b16555909 3 // Example 1:
hux 28:a23b16555909 4 //
hux 28:a23b16555909 5 // DisplayShield *pShield = new DisplayShield;
hux 28:a23b16555909 6 // pShield->init("INIT",1000) // display "INIT" @ 1000 ms
hux 28:a23b16555909 7 //
hux 28:a23b16555909 8 #ifndef _XN6180_H_
hux 28:a23b16555909 9 #define _XN6180_H_
hux 28:a23b16555909 10
hux 28:a23b16555909 11 #include "x_nucleo_6180xa1.h"
hux 28:a23b16555909 12
hux 28:a23b16555909 13 #define InterruptTOF range_continuous_interrupt // just an alias
hux 28:a23b16555909 14 #define InterruptALS als_continuous_interrupt // just an alias
hux 28:a23b16555909 15 #define PollTOF range_continuous_poll // just an alias
hux 28:a23b16555909 16 #define PollALS als_continuous_poll // just an alias
hux 28:a23b16555909 17
hux 28:a23b16555909 18 enum OpModeIntPoll_t { PollMeasure, IntMeasure }; // red slider position
hux 28:a23b16555909 19
hux 28:a23b16555909 20 typedef OperatingMode OpMode; // a short hand for Operating Mode
hux 28:a23b16555909 21
hux 28:a23b16555909 22 class DisplayShield
hux 28:a23b16555909 23 {
hux 28:a23b16555909 24 public:
hux 28:a23b16555909 25 DevI2C *pDevice;
hux 28:a23b16555909 26 X_NUCLEO_6180XA1 *pBoard;
hux 28:a23b16555909 27 MeasureData_t data;
hux 28:a23b16555909 28 bool flagService; // data read service request flag
hux 28:a23b16555909 29
hux 28:a23b16555909 30 public:
hux 28:a23b16555909 31 OperatingMode curMode; // board's current operating mode
hux 28:a23b16555909 32 OperatingMode prvMode; // board's previous operating mode
hux 28:a23b16555909 33
hux 28:a23b16555909 34 public: // construction
hux 28:a23b16555909 35 DisplayShield(); // constructor
hux 28:a23b16555909 36 void init(const char *msg = 0, int msec = 1000); // initialize shield
hux 28:a23b16555909 37
hux 28:a23b16555909 38 public: // public methods
hux 28:a23b16555909 39 void set(); // set stop request
hux 28:a23b16555909 40 void clear(); // clear stop request
hux 28:a23b16555909 41 bool request(); // stop requested?
hux 28:a23b16555909 42 void disable(); // disable interrupt
hux 28:a23b16555909 43 void ready(); // set data ready status
hux 28:a23b16555909 44 int handle(); // handle IRQ
hux 28:a23b16555909 45 int start(void (*pCb)(void));// start measurement
hux 28:a23b16555909 46 // int start(); // start measurement
hux 28:a23b16555909 47 int stop(); // stop current measurement
hux 28:a23b16555909 48
hux 28:a23b16555909 49 void display(const char * msg);
hux 28:a23b16555909 50 void display(const char * msg, int msec); // display & wait
hux 28:a23b16555909 51 void refresh(OpMode mode);
hux 28:a23b16555909 52 void refresh(); // refresh display in current mode
hux 28:a23b16555909 53
hux 28:a23b16555909 54 public:
hux 28:a23b16555909 55 bool slider(enum OpModeIntPoll_t OpMode); // did slider change?
hux 28:a23b16555909 56 bool setup(OpMode mode); // setup the operation mode
hux 28:a23b16555909 57
hux 28:a23b16555909 58 void startMessage(OpMode mode);
hux 28:a23b16555909 59 void startMessage();
hux 28:a23b16555909 60 void stopMessage(OpMode mode);
hux 28:a23b16555909 61 void stopMessage();
hux 28:a23b16555909 62 };
hux 28:a23b16555909 63
hux 28:a23b16555909 64
hux 28:a23b16555909 65 #endif // _XN6180_H_