I2C hang recover function added

Dependencies:   UniGraphic mbed vt100

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StatusCommand.h Source File

StatusCommand.h

00001 /**
00002  * Copyright 2015 Afero, Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef STATUS_COMMAND_H__
00018 #define STATUS_COMMAND_H__
00019 
00020 #include "mbed.h"
00021 
00022 class StatusCommand {
00023 public:
00024 
00025     StatusCommand();
00026 
00027     StatusCommand(uint16_t bytesToSend);
00028 
00029     ~StatusCommand();
00030 
00031     uint16_t getSize();
00032 
00033     uint16_t getBytes(int *bytes);
00034 
00035     uint8_t calcChecksum();
00036 
00037     void setChecksum(uint8_t checksum);
00038 
00039     uint8_t getChecksum();
00040 
00041     void setAck(bool ack);
00042 
00043     void setBytesToSend(uint16_t bytesToSend);
00044 
00045     uint16_t getBytesToSend();
00046 
00047     void setBytesToRecv(uint16_t bytesToRecv);
00048 
00049     uint16_t getBytesToRecv();
00050 
00051     bool equals(StatusCommand *statusCommand);
00052 
00053     bool isValid();
00054 
00055     void dump();
00056 
00057     void dumpBytes();
00058 
00059 private:
00060 
00061     uint8_t     _cmd;
00062     uint16_t    _bytesToSend;
00063     uint16_t    _bytesToRecv;
00064     uint8_t     _checksum;
00065 };
00066 
00067 #endif // STATUS_COMMAND_H__