Skeleton program for Federico's 4YP project.

Dependencies:   WebSocketClient WiflyInterface mbed messages

Fork of IoT_Ex by Damien Frost

Committer:
defrost
Date:
Tue Oct 04 11:34:47 2016 +0000
Revision:
0:c5607b31fb07
Child:
6:424e225d2a91
- Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
defrost 0:c5607b31fb07 1 // ********************
defrost 0:c5607b31fb07 2 // * iQ_StatusReg.cpp *
defrost 0:c5607b31fb07 3 // ********************
defrost 0:c5607b31fb07 4 //
defrost 0:c5607b31fb07 5 // Created: 2016/03/24
defrost 0:c5607b31fb07 6 // By: Damien Frost
defrost 0:c5607b31fb07 7
defrost 0:c5607b31fb07 8
defrost 0:c5607b31fb07 9 #include "StatusReg.h"
defrost 0:c5607b31fb07 10
defrost 0:c5607b31fb07 11 StatusReg::StatusReg()
defrost 0:c5607b31fb07 12 {
defrost 0:c5607b31fb07 13 _reg = 0;
defrost 0:c5607b31fb07 14 return;
defrost 0:c5607b31fb07 15 }
defrost 0:c5607b31fb07 16
defrost 0:c5607b31fb07 17 // Set a flag:
defrost 0:c5607b31fb07 18 void StatusReg::SetFlag(unsigned int flag){
defrost 0:c5607b31fb07 19 _reg |= flag;
defrost 0:c5607b31fb07 20 return;
defrost 0:c5607b31fb07 21 }
defrost 0:c5607b31fb07 22
defrost 0:c5607b31fb07 23 // Clear a flag:
defrost 0:c5607b31fb07 24 void StatusReg::ClearFlag(unsigned int flag){
defrost 0:c5607b31fb07 25 _reg &= (~flag);
defrost 0:c5607b31fb07 26 return;
defrost 0:c5607b31fb07 27 }
defrost 0:c5607b31fb07 28
defrost 0:c5607b31fb07 29 // Check for flag
defrost 0:c5607b31fb07 30 bool StatusReg::CheckFlag(unsigned int flag){
defrost 0:c5607b31fb07 31 if((_reg & flag) > 0){
defrost 0:c5607b31fb07 32 return true;
defrost 0:c5607b31fb07 33 }else{
defrost 0:c5607b31fb07 34 return false;
defrost 0:c5607b31fb07 35 }
defrost 0:c5607b31fb07 36 }
defrost 0:c5607b31fb07 37
defrost 0:c5607b31fb07 38 // Check for no flags
defrost 0:c5607b31fb07 39 bool StatusReg::AllClear(void){
defrost 0:c5607b31fb07 40 if(_reg == 0){
defrost 0:c5607b31fb07 41 return true;
defrost 0:c5607b31fb07 42 }else{
defrost 0:c5607b31fb07 43 return false;
defrost 0:c5607b31fb07 44 }
defrost 0:c5607b31fb07 45 }
defrost 0:c5607b31fb07 46
defrost 0:c5607b31fb07 47 unsigned int StatusReg::GetReg(void){
defrost 0:c5607b31fb07 48 return _reg;
defrost 0:c5607b31fb07 49 }