li lei / eeprom
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eeprom.h Source File

eeprom.h

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  
00017 #include "mbed.h"
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 #ifndef SANFAN_EEPROM_H
00026 #define SANFAN_EEPROM_H
00027 
00028 #include "platform.h"
00029 
00030 
00031 
00032 //eeprom storage
00033 #define EEPROM_ADDR_PAGE0 0X08080000
00034 #define EEPROM_ADDR_PAGE1 0X08080080
00035 #define EEPROM_ADDR_PAGE2 0X08080100
00036 #define EEPROM_ADDR_PAGE3 0X08080180
00037 #define EEPROM_ADDR_PAGE4 0X08080200
00038 #define EEPROM_ADDR_PAGE5 0X08080280
00039 #define EEPROM_ADDR_PAGE6 0X08080300
00040 #define EEPROM_ADDR_PAGE7 0X08080380
00041 #define EEPROM_ADDR_PAGE8 0X08080400
00042 #define EEPROM_ADDR_PAGE9 0X08080480
00043 #define EEPROM_ADDR_PAGE10 0X08080500
00044 #define EEPROM_ADDR_PAGE11 0X08080580
00045 #define EEPROM_ADDR_PAGE12 0X08080600
00046 #define EEPROM_ADDR_PAGE13 0X08080680
00047 #define EEPROM_ADDR_PAGE14 0X08080700
00048 #define EEPROM_ADDR_PAGE15 0X08080780
00049 
00050 #define EEPROM_ADDR_BIAOHAO                 EEPROM_ADDR_PAGE10
00051 #define EEPROM_ADDR_SHUILIANGDECIMAL        EEPROM_ADDR_PAGE1
00052 #define EEPROM_ADDR_SHUILIANGMAIN           EEPROM_ADDR_PAGE15
00053 #define EEPROM_ADDR_SHUILIANGBACKUP         EEPROM_ADDR_PAGE14
00054 #define EEPROM_ADDR_UPFREQ                  100
00055 
00056 #define EEPROM_VALUE_BIAOHAO                *(unsigned int *)EEPROM_ADDR_BIAOHAO
00057 #define EEPROM_VALUE_SHUILIANGDECIMAL(n)    *((unsigned int *)(EEPROM_ADDR_PAGE1+n*4))
00058 #define EEPROM_VALUE_SHUILIANGMAIN          *(unsigned int *)EEPROM_ADDR_SHUILIANGMAIN
00059 #define EEPROM_VALUE_SHUILIANGBACKUP        *(unsigned int *)EEPROM_ADDR_SHUILIANGBACKUP
00060 
00061 #define EEPROM_MARK_SHUILDECIMAL         0X55
00062 
00063 
00064 
00065 
00066 class Eeprom {
00067 
00068 public:
00069     Eeprom();
00070 
00071     unsigned int eeprom_countor_read();
00072     unsigned int eeprom_countor_write(unsigned int watervalue);
00073     unsigned int eeprom_countor_addone();
00074     
00075     
00076     unsigned short open(void);
00077     unsigned short close(void);
00078     
00079 /*
00080 private:
00081 
00082    
00083     */
00084 protected:
00085   
00086 };
00087 
00088 #endif
00089 
00090 
00091