fix for mbed lib issue 3 (i2c problem) see also https://mbed.org/users/mbed_official/code/mbed/issues/3 affected implementations: LPC812, LPC11U24, LPC1768, LPC2368, LPC4088
Fork of mbed-src by
FileBase.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #include "FileBase.h" 00017 00018 namespace mbed { 00019 00020 FileBase *FileBase::_head = NULL; 00021 00022 FileBase::FileBase(const char *name, PathType t) { 00023 _name = name; 00024 _path_type = t; 00025 00026 if (name != NULL) { 00027 // put this object at head of the list 00028 _next = _head; 00029 _head = this; 00030 } else { 00031 _next = NULL; 00032 } 00033 } 00034 00035 FileBase::~FileBase() { 00036 if (_name != NULL) { 00037 // remove this object from the list 00038 if (_head == this) { // first in the list, so just drop me 00039 _head = _next; 00040 } else { // find the object before me, then drop me 00041 FileBase *p = _head; 00042 while (p->_next != this) { 00043 p = p->_next; 00044 } 00045 p->_next = _next; 00046 } 00047 } 00048 } 00049 00050 FileBase *FileBase::lookup(const char *name, unsigned int len) { 00051 FileBase *p = _head; 00052 while (p != NULL) { 00053 /* Check that p->_name matches name and is the correct length */ 00054 if (p->_name != NULL && std::strncmp(p->_name, name, len) == 0 && std::strlen(p->_name) == len) { 00055 return p; 00056 } 00057 p = p->_next; 00058 } 00059 return NULL; 00060 } 00061 00062 FileBase *FileBase::get(int n) { 00063 FileBase *p = _head; 00064 int m = 0; 00065 while (p != NULL) { 00066 if (m == n) return p; 00067 00068 m++; 00069 p = p->_next; 00070 } 00071 return NULL; 00072 } 00073 00074 const char* FileBase::getName(void) { 00075 return _name; 00076 } 00077 00078 PathType FileBase::getPathType(void) { 00079 return _path_type; 00080 } 00081 00082 } // namespace mbed 00083
Generated on Tue Jul 12 2022 13:47:00 by 1.7.2