From f682c4bf327a7e2b030a760ce43283cdefadd75d Mon Sep 17 00:00:00 2001 From: "james.goppert" Date: Fri, 24 Dec 2010 05:29:56 +0000 Subject: [PATCH] Added EEProm file. git-svn-id: https://arducopter.googlecode.com/svn/trunk@1245 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/AP_EEProm/AP_EEProm.cpp | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 libraries/AP_EEProm/AP_EEProm.cpp diff --git a/libraries/AP_EEProm/AP_EEProm.cpp b/libraries/AP_EEProm/AP_EEProm.cpp new file mode 100644 index 0000000000..bca9968eaf --- /dev/null +++ b/libraries/AP_EEProm/AP_EEProm.cpp @@ -0,0 +1,33 @@ +/* + * AP_EEProm.h + * Copyright (C) James Goppert 2010 + * + * This file is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include + +void AP_EEPromRegistry::add(AP_EEPromEntry * entry, uint16_t & id, uint16_t & address, size_t size) +{ + if (_newAddress + size > _maxSize) return; + address = _newAddress; + _newAddress += size; + id = _newId++; + push_back(entry); +} + +/** + * The global declaration for the eepromRegistry + */ +extern AP_EEPromRegistry eepromRegistry(1024);