The BERG Cloud connection library for mbed. This works in conjunction with the BERG Cloud Devshield available via http://bergcloud.com/platform/devkit/
Dependents: LittleCounter-Example
BERGCloudConst.h
00001 /* 00002 00003 BERGCloud constant definitions 00004 00005 Copyright (c) 2013 BERG Cloud Ltd. http://bergcloud.com/ 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a copy 00008 of this software and associated documentation files (the "Software"), to deal 00009 in the Software without restriction, including without limitation the rights 00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00011 copies of the Software, and to permit persons to whom the Software is 00012 furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00020 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00022 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00023 THE SOFTWARE. 00024 00025 */ 00026 00027 /* 00028 * Sizes of things 00029 */ 00030 00031 #define BC_EUI64_SIZE_BYTES 8 00032 #define BC_ADDRESS_SIZE_BYTES 8 00033 #define BC_CLAIMCODE_SIZE_BYTES 20 00034 #define BC_KEY_SIZE_BYTES 16 00035 #define BC_PRINT_MAX_CHARS 26 00036 00037 /* 00038 * Network commands 00039 */ 00040 00041 #define BC_EVENT_ANNOUNCE 0xA000 00042 #define BC_COMMAND_SET_ADDRESS 0xB000 00043 00044 #define BC_COMMAND_START_RAW 0xC000 00045 #define BC_COMMAND_START_PACKED 0xC100 00046 #define BC_COMMAND_NAMED_PACKED 0xC17F 00047 #define BC_COMMAND_ID_MASK 0x00FF 00048 #define BC_COMMAND_FORMAT_MASK 0xFF00 00049 00050 #define BC_COMMAND_DISPLAY_IMAGE 0xD000 00051 #define BC_COMMAND_DISPLAY_TEXT 0xD001 00052 00053 #define BC_EVENT_START_RAW 0xE000 00054 #define BC_EVENT_START_PACKED 0xE100 00055 #define BC_EVENT_NAMED_PACKED 0xE17F 00056 #define BC_EVENT_ID_MASK 0x00FF 00057 #define BC_EVENT_FORMAT_MASK 0xFF00 00058 00059 #define BC_COMMAND_FIRMWARE_ARDUINO 0xF010 00060 #define BC_COMMAND_FIRMWARE_MBED 0xF020 00061 00062 /* 00063 * SPI bus commands 00064 */ 00065 00066 #define SPI_CMD_GET_CONNECT_STATE 0x80 00067 #define SPI_CMD_GET_CLAIMCODE 0x81 00068 #define SPI_CMD_GET_CLAIM_STATE 0x82 00069 #define SPI_CMD_GET_SIGNAL_QUALITY 0x83 00070 #define SPI_CMD_GET_EUI64 0x90 00071 00072 #define SPI_CMD_SEND_ANNOUNCE 0xA0 00073 #define SPI_CMD_GET_ADDRESS 0xB0 00074 #define SPI_CMD_POLL_FOR_COMMAND 0xC0 00075 #define SPI_CMD_SET_DISPLAY_STYLE 0xD0 00076 #define SPI_CMD_DISPLAY_PRINT 0xD1 00077 #define SPI_CMD_SEND_EVENT_RAW 0xE0 00078 #define SPI_CMD_SEND_EVENT_PACKED 0xE1 00079 00080 #define SPI_PROTOCOL_PAD 0xff 00081 #define SPI_PROTOCOL_PENDING 0xfa 00082 #define SPI_PROTOCOL_RESET 0xf5 00083 00084 /* For SPI_CMD_GET_CONNECT_STATE */ 00085 #define BC_CONNECT_STATE_CONNECTED 0x00 00086 #define BC_CONNECT_STATE_CONNECTING 0x01 00087 #define BC_CONNECT_STATE_DISCONNECTED 0x02 00088 00089 /* For SPI_CMD_GET_EUI64 */ 00090 #define BC_EUI64_NODE 0x00 00091 #define BC_EUI64_PARENT 0x01 00092 #define BC_EUI64_COORDINATOR 0x02 00093 00094 /* For SPI_CMD_SEND_ANNOUNCE */ 00095 #define BC_HOST_UNKNOWN 0x0000 00096 #define BC_HOST_ARDUINO 0x1000 00097 #define BC_HOST_MBED 0x2000 00098 #define BC_HOST_LINUX 0x3000 00099 00100 /* For SPI_CMD_GET_CLAIM_STATE */ 00101 #define BC_CLAIM_STATE_CLAIMED 0x00 00102 #define BC_CLAIM_STATE_NOT_CLAIMED 0x01 00103 00104 /* For SPI_CMD_DISPLAY_STYLE */ 00105 #define BC_DISPLAY_NONE 0x00 00106 #define BC_DISPLAY_STYLE_ONE_LINE 0x01 00107 #define BC_DISPLAY_STYLE_TWO_LINES 0x02 00108 #define BC_DISPLAY_STYLE_FOUR_LINES 0x04 00109 00110 #define BC_DISPLAY_CLEAR 0xc0 00111 /* Clear the display without changing the style */ 00112 00113 /* For SPI_CMD_SEND_EVENT_ */ 00114 #define SPI_EVENT_HEADER_SIZE_BYTES 4 00115 00116 /* SPI data sizes */ 00117 #define SPI_MAX_PACKET_SIZE_BYTES 128 00118 #define SPI_HEADER_SIZE_BYTES 4 00119 #define SPI_FOOTER_SIZE_BYTES 2 00120 00121 #define SPI_MAX_PAYLOAD_SIZE_BYTES \ 00122 (SPI_MAX_PACKET_SIZE_BYTES - (SPI_HEADER_SIZE_BYTES + SPI_FOOTER_SIZE_BYTES)) 00123 00124 /* Response status values */ 00125 #define SPI_RSP_SUCCESS 0x00 00126 #define SPI_RSP_INVALID_COMMAND 0x01 00127 #define SPI_RSP_BUSY 0x02 00128 #define SPI_RSP_NO_DATA 0x03 00129 #define SPI_RSP_SEND_FAILED 0x04 00130 #define SPI_RSP_NO_FREE_BUFFERS 0x05 00131
Generated on Sun Jul 17 2022 20:45:26 by
1.7.2
BERG Cloud


