Color sensor reset at the end of calibration added. sensor id auto assignment was changed to be a fixed value assignment to avoid sensor id shift when some sensor is absent.

Dependencies:   UniGraphic mbed vt100

Committer:
Rhyme
Date:
Fri Feb 23 07:51:55 2018 +0000
Revision:
1:8818b793d147
Parent:
0:ce97f6d34336
Wrong behavior when one of color sensor is missing has been fixed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:ce97f6d34336 1 /**
Rhyme 0:ce97f6d34336 2 * Copyright 2015 Afero, Inc.
Rhyme 0:ce97f6d34336 3 *
Rhyme 0:ce97f6d34336 4 * Licensed under the Apache License, Version 2.0 (the "License");
Rhyme 0:ce97f6d34336 5 * you may not use this file except in compliance with the License.
Rhyme 0:ce97f6d34336 6 * You may obtain a copy of the License at
Rhyme 0:ce97f6d34336 7 *
Rhyme 0:ce97f6d34336 8 * http://www.apache.org/licenses/LICENSE-2.0
Rhyme 0:ce97f6d34336 9 *
Rhyme 0:ce97f6d34336 10 * Unless required by applicable law or agreed to in writing, software
Rhyme 0:ce97f6d34336 11 * distributed under the License is distributed on an "AS IS" BASIS,
Rhyme 0:ce97f6d34336 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Rhyme 0:ce97f6d34336 13 * See the License for the specific language governing permissions and
Rhyme 0:ce97f6d34336 14 * limitations under the License.
Rhyme 0:ce97f6d34336 15 */
Rhyme 0:ce97f6d34336 16
Rhyme 0:ce97f6d34336 17 #ifndef STATUS_COMMAND_H__
Rhyme 0:ce97f6d34336 18 #define STATUS_COMMAND_H__
Rhyme 0:ce97f6d34336 19
Rhyme 0:ce97f6d34336 20 #include "mbed.h"
Rhyme 0:ce97f6d34336 21 #include "DebugIO.hpp"
Rhyme 0:ce97f6d34336 22
Rhyme 0:ce97f6d34336 23 class StatusCommand {
Rhyme 0:ce97f6d34336 24 public:
Rhyme 0:ce97f6d34336 25
Rhyme 0:ce97f6d34336 26 StatusCommand();
Rhyme 0:ce97f6d34336 27
Rhyme 0:ce97f6d34336 28 StatusCommand(uint16_t bytesToSend);
Rhyme 0:ce97f6d34336 29
Rhyme 0:ce97f6d34336 30 ~StatusCommand();
Rhyme 0:ce97f6d34336 31
Rhyme 0:ce97f6d34336 32 uint16_t getSize();
Rhyme 0:ce97f6d34336 33
Rhyme 0:ce97f6d34336 34 uint16_t getBytes(int *bytes);
Rhyme 0:ce97f6d34336 35
Rhyme 0:ce97f6d34336 36 uint8_t calcChecksum();
Rhyme 0:ce97f6d34336 37
Rhyme 0:ce97f6d34336 38 void setChecksum(uint8_t checksum);
Rhyme 0:ce97f6d34336 39
Rhyme 0:ce97f6d34336 40 uint8_t getChecksum();
Rhyme 0:ce97f6d34336 41
Rhyme 0:ce97f6d34336 42 void setAck(bool ack);
Rhyme 0:ce97f6d34336 43
Rhyme 0:ce97f6d34336 44 void setBytesToSend(uint16_t bytesToSend);
Rhyme 0:ce97f6d34336 45
Rhyme 0:ce97f6d34336 46 uint16_t getBytesToSend();
Rhyme 0:ce97f6d34336 47
Rhyme 0:ce97f6d34336 48 void setBytesToRecv(uint16_t bytesToRecv);
Rhyme 0:ce97f6d34336 49
Rhyme 0:ce97f6d34336 50 uint16_t getBytesToRecv();
Rhyme 0:ce97f6d34336 51
Rhyme 0:ce97f6d34336 52 bool equals(StatusCommand *statusCommand);
Rhyme 0:ce97f6d34336 53
Rhyme 0:ce97f6d34336 54 bool isValid();
Rhyme 0:ce97f6d34336 55
Rhyme 0:ce97f6d34336 56 void dump();
Rhyme 0:ce97f6d34336 57
Rhyme 0:ce97f6d34336 58 void dumpBytes();
Rhyme 0:ce97f6d34336 59
Rhyme 0:ce97f6d34336 60 private:
Rhyme 0:ce97f6d34336 61
Rhyme 0:ce97f6d34336 62 uint8_t _cmd;
Rhyme 0:ce97f6d34336 63 uint16_t _bytesToSend;
Rhyme 0:ce97f6d34336 64 uint16_t _bytesToRecv;
Rhyme 0:ce97f6d34336 65 uint8_t _checksum;
Rhyme 0:ce97f6d34336 66 };
Rhyme 0:ce97f6d34336 67
Rhyme 0:ce97f6d34336 68 #endif // STATUS_COMMAND_H__