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
BERGCloudMbed.h
00001 /* 00002 00003 BERGCloud library for mbed 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 #ifndef BERGCLOUDMBED_H 00028 #define BERGCLOUDMBED_H 00029 00030 #include "mbed.h" 00031 #include <string> 00032 #include "BERGCloudBase.h" 00033 00034 #ifdef BERGCLOUD_PACK_UNPACK 00035 #include "BERGCloudMessageBase.h" 00036 #endif 00037 00038 class BERGCloudMbed : public BERGCloudBase 00039 { 00040 public: 00041 void begin(PinName _MOSIPin, PinName _MISOPin, PinName _SCLKPin, PinName _nSSELPin); 00042 void end(); 00043 /* Methods using std::string class */ 00044 using BERGCloudBase::display; 00045 bool display(std::string& s); 00046 using BERGCloudBase::pollForCommand; 00047 bool pollForCommand(BERGCloudMessageBuffer& buffer, string &commandName); 00048 private: 00049 virtual uint16_t SPITransaction(uint8_t *dataOut, uint8_t *dataIn, uint16_t dataSize, bool finalCS); 00050 virtual void timerReset(void); 00051 virtual uint32_t timerRead_mS(void); 00052 virtual uint16_t getHostType(void); 00053 SPI *spi; 00054 DigitalOut *nSSELPin; 00055 Timer *timer; 00056 }; 00057 00058 #ifdef BERGCLOUD_PACK_UNPACK 00059 00060 class BERGCloudMessage : public BERGCloudMessageBase 00061 { 00062 public: 00063 using BERGCloudMessageBase::pack; 00064 using BERGCloudMessageBase::unpack; 00065 /* Methods using std::string class */ 00066 bool pack(std::string& s); 00067 bool unpack(std::string& s); 00068 }; 00069 00070 #endif // #ifdef BERGCLOUD_PACK_UNPACK 00071 00072 #endif // #ifndef BERGCLOUDMBED_H 00073
Generated on Sun Jul 17 2022 20:45:26 by
1.7.2
BERG Cloud


