mbed

Dependents:   DHTSensor_Test K64F_eCompass_OneNET_JW

Committer:
mbotkinl
Date:
Wed Feb 25 20:22:22 2015 +0000
Revision:
0:2cc6bb4d7fea
Working code to read Temperature and Humidity readings

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbotkinl 0:2cc6bb4d7fea 1 /* mbed Microcontroller Library
mbotkinl 0:2cc6bb4d7fea 2 * Copyright (c) 2006-2013 ARM Limited
mbotkinl 0:2cc6bb4d7fea 3 *
mbotkinl 0:2cc6bb4d7fea 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbotkinl 0:2cc6bb4d7fea 5 * you may not use this file except in compliance with the License.
mbotkinl 0:2cc6bb4d7fea 6 * You may obtain a copy of the License at
mbotkinl 0:2cc6bb4d7fea 7 *
mbotkinl 0:2cc6bb4d7fea 8 * http://www.apache.org/licenses/LICENSE-2.0
mbotkinl 0:2cc6bb4d7fea 9 *
mbotkinl 0:2cc6bb4d7fea 10 * Unless required by applicable law or agreed to in writing, software
mbotkinl 0:2cc6bb4d7fea 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbotkinl 0:2cc6bb4d7fea 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbotkinl 0:2cc6bb4d7fea 13 * See the License for the specific language governing permissions and
mbotkinl 0:2cc6bb4d7fea 14 * limitations under the License.
mbotkinl 0:2cc6bb4d7fea 15 */
mbotkinl 0:2cc6bb4d7fea 16 #ifndef MBED_FILEBASE_H
mbotkinl 0:2cc6bb4d7fea 17 #define MBED_FILEBASE_H
mbotkinl 0:2cc6bb4d7fea 18
mbotkinl 0:2cc6bb4d7fea 19 typedef int FILEHANDLE;
mbotkinl 0:2cc6bb4d7fea 20
mbotkinl 0:2cc6bb4d7fea 21 #include <stdio.h>
mbotkinl 0:2cc6bb4d7fea 22
mbotkinl 0:2cc6bb4d7fea 23 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
mbotkinl 0:2cc6bb4d7fea 24 # define O_RDONLY 0
mbotkinl 0:2cc6bb4d7fea 25 # define O_WRONLY 1
mbotkinl 0:2cc6bb4d7fea 26 # define O_RDWR 2
mbotkinl 0:2cc6bb4d7fea 27 # define O_CREAT 0x0200
mbotkinl 0:2cc6bb4d7fea 28 # define O_TRUNC 0x0400
mbotkinl 0:2cc6bb4d7fea 29 # define O_APPEND 0x0008
mbotkinl 0:2cc6bb4d7fea 30
mbotkinl 0:2cc6bb4d7fea 31 # define NAME_MAX 255
mbotkinl 0:2cc6bb4d7fea 32
mbotkinl 0:2cc6bb4d7fea 33 typedef int mode_t;
mbotkinl 0:2cc6bb4d7fea 34 typedef int ssize_t;
mbotkinl 0:2cc6bb4d7fea 35 typedef long off_t;
mbotkinl 0:2cc6bb4d7fea 36
mbotkinl 0:2cc6bb4d7fea 37 #else
mbotkinl 0:2cc6bb4d7fea 38 # include <sys/fcntl.h>
mbotkinl 0:2cc6bb4d7fea 39 # include <sys/types.h>
mbotkinl 0:2cc6bb4d7fea 40 # include <sys/syslimits.h>
mbotkinl 0:2cc6bb4d7fea 41 #endif
mbotkinl 0:2cc6bb4d7fea 42
mbotkinl 0:2cc6bb4d7fea 43 #include "platform.h"
mbotkinl 0:2cc6bb4d7fea 44
mbotkinl 0:2cc6bb4d7fea 45 namespace mbed {
mbotkinl 0:2cc6bb4d7fea 46
mbotkinl 0:2cc6bb4d7fea 47 typedef enum {
mbotkinl 0:2cc6bb4d7fea 48 FilePathType,
mbotkinl 0:2cc6bb4d7fea 49 FileSystemPathType
mbotkinl 0:2cc6bb4d7fea 50 } PathType;
mbotkinl 0:2cc6bb4d7fea 51
mbotkinl 0:2cc6bb4d7fea 52 class FileBase {
mbotkinl 0:2cc6bb4d7fea 53 public:
mbotkinl 0:2cc6bb4d7fea 54 FileBase(const char *name, PathType t);
mbotkinl 0:2cc6bb4d7fea 55
mbotkinl 0:2cc6bb4d7fea 56 virtual ~FileBase();
mbotkinl 0:2cc6bb4d7fea 57
mbotkinl 0:2cc6bb4d7fea 58 const char* getName(void);
mbotkinl 0:2cc6bb4d7fea 59 PathType getPathType(void);
mbotkinl 0:2cc6bb4d7fea 60
mbotkinl 0:2cc6bb4d7fea 61 static FileBase *lookup(const char *name, unsigned int len);
mbotkinl 0:2cc6bb4d7fea 62
mbotkinl 0:2cc6bb4d7fea 63 static FileBase *get(int n);
mbotkinl 0:2cc6bb4d7fea 64
mbotkinl 0:2cc6bb4d7fea 65 protected:
mbotkinl 0:2cc6bb4d7fea 66 static FileBase *_head;
mbotkinl 0:2cc6bb4d7fea 67
mbotkinl 0:2cc6bb4d7fea 68 FileBase *_next;
mbotkinl 0:2cc6bb4d7fea 69 const char *_name;
mbotkinl 0:2cc6bb4d7fea 70 PathType _path_type;
mbotkinl 0:2cc6bb4d7fea 71
mbotkinl 0:2cc6bb4d7fea 72 /* disallow copy constructor and assignment operators */
mbotkinl 0:2cc6bb4d7fea 73 private:
mbotkinl 0:2cc6bb4d7fea 74 FileBase(const FileBase&);
mbotkinl 0:2cc6bb4d7fea 75 FileBase & operator = (const FileBase&);
mbotkinl 0:2cc6bb4d7fea 76 };
mbotkinl 0:2cc6bb4d7fea 77
mbotkinl 0:2cc6bb4d7fea 78 } // namespace mbed
mbotkinl 0:2cc6bb4d7fea 79
mbotkinl 0:2cc6bb4d7fea 80 #endif