pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT
Dependencies: mbed MMA8451Q USBDevice WakeUp vt100
Fork of afero_node_suntory_2017_06_15 by
afLib/Command.h@23:e4d2316383a1, 2017-10-18 (annotated)
- Committer:
- Rhyme
- Date:
- Wed Oct 18 00:31:13 2017 +0000
- Revision:
- 23:e4d2316383a1
- Parent:
- 5:9d5c7ee80f3b
pwm period is now 200us from default 20ms; veml6040->setCOLORCOnf is now AF_BIT | TRIG_BIT from 0x00;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wataloh | 0:20bce0dcc921 | 1 | /** |
wataloh | 0:20bce0dcc921 | 2 | * Copyright 2015 Afero, Inc. |
wataloh | 0:20bce0dcc921 | 3 | * |
wataloh | 0:20bce0dcc921 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
wataloh | 0:20bce0dcc921 | 5 | * you may not use this file except in compliance with the License. |
wataloh | 0:20bce0dcc921 | 6 | * You may obtain a copy of the License at |
wataloh | 0:20bce0dcc921 | 7 | * |
wataloh | 0:20bce0dcc921 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
wataloh | 0:20bce0dcc921 | 9 | * |
wataloh | 0:20bce0dcc921 | 10 | * Unless required by applicable law or agreed to in writing, software |
wataloh | 0:20bce0dcc921 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
wataloh | 0:20bce0dcc921 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
wataloh | 0:20bce0dcc921 | 13 | * See the License for the specific language governing permissions and |
wataloh | 0:20bce0dcc921 | 14 | * limitations under the License. |
wataloh | 0:20bce0dcc921 | 15 | */ |
wataloh | 0:20bce0dcc921 | 16 | |
wataloh | 0:20bce0dcc921 | 17 | #ifndef COMMAND_H__ |
wataloh | 0:20bce0dcc921 | 18 | #define COMMAND_H__ |
wataloh | 0:20bce0dcc921 | 19 | |
wataloh | 0:20bce0dcc921 | 20 | #include "mbed.h" //wsugi |
wataloh | 0:20bce0dcc921 | 21 | #include <string> //wsugi |
wataloh | 0:20bce0dcc921 | 22 | |
wataloh | 0:20bce0dcc921 | 23 | using namespace std; //wsugi |
wataloh | 0:20bce0dcc921 | 24 | |
wataloh | 0:20bce0dcc921 | 25 | #define SPI_CMD_MAX_LEN 256 |
wataloh | 0:20bce0dcc921 | 26 | |
wataloh | 0:20bce0dcc921 | 27 | #define UPDATE_REASON_UNKNOWN 0 |
wataloh | 0:20bce0dcc921 | 28 | #define UPDATE_REASON_LOCAL_UPDATE 1 |
wataloh | 0:20bce0dcc921 | 29 | #define UPDATE_REASON_SERVICE_SET 2 |
wataloh | 0:20bce0dcc921 | 30 | #define UPDATE_REASON_MCU_SET 3 |
wataloh | 0:20bce0dcc921 | 31 | #define UPDATE_REASON_RELINK 4 |
wataloh | 0:20bce0dcc921 | 32 | #define UPDATE_REASON_REBOOT 5 |
wataloh | 0:20bce0dcc921 | 33 | |
wataloh | 0:20bce0dcc921 | 34 | class Command { |
wataloh | 0:20bce0dcc921 | 35 | public: |
wataloh | 0:20bce0dcc921 | 36 | Command(uint16_t len, uint8_t *bytes); |
wataloh | 0:20bce0dcc921 | 37 | |
wataloh | 0:20bce0dcc921 | 38 | Command(uint8_t requestId, const char *str); |
wataloh | 0:20bce0dcc921 | 39 | |
wataloh | 0:20bce0dcc921 | 40 | Command(uint8_t requestId, uint8_t cmd, uint16_t attrId); |
wataloh | 0:20bce0dcc921 | 41 | |
wataloh | 0:20bce0dcc921 | 42 | Command(uint8_t requestId, uint8_t cmd, uint16_t attrId, uint16_t valueLen, uint8_t *value); |
wataloh | 0:20bce0dcc921 | 43 | |
wataloh | 0:20bce0dcc921 | 44 | Command(uint8_t requestId, uint8_t cmd, uint16_t attrId, uint8_t status, uint8_t reason, uint16_t valueLen, |
wataloh | 0:20bce0dcc921 | 45 | uint8_t *value); |
wataloh | 0:20bce0dcc921 | 46 | |
wataloh | 0:20bce0dcc921 | 47 | Command(); |
wataloh | 0:20bce0dcc921 | 48 | |
wataloh | 0:20bce0dcc921 | 49 | ~Command(); |
wataloh | 0:20bce0dcc921 | 50 | |
wataloh | 0:20bce0dcc921 | 51 | uint8_t getCommand(); |
wataloh | 0:20bce0dcc921 | 52 | |
wataloh | 0:20bce0dcc921 | 53 | uint8_t getReqId(); |
wataloh | 0:20bce0dcc921 | 54 | |
wataloh | 0:20bce0dcc921 | 55 | uint16_t getAttrId(); |
wataloh | 0:20bce0dcc921 | 56 | |
wataloh | 0:20bce0dcc921 | 57 | uint16_t getValueLen(); |
wataloh | 0:20bce0dcc921 | 58 | |
wataloh | 0:20bce0dcc921 | 59 | void getValue(uint8_t *value); |
wataloh | 0:20bce0dcc921 | 60 | |
wataloh | 0:20bce0dcc921 | 61 | uint8_t *getValueP(); |
wataloh | 0:20bce0dcc921 | 62 | |
wataloh | 0:20bce0dcc921 | 63 | uint16_t getSize(); |
wataloh | 0:20bce0dcc921 | 64 | |
wataloh | 0:20bce0dcc921 | 65 | uint16_t getBytes(uint8_t *bytes); |
wataloh | 0:20bce0dcc921 | 66 | |
wataloh | 0:20bce0dcc921 | 67 | bool isValid(); |
wataloh | 0:20bce0dcc921 | 68 | |
wataloh | 0:20bce0dcc921 | 69 | void dump(); |
wataloh | 0:20bce0dcc921 | 70 | |
wataloh | 0:20bce0dcc921 | 71 | void dumpBytes(); |
wataloh | 0:20bce0dcc921 | 72 | |
wataloh | 0:20bce0dcc921 | 73 | private: |
wataloh | 0:20bce0dcc921 | 74 | uint8_t getVal(char c); |
wataloh | 0:20bce0dcc921 | 75 | int strToValue(char *valueStr, uint8_t *value); |
wataloh | 0:20bce0dcc921 | 76 | |
wataloh | 0:20bce0dcc921 | 77 | uint8_t strToCmd(char *cmdStr); |
wataloh | 0:20bce0dcc921 | 78 | |
wataloh | 0:20bce0dcc921 | 79 | uint16_t strToAttrId(char *attrIdStr); |
wataloh | 0:20bce0dcc921 | 80 | |
wataloh | 0:20bce0dcc921 | 81 | uint16_t _len; |
wataloh | 0:20bce0dcc921 | 82 | uint8_t _cmd; |
wataloh | 0:20bce0dcc921 | 83 | uint8_t _requestId; |
wataloh | 0:20bce0dcc921 | 84 | uint16_t _attrId; |
wataloh | 0:20bce0dcc921 | 85 | uint8_t _status; |
wataloh | 0:20bce0dcc921 | 86 | uint8_t _reason; |
wataloh | 0:20bce0dcc921 | 87 | uint16_t _valueLen; |
wataloh | 0:20bce0dcc921 | 88 | uint8_t *_value; |
wataloh | 0:20bce0dcc921 | 89 | |
wataloh | 0:20bce0dcc921 | 90 | char _printBuf[256]; |
wataloh | 0:20bce0dcc921 | 91 | |
wataloh | 0:20bce0dcc921 | 92 | }; |
wataloh | 0:20bce0dcc921 | 93 | |
wataloh | 0:20bce0dcc921 | 94 | #endif // COMMAND_H__ |