FlexBook / Mbed 2 deprecated FlexBook171204a

Dependencies:   SDFileSystem app epson mbed msp430 pl tests

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pagesensor.h Source File

pagesensor.h

00001 //
00002 // Filename: pagesensor.h
00003 //
00004 // Flexbook page for page A1.
00005 //
00006 
00007 // include guards
00008 #ifndef PAGESENSOR_H
00009 #define PAGESENSOR_H
00010 
00011 #include "page.h"
00012 #include "pagedice.h"
00013 #include "pageoled.h"
00014 #include "mcp23s17.h"
00015 #include "hal.h"
00016 
00017 #include <stdint.h>
00018 
00019 namespace Flexbook
00020 {
00021 
00022 // Sensor data.
00023 struct SensorData
00024 {
00025     SensorData()
00026     : temperature(0), pressure(0), dice(1)
00027     {
00028     }
00029 
00030     uint8_t temperature;
00031     uint8_t pressure;
00032     uint8_t dice;
00033 };
00034 
00035 bool operator!=(const SensorData &lhs, const SensorData &rhs);
00036 
00037 class PageSensor : public Page
00038 {
00039 public:
00040     // Constructor needs to be explicit.
00041     explicit PageSensor();
00042 
00043     // Destructor.
00044     virtual ~PageSensor();
00045 
00046     virtual void HandlePageActions();
00047 
00048 private:
00049     // Disable the copy constructor.
00050     PageSensor(const PageSensor &);
00051 
00052     // Disable assignment.
00053     PageSensor &operator=(const PageSensor &);
00054     
00055     void SensorPoll();
00056     //void HandleDice();
00057     uint8_t BinTemp(uint16_t TempSensorReading);
00058     uint8_t BinPres(uint16_t PresSensorReading);
00059 
00060     PageOLED pageoled;
00061     //PageDice pagedice;
00062     
00063     SensorData sensordata;
00064 };
00065 
00066 } // End Flexbook namespace.
00067 
00068 #endif // PAGESENSOR_H
00069