This short program illustrates how to use the DS130x_I2C library. My objective is to share the same RTC with Microchip 18F MCU.

Dependencies:   mbed DebugLibrary

Committer:
Yann
Date:
Wed Feb 09 13:57:49 2011 +0000
Revision:
0:f30e2135b0db
V0.0.0.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yann 0:f30e2135b0db 1
Yann 0:f30e2135b0db 2 /*
Yann 0:f30e2135b0db 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
Yann 0:f30e2135b0db 4
Yann 0:f30e2135b0db 5 Permission is hereby granted, free of charge, to any person obtaining a copy
Yann 0:f30e2135b0db 6 of this software and associated documentation files (the "Software"), to deal
Yann 0:f30e2135b0db 7 in the Software without restriction, including without limitation the rights
Yann 0:f30e2135b0db 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Yann 0:f30e2135b0db 9 copies of the Software, and to permit persons to whom the Software is
Yann 0:f30e2135b0db 10 furnished to do so, subject to the following conditions:
Yann 0:f30e2135b0db 11
Yann 0:f30e2135b0db 12 The above copyright notice and this permission notice shall be included in
Yann 0:f30e2135b0db 13 all copies or substantial portions of the Software.
Yann 0:f30e2135b0db 14
Yann 0:f30e2135b0db 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Yann 0:f30e2135b0db 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Yann 0:f30e2135b0db 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Yann 0:f30e2135b0db 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Yann 0:f30e2135b0db 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Yann 0:f30e2135b0db 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Yann 0:f30e2135b0db 21 THE SOFTWARE.
Yann 0:f30e2135b0db 22 */
Yann 0:f30e2135b0db 23
Yann 0:f30e2135b0db 24 #ifndef RPC_HANDLER_H
Yann 0:f30e2135b0db 25 #define RPC_HANDLER_H
Yann 0:f30e2135b0db 26
Yann 0:f30e2135b0db 27 #include "../HTTPRequestHandler.h"
Yann 0:f30e2135b0db 28
Yann 0:f30e2135b0db 29 class RPCHandler : public HTTPRequestHandler
Yann 0:f30e2135b0db 30 {
Yann 0:f30e2135b0db 31 public:
Yann 0:f30e2135b0db 32 RPCHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
Yann 0:f30e2135b0db 33 virtual ~RPCHandler();
Yann 0:f30e2135b0db 34
Yann 0:f30e2135b0db 35 //protected:
Yann 0:f30e2135b0db 36 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new RPCHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
Yann 0:f30e2135b0db 37
Yann 0:f30e2135b0db 38 virtual void doGet();
Yann 0:f30e2135b0db 39 virtual void doPost();
Yann 0:f30e2135b0db 40 virtual void doHead();
Yann 0:f30e2135b0db 41
Yann 0:f30e2135b0db 42 virtual void onReadable(); //Data has been read
Yann 0:f30e2135b0db 43 virtual void onWriteable(); //Data has been written & buf is free
Yann 0:f30e2135b0db 44 virtual void onClose(); //Connection is closing
Yann 0:f30e2135b0db 45
Yann 0:f30e2135b0db 46 protected:
Yann 0:f30e2135b0db 47 void cleanReq(char* data);
Yann 0:f30e2135b0db 48 };
Yann 0:f30e2135b0db 49
Yann 0:f30e2135b0db 50 #endif