• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AP_EEProm.cpp

Go to the documentation of this file.
00001 /*
00002  * AP_EEProm.cpp
00003  * Copyright (C) James Goppert 2010 <james.goppert@gmail.com>
00004  *
00005  * This file is free software: you can redistribute it and/or modify it
00006  * under the terms of the GNU General Public License as published by the
00007  * Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This file is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00013  * See the GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <AP_EEProm.h>
00020 void AP_EEPromRegistry::print(BetterStream & stream)
00021 {
00022         stream.printf("\nEEPROM Registry\n");
00023         for (int i=0;i<getSize();i++)                           
00024         {
00025                 stream.printf("id:\t%u\t%s\t%s\tval:\t%10.4f\taddr:\t%u\t\n",
00026                                 (*this)[i]->getEntryId(),
00027                                 (*this)[i]->getEntryParentName(),
00028                                 (*this)[i]->getEntryName(),
00029                                 (*this)[i]->getEntry(),
00030                                 (*this)[i]->getEntryAddress());
00031         }
00032 }
00033 
00034 
00035 void AP_EEPromRegistry::add(AP_EEPromEntryI * entry, uint16_t & id, uint16_t & address, size_t size)
00036 {
00037         if (_newAddress + size > _maxSize) return;
00038         address = _newAddress;
00039         _newAddress += size;
00040         id = _newId++;
00041         push_back(entry);
00042 }
00043 
00044 extern AP_EEPromRegistry eepromRegistry(1024);

Generated for ArduPilot Libraries by doxygen