Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <avr/eeprom.h>
00013 #include "AP_EEPROMB.h"
00014
00015
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