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

/home/jgoppert/Projects/ap/libraries/AP_EEPROMB/AP_EEPROMB.cpp

Go to the documentation of this file.
00001 /*
00002         RC_Channel.cpp - Radio library for Arduino
00003         Code by Jason Short. DIYDrones.com
00004         
00005         This library is free software; you can redistribute it and / or
00006                 modify it under the terms of the GNU Lesser General Public
00007                 License as published by the Free Software Foundation; either
00008                 version 2.1 of the License, or (at your option) any later version.
00009 
00010 */
00011 
00012 #include <avr/eeprom.h>
00013 #include "AP_EEPROMB.h"
00014 
00015 //#include "WProgram.h"
00016 
00017 void
00018 AP_EEPROMB::write_byte(int address, int8_t value)
00019 {
00020         eeprom_write_byte((uint8_t *) address, value);
00021 }
00022 
00023 void
00024 AP_EEPROMB::write_int(int address, int value)
00025 {
00026         eeprom_write_word((uint16_t *) address, value);
00027 }
00028 
00029 void
00030 AP_EEPROMB::write_long(int address, long value)
00031 {
00032         eeprom_write_dword((uint32_t *) address, value);
00033 }
00034 
00035 void
00036 AP_EEPROMB::write_float(int address, float value)
00037 {
00038         _type_union.fvalue = value;
00039         write_long(address, _type_union.lvalue);
00040 }
00041 
00042 int
00043 AP_EEPROMB::read_byte(int address)
00044 {
00045         return eeprom_read_byte((const uint8_t *) address);
00046 }
00047 
00048 int
00049 AP_EEPROMB::read_int(int address)
00050 {
00051         return eeprom_read_word((const uint16_t *) address);
00052 }
00053 
00054 long
00055 AP_EEPROMB::read_long(int address)
00056 {
00057         return eeprom_read_dword((const uint32_t *) address);
00058 }
00059 
00060 float
00061 AP_EEPROMB::read_float(int address)
00062 {
00063         _type_union.lvalue = eeprom_read_dword((const uint32_t *) address);
00064         return _type_union.fvalue;
00065 }
00066 
00067 

Generated for ArduPilot Libraries by doxygen